diff options
author | Karthik Bhat <kv.bhat@samsung.com> | 2019-05-07 12:22:01 +0530 |
---|---|---|
committer | Karthik Bhat <kv.bhat@samsung.com> | 2019-05-07 14:00:34 +0530 |
commit | dd1a1d611b7aa9853942398f61c1038379e6c6f8 (patch) | |
tree | 2d8e130982342dc37d6a6e93a2e1f5024397f5c8 | |
parent | 099b2080721aab85e2b1d506101a44cb74999c82 (diff) | |
download | qemu-dd1a1d611b7aa9853942398f61c1038379e6c6f8.tar.gz qemu-dd1a1d611b7aa9853942398f61c1038379e6c6f8.tar.bz2 qemu-dd1a1d611b7aa9853942398f61c1038379e6c6f8.zip |
Fix emulator launch crash on MAC
Change-Id: If02e8700c012e0e7944e8acac3653d1c4feb0e9d
Signed-off-by: Karthik Bhat <kv.bhat@samsung.com>
-rw-r--r-- | hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c | 35 | ||||
-rw-r--r-- | package/changelog | 3 | ||||
-rw-r--r-- | package/pkginfo.manifest | 2 |
3 files changed, 27 insertions, 13 deletions
diff --git a/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c b/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c index 0f398babde..90cd0bc332 100644 --- a/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c +++ b/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c @@ -387,14 +387,24 @@ 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; + // 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 (driver->gl_version > yagl_gl_2) { + 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,11 +420,12 @@ 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)) { + error = CGLDestroyPBuffer((CGLPBufferObj)sfc); - error = CGLDestroyPBuffer((CGLPBufferObj)sfc); - - if (error) { - YAGL_LOG_ERROR("CGLDestroyPBuffer failed: %s", CGLErrorString(error)); + if (error) { + YAGL_LOG_ERROR("CGLDestroyPBuffer failed: %s", CGLErrorString(error)); + } } YAGL_LOG_FUNC_EXIT(NULL); @@ -445,7 +456,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; @@ -504,7 +515,7 @@ static bool yagl_egl_cgl_make_current(struct yagl_egl_driver *driver, draw, read, ctx); - + // Call CGLSetPBuffer only in case a valid CGLCreatePBuffer is created. if (cgl_ctx && !cgl_ctx->is_3_2_core) { if (read_pbuffer) { error = CGLSetPBuffer(cgl_ctx->base, read_pbuffer, 0, 0, 0); diff --git a/package/changelog b/package/changelog index a8ce18801d..26b82c82e6 100644 --- a/package/changelog +++ b/package/changelog @@ -1,3 +1,6 @@ +* 2.8.0.24 +- YAGL: Fix emulator launch fail on MAC +== Karthik Bhat <kv.bhat@samsung.com> 2019-05-07 * 2.8.0.23 - Open source Vulnerability fixed == Rahul Dadhich <r.dadhich@samsung.com> 2018-10-05 diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index a498bcaf3e..d644b0f72b 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,4 +1,4 @@ -Version: 2.8.0.23 +Version: 2.8.0.24 Maintainer: SeokYeon Hwang <syeon.hwang@samsung.com> Source: emulator |