bugfix: Fix crash on eglTerminate with buggy Nvidia blob driver

NB: Thanks for the report cedric ;)

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2014-03-20 10:17:46 +00:00
parent 52532f9a32
commit db40e4b67e
1 changed files with 20 additions and 4 deletions

View File

@ -224,6 +224,9 @@ static const struct wl_pointer_grab_interface _e_drag_grab_interface =
/* local variables */ /* local variables */
static Ecore_Idler *_module_idler = NULL; static Ecore_Idler *_module_idler = NULL;
#ifdef HAVE_WAYLAND_EGL
static Eina_Bool can_terminate = EINA_TRUE;
#endif
/* external variables */ /* external variables */
EAPI E_Wayland_Compositor *_e_wl_comp; EAPI E_Wayland_Compositor *_e_wl_comp;
@ -278,12 +281,25 @@ e_comp_wl_init(void)
else else
{ {
EGLint major, minor; EGLint major, minor;
const char *vendor;
/* FIXME: HACK:
*
* Frenchie reports major icky crash with Binary Nvidia Driver and
* calling eglTerminate. Let's hack around that.... */
vendor =
(const char *)eglQueryString(_e_wl_comp->egl.display, EGL_VENDOR);
if (vendor)
{
if (!strcmp(vendor, "NVIDIA Corporation"))
can_terminate = EINA_FALSE;
}
/* try to initialize egl */ /* try to initialize egl */
if (!eglInitialize(_e_wl_comp->egl.display, &major, &minor)) if (!eglInitialize(_e_wl_comp->egl.display, &major, &minor))
{ {
ERR("Could not initialize EGL: %m"); ERR("Could not initialize EGL: %m");
eglTerminate(_e_wl_comp->egl.display); if (can_terminate) eglTerminate(_e_wl_comp->egl.display);
} }
else else
{ {
@ -295,13 +311,12 @@ e_comp_wl_init(void)
EGL_ALPHA_SIZE, 1, EGL_RENDERABLE_TYPE, EGL_ALPHA_SIZE, 1, EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES2_BIT, EGL_NONE EGL_OPENGL_ES2_BIT, EGL_NONE
}; };
/* const char *exts; */
if ((!eglChooseConfig(_e_wl_comp->egl.display, attribs, if ((!eglChooseConfig(_e_wl_comp->egl.display, attribs,
&_e_wl_comp->egl.config, 1, &n) || (n == 0))) &_e_wl_comp->egl.config, 1, &n) || (n == 0)))
{ {
ERR("Could not choose EGL config: %m"); ERR("Could not choose EGL config: %m");
eglTerminate(_e_wl_comp->egl.display); if (can_terminate) eglTerminate(_e_wl_comp->egl.display);
} }
} }
} }
@ -366,7 +381,8 @@ err:
_e_wl_comp->egl.unbind_display(_e_wl_comp->egl.display, _e_wl_comp->wl.display); _e_wl_comp->egl.unbind_display(_e_wl_comp->egl.display, _e_wl_comp->wl.display);
/* terminate the egl display */ /* terminate the egl display */
if (_e_wl_comp->egl.display) eglTerminate(_e_wl_comp->egl.display); if ((_e_wl_comp->egl.display) && (can_terminate))
eglTerminate(_e_wl_comp->egl.display);
eglReleaseThread(); eglReleaseThread();
#endif #endif