From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkKRh-0004Xi-IQ for qemu-devel@nongnu.org; Mon, 09 Jan 2012 13:59:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkKRd-0006rU-3f for qemu-devel@nongnu.org; Mon, 09 Jan 2012 13:59:49 -0500 Received: from mail-wi0-f173.google.com ([209.85.212.173]:51690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkKRc-0006rQ-Rd for qemu-devel@nongnu.org; Mon, 09 Jan 2012 13:59:45 -0500 Received: by wibhm2 with SMTP id hm2so3351833wib.4 for ; Mon, 09 Jan 2012 10:59:44 -0800 (PST) From: Andrzej Zaborowski Date: Mon, 9 Jan 2012 08:57:56 +0100 Message-Id: <1326095876-31319-7-git-send-email-balrogg@gmail.com> In-Reply-To: <1326095876-31319-1-git-send-email-balrogg@gmail.com> References: <1326095876-31319-1-git-send-email-balrogg@gmail.com> Subject: [Qemu-devel] [PATCH 6/6] gl: -enable-gl switch to enable the GL virtio port. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Andrzej Zaborowski --- qemu-options.hx | 24 ++++++++++++++++++++++++ vl.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 0 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 7903e5c..f00bb6d 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1093,6 +1093,30 @@ like Tight. @end table ETEXI +DEF("enable-gl", 0, QEMU_OPTION_enable_gl, \ + "-enable-gl enable OpenGL passthrough support\n", QEMU_ARCH_ALL) +STEXI +@item -enable-gl +@findex -enable-gl +Enable OpenGL passthrough support in QEMU. Requires corresponding client +software in the guest OS. Requires hardware graphics acceleration +on host system. Only virtio-capable target machines supported. Does +not support vmsave/vmload or migration. + +@strong{NOTE}: this feature has not been security reviewed and assumes that +the emulator runs a trusted guest system. Enabling this option may allow +rogue software in the emulator to crash or control QEMU. Do not use this +option if unsure. + +This option allows the emulated system to take advantage of hardware- +accelerated OpenGL support of the host machine to speed up applications +that make heavy use of OpenGL graphics (3D or otherwise) - useful during +the development of such applications. For Linux guests running X.org, the +client software can be installed from +@url{http://meego.gitorious.org/meego-developer-tools/meego-emulator-libgl-x86} +or distribution packages if available. +ETEXI + STEXI @end table ETEXI diff --git a/vl.c b/vl.c index ba55b35..6a4fa7b 100644 --- a/vl.c +++ b/vl.c @@ -230,6 +230,7 @@ int ctrl_grab = 0; unsigned int nb_prom_envs = 0; const char *prom_envs[MAX_PROM_ENVS]; int boot_menu; +int enable_gl = 0; uint8_t *boot_splash_filedata; int boot_splash_filedata_size; uint8_t qemu_extra_params_fw[2]; @@ -320,6 +321,21 @@ static int default_driver_check(QemuOpts *opts, void *opaque) return 0; } +typedef struct { + const char *device_name; + int found; +} device_opt_search_t; + +static int find_device_opt(QemuOpts *opts, void *opaque) +{ + device_opt_search_t *devp = (device_opt_search_t *) opaque; + + devp->found = devp->found || + !strcmp(qemu_opt_get(opts, "driver"), devp->device_name); + + return 0; +} + /***********************************************************/ /* QEMU state */ @@ -2839,6 +2855,11 @@ int main(int argc, char **argv, char **envp) machine = machine_parse(optarg); } break; +#ifdef CONFIG_GL + case QEMU_OPTION_enable_gl: + enable_gl = 1; + break; +#endif case QEMU_OPTION_usb: usb_enabled = 1; break; @@ -3076,6 +3097,21 @@ int main(int argc, char **argv, char **envp) exit(1); } + if (enable_gl) { + QemuOptsList *device = qemu_find_opts("device"); + QemuOpts *bus_opts, *dev_opts; + device_opt_search_t devp = { "virtio-serial", 0 }; + + qemu_opts_foreach(device, find_device_opt, &devp, 0); + if (devp.found == 0) { + bus_opts = qemu_opts_create(device, NULL, 0); + qemu_opt_set(bus_opts, "driver", "virtio-serial"); + } + + dev_opts = qemu_opts_create(device, NULL, 0); + qemu_opt_set(dev_opts, "driver", "virtio-gl-port"); + } + /* If no data_dir is specified then try to find it relative to the executable path. */ if (!data_dir) { -- 1.7.4.4