Mesa (master): panfrost: Fix viewport scissor for preload draws

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 30 22:39:05 UTC 2021


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

Author: Icecream95 <ixn at disroot.org>
Date:   Fri Apr 30 22:18:09 2021 +1200

panfrost: Fix viewport scissor for preload draws

The max values are inclusive, so add 1 before aligning. This means
that a max of 32 will be aligned up to 64 then be decremented to 63.

Add a comment to the pan_fb_info struct to document maxx and maxy as
inclusive.

Fixes: 8ba2f9f6985 ("panfrost: Create a blitter library to replace the existing preload helpers")
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10542>

---

 src/panfrost/lib/pan_blitter.c | 8 ++++----
 src/panfrost/lib/pan_cs.h      | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c
index 4682598e0be..7cfe2d9614d 100644
--- a/src/panfrost/lib/pan_blitter.c
+++ b/src/panfrost/lib/pan_blitter.c
@@ -882,10 +882,10 @@ pan_preload_emit_viewport(struct pan_pool *pool,
                         /* Align on 32x32 tiles */
                         cfg.scissor_minimum_x = fb->extent.minx & ~31;
                         cfg.scissor_minimum_y = fb->extent.miny & ~31;
-                        cfg.scissor_maximum_x = MIN2(ALIGN_POT(fb->extent.maxx, 32) - 1,
-                                                     fb->width - 1);
-                        cfg.scissor_maximum_y = MIN2(ALIGN_POT(fb->extent.maxy, 32) - 1,
-                                                     fb->height - 1);
+                        cfg.scissor_maximum_x = MIN2(ALIGN_POT(fb->extent.maxx + 1, 32),
+                                                     fb->width) - 1;
+                        cfg.scissor_maximum_y = MIN2(ALIGN_POT(fb->extent.maxy + 1, 32),
+                                                     fb->height) - 1;
                 }
         }
 
diff --git a/src/panfrost/lib/pan_cs.h b/src/panfrost/lib/pan_cs.h
index 8f5db219014..ac27f688d00 100644
--- a/src/panfrost/lib/pan_cs.h
+++ b/src/panfrost/lib/pan_cs.h
@@ -103,6 +103,7 @@ struct pan_fb_bifrost_info {
 struct pan_fb_info {
         unsigned width, height;
         struct {
+                /* Max values are inclusive */
                 unsigned minx, miny, maxx, maxy;
         } extent;
         unsigned nr_samples;



More information about the mesa-commit mailing list