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@disroot.org>
Suggested-by: Icecream95 <ixn@disroot.org>
Fixes: 051d62cf04 ("panfrost: Add a pan_image_layout_init() helper")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10423>
(cherry picked from commit 6b036d1350)
This commit is contained in:
Boris Brezillon 2021-04-23 09:24:50 +02:00 committed by Eric Engestrom
parent 06f5c009da
commit d87dc12a41
2 changed files with 5 additions and 10 deletions

View file

@ -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"
},

View file

@ -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;