Module: Mesa
Branch: staging/23.3
Commit: d4626797bf344547c498f7c8b023c25650ee8630
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4626797bf344547c498f7c8b023c25650ee8630

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-pra...@amd.com>
Date:   Mon Nov 27 17:36:54 2023 +0100

egl/wayland: set the correct modifier for the linear_copy image

linear_copy_display_gpu_image is created using DRM_FORMAT_MOD_LINEAR,
so use createImageFromDmaBufs3 to be able to pass the modifier when
importing it on the render GPU.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9282
Reviewed-by: Simon Ser <cont...@emersion.fr>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26337>
(cherry picked from commit 5119e0adc3e3d0bbf3fa162b00d952d71d53c6fe)

---

 .pick_status.json                       |  2 +-
 src/egl/drivers/dri2/platform_wayland.c | 18 ++++++++++++------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index a864fb1a227..45309d81b36 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -184,7 +184,7 @@
         "description": "egl/wayland: set the correct modifier for the 
linear_copy image",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index b86328f3603..7e85dd682a4 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1146,6 +1146,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
             int buffer_fds[4];
             int strides[4];
             int offsets[4];
+            unsigned error;
 
             if (!dri2_dpy->image->queryImage(linear_copy_display_gpu_image,
                                              __DRI_IMAGE_ATTRIB_NUM_PLANES,
@@ -1185,12 +1186,17 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
             /* The linear buffer was created in the display GPU's vram, so we
              * need to make it visible to render GPU
              */
-            dri2_surf->back->linear_copy = dri2_dpy->image->createImageFromFds(
-               dri2_dpy->dri_screen_render_gpu, dri2_surf->base.Width,
-               dri2_surf->base.Height,
-               loader_image_format_to_fourcc(linear_dri_image_format),
-               &buffer_fds[0], num_planes, &strides[0], &offsets[0],
-               dri2_surf->back);
+            dri2_surf->back->linear_copy =
+               dri2_dpy->image->createImageFromDmaBufs3(
+                  dri2_dpy->dri_screen_render_gpu, dri2_surf->base.Width,
+                  dri2_surf->base.Height,
+                  loader_image_format_to_fourcc(linear_dri_image_format),
+                  linear_mod, &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);
+
             for (i = 0; i < num_planes; ++i) {
                if (buffer_fds[i] != -1)
                   close(buffer_fds[i]);

Reply via email to