From 746381f870cc79e1b1331bac75dcb82ac7b0d6b3 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Mon, 30 Dec 2024 21:10:18 +0800 Subject: [PATCH] dri: dmabuf cap does not rely on winsys multibuffer support dmabuf cap is client side cap, should not rely on whether window system support multibuffer (i.e. DRI2 multi plane with modifier). Acked-by: Daniel Stone Part-of: --- src/gallium/frontends/dri/dri_screen.c | 14 ++++++-------- src/gallium/frontends/dri/dri_screen.h | 1 + src/gallium/frontends/dri/kopper.c | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/gallium/frontends/dri/dri_screen.c b/src/gallium/frontends/dri/dri_screen.c index 6235fd84ba6..1f1748896e5 100644 --- a/src/gallium/frontends/dri/dri_screen.c +++ b/src/gallium/frontends/dri/dri_screen.c @@ -646,16 +646,14 @@ dri_init_screen(struct dri_screen *screen, if (pscreen->caps.device_protected_context) screen->has_protected_context = true; screen->has_reset_status_query = pscreen->caps.device_reset_status_query; - + screen->has_multibuffer = has_multibuffer; #ifdef HAVE_LIBDRM - if (has_multibuffer) { - int dmabuf_caps = pscreen->caps.dmabuf; - if (dmabuf_caps & DRM_PRIME_CAP_IMPORT) - screen->dmabuf_import = true; - if (screen->dmabuf_import && dmabuf_caps & DRM_PRIME_CAP_EXPORT) - screen->has_dmabuf = true; - } + unsigned dmabuf_caps = pscreen->caps.dmabuf; + if (dmabuf_caps & DRM_PRIME_CAP_IMPORT) + screen->dmabuf_import = true; + if (screen->dmabuf_import && dmabuf_caps & DRM_PRIME_CAP_EXPORT) + screen->has_dmabuf = true; #endif return dri_fill_in_modes(screen); diff --git a/src/gallium/frontends/dri/dri_screen.h b/src/gallium/frontends/dri/dri_screen.h index bdb64ddf9dd..b01fcb46f48 100644 --- a/src/gallium/frontends/dri/dri_screen.h +++ b/src/gallium/frontends/dri/dri_screen.h @@ -92,6 +92,7 @@ struct dri_screen bool throttle; bool dmabuf_import; + bool has_multibuffer; struct st_config_options options; diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c index 99916e231d7..9593064a6f6 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -158,7 +158,7 @@ kopper_get_pixmap_buffer(struct dri_drawable *drawable, #ifndef GLX_USE_APPLE drawable->image = loader_dri3_get_pixmap_buffer(conn, pixmap, screen, - fourcc, drawable->screen->dmabuf_import, &width, &height, drawable); + fourcc, drawable->screen->has_multibuffer, &width, &height, drawable); #else drawable->image = NULL; #endif