mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-01-09 07:15:12 +08:00
glx: Implement GLX_EXT_swap_control for DRI2 and DRI3
This is a slight generalization of the existing SGI and MESA swap control extensions, and a prerequisite for GLX_EXT_swap_control_tear. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6671>
This commit is contained in:
parent
b8239abdf8
commit
60ebeb4608
@ -3,3 +3,4 @@ GL_NV_copy_depth_to_color for NIR
|
||||
GL_NV_half_float
|
||||
EGL_KHR_swap_buffers_with_damage on X11 (DRI3)
|
||||
VK_PRESENT_MODE_FIFO_RELAXED on X11
|
||||
GLX_EXT_swap_control for DRI2 and DRI3
|
||||
|
@ -1109,6 +1109,7 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv,
|
||||
|
||||
extensions = psc->core->getExtensions(psc->driScreen);
|
||||
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_EXT_swap_control");
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_SGI_swap_control");
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_MESA_swap_control");
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_SGI_make_current_read");
|
||||
|
@ -741,6 +741,7 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
|
||||
|
||||
extensions = psc->core->getExtensions(psc->driScreen);
|
||||
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_EXT_swap_control");
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_SGI_swap_control");
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_MESA_swap_control");
|
||||
__glXEnableDirectExtension(&psc->base, "GLX_SGI_make_current_read");
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <X11/extensions/Xext.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include "glxextensions.h"
|
||||
|
||||
#ifdef GLX_USE_APPLEGL
|
||||
@ -343,6 +344,16 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pdraw) {
|
||||
if (attribute == GLX_SWAP_INTERVAL_EXT) {
|
||||
*value = pdraw->psc->driScreen->getSwapInterval(pdraw);
|
||||
return 0;
|
||||
} else if (attribute == GLX_MAX_SWAP_INTERVAL_EXT) {
|
||||
*value = INT_MAX;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LockDisplay(dpy);
|
||||
|
@ -1845,6 +1845,34 @@ glXGetSwapIntervalMESA(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** GLX_EXT_swap_control
|
||||
*/
|
||||
_X_HIDDEN void
|
||||
glXSwapIntervalEXT(Display *dpy, GLXDrawable drawable, int interval)
|
||||
{
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
|
||||
|
||||
/*
|
||||
* Strictly, this should throw an error if drawable is not a Window or
|
||||
* GLXWindow. We don't actually track that, so, oh well.
|
||||
*/
|
||||
if (!pdraw) {
|
||||
__glXSendError(dpy, BadWindow, drawable, 0, True);
|
||||
return;
|
||||
}
|
||||
|
||||
if (interval < 0) {
|
||||
__glXSendError(dpy, BadValue, interval, 0, True);
|
||||
return;
|
||||
}
|
||||
|
||||
pdraw->psc->driScreen->setSwapInterval(pdraw, interval);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** GLX_SGI_video_sync
|
||||
*/
|
||||
@ -2530,6 +2558,9 @@ static const struct name_address_pair GLX_functions[] = {
|
||||
/*** GLX_EXT_texture_from_pixmap ***/
|
||||
GLX_FUNCTION(glXBindTexImageEXT),
|
||||
GLX_FUNCTION(glXReleaseTexImageEXT),
|
||||
|
||||
/*** GLX_EXT_swap_control ***/
|
||||
GLX_FUNCTION(glXSwapIntervalEXT),
|
||||
#endif
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && defined(GLX_USE_DRM)
|
||||
|
@ -147,6 +147,7 @@ static const struct extension_info known_glx_extensions[] = {
|
||||
{ GLX(EXT_fbconfig_packed_float), VER(0,0), Y, Y, N, N },
|
||||
{ GLX(EXT_framebuffer_sRGB), VER(0,0), Y, Y, N, N },
|
||||
{ GLX(EXT_import_context), VER(0,0), Y, Y, N, N },
|
||||
{ GLX(EXT_swap_control), VER(0,0), Y, N, N, Y },
|
||||
{ GLX(EXT_texture_from_pixmap), VER(0,0), Y, N, N, N },
|
||||
{ GLX(EXT_visual_info), VER(0,0), Y, Y, N, N },
|
||||
{ GLX(EXT_visual_rating), VER(0,0), Y, Y, N, N },
|
||||
|
@ -51,6 +51,7 @@ enum
|
||||
EXT_fbconfig_packed_float_bit,
|
||||
EXT_framebuffer_sRGB_bit,
|
||||
EXT_import_context_bit,
|
||||
EXT_swap_control_bit,
|
||||
EXT_texture_from_pixmap_bit,
|
||||
EXT_visual_info_bit,
|
||||
EXT_visual_rating_bit,
|
||||
|
Loading…
Reference in New Issue
Block a user