Module: Mesa
Branch: staging/22.2
Commit: 69946a64025bfcf25db36b4d9cdd047b0deb566e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=69946a64025bfcf25db36b4d9cdd047b0deb566e

Author: Lucas Stach <[email protected]>
Date:   Wed Jul 13 19:58:23 2022 +0200

etnaviv: move checking for MC2.0 for TS into screen init

The decision whether to use fast clear aka TS currently checks for two
feature bits: FAST_CEAR and MC20. We check for MC20, as TS on MC1.0 bypasses
the memory offset and we don't have any way to fixup the GPU address to
account for that. It could be done with some support of the kernel driver,
but then GPUs with MC1.0 are very rare to find these days, so not sure if we
are ever going to bother with that.

Instead of checking two separate feature bits to determine if TS can be used,
mask out the FAST_CLEAR bit from the features when MC20 isn't present. This
way we only have to check for a single feature bit.

CC: mesa-stable #22.2
Signed-off-by: Lucas Stach <[email protected]>
Tested-by: Guido Günther <[email protected]>
Reviewed-by: Guido Günther <[email protected]>
Reviewed-by: Philipp Zabel <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18232>
(cherry picked from commit 09953d7b75524022b5f1e9bfa8264adcfd8691a1)

---

 .pick_status.json                             | 2 +-
 src/gallium/drivers/etnaviv/etnaviv_screen.c  | 6 ++++++
 src/gallium/drivers/etnaviv/etnaviv_surface.c | 1 -
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 3f9587e99d7..1cfb4bf04d5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2947,7 +2947,7 @@
         "description": "etnaviv: move checking for MC2.0 for TS into screen 
init",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index 50e5010e7a1..93a55e48fbf 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -922,6 +922,12 @@ etna_get_specs(struct etna_screen *screen)
 
    screen->specs.use_blt = VIV_FEATURE(screen, chipMinorFeatures5, BLT_ENGINE);
 
+   /* Only allow fast clear with MC2.0, as the TS unit bypasses the memory
+    * offset on MC1.0 and we have no way to fixup the address.
+    */
+   if (!VIV_FEATURE(screen, chipMinorFeatures0, MC20))
+      screen->features[viv_chipFeatures] &= ~chipFeatures_FAST_CLEAR;
+
    return true;
 
 fail:
diff --git a/src/gallium/drivers/etnaviv/etnaviv_surface.c 
b/src/gallium/drivers/etnaviv/etnaviv_surface.c
index e342b96ec78..fa2d152ee5a 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_surface.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_surface.c
@@ -105,7 +105,6 @@ etna_create_surface(struct pipe_context *pctx, struct 
pipe_resource *prsc,
     * offset and MMU. */
 
    if (VIV_FEATURE(screen, chipFeatures, FAST_CLEAR) &&
-       VIV_FEATURE(screen, chipMinorFeatures0, MC20) &&
        !rsc->ts_bo &&
        /* needs to be RS/BLT compatible for transfer_map/unmap */
        (rsc->levels[level].padded_width & ETNA_RS_WIDTH_MASK) == 0 &&

Reply via email to