xwayland: add detection for drivers that don't support implicit sync

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/967>
This commit is contained in:
Erik Kurzinger 2024-03-04 17:11:59 +01:00 committed by Olivier Fourdan
parent c5e88238f2
commit 89c327f263
2 changed files with 19 additions and 1 deletions

View File

@ -62,6 +62,7 @@ struct xwl_gbm_private {
Bool drm_authenticated;
Bool dmabuf_capable;
Bool glamor_gles;
Bool implicit_sync;
/* Set if wl_drm is available */
struct wl_drm *drm;
@ -1020,6 +1021,14 @@ xwl_glamor_gbm_has_egl_extension(void)
epoxy_has_egl_extension(NULL, "EGL_KHR_platform_gbm"));
}
Bool
xwl_glamor_supports_implicit_sync(struct xwl_screen *xwl_screen)
{
/* absent glamor, implicit sync is irrelevant so just return TRUE */
return !xwl_screen->glamor ||
xwl_gbm_get(xwl_screen)->implicit_sync;
}
static Bool
xwl_glamor_try_to_make_context_current(struct xwl_screen *xwl_screen)
{
@ -1164,7 +1173,7 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
EGLint major, minor;
const GLubyte *renderer;
const char *gbm_backend_name;
const char *gbm_backend_name, *egl_vendor;
if (!xwl_gbm->drm && !xwl_glamor_gbm_init_main_dev(xwl_screen))
return FALSE;
@ -1229,6 +1238,14 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
xwl_screen->glvnd_vendor = gbm_backend_name;
xwl_gbm->glamor_gles = !epoxy_is_desktop_gl();
egl_vendor = eglQueryString(xwl_screen->egl_display, EGL_VENDOR);
if (!egl_vendor) {
ErrorF("Could not determine EGL vendor\n");
goto error;
}
/* NVIDIA driver does not support implicit sync */
xwl_gbm->implicit_sync = !strstr(egl_vendor, "NVIDIA");
return TRUE;
error:
if (xwl_screen->egl_display != EGL_NO_DISPLAY) {

View File

@ -57,6 +57,7 @@ void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
Bool xwl_glamor_check_flip(WindowPtr present_window, PixmapPtr pixmap);
PixmapPtr xwl_glamor_create_pixmap_for_window (struct xwl_window *xwl_window);
Bool xwl_glamor_supports_implicit_sync(struct xwl_screen *xwl_screen);
#ifdef XV
/* glamor Xv Adaptor */