xserver: Branch 'master' - 3 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Aug 5 08:45:48 UTC 2024
hw/xwayland/xwayland-glamor-gbm.c | 18 ++++++++++++------
hw/xwayland/xwayland-present.c | 24 ++++++++++++++----------
hw/xwayland/xwayland-window-buffers.c | 2 ++
meson.build | 6 +++++-
4 files changed, 33 insertions(+), 17 deletions(-)
New commits:
commit 23c295ea8b68e5765163f997d5cbb14375b1df3f
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Thu Aug 1 14:18:48 2024 +0200
xwayland: Do not include sys/eventfd.h without DRI3
Now that we won't enable DRI3 if <sys/eventfd.h> is not available, there
is not point in trying to include that header without DRI3.
That allows to build Xwayland with GLAMOR enabled (without DRI3) on
platforms which do not support eventfd.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1523>
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 8872bc848..92241bd1e 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -33,7 +33,9 @@
#include <fcntl.h>
#include <errno.h>
#include <poll.h>
+#ifdef DRI3
#include <sys/eventfd.h>
+#endif /* DRI3 */
#include <sys/stat.h>
#include <xf86drm.h>
#include <drm_fourcc.h>
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 3345d4a0c..f2b4154f7 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -31,7 +31,9 @@
#endif
#include <windowstr.h>
#include <present.h>
+#ifdef DRI3
#include <sys/eventfd.h>
+#endif /* DRI3 */
#include "xwayland-present.h"
#include "xwayland-screen.h"
diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c
index 2bf6c978c..a470ef313 100644
--- a/hw/xwayland/xwayland-window-buffers.c
+++ b/hw/xwayland/xwayland-window-buffers.c
@@ -39,7 +39,9 @@
#include "dri3.h"
#include <poll.h>
+#ifdef DRI3
#include <sys/eventfd.h>
+#endif
#include "linux-drm-syncobj-v1-client-protocol.h"
#define BUFFER_TIMEOUT 1 * 1000 /* ms */
commit 96bdc156a1c42b884e54960dbdb64a5f0804dfc3
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue May 7 13:42:22 2024 +0200
xwayland: Do not enable DRI3 without eventfd
DRI3 version 1.4 which supports explicit buffers synchronization relies
on the eventfd interface.
As result, building would fail with DRI3 enabled on platforms without
the eventfd interface.
Check for the availability of the sys/eventfd.h header and disable DRI3
support if missing.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1523>
diff --git a/meson.build b/meson.build
index ada548a2d..85627e3a6 100644
--- a/meson.build
+++ b/meson.build
@@ -505,14 +505,18 @@ else
build_dri2 = get_option('dri2') == 'true'
endif
+have_eventfd = cc.has_header('sys/eventfd.h')
if get_option('dri3') == 'auto'
- build_dri3 = dri3proto_dep.found() and xshmfence_dep.found() and libdrm_dep.found()
+ build_dri3 = dri3proto_dep.found() and xshmfence_dep.found() and libdrm_dep.found() and have_eventfd
else
build_dri3 = get_option('dri3') == 'true'
if build_dri3
if not xshmfence_dep.found()
error('DRI3 requested, but xshmfence not found')
endif
+ if not have_eventfd
+ error('DRI3 requested, but sys/eventfd.h not found')
+ endif
endif
endif
commit a58352b985bb9cdca8ce8b215643c5e862427e51
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue May 7 11:37:02 2024 +0200
xwayland: Fix build without DRI3 enabled
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1668
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1523>
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 6a73efe04..8872bc848 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -234,9 +234,9 @@ xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo,
xwl_pixmap->bo = bo;
xwl_pixmap->buffer = NULL;
xwl_pixmap->implicit_modifier = implicit_modifier;
-#ifdef XWL_HAS_GLAMOR
+#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
xwl_pixmap->efd = -1;
-#endif /* XWL_HAS_GLAMOR */
+#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
#ifdef GBM_BO_FD_FOR_PLANE
if (xwl_gbm->dmabuf_capable) {
@@ -679,6 +679,7 @@ xwl_auth_state_client_callback(CallbackListPtr *pcbl, void *unused, void *data)
}
}
+#ifdef DRI3
static void
sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
{
@@ -741,6 +742,7 @@ xwl_dri3_open_client(ClientPtr client,
return Success;
}
+#endif /* DRI3 */
PixmapPtr
glamor_pixmap_from_fds(ScreenPtr screen, CARD8 num_fds, const int *fds,
@@ -981,6 +983,7 @@ xwl_glamor_dmabuf_import_sync_file(PixmapPtr pixmap, int sync_file)
close(sync_file);
}
+#ifdef DRI3
struct xwl_dri3_syncobj
{
struct dri3_syncobj base;
@@ -1239,6 +1242,7 @@ static dri3_screen_info_rec xwl_dri3_info = {
.get_drawable_modifiers = xwl_glamor_get_drawable_modifiers,
.import_syncobj = NULL, /* need to check for kernel support */
};
+#endif /* DRI3 */
static const char *
get_render_node_path_for_device(const drmDevicePtr drm_device,
@@ -1768,7 +1772,7 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
}
/* NVIDIA driver does not support implicit sync */
xwl_gbm->implicit_sync = !strstr(egl_vendor, "NVIDIA");
-
+#ifdef DRI3
if (xwl_gbm_supports_syncobjs(xwl_screen) &&
epoxy_has_egl_extension(xwl_screen->egl_display,
"ANDROID_native_fence_sync"))
@@ -1779,7 +1783,7 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
wp_linux_drm_syncobj_manager_v1_destroy(xwl_screen->explicit_sync);
xwl_screen->explicit_sync = NULL;
}
-
+#endif /* DRI3 */
return TRUE;
error:
if (xwl_screen->egl_display != EGL_NO_DISPLAY) {
@@ -1796,7 +1800,7 @@ Bool
xwl_glamor_gbm_init_screen(struct xwl_screen *xwl_screen)
{
struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
-
+#ifdef DRI3
if (xwl_gbm->supports_syncobjs) {
xwl_dri3_info.version = 4;
xwl_dri3_info.import_syncobj = xwl_dri3_import_syncobj;
@@ -1806,7 +1810,7 @@ xwl_glamor_gbm_init_screen(struct xwl_screen *xwl_screen)
ErrorF("Failed to initialize dri3\n");
goto error;
}
-
+#endif /* DRI3 */
if (xwl_gbm->fd_render_node)
goto skip_drm_auth;
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index b52c6896a..3345d4a0c 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -328,7 +328,7 @@ xwl_present_free_event(struct xwl_present_event *event)
static void
xwl_present_free_idle_vblank(present_vblank_ptr vblank)
{
-#ifdef XWL_HAS_GLAMOR
+#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
if (vblank->release_syncobj) {
/* transfer implicit fence to release syncobj */
int fence_fd = xwl_glamor_dmabuf_export_sync_file(vblank->pixmap);
@@ -336,7 +336,7 @@ xwl_present_free_idle_vblank(present_vblank_ptr vblank)
vblank->release_point,
fence_fd);
} else
-#endif /* XWL_HAS_GLAMOR */
+#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
present_pixmap_idle(vblank->pixmap, vblank->window,
vblank->serial, vblank->idle_fence);
xwl_present_free_event(xwl_present_event_from_vblank(vblank));
@@ -393,7 +393,9 @@ static void
xwl_present_flip_notify_vblank(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
{
WindowPtr window = vblank->window;
+#ifdef DRI3
struct xwl_screen *xwl_screen = xwl_screen_get(window->drawable.pScreen);
+#endif /* DRI3 */
struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window);
uint8_t mode = PresentCompleteModeFlip;
@@ -507,7 +509,7 @@ xwl_present_buffer_release(void *data)
vblank = &event->vblank;
-#ifdef XWL_HAS_GLAMOR
+#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
if (vblank->release_syncobj) {
/* transfer implicit fence to release syncobj */
int fence_fd = xwl_glamor_dmabuf_export_sync_file(vblank->pixmap);
@@ -515,7 +517,7 @@ xwl_present_buffer_release(void *data)
vblank->release_point,
fence_fd);
} else
-#endif /* XWL_HAS_GLAMOR */
+#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
xwl_present_window = xwl_present_window_priv(vblank->window);
@@ -881,7 +883,7 @@ xwl_present_flip(present_vblank_ptr vblank, RegionPtr damage)
event->pixmap = pixmap;
-#ifdef XWL_HAS_GLAMOR
+#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
if (vblank->acquire_syncobj && vblank->release_syncobj) {
if (xwl_window->xwl_screen->explicit_sync) {
xwl_glamor_dri3_syncobj_passthrough(xwl_window,
@@ -898,7 +900,7 @@ xwl_present_flip(present_vblank_ptr vblank, RegionPtr damage)
xwl_glamor_dmabuf_import_sync_file(vblank->pixmap, fence_fd);
}
}
-#endif /* XWL_HAS_GLAMOR */
+#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
if (implicit_sync) {
xwl_pixmap_set_buffer_release_cb(pixmap, xwl_present_buffer_release, event);
@@ -950,7 +952,7 @@ xwl_present_flip(present_vblank_ptr vblank, RegionPtr damage)
return TRUE;
}
-#ifdef XWL_HAS_GLAMOR
+#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
static void
xwl_present_acquire_fence_avail(int fd, int xevents, void *data)
{
@@ -962,13 +964,13 @@ xwl_present_acquire_fence_avail(int fd, int xevents, void *data)
xwl_present_re_execute(vblank);
}
-#endif /* XWL_HAS_GLAMOR */
+#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
static Bool
xwl_present_wait_acquire_fence_avail(struct xwl_screen *xwl_screen,
present_vblank_ptr vblank)
{
-#ifdef XWL_HAS_GLAMOR
+#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
/* If the compositor does not support explicit sync we need to wait for the
* acquire fence to be submitted before flipping. */
if (vblank->flip && !xwl_screen->explicit_sync &&
@@ -982,7 +984,7 @@ xwl_present_wait_acquire_fence_avail(struct xwl_screen *xwl_screen,
vblank->efd);
return TRUE;
}
-#endif /* XWL_HAS_GLAMOR */
+#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
return FALSE;
}
More information about the xorg-commit
mailing list