diff options
author | Hans de Goede <hdegoede@redhat.com> | 2016-09-08 09:30:31 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2016-09-13 10:26:35 +0200 |
commit | 3fe4107643ba029dd48e3d12ec9bc97d07112300 (patch) | |
tree | b1275e3e81ff209608a61d25e63cb2f2116db35c /glamor | |
parent | 1075af8a6c26009c04db30a6d6d1f10070568ab1 (diff) |
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>
Diffstat (limited to 'glamor')
-rw-r--r-- | glamor/glamor_egl.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 16a20a7f8..2b9e0e109 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -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") && |