Mesa (main): panfrost: Fix pan_blit_ctx_init() when start > end

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 26 09:08:47 UTC 2021


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

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Tue Jun  1 10:18:00 2021 +0200

panfrost: Fix pan_blit_ctx_init() when start > end

This can happen when one wants to obtain a mirrored view. We need
to make sure the min <= max before emitting the viewport.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12552>

---

 src/panfrost/lib/pan_blitter.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c
index e96c96604e3..641e2966801 100644
--- a/src/panfrost/lib/pan_blitter.c
+++ b/src/panfrost/lib/pan_blitter.c
@@ -1431,10 +1431,10 @@ pan_blit_ctx_init(struct panfrost_device *dev,
 
         unsigned dst_w = u_minify(info->dst.planes[0].image->layout.width, info->dst.level);
         unsigned dst_h = u_minify(info->dst.planes[0].image->layout.height, info->dst.level);
-        unsigned minx = MAX2(info->dst.start.x, 0);
-        unsigned miny = MAX2(info->dst.start.y, 0);
-        unsigned maxx = MIN2(info->dst.end.x, dst_w - 1);
-        unsigned maxy = MIN2(info->dst.end.y, dst_h - 1);
+        unsigned maxx = MIN2(MAX2(info->dst.start.x, info->dst.end.x), dst_w - 1);
+        unsigned maxy = MIN2(MAX2(info->dst.start.y, info->dst.end.y), dst_h - 1);
+        unsigned minx = MAX2(MIN3(info->dst.start.x, info->dst.end.x, maxx), 0);
+        unsigned miny = MAX2(MIN3(info->dst.start.y, info->dst.end.y, maxy), 0);
 
         if (info->scissor.enable) {
                 minx = MAX2(minx, info->scissor.minx);



More information about the mesa-commit mailing list