From b919bdc6f60a2f263be306c9e18cb32bd6d6010f Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 28 Jun 2024 12:39:01 -0400 Subject: [PATCH] gallium/video: Move DRI2 support behind legacy-x11 Acked-by: Daniel Stone Reviewed-by: David Heidelberg Part-of: --- src/gallium/auxiliary/vl/vl_winsys_dri.c | 8 ++++++++ src/gallium/frontends/omx/vid_omx_common.c | 2 ++ src/gallium/frontends/va/context.c | 2 ++ src/gallium/frontends/vdpau/device.c | 2 ++ 4 files changed, 14 insertions(+) diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c index 6e99c945a42..bbcf698badc 100644 --- a/src/gallium/auxiliary/vl/vl_winsys_dri.c +++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c @@ -32,7 +32,9 @@ #include #include +#ifdef HAVE_X11_DRI2 #include +#endif #include #include @@ -67,13 +69,16 @@ struct vl_dri_screen struct u_rect dirty_areas[2]; bool flushed; +#ifdef HAVE_X11_DRI2 xcb_dri2_swap_buffers_cookie_t swap_cookie; xcb_dri2_wait_sbc_cookie_t wait_cookie; xcb_dri2_get_buffers_cookie_t buffers_cookie; +#endif int64_t last_ust, ns_frame, last_msc, next_msc; }; +#ifdef HAVE_X11_DRI2 static const unsigned attachments[1] = { XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT }; static void vl_dri2_screen_destroy(struct vl_screen *vscreen); @@ -317,6 +322,7 @@ get_xcb_screen(xcb_screen_iterator_t iter, int screen) return NULL; } +#endif static xcb_visualtype_t * get_xcb_visualtype_for_depth(struct vl_screen *vscreen, int depth) @@ -370,6 +376,7 @@ vl_dri2_format_for_depth(struct vl_screen *vscreen, int depth) } } +#ifdef HAVE_X11_DRI2 struct vl_screen * vl_dri2_screen_create(Display *display, int screen) { @@ -520,3 +527,4 @@ vl_dri2_screen_destroy(struct vl_screen *vscreen) /* There is no user provided fd */ FREE(scrn); } +#endif diff --git a/src/gallium/frontends/omx/vid_omx_common.c b/src/gallium/frontends/omx/vid_omx_common.c index 656cdadfcc3..b931c28599b 100644 --- a/src/gallium/frontends/omx/vid_omx_common.c +++ b/src/gallium/frontends/omx/vid_omx_common.c @@ -77,8 +77,10 @@ struct vl_screen *omx_get_screen(void) goto error; omx_screen = vl_dri3_screen_create(omx_display, 0); +#ifdef HAVE_X11_DRI2 if (!omx_screen) omx_screen = vl_dri2_screen_create(omx_display, 0); +#endif if (!omx_screen) { XCloseDisplay(omx_display); goto error; diff --git a/src/gallium/frontends/va/context.c b/src/gallium/frontends/va/context.c index bb861720951..e2a12db4df7 100644 --- a/src/gallium/frontends/va/context.c +++ b/src/gallium/frontends/va/context.c @@ -145,8 +145,10 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx) case VA_DISPLAY_GLX: case VA_DISPLAY_X11: drv->vscreen = vl_dri3_screen_create(ctx->native_dpy, ctx->x11_screen); +#ifdef HAVE_X11_DRI2 if (!drv->vscreen) drv->vscreen = vl_dri2_screen_create(ctx->native_dpy, ctx->x11_screen); +#endif if (!drv->vscreen) drv->vscreen = vl_xlib_swrast_screen_create(ctx->native_dpy, ctx->x11_screen); break; diff --git a/src/gallium/frontends/vdpau/device.c b/src/gallium/frontends/vdpau/device.c index a8681d2b872..886bab3dc82 100644 --- a/src/gallium/frontends/vdpau/device.c +++ b/src/gallium/frontends/vdpau/device.c @@ -64,8 +64,10 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, pipe_reference_init(&dev->reference, 1); dev->vscreen = vl_dri3_screen_create(display, screen); +#ifdef HAVE_X11_DRI2 if (!dev->vscreen) dev->vscreen = vl_dri2_screen_create(display, screen); +#endif if (!dev->vscreen) dev->vscreen = vl_xlib_swrast_screen_create(display, screen); if (!dev->vscreen) {