From e6dbe4580e19447abb80e7e4b7b75744dca6d1e5 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 12 Aug 2024 21:10:54 +0200 Subject: [PATCH] render/gles2: check for DRM_CAP_SYNCOBJ_TIMELINE Before advertising support for timelines, check for DRM_CAP_SYNCOBJ_TIMELINE. Without this, the user cannot create/import drm_syncobj timelines. References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4715#note_2523517 --- render/gles2/renderer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 3eeb1ba9c..4cdbf3f6e 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "render/egl.h" #include "render/gles2.h" #include "render/pixel_format.h" @@ -684,8 +685,12 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) { get_gles2_shm_formats(renderer, &renderer->shm_texture_formats); - renderer->wlr_renderer.features.timeline = - egl->procs.eglDupNativeFenceFDANDROID && egl->procs.eglWaitSyncKHR; + int drm_fd = wlr_renderer_get_drm_fd(&renderer->wlr_renderer); + uint64_t cap_syncobj_timeline; + if (drm_fd >= 0 && drmGetCap(drm_fd, DRM_CAP_SYNCOBJ_TIMELINE, &cap_syncobj_timeline) == 0) { + renderer->wlr_renderer.features.timeline = egl->procs.eglDupNativeFenceFDANDROID && + egl->procs.eglWaitSyncKHR && cap_syncobj_timeline != 0; + } return &renderer->wlr_renderer;