diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2024-05-07 11:37:02 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2024-08-05 10:24:58 +0200 |
commit | a58352b985bb9cdca8ce8b215643c5e862427e51 (patch) | |
tree | 6dbabdecd4ba23ac2c0169b5aaab670b605e59fc | |
parent | 39c8a6f367154b1110a1e6845566a3388be4f90e (diff) |
xwayland: Fix build without DRI3 enabled
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1668
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1523>
-rw-r--r-- | hw/xwayland/xwayland-glamor-gbm.c | 16 | ||||
-rw-r--r-- | hw/xwayland/xwayland-present.c | 22 |
2 files changed, 22 insertions, 16 deletions
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; } |