From d87dc12a41f857d686b0fb35b2e371f022a75830 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 23 Apr 2021 09:24:50 +0200 Subject: [PATCH] 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 Suggested-by: Icecream95 Fixes: 051d62cf0410 ("panfrost: Add a pan_image_layout_init() helper") Signed-off-by: Boris Brezillon Reviewed-by: Daniel Stone Reviewed-by: Alyssa Rosenzweig Part-of: (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 4338231d31d..2673d990024 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;