Module: Mesa
Branch: master
Commit: acaf07c24b348100ca6e011c5ca4531175ab0593
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=acaf07c24b348100ca6e011c5ca4531175ab0593

Author: Adam Jackson <[email protected]>
Date:   Mon Nov 16 13:24:23 2020 -0500

glx: Fix GLX_SGI_video_sync for the no-current-drawable case

Starting with GL 3.0 it's legal to have no drawable bound to the current
context. GLX_SGI_video_sync doesn't take a drawable for an argument so
it implicitly operates on... something. NVIDIA's driver throws
GLX_BAD_CONTEXT for GetVideoSync, but WaitVideoSync seems to actually
wait for the next MSC on the context's screen. We could work around this
by internally creating/destroying a GLXWindow for the root window, but
for Xwayland there's not necessarily a good answer it can return.

Just throw GLX_BAD_CONTEXT for both.

Fixes: mesa/mesa#1207
Reviewed-by: Michel Dänzer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8334>

---

 src/glx/glxcmds.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index fcd82bab4a4..7882d606554 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -1888,6 +1888,9 @@ glXGetVideoSyncSGI(unsigned int *count)
    if (!gc->isDirect)
       return GLX_BAD_CONTEXT;
 
+   if (!gc->currentDrawable)
+      return GLX_BAD_CONTEXT;
+
    psc = GetGLXScreenConfigs(gc->currentDpy, gc->screen);
    pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
 
@@ -1926,6 +1929,9 @@ glXWaitVideoSyncSGI(int divisor, int remainder, unsigned 
int *count)
    if (!gc->isDirect)
       return GLX_BAD_CONTEXT;
 
+   if (!gc->currentDrawable)
+      return GLX_BAD_CONTEXT;
+
    psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen);
    pdraw = GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to