glx: Move DRI2 client support behind legacy-x11

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: David Heidelberg <david@ixit.cz>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29969>
This commit is contained in:
Adam Jackson 2024-06-28 10:45:29 -04:00 committed by Marge Bot
parent e8c1d966e5
commit 6292dfb939
7 changed files with 39 additions and 35 deletions

View file

@ -799,24 +799,6 @@ dri2GetSwapInterval(__GLXDRIdrawable *pdraw)
return priv->swap_interval;
}
static void
driSetBackgroundContext(void *loaderPrivate)
{
__glXSetCurrentContext(loaderPrivate);
}
static GLboolean
driIsThreadSafe(void *loaderPrivate)
{
struct glx_context *pcp = (struct glx_context *) loaderPrivate;
/* Check Xlib is running in thread safe mode
*
* 'lock_fns' is the XLockDisplay function pointer of the X11 display 'dpy'.
* It will be NULL if XInitThreads wasn't called.
*/
return pcp->psc->dpy->lock_fns != NULL;
}
static const __DRIdri2LoaderExtension dri2LoaderExtension = {
.base = { __DRI_DRI2_LOADER, 3 },
@ -825,17 +807,6 @@ static const __DRIdri2LoaderExtension dri2LoaderExtension = {
.getBuffersWithFormat = dri2GetBuffersWithFormat,
};
const __DRIuseInvalidateExtension dri2UseInvalidate = {
.base = { __DRI_USE_INVALIDATE, 1 }
};
const __DRIbackgroundCallableExtension driBackgroundCallable = {
.base = { __DRI_BACKGROUND_CALLABLE, 2 },
.setBackgroundContext = driSetBackgroundContext,
.isThreadSafe = driIsThreadSafe,
};
_X_HIDDEN void
dri2InvalidateBuffers(Display *dpy, XID drawable)
{

View file

@ -541,7 +541,7 @@ const __DRIuseInvalidateExtension dri3UseInvalidate = {
.base = { __DRI_USE_INVALIDATE, 1 }
};
static const __DRIbackgroundCallableExtension driBackgroundCallable = {
static const __DRIbackgroundCallableExtension dri3BackgroundCallable = {
.base = { __DRI_BACKGROUND_CALLABLE, 2 },
.setBackgroundContext = dri_set_background_context,
@ -551,7 +551,7 @@ static const __DRIbackgroundCallableExtension driBackgroundCallable = {
static const __DRIextension *loader_extensions[] = {
&imageLoaderExtension.base,
&dri3UseInvalidate.base,
&driBackgroundCallable.base,
&dri3BackgroundCallable.base,
NULL
};

View file

@ -806,4 +806,33 @@ out:
return e ? e->config : NULL;
}
static void
driSetBackgroundContext(void *loaderPrivate)
{
__glXSetCurrentContext(loaderPrivate);
}
static GLboolean
driIsThreadSafe(void *loaderPrivate)
{
struct glx_context *pcp = (struct glx_context *) loaderPrivate;
/* Check Xlib is running in thread safe mode
*
* 'lock_fns' is the XLockDisplay function pointer of the X11 display 'dpy'.
* It will be NULL if XInitThreads wasn't called.
*/
return pcp->psc->dpy->lock_fns != NULL;
}
const __DRIbackgroundCallableExtension driBackgroundCallable = {
.base = { __DRI_BACKGROUND_CALLABLE, 2 },
.setBackgroundContext = driSetBackgroundContext,
.isThreadSafe = driIsThreadSafe,
};
const __DRIuseInvalidateExtension dri2UseInvalidate = {
.base = { __DRI_USE_INVALIDATE, 1 }
};
#endif /* GLX_DIRECT_RENDERING */

View file

@ -90,6 +90,9 @@ dri_common_create_context(struct glx_screen *base,
struct glx_context *shareList,
int renderType);
extern const __DRIbackgroundCallableExtension driBackgroundCallable;
extern const __DRIuseInvalidateExtension dri2UseInvalidate;
#endif /* GLX_DIRECT_RENDERING */
#endif /* _DRI_COMMON_H */

View file

@ -406,9 +406,6 @@ static const __DRIextension *loader_extensions_noshm[] = {
NULL
};
extern const __DRIuseInvalidateExtension dri2UseInvalidate;
extern const __DRIbackgroundCallableExtension driBackgroundCallable;
static const __DRIextension *kopper_extensions_noshm[] = {
&swrastLoaderExtension.base,
&kopperLoaderExtension.base,

View file

@ -785,8 +785,10 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv, Bool zink,
if (priv->dri3Display)
psc = priv->dri3Display->createScreen(i, priv, driver_name_is_inferred);
#endif /* HAVE_DRI3 */
#if defined(HAVE_X11_DRI2)
if (psc == NULL && priv->dri2Display)
psc = priv->dri2Display->createScreen(i, priv, driver_name_is_inferred);
#endif
#endif /* GLX_USE_DRM */
#ifdef GLX_USE_WINDOWSGL
@ -917,8 +919,10 @@ __glXInitialize(Display * dpy)
try_zink = !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false);
}
#endif /* HAVE_DRI3 */
#if defined(HAVE_X11_DRI2)
if (!debug_get_bool_option("LIBGL_DRI2_DISABLE", false))
dpyPriv->dri2Display = dri2CreateDisplay(dpy);
#endif
#if defined(HAVE_ZINK)
if (!dpyPriv->dri3Display && !dpyPriv->dri2Display)
try_zink = !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false) &&

View file

@ -61,7 +61,7 @@ extra_deps_libgl = []
extra_ld_args_libgl = []
# dri2
if (with_dri_platform == 'drm' and dep_libdrm.found()) or with_dri_platform == 'apple'
if with_x11_dri2
files_libglx += files(
'dri2.c',
'dri2_glx.c',