diff options
author | Boris Brezillon <boris.brezillon@collabora.com> | 2021-04-23 09:24:50 +0200 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@collabora.com> | 2021-05-17 09:47:46 +0200 |
commit | 6b036d13502c8aff12b382af0bab5c7680ee24fd (patch) | |
tree | 61aa4c9a0a9bcaff4b6ecdf06f64d9c2383f0d30 | |
parent | d661e32bfb7c6ef40bb75a8abf1be6f3df722d37 (diff) |
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: 051d62cf0410 ("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>
-rw-r--r-- | src/panfrost/lib/pan_texture.c | 13 |
1 files 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; |