From 3f78ccb7baddfac5d3d9705d4ea3acfd849d3063 Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Fri, 30 Apr 2021 22:18:09 +1200 Subject: [PATCH] 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 Part-of: (cherry picked from commit ab8e531cf03018ebd4d99d3ea47750332ac96e71) --- .pick_status.json | 2 +- src/panfrost/lib/pan_blitter.c | 8 ++++---- src/panfrost/lib/pan_cs.h | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 617dd052565..b75a8734281 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -283,7 +283,7 @@ "description": "panfrost: Fix viewport scissor for preload draws", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "8ba2f9f698584d20830ef31bbc2fb8a6635c8314" }, diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c index ea43e04ab3f..203b9ff9255 100644 --- a/src/panfrost/lib/pan_blitter.c +++ b/src/panfrost/lib/pan_blitter.c @@ -877,10 +877,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;