egl/wayland: use __DRI_IMAGE_PRIME_LINEAR_BUFFER in get_back_bo
Some drivers (radeonsi, iris) relies on this hint to detect DRI_PRIME
blits and implement a special path (eg: SDMA copy for radeonsi).
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27719>
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index ab530fb..306ca94 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1131,8 +1131,8 @@
&buffer_fds[0], num_planes, &strides[0], &offsets[0],
__DRI_YUV_COLOR_SPACE_UNDEFINED,
__DRI_YUV_RANGE_UNDEFINED, __DRI_YUV_CHROMA_SITING_UNDEFINED,
- __DRI_YUV_CHROMA_SITING_UNDEFINED, 0, &error,
- dri2_surf->back);
+ __DRI_YUV_CHROMA_SITING_UNDEFINED, __DRI_IMAGE_PRIME_LINEAR_BUFFER,
+ &error, dri2_surf->back);
for (i = 0; i < num_planes; ++i) {
if (buffer_fds[i] != -1)
diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
index 3da0d75..5ce777f 100644
--- a/src/gallium/frontends/dri/dri2.c
+++ b/src/gallium/frontends/dri/dri2.c
@@ -1808,13 +1808,17 @@
unsigned *error,
void *loaderPrivate)
{
+ unsigned bind = 0;
__DRIimage *img;
+ if (flags & __DRI_IMAGE_PROTECTED_CONTENT_FLAG)
+ bind |= PIPE_BIND_PROTECTED;
+ if (flags & __DRI_IMAGE_PRIME_LINEAR_BUFFER)
+ bind |= PIPE_BIND_PRIME_BLIT_DST;
+
img = dri2_create_image_from_fd(screen, width, height, fourcc,
modifier, fds, num_fds, strides, offsets,
- (flags & __DRI_IMAGE_PROTECTED_CONTENT_FLAG) ?
- PIPE_BIND_PROTECTED : 0,
- error, loaderPrivate);
+ bind, error, loaderPrivate);
if (img == NULL)
return NULL;