From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0VqR-0001pl-Or for qemu-devel@nongnu.org; Thu, 23 Feb 2012 05:24:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0VqQ-000628-8P for qemu-devel@nongnu.org; Thu, 23 Feb 2012 05:24:15 -0500 Received: from mail-we0-f173.google.com ([74.125.82.173]:35909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0VqQ-00061m-3l for qemu-devel@nongnu.org; Thu, 23 Feb 2012 05:24:14 -0500 Received: by werh12 with SMTP id h12so759898wer.4 for ; Thu, 23 Feb 2012 02:24:13 -0800 (PST) Sender: andrzej zaborowski From: Andrzej Zaborowski Date: Thu, 23 Feb 2012 00:22:49 +0100 Message-Id: <1329952970-356-6-git-send-email-andrew.zaborowski@intel.com> In-Reply-To: <1329952970-356-1-git-send-email-andrew.zaborowski@intel.com> References: <1329952970-356-1-git-send-email-andrew.zaborowski@intel.com> Subject: [Qemu-devel] [PATCH 6/6 v2] gl: -enable-gl switch to enable the OpenGL 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 b129996..8a5784c 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1114,6 +1114,30 @@ spec but is traditional qemu behavior. @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 37f2f96..a2f1c84 100644 --- a/vl.c +++ b/vl.c @@ -228,6 +228,7 @@ int ctrl_grab = 0; unsigned int nb_prom_envs = 0; const char *prom_envs[MAX_PROM_ENVS]; int boot_menu; +int enable_gl; uint8_t *boot_splash_filedata; int boot_splash_filedata_size; uint8_t qemu_extra_params_fw[2]; @@ -312,6 +313,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 */ @@ -2896,6 +2912,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; @@ -3133,6 +3154,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