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 <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31657>
This commit is contained in:
Qiang Yu 2024-12-30 21:10:18 +08:00 committed by Marge Bot
parent 354dc800d2
commit 746381f870
3 changed files with 8 additions and 9 deletions

View file

@ -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);

View file

@ -92,6 +92,7 @@ struct dri_screen
bool throttle;
bool dmabuf_import;
bool has_multibuffer;
struct st_config_options options;

View file

@ -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