glx: unify more extension setup

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30619>
This commit is contained in:
Mike Blumenkrantz 2024-08-01 15:47:48 -04:00 committed by Marge Bot
parent 0af723ea44
commit 912090fa96
3 changed files with 35 additions and 63 deletions

View file

@ -748,33 +748,6 @@ dri2CreateScreen(int screen, struct glx_display * priv, bool driver_name_is_infe
psc->base.can_EXT_texture_from_pixmap = true;
__glXEnableDirectExtension(&psc->base, "GLX_OML_sync_control");
__glXEnableDirectExtension(&psc->base, "GLX_SGI_video_sync");
if (dri2GalliumConfigQuerys(psc->base.frontend_screen, "glx_extension_override",
&tmp) == 0)
__glXParseExtensionOverride(&psc->base, tmp);
if (dri2GalliumConfigQuerys(psc->base.frontend_screen,
"indirect_gl_extension_override",
&tmp) == 0)
__IndirectGlParseExtensionOverride(&psc->base, tmp);
{
uint8_t force = false;
if (dri2GalliumConfigQueryb(psc->base.frontend_screen, "force_direct_glx_context",
&force) == 0) {
psc->base.force_direct_context = force;
}
uint8_t invalid_glx_destroy_window = false;
if (dri2GalliumConfigQueryb(psc->base.frontend_screen,
"allow_invalid_glx_destroy_window",
&invalid_glx_destroy_window) == 0) {
psc->base.allow_invalid_glx_destroy_window = invalid_glx_destroy_window;
}
}
/* DRI2 supports SubBuffer through DRI2CopyRegion, so it's always
* available.*/
psp->copySubBuffer = dri2CopySubBuffer;

View file

@ -495,7 +495,7 @@ dri3_create_screen(int screen, struct glx_display * priv, bool driver_name_is_in
struct dri3_screen *psc;
__GLXDRIscreen *psp;
struct glx_config *configs = NULL, *visuals = NULL;
char *driverName, *driverNameDisplayGPU, *tmp;
char *driverName, *driverNameDisplayGPU;
*return_zink = false;
psc = calloc(1, sizeof *psc);
@ -609,43 +609,8 @@ dri3_create_screen(int screen, struct glx_display * priv, bool driver_name_is_in
* a texture from them.
*/
psc->base.can_EXT_texture_from_pixmap = psc->fd_render_gpu == psc->fd_display_gpu;
__glXEnableDirectExtension(&psc->base, "GLX_OML_sync_control");
__glXEnableDirectExtension(&psc->base, "GLX_SGI_video_sync");
psp->copySubBuffer = dri3_copy_sub_buffer;
if (dri2GalliumConfigQuerys(psc->base.frontend_screen, "glx_extension_override",
&tmp) == 0)
__glXParseExtensionOverride(&psc->base, tmp);
if (dri2GalliumConfigQuerys(psc->base.frontend_screen,
"indirect_gl_extension_override",
&tmp) == 0)
__IndirectGlParseExtensionOverride(&psc->base, tmp);
{
uint8_t force = false;
if (dri2GalliumConfigQueryb(psc->base.frontend_screen, "force_direct_glx_context",
&force) == 0) {
psc->base.force_direct_context = force;
}
uint8_t invalid_glx_destroy_window = false;
if (dri2GalliumConfigQueryb(psc->base.frontend_screen,
"allow_invalid_glx_destroy_window",
&invalid_glx_destroy_window) == 0) {
psc->base.allow_invalid_glx_destroy_window = invalid_glx_destroy_window;
}
uint8_t keep_native_window_glx_drawable = false;
if (dri2GalliumConfigQueryb(psc->base.frontend_screen,
"keep_native_window_glx_drawable",
&keep_native_window_glx_drawable) == 0) {
psc->base.keep_native_window_glx_drawable = keep_native_window_glx_drawable;
}
}
InfoMessageF("Using DRI3 for screen %d\n", screen);
psc->prefer_back_buffer_reuse = 1;

View file

@ -760,6 +760,8 @@ bind_extensions(struct glx_screen *psc, const char *driverName)
__glXEnableDirectExtension(psc, "GLX_EXT_swap_control");
__glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
__glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
__glXEnableDirectExtension(psc, "GLX_OML_sync_control");
__glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
// for zink this needs to check whether RELAXED is available
if (psc->display->driver == GLX_DRIVER_DRI3)
__glXEnableDirectExtension(psc, "GLX_EXT_swap_control_tear");
@ -810,6 +812,38 @@ bind_extensions(struct glx_screen *psc, const char *driverName)
__glXEnableDirectExtension(psc, "GLX_MESA_query_renderer");
__glXEnableDirectExtension(psc, "GLX_MESA_gl_interop");
char *tmp;
if (dri2GalliumConfigQuerys(psc->frontend_screen, "glx_extension_override",
&tmp) == 0)
__glXParseExtensionOverride(psc, tmp);
if (dri2GalliumConfigQuerys(psc->frontend_screen,
"indirect_gl_extension_override",
&tmp) == 0)
__IndirectGlParseExtensionOverride(psc, tmp);
{
uint8_t force = false;
if (dri2GalliumConfigQueryb(psc->frontend_screen, "force_direct_glx_context",
&force) == 0) {
psc->force_direct_context = force;
}
uint8_t invalid_glx_destroy_window = false;
if (dri2GalliumConfigQueryb(psc->frontend_screen,
"allow_invalid_glx_destroy_window",
&invalid_glx_destroy_window) == 0) {
psc->allow_invalid_glx_destroy_window = invalid_glx_destroy_window;
}
uint8_t keep_native_window_glx_drawable = false;
if (dri2GalliumConfigQueryb(psc->frontend_screen,
"keep_native_window_glx_drawable",
&keep_native_window_glx_drawable) == 0) {
psc->keep_native_window_glx_drawable = keep_native_window_glx_drawable;
}
}
}