From a9afce67737a757737eb76dd6dfafa6b99982b2b Mon Sep 17 00:00:00 2001 From: Igor Mitsyanko Date: Wed, 21 Nov 2012 22:33:36 +0400 Subject: [PATCH] qemu-options: add option to enable YaGL Also, check and exit(1) if user specified virtGL and YaGL simultaniously. Signed-off-by: Igor Mitsyanko --- qemu-options.hx | 9 +++++++++ vl.c | 22 +++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 854bf91..4be6d46 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2428,6 +2428,15 @@ Enable OpenGL passthrough support. This option requires the support of a special libGL installed on the guest OS. ETEXI +DEF("enable-yagl", 0, QEMU_OPTION_enable_yagl, \ + "-enable-yagl enable OpenGLES passthrough support\n", QEMU_ARCH_ALL) +STEXI +@item -enable-yagl +@findex -enable-yagl +Enable EGL and OpenGLES passthrough support. This option requires special +libEGL, libGLES_CM and libGLESv2 to be installed on the guest OS. Corresponding +EGL and openGLES calls on target system are translated to host openGL calls. +ETEXI DEF("enable-hax", 0, QEMU_OPTION_enable_hax, \ "-enable-hax enable HAX virtualization support\n", QEMU_ARCH_I386) diff --git a/vl.c b/vl.c index e349079..bd32238 100644 --- a/vl.c +++ b/vl.c @@ -265,6 +265,7 @@ uint8_t qemu_extra_params_fw[2]; #if defined(CONFIG_MARU) && (!defined(CONFIG_DARWIN)) extern int gl_acceleration_capability_check(void); int enable_gl = 0; +int enable_yagl = 0; int capability_check_gl = 0; #endif #if defined(CONFIG_MARU) && (!defined(CONFIG_DARWIN)) @@ -3201,6 +3202,14 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "Virtio GL support is disabled, ignoring -enable-gl\n"); #endif break; + case QEMU_OPTION_enable_yagl: +#if defined(CONFIG_YAGL) && !defined(CONFIG_DARWIN) + enable_yagl = 1; +#else + fprintf(stderr, "YaGL openGLES passthrough support is disabled," + " ignoring -enable-yagl\n"); +#endif + break; case QEMU_OPTION_machine: olist = qemu_find_opts("machine"); opts = qemu_opts_parse(olist, optarg, 1); @@ -3495,19 +3504,23 @@ int main(int argc, char **argv, char **envp) exit(0); } -#ifdef CONFIG_GL_BACKEND #if defined(CONFIG_MARU) && (!defined(CONFIG_DARWIN)) - if (enable_gl) { + if (enable_gl && enable_yagl) { + fprintf (stderr, "Error: only one openGL passthrough device can be used at one time!\n"); + exit(1); + } + + if (enable_gl || enable_yagl) { capability_check_gl = gl_acceleration_capability_check(); if (capability_check_gl != 0) { - enable_gl = 0; + enable_gl = enable_yagl = 0; fprintf (stderr, "Warn: GL acceleration was disabled due to the fail of GL check!\n"); } // To check host gl driver capability and notify to guest. gchar *tmp = tmp_cmdline; - tmp_cmdline = g_strdup_printf("%s gles=%d", tmp, enable_gl); + tmp_cmdline = g_strdup_printf("%s gles=%d yagl=%d", tmp, enable_gl, enable_yagl); qemu_opts_set(qemu_find_opts("machine"), 0, "append", tmp_cmdline); fprintf(stdout, "kernel command : %s\n", tmp_cmdline); g_free(tmp); @@ -3523,7 +3536,6 @@ int main(int argc, char **argv, char **envp) } } #endif -#endif /* Open the logfile at this point, if necessary. We can't open the logfile * when encountering either of the logging options (-d or -D) because the -- 2.7.4