Mesa (main): panfrost: Only tile for 2D dimensions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Apr 16 14:13:59 UTC 2022


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Sat Apr  9 18:24:33 2022 -0400

panfrost: Only tile for 2D dimensions

1D textures (Nx1 or 1xN) do not benefit from tiling. Don't try, it's a waste.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Suggested-by: Icecream95 <ixn at disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15803>

---

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

diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index dde07e6c3bd..ee4952aeea2 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -419,6 +419,14 @@ panfrost_should_tile(struct panfrost_device *dev,
                 PIPE_BIND_SCANOUT |
                 PIPE_BIND_SHARED;
 
+        /* The purpose of tiling is improving locality in both X- and
+         * Y-directions. If there is only a single pixel in either direction,
+         * tiling does not make sense; using a linear layout instead is optimal
+         * for both memory usage and performance.
+         */
+        if (MIN2(pres->base.width0, pres->base.height0) < 2)
+                return false;
+
         bool can_tile = panfrost_is_2d(pres)
                 && ((pres->base.bind & ~valid_binding) == 0);
 



More information about the mesa-commit mailing list