Mesa (main): panfrost: Use tiled AFBC textures

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 26 16:12:43 UTC 2022


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu May  5 11:05:32 2022 -0400

panfrost: Use tiled AFBC textures

On GPUs that support AFBC with tiled headers, try to use tiled headers instead
of linear headers. This should be a bit more efficient for the caches.
Additionally, on Mali, tiled headers are tied to solid colour blocks, so this
has the effect of enabling AFBC with solid colour blocks where supported.

Unfortunately, results are disappointing. Mali-G52:

-btexture from 856fps to 859fps
-bdesktop from 292fps to 294fps

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16697>

---

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

diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 18d82a12e6c..cf9785bc82b 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -350,6 +350,20 @@ panfrost_should_afbc(struct panfrost_device *dev,
         return true;
 }
 
+/*
+ * For a resource we want to use AFBC with, should we use AFBC with tiled
+ * headers? On GPUs that support it, this is believed to be beneficial for
+ * images that are at least 128x128.
+ */
+static bool
+panfrost_should_tile_afbc(const struct panfrost_device *dev,
+                          const struct panfrost_resource *pres)
+{
+        return panfrost_afbc_can_tile(dev) &&
+               pres->base.width0 >= 128 &&
+               pres->base.height0 >= 128;
+}
+
 static bool
 panfrost_should_tile(struct panfrost_device *dev,
                      const struct panfrost_resource *pres,
@@ -395,6 +409,9 @@ panfrost_best_modifier(struct panfrost_device *dev,
                 if (panfrost_afbc_can_ytr(pres->base.format))
                         afbc |= AFBC_FORMAT_MOD_YTR;
 
+                if (panfrost_should_tile_afbc(dev, pres))
+                        afbc |= AFBC_FORMAT_MOD_TILED | AFBC_FORMAT_MOD_SC;
+
                 return DRM_FORMAT_MOD_ARM_AFBC(afbc);
         } else if (panfrost_should_tile(dev, pres, fmt))
                 return DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED;



More information about the mesa-commit mailing list