diff options
author | Adam Jackson <ajax@redhat.com> | 2023-01-03 18:33:34 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-01-13 19:59:26 +0000 |
commit | cf9debb6397a6c23fd6377e557e5f7ac1a19b895 (patch) | |
tree | 80eed49ef75474b6b405eac60977183b272d7d1e /src/glx | |
parent | f0eed0001032b9bfef12e346709a7d95f9966775 (diff) |
glx: Clean up some funny business from context bind/unbind
We always fully unbind the old context before binding the new one, so
there's no point in passing both contexts to both the unbind and then
the bind.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20549>
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/applegl_glx.c | 10 | ||||
-rw-r--r-- | src/glx/dri2_glx.c | 5 | ||||
-rw-r--r-- | src/glx/dri3_glx.c | 5 | ||||
-rw-r--r-- | src/glx/drisw_glx.c | 5 | ||||
-rw-r--r-- | src/glx/driwindows_glx.c | 5 | ||||
-rw-r--r-- | src/glx/glxclient.h | 5 | ||||
-rw-r--r-- | src/glx/glxcurrent.c | 4 | ||||
-rw-r--r-- | src/glx/indirect_glx.c | 28 |
8 files changed, 20 insertions, 47 deletions
diff --git a/src/glx/applegl_glx.c b/src/glx/applegl_glx.c index d8b2d13dd66..0b2e722b66c 100644 --- a/src/glx/applegl_glx.c +++ b/src/glx/applegl_glx.c @@ -50,13 +50,13 @@ applegl_destroy_context(struct glx_context *gc) static int applegl_bind_context( - struct glx_context *gc, struct glx_context *old, + struct glx_context *gc, GLXDrawable draw, GLXDrawable read) { Display *dpy = gc->psc->dpy; bool error = apple_glx_make_current_context( dpy, - (old && old != &dummyContext) ? old->driContext : NULL, + NULL, gc ? gc->driContext : NULL, draw); apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO"); @@ -69,7 +69,7 @@ applegl_bind_context( } static void -applegl_unbind_context(struct glx_context *gc, struct glx_context *new) +applegl_unbind_context(struct glx_context *gc) { Display *dpy; bool error; @@ -78,10 +78,6 @@ applegl_unbind_context(struct glx_context *gc, struct glx_context *new) if (!gc) return; - /* If we have a new context, keep this one around and remove it during bind. */ - if (new) - return; - dpy = gc->psc->dpy; error = apple_glx_make_current_context( diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 0399dd5cb5d..3b0c3ccaf3e 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -111,8 +111,7 @@ dri2_destroy_context(struct glx_context *context) } static Bool -dri2_bind_context(struct glx_context *context, struct glx_context *old, - GLXDrawable draw, GLXDrawable read) +dri2_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read) { struct dri2_screen *psc = (struct dri2_screen *) context->psc; struct dri2_drawable *pdraw, *pread; @@ -140,7 +139,7 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old, } static void -dri2_unbind_context(struct glx_context *context, struct glx_context *new) +dri2_unbind_context(struct glx_context *context) { struct dri2_screen *psc = (struct dri2_screen *) context->psc; diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index f957a431dc7..613c620d213 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -157,8 +157,7 @@ dri3_destroy_context(struct glx_context *context) } static Bool -dri3_bind_context(struct glx_context *context, struct glx_context *old, - GLXDrawable draw, GLXDrawable read) +dri3_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read) { struct dri3_screen *psc = (struct dri3_screen *) context->psc; struct dri3_drawable *pdraw, *pread; @@ -191,7 +190,7 @@ dri3_bind_context(struct glx_context *context, struct glx_context *old, } static void -dri3_unbind_context(struct glx_context *context, struct glx_context *new) +dri3_unbind_context(struct glx_context *context) { struct dri3_screen *psc = (struct dri3_screen *) context->psc; diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index d7658eaf7c1..0e41f8560a9 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -431,8 +431,7 @@ drisw_destroy_context(struct glx_context *context) } static int -drisw_bind_context(struct glx_context *context, struct glx_context *old, - GLXDrawable draw, GLXDrawable read) +drisw_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read) { struct drisw_screen *psc = (struct drisw_screen *) context->psc; struct drisw_drawable *pdraw, *pread; @@ -457,7 +456,7 @@ drisw_bind_context(struct glx_context *context, struct glx_context *old, } static void -drisw_unbind_context(struct glx_context *context, struct glx_context *new) +drisw_unbind_context(struct glx_context *context) { struct drisw_screen *psc = (struct drisw_screen *) context->psc; diff --git a/src/glx/driwindows_glx.c b/src/glx/driwindows_glx.c index 3eb961dae3d..0c5540f3876 100644 --- a/src/glx/driwindows_glx.c +++ b/src/glx/driwindows_glx.c @@ -79,8 +79,7 @@ driwindows_destroy_context(struct glx_context *context) } static int -driwindows_bind_context(struct glx_context *context, struct glx_context *old, - GLXDrawable draw, GLXDrawable read) +driwindows_bind_context(struct glx_context *context, GLXDrawable draw, GLXDrawable read) { struct driwindows_context *pcp = (struct driwindows_context *) context; struct driwindows_drawable *pdraw, *pread; @@ -101,7 +100,7 @@ driwindows_bind_context(struct glx_context *context, struct glx_context *old, } static void -driwindows_unbind_context(struct glx_context *context, struct glx_context *new) +driwindows_unbind_context(struct glx_context *context) { struct driwindows_context *pcp = (struct driwindows_context *) context; diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 0b9b3e966da..3b3eb07d8fe 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -210,9 +210,8 @@ struct mesa_glinterop_export_out; struct glx_context_vtable { void (*destroy)(struct glx_context *ctx); - int (*bind)(struct glx_context *context, struct glx_context *old, - GLXDrawable draw, GLXDrawable read); - void (*unbind)(struct glx_context *context, struct glx_context *new_ctx); + int (*bind)(struct glx_context *context, GLXDrawable draw, GLXDrawable read); + void (*unbind)(struct glx_context *context); void (*wait_gl)(struct glx_context *ctx); void (*wait_x)(struct glx_context *ctx); int (*interop_query_device_info)(struct glx_context *ctx, diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c index 517a9e95327..a0a0aa3ca9a 100644 --- a/src/glx/glxcurrent.c +++ b/src/glx/glxcurrent.c @@ -125,7 +125,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, } if (oldGC != &dummyContext) { - oldGC->vtable->unbind(oldGC, gc); + oldGC->vtable->unbind(oldGC); oldGC->currentDpy = NULL; } @@ -138,7 +138,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, * blown away our old context. The caller is responsible for * figuring out how to handle setting a valid context. */ - if (gc->vtable->bind(gc, oldGC, draw, read) != Success) { + if (gc->vtable->bind(gc, draw, read) != Success) { __glXSetCurrentContextNull(); __glXUnlock(); __glXSendError(dpy, GLXBadContext, None, opcode, False); diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c index 80e95f6754e..dc3464fc99e 100644 --- a/src/glx/indirect_glx.c +++ b/src/glx/indirect_glx.c @@ -123,21 +123,13 @@ SendMakeCurrentRequest(Display * dpy, GLXContextID gc_id, } static int -indirect_bind_context(struct glx_context *gc, struct glx_context *old, +indirect_bind_context(struct glx_context *gc, GLXDrawable draw, GLXDrawable read) { - GLXContextTag tag; Display *dpy = gc->psc->dpy; Bool sent; - if (old != &dummyContext && !old->isDirect && old->psc->dpy == dpy) { - tag = old->currentContextTag; - old->currentContextTag = 0; - } else { - tag = 0; - } - - sent = SendMakeCurrentRequest(dpy, gc->xid, tag, draw, read, + sent = SendMakeCurrentRequest(dpy, gc->xid, 0, draw, read, &gc->currentContextTag); if (sent) { @@ -166,22 +158,12 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old, } static void -indirect_unbind_context(struct glx_context *gc, struct glx_context *new) +indirect_unbind_context(struct glx_context *gc) { Display *dpy = gc->psc->dpy; - if (gc == new) - return; - - /* We are either switching to no context, away from an indirect - * context to a direct context or from one dpy to another and have - * to send a request to the dpy to unbind the previous context. - */ - if (!new || new->isDirect || new->psc->dpy != dpy) { - SendMakeCurrentRequest(dpy, None, gc->currentContextTag, None, None, - NULL); - gc->currentContextTag = 0; - } + SendMakeCurrentRequest(dpy, None, gc->currentContextTag, None, None, NULL); + gc->currentContextTag = 0; } static void |