Mesa (staging/21.2): radeonsi: use viewport offset in quant_mode determination

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 18 20:31:36 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: b720849cd0e8bacf58253c3c34c1c0c6c9c79763
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b720849cd0e8bacf58253c3c34c1c0c6c9c79763

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Fri Oct 15 17:28:19 2021 +0200

radeonsi: use viewport offset in quant_mode determination

Instead of only using the viewport extent.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5344
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13382>
(cherry picked from commit 234c69f60097d01b2c31a51421abc5a39321130c)

---

 .pick_status.json                                |  2 +-
 src/gallium/drivers/radeonsi/si_state_viewport.c | 23 +++--------------------
 2 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 8e5af06ddff..6ce17db5f21 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -265,7 +265,7 @@
         "description": "radeonsi: use viewport offset in quant_mode determination",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/radeonsi/si_state_viewport.c b/src/gallium/drivers/radeonsi/si_state_viewport.c
index 7dda99a181e..c12154160c8 100644
--- a/src/gallium/drivers/radeonsi/si_state_viewport.c
+++ b/src/gallium/drivers/radeonsi/si_state_viewport.c
@@ -416,27 +416,10 @@ static void si_set_viewport_states(struct pipe_context *pctx, unsigned start_slo
 
       si_get_scissor_from_viewport(ctx, &state[i], scissor);
 
-      unsigned w = scissor->maxx - scissor->minx;
-      unsigned h = scissor->maxy - scissor->miny;
-      unsigned max_extent = MAX2(w, h);
-
       int max_corner = MAX2(
          MAX2(abs(scissor->maxx), abs(scissor->maxy)),
          MAX2(abs(scissor->minx), abs(scissor->miny)));
 
-      unsigned center_x = (scissor->maxx + scissor->minx) / 2;
-      unsigned center_y = (scissor->maxy + scissor->miny) / 2;
-      unsigned max_center = MAX2(center_x, center_y);
-
-      /* PA_SU_HARDWARE_SCREEN_OFFSET can't center viewports whose
-       * center start farther than MAX_PA_SU_HARDWARE_SCREEN_OFFSET.
-       * (for example, a 1x1 viewport in the lower right corner of
-       * 16Kx16K) Such viewports need a greater guardband, so they
-       * have to use a worse quantization mode.
-       */
-      unsigned distance_off_center = MAX2(0, (int)max_center - MAX_PA_SU_HARDWARE_SCREEN_OFFSET);
-      max_extent += distance_off_center;
-
       /* Determine the best quantization mode (subpixel precision),
        * but also leave enough space for the guardband.
        *
@@ -445,7 +428,7 @@ static void si_set_viewport_states(struct pipe_context *pctx, unsigned start_slo
        * Always use 16_8 if primitive binning is possible to occur.
        */
       if ((ctx->family == CHIP_VEGA10 || ctx->family == CHIP_RAVEN) && ctx->screen->dpbb_allowed)
-         max_extent = 16384; /* Use QUANT_MODE == 16_8. */
+         max_corner = 16384; /* Use QUANT_MODE == 16_8. */
 
       /* Another constraint is that all coordinates in the viewport
        * are representable in fixed point with respect to the
@@ -462,9 +445,9 @@ static void si_set_viewport_states(struct pipe_context *pctx, unsigned start_slo
        * 4k x 4k of the render target.
        */
 
-      if (max_extent <= 1024 && max_corner < (1 << 12)) /* 4K scanline area for guardband */
+      if (max_corner <= 1024) /* 4K scanline area for guardband */
          scissor->quant_mode = SI_QUANT_MODE_12_12_FIXED_POINT_1_4096TH;
-      else if (max_extent <= 4096 && max_corner < (1 << 14)) /* 16K scanline area for guardband */
+      else if (max_corner <= 4096) /* 16K scanline area for guardband */
          scissor->quant_mode = SI_QUANT_MODE_14_10_FIXED_POINT_1_1024TH;
       else /* 64K scanline area for guardband */
          scissor->quant_mode = SI_QUANT_MODE_16_8_FIXED_POINT_1_256TH;



More information about the mesa-commit mailing list