qemu-options: add option to enable YaGL
authorIgor Mitsyanko <i.mitsyanko@samsung.com>
Wed, 21 Nov 2012 18:33:36 +0000 (22:33 +0400)
committerEvgeny Voevodin <e.voevodin@samsung.com>
Mon, 26 Nov 2012 09:25:43 +0000 (13:25 +0400)
Also, check and exit(1) if user specified virtGL and YaGL simultaniously.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
qemu-options.hx
vl.c

index 854bf912e90119a2b18d1596e18d2c0c511b55be..4be6d46960674b344f2322de0ebe019fb2c71e13 100644 (file)
@@ -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 e349079e11f174917d4435169b447ce3d94c549d..bd322383afb2889e21fac4e9b9c0931a7f10862a 100644 (file)
--- 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))
@@ -3199,6 +3200,14 @@ int main(int argc, char **argv, char **envp)
 #endif
 #else
                 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:
@@ -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);
@@ -3522,7 +3535,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