[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/6 v2] gl: -enable-gl switch to enable the OpenGL v
From: |
Andrzej Zaborowski |
Subject: |
[Qemu-devel] [PATCH 6/6 v2] gl: -enable-gl switch to enable the OpenGL virtio port. |
Date: |
Thu, 23 Feb 2012 00:22:49 +0100 |
Signed-off-by: Andrzej Zaborowski <address@hidden>
---
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
address@hidden -enable-gl
address@hidden -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.
+
address@hidden: 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
address@hidden://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