Mesa (master): panfrost: Correctly calculate tiled stride

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 15 21:52:14 UTC 2020


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Mon Jun 15 12:42:40 2020 -0400

panfrost: Correctly calculate tiled stride

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Fixes: bde19c0e7ba ("panfrost: Fix tiled texture "stride"s on Bifrost")
Tested-by: Christian Hewitt <christianshewitt at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5474>

---

 src/panfrost/encoder/pan_texture.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/panfrost/encoder/pan_texture.c b/src/panfrost/encoder/pan_texture.c
index 59c08097196..d51ff0dff72 100644
--- a/src/panfrost/encoder/pan_texture.c
+++ b/src/panfrost/encoder/pan_texture.c
@@ -170,17 +170,18 @@ panfrost_estimate_texture_payload_size(
 
 /* Bifrost requires a tile stride for tiled textures. This stride is computed
  * as (16 * bpp * width) assuming there is at least one tile (width >= 16).
- * Otherwise if width < 16, the blob puts zero. Interactions with AFBC are
+ * Otherwise if height <= 16, the blob puts zero. Interactions with AFBC are
  * currently unknown.
  */
 
 static unsigned
 panfrost_nonlinear_stride(enum mali_texture_layout layout,
                 unsigned bytes_per_pixel,
-                unsigned width)
+                unsigned width,
+                unsigned height)
 {
         if (layout == MALI_TEXTURE_TILED) {
-                return (width < 16) ? 0 : (16 * bytes_per_pixel * ALIGN_POT(width, 16));
+                return (height <= 16) ? 0 : (16 * bytes_per_pixel * ALIGN_POT(width, 16));
         } else {
                 unreachable("TODO: AFBC on Bifrost");
         }
@@ -193,7 +194,7 @@ panfrost_emit_texture_payload(
         enum mali_format mali_format,
         enum mali_texture_type type,
         enum mali_texture_layout layout,
-        unsigned width,
+        unsigned width, unsigned height,
         unsigned first_level, unsigned last_level,
         unsigned first_layer, unsigned last_layer,
         unsigned cube_stride,
@@ -227,7 +228,8 @@ panfrost_emit_texture_payload(
                                                 slices[l].stride :
                                                 panfrost_nonlinear_stride(layout,
                                                                 MAX2(desc->block.bits / 8, 1),
-                                                                u_minify(width, l));
+                                                                u_minify(width, l),
+                                                                u_minify(height, l));
                                 }
                         }
                 }
@@ -288,7 +290,7 @@ panfrost_new_texture(
                 mali_format,
                 type,
                 layout,
-                width,
+                width, height,
                 first_level, last_level,
                 first_layer, last_layer,
                 cube_stride,
@@ -325,7 +327,7 @@ panfrost_new_texture_bifrost(
                 mali_format,
                 type,
                 layout,
-                width,
+                width, height,
                 first_level, last_level,
                 first_layer, last_layer,
                 cube_stride,



More information about the mesa-commit mailing list