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 <mdaenzer@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8334>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user