glamor: Fix crash when master gpu is using glamor and another gpu is hotplugged
When a GPU gets hotplugged while X is already running, glamor_egl_init() gets called and changes the current egl context, without updating lastGLContext, potentially causing the next glamor call on another GPU to run in the wrong context. This causes glamor to e.g. crash in the next glamor_create_pixmap() call (called through the master's screen->CreatePixmap), note this is not the only troublesome entry point I've seen other backtraces when using a compositing window manager. Set lastGLContext to NULL to force the next glamor_make_current() call to set the right context. Note that we cannot use glamor_make_current() here to replace the eglMakeCurrent() call and update lastGLContext for us because glamor_make_current takes a glamor_priv struct as argument and that has not been created yet when glamor_egl_init() gets called. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
1075af8a6c
commit
3fe4107643
|
@ -703,6 +703,11 @@ static void glamor_egl_cleanup(struct glamor_egl_screen_private *glamor_egl)
|
|||
if (glamor_egl->display != EGL_NO_DISPLAY) {
|
||||
eglMakeCurrent(glamor_egl->display,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
/*
|
||||
* Force the next glamor_make_current call to update the context
|
||||
* (on hot unplug another GPU may still be using glamor)
|
||||
*/
|
||||
lastGLContext = NULL;
|
||||
eglTerminate(glamor_egl->display);
|
||||
}
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
|
@ -831,6 +836,11 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
|
|||
"Failed to make EGL context current\n");
|
||||
goto error;
|
||||
}
|
||||
/*
|
||||
* Force the next glamor_make_current call to set the right context
|
||||
* (in case of multiple GPUs using glamor)
|
||||
*/
|
||||
lastGLContext = NULL;
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
if (epoxy_has_egl_extension(glamor_egl->display,
|
||||
"EGL_KHR_gl_texture_2D_image") &&
|
||||
|
|
Loading…
Reference in New Issue