Mesa (master): panfrost: Cleanup tiling selection logic

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 6 13:09:08 UTC 2020


Module: Mesa
Branch: master
Commit: 32851ff71521d203c08e26b3198d96d0f6467bb5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=32851ff71521d203c08e26b3198d96d0f6467bb5

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Sat Jan  4 13:00:50 2020 -0500

panfrost: Cleanup tiling selection logic

Make it a lot more obvious what we're doing and fix more than a few
corner cases in the process.

Fixes
dEQP-GLES3.functional.buffer.map.write.render_as_index_array.pixel*, and
likely others.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>

---

 src/gallium/drivers/panfrost/pan_resource.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 0d49d2bb4f7..0ea14a028cd 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -389,28 +389,29 @@ panfrost_resource_create_bo(struct panfrost_screen *screen, struct panfrost_reso
          * AFBC: Compressed and renderable (so always desirable for non-scanout
          * rendertargets). Cheap to sample from. The format is black box, so we
          * can't read/write from software.
-         */
-
-        /* Tiling textures is almost always faster, unless we only use it once */
-
-        bool is_texture = (res->bind & PIPE_BIND_SAMPLER_VIEW);
-        bool is_2d = res->depth0 == 1 && res->array_size == 1;
-        bool is_streaming = (res->usage != PIPE_USAGE_STREAM);
-        bool is_global = res->bind & PIPE_BIND_GLOBAL;
+         *
+         * Tiling textures is almost always faster, unless we only use it once.
+         * Only a few types of resources can be tiled, ensure the bind is only
+         * (a combination of) one of the following */
 
-        bool should_tile = is_streaming && is_texture && is_2d && !is_global;
+        const unsigned valid_binding =
+                PIPE_BIND_RENDER_TARGET |
+                PIPE_BIND_BLENDABLE |
+                PIPE_BIND_SAMPLER_VIEW |
+                PIPE_BIND_DISPLAY_TARGET;
 
-        /* Depth/stencil can't be tiled, only linear or AFBC */
-        should_tile &= !(res->bind & PIPE_BIND_DEPTH_STENCIL);
+        bool is_2d = (res->target == PIPE_TEXTURE_2D);
+        bool should_tile = (res->usage != PIPE_USAGE_STREAM);
+        bool can_tile = is_2d && ((res->bind & ~valid_binding) == 0);
 
         /* FBOs we would like to checksum, if at all possible */
-        bool can_checksum = !(res->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_SHARED));
+        bool can_checksum = !(res->bind & ~valid_binding);
         bool should_checksum = res->bind & PIPE_BIND_RENDER_TARGET;
 
         pres->checksummed = can_checksum && should_checksum;
 
         /* Set the layout appropriately */
-        pres->layout = should_tile ? PAN_TILED : PAN_LINEAR;
+        pres->layout = (can_tile && should_tile) ? PAN_TILED : PAN_LINEAR;
 
         size_t bo_size;
 




More information about the mesa-commit mailing list