Signed-off-by: Andrzej Zaborowski <andrew.zaborow...@intel.com> --- 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