From 42c149e36b3e7f365f2aba45dd8320df550b4e5d Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 19 Jan 2022 11:32:22 +0100 Subject: [PATCH] gallium/dri: add missing PIPE_BIND_DRI_PRIME handling e9c3dbd0461 added PIPE_BIND_DRI_PRIME but it was only set when importing a prime buffer. This commit adds handling of this flag in the other codepath = the one where the prime buffer is allocated by the render GPU. With this change PIPE_BIND_DRI_PRIME is still only set for the render GPU - the display GPU will never see this flag; a future commit will rename it. Reviewed-by: Kenneth Graunke Part-of: --- include/GL/internal/dri_interface.h | 1 + src/gallium/frontends/dri/dri2.c | 2 ++ src/loader/loader_dri3_helper.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 443f649..42da745 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1222,6 +1222,7 @@ struct __DRIdri2ExtensionRec { */ #define __DRI_IMAGE_USE_BACKBUFFER 0x0010 #define __DRI_IMAGE_USE_PROTECTED 0x0020 +#define __DRI_IMAGE_USE_PRIME_BUFFER 0x0040 #define __DRI_IMAGE_TRANSFER_READ 0x1 diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c index 59979ec..09a3af4 100644 --- a/src/gallium/frontends/dri/dri2.c +++ b/src/gallium/frontends/dri/dri2.c @@ -1099,6 +1099,8 @@ dri2_create_image_common(__DRIscreen *_screen, } if (use & __DRI_IMAGE_USE_PROTECTED) tex_usage |= PIPE_BIND_PROTECTED; + if (use & __DRI_IMAGE_USE_PRIME_BUFFER) + tex_usage |= PIPE_BIND_DRI_PRIME; img = CALLOC_STRUCT(__DRIimageRec); if (!img) diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c index 8e775a4..364695d 100644 --- a/src/loader/loader_dri3_helper.c +++ b/src/loader/loader_dri3_helper.c @@ -1557,7 +1557,8 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format, __DRI_IMAGE_USE_SHARE | __DRI_IMAGE_USE_LINEAR | __DRI_IMAGE_USE_BACKBUFFER | - __DRI_IMAGE_USE_SCANOUT, + __DRI_IMAGE_USE_SCANOUT | + __DRI_IMAGE_USE_PRIME_BUFFER, buffer); pixmap_buffer = buffer->linear_buffer; -- 2.7.4