Mesa (main): panfrost: Support planar formats for scanout

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 26 12:34:15 UTC 2021


Module: Mesa
Branch: main
Commit: f96ad5d71c067c4263c1af1552d02637e76d9c01
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f96ad5d71c067c4263c1af1552d02637e76d9c01

Author: Derek Foreman <derek.foreman at collabora.com>
Date:   Mon Oct 25 15:53:21 2021 -0500

panfrost: Support planar formats for scanout

While panfrost doesn't directly support planar formats, we can get here
from GBM. This happens, for example, when weston is trying to use a BO
for direct scanout.

Walk the list of planes to find the right one.

Signed-off-by: Derek Foreman <derek.foreman at collabora.com>
Reviewed-by: Daniel Stone <daniels at collabora.com>
Reviewed-by: Simon Ser <contact at emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13039>

---

 src/gallium/drivers/panfrost/pan_resource.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 18c43ea7e47..84120be64a0 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -135,8 +135,21 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
                              unsigned usage)
 {
         struct panfrost_device *dev = pan_device(pscreen);
-        struct panfrost_resource *rsrc = (struct panfrost_resource *) pt;
-        struct renderonly_scanout *scanout = rsrc->scanout;
+        struct panfrost_resource *rsrc;
+        struct renderonly_scanout *scanout;
+        struct pipe_resource *cur = pt;
+
+        /* Even though panfrost doesn't support multi-planar formats, we
+         * can get here through GBM, which does. Walk the list of planes
+         * to find the right one.
+         */
+        for (int i = 0; i < handle->plane; i++) {
+                cur = cur->next;
+                if (!cur)
+                        return false;
+        }
+        rsrc = pan_resource(cur);
+        scanout = rsrc->scanout;
 
         handle->modifier = rsrc->image.layout.modifier;
         rsrc->modifier_constant = true;



More information about the mesa-commit mailing list