diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2017-05-26 12:30:13 +0900 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2017-09-25 15:34:10 -0400 |
commit | 40edd409bfc527223dfae89c7f84fea0721dec49 (patch) | |
tree | 69a20104a9a5438d5c19ede9b035a7d90bfe3c9a /glamor | |
parent | 7c4f7b3a49a43984ab90788b85b35078feadf42a (diff) |
glamor: Store the actual EGL/GLX context pointer in lastGLContext
Fixes subtle breakage which could sometimes trigger after a server reset
with multiple screens using glamor:
Screen A enters glamor_close_screen last and calls various cleanup
functions, which at some point call glamor_make_current to make sure
screen A's GL context is current. This sets lastGLContext to screen A's
&glamor_priv->ctx. Finally, glamor_close_screen calls
glamor_release_screen_priv, which calls free(glamor_priv).
Later, screen B enters glamor_init, which allocates a new glamor_priv.
With bad luck, this can return the same pointer which was previously
used for screen A's glamor_priv. So when screen B's glamor_init calls
glamor_make_current, lastGLContext == &glamor_priv->ctx, so MakeCurrent
isn't called for screen B's GL context, and the following OpenGL API
calls triggered by glamor_init mess up screen A's GL context.
The observed end result of this was a crash in glamor_get_vbo_space
because glamor_priv->vbo didn't match the GL context, though there might
be other possible outcomes.
Assigning the actual GL context pointer to lastGLContext prevents this
by preventing the false negative test in glamor_make_current.
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 7c88977d338a01aca866e52c9e736f8857fb9ae4)
Diffstat (limited to 'glamor')
-rw-r--r-- | glamor/glamor_utils.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h index 6b88527e6..a35917c37 100644 --- a/glamor/glamor_utils.h +++ b/glamor/glamor_utils.h @@ -723,8 +723,8 @@ glamor_is_large_pixmap(PixmapPtr pixmap) static inline void glamor_make_current(glamor_screen_private *glamor_priv) { - if (lastGLContext != &glamor_priv->ctx) { - lastGLContext = &glamor_priv->ctx; + if (lastGLContext != glamor_priv->ctx.ctx) { + lastGLContext = glamor_priv->ctx.ctx; glamor_priv->ctx.make_current(&glamor_priv->ctx); } } |