Mesa (main): panfrost: Relax the stride check when importing resources

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 17 08:00:33 UTC 2021


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

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Fri Apr 23 09:24:50 2021 +0200

panfrost: Relax the stride check when importing resources

Imported resources will not necessarily have their line stride aligned
on 64 bytes, and things prove to work just fine even on Bifrost, so
let's relax the condition and drop the comment stating that Bifrost
needs pixel lines to be aligned on 64 bytes.

Reported-by: Icecream95 <ixn at disroot.org>
Suggested-by: Icecream95 <ixn at disroot.org>
Fixes: 051d62cf0410 ("panfrost: Add a pan_image_layout_init() helper")
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Daniel Stone <daniels at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10423>

---

 src/panfrost/lib/pan_texture.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c
index 18eeb917a89..ccc2d89abbb 100644
--- a/src/panfrost/lib/pan_texture.c
+++ b/src/panfrost/lib/pan_texture.c
@@ -638,20 +638,15 @@ pan_image_layout_init(const struct panfrost_device *dev,
                 /* Compute the would-be stride */
                 unsigned stride = bytes_per_pixel * effective_width;
 
-                /* On Bifrost, pixel lines have to be aligned on 64 bytes otherwise
-                 * we end up with DATA_INVALID faults. That doesn't seem to be
-                 * mandatory on Midgard, but we keep the alignment for performance.
-                 */
-                if (linear)
-                        stride = ALIGN_POT(stride, 64);
-
                 if (explicit_layout) {
                         /* Make sure the explicit stride is valid */
-                        if (explicit_layout->line_stride < stride ||
-                            (explicit_layout->line_stride & 63))
+                        if (explicit_layout->line_stride < stride)
                                 return false;
 
                         stride = explicit_layout->line_stride;
+                } else if (linear) {
+                        /* Keep lines alignment on 64 byte for performance */
+                        stride = ALIGN_POT(stride, 64);
                 }
 
                 slice->line_stride = stride;



More information about the mesa-commit mailing list