Fix emulator launch crash on MAC 11/205511/2
authorKarthik Bhat <kv.bhat@samsung.com>
Tue, 7 May 2019 05:13:07 +0000 (10:43 +0530)
committerKarthik Bhat <kv.bhat@samsung.com>
Tue, 7 May 2019 05:16:28 +0000 (10:46 +0530)
Change-Id: I2c80d0ee031c56bf6c815acdfd0cccf374988294
Signed-off-by: Karthik Bhat <kv.bhat@samsung.com>
hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c
package/changelog
package/pkginfo.manifest

index 0f398babde77d77119762a7d9b3b75fae9d80add..40b15b15bef365d16fc8696b186e1824eb8e092c 100644 (file)
@@ -380,6 +380,7 @@ static EGLSurface yagl_egl_cgl_pbuffer_surface_create(struct yagl_egl_driver *dr
 {
     CGLPBufferObj pbuffer = NULL;
     CGLError error;
+    bool is_3_2_core = false;
 
     YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_pbuffer_surface_create,
                         "dpy = %p, width = %d, height = %d",
@@ -387,14 +388,27 @@ static EGLSurface yagl_egl_cgl_pbuffer_surface_create(struct yagl_egl_driver *dr
                         width,
                         height);
 
-    error = CGLCreatePBuffer(width, height, GL_TEXTURE_2D, GL_RGBA,
-                             0, &pbuffer);
-
-    if (error) {
-        YAGL_LOG_ERROR("CGLCreatePBuffer failed: %s", CGLErrorString(error));
-        pbuffer = NULL;
+    if (driver->gl_version > yagl_gl_2)
+        is_3_2_core = true;
+
+    // TODO: Migrate to Metal Framework
+    // CGLCreatePBuffer is deprecated on MAC.
+    // Below hack is to fix Emulator launch issue on MAC.
+    // The surface returned by CGLCreatePBuffer is not used in case of opengl 3.2
+    // Hence return dummy surface in case of opengl 3.2 instead of returning null and exiting.
+    if (is_3_2_core) {
+       YAGL_LOG_INFO("Creating Dummy EGLSurface\n");
+       pbuffer = (EGLSurface)1;
     }
+    else {
+        error = CGLCreatePBuffer(width, height, GL_TEXTURE_2D, GL_RGBA,
+                                0, &pbuffer);
 
+        if (error) {
+            YAGL_LOG_ERROR("CGLCreatePBuffer failed: %s", CGLErrorString(error));
+            pbuffer = NULL;
+        }
+    }
     YAGL_LOG_FUNC_EXIT("%p", pbuffer);
 
     return pbuffer;
@@ -410,13 +424,15 @@ static void yagl_egl_cgl_pbuffer_surface_destroy(struct yagl_egl_driver *driver,
                         "dpy = %p, sfc = %p",
                         dpy,
                         sfc);
+    if (driver->gl_version > yagl_gl_2)
+       goto done;
 
     error = CGLDestroyPBuffer((CGLPBufferObj)sfc);
 
     if (error) {
         YAGL_LOG_ERROR("CGLDestroyPBuffer failed: %s", CGLErrorString(error));
     }
-
+done:
     YAGL_LOG_FUNC_EXIT(NULL);
 }
 
@@ -445,7 +461,7 @@ static EGLContext yagl_egl_cgl_context_create(struct yagl_egl_driver *driver,
         share_ctx = NULL;
     }
 
-    if ((egl_cgl->base.gl_version > yagl_gl_2) && (version != 1)) {
+    if (egl_cgl->base.gl_version > yagl_gl_2) {
         ctx->is_3_2_core = true;
     } else {
         ctx->is_3_2_core = false;
index f752627c7cf2b52b51b60b3dffdbfeb132264571..0a79ffe9c3e34c727e19425b848394a0b7141529 100644 (file)
@@ -1,3 +1,6 @@
+* 2.8.0.28
+- YAGL: Fix emulator launch fail on MAC
+== Karthik Bhat <kv.bhat@samsung.com> 2019-05-07
 * 2.8.0.27
 - Added sdbscript install dependency in mac for 5.0
 == Aditya Aswani <a.aswani@samsung.com> 2018-12-17
index 9a92848e986e43a4d39978d85636e79c07ba3693..aa3d4ee8c33e82f9c4a281dbf7bed9c4e712d184 100644 (file)
@@ -1,4 +1,4 @@
-Version: 2.8.0.27
+Version: 2.8.0.28
 Maintainer: SeokYeon Hwang <syeon.hwang@samsung.com>
 Source: emulator