Module: Mesa
Branch: staging/21.1
Commit: c1697854a6e95803c20ecbebc9257173df3ce019
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1697854a6e95803c20ecbebc9257173df3ce019

Author: Boris Brezillon <[email protected]>
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 <[email protected]>
Suggested-by: Icecream95 <[email protected]>
Fixes: 051d62cf0410 ("panfrost: Add a pan_image_layout_init() helper")
Signed-off-by: Boris Brezillon <[email protected]>
Reviewed-by: Daniel Stone <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10423>
(cherry picked from commit 6b036d13502c8aff12b382af0bab5c7680ee24fd)

---

 .pick_status.json              |  2 +-
 src/panfrost/lib/pan_texture.c | 13 ++++---------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index b9564d72f7f..192d4c37d77 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -301,7 +301,7 @@
         "description": "panfrost: Relax the stride check when importing 
resources",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "051d62cf041054bf0fdbd0ae5d2160d1b02e0203"
     },
diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c
index b42efa68af1..bb4f78cab35 100644
--- a/src/panfrost/lib/pan_texture.c
+++ b/src/panfrost/lib/pan_texture.c
@@ -625,20 +625,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;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to