Mesa (main): etnaviv: correct bits per tile and clear value for HALTI5

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 27 09:19:02 UTC 2022


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

Author: Lucas Stach <l.stach at pengutronix.de>
Date:   Thu Jan 21 15:56:18 2021 +0100

etnaviv: correct bits per tile and clear value for HALTI5

Bits per tile and the tile clear value are not determined by the
HALTI version, but by two separate feature bits that are not always
present on HALTI5 GPUs. With big 128B/256B tile support the bits
per tile are always 4.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9255>

---

 src/gallium/drivers/etnaviv/etnaviv_resource.c | 7 +++----
 src/gallium/drivers/etnaviv/etnaviv_screen.c   | 9 +++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 20e0c730f1e..e114e2fc2f6 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -85,7 +85,7 @@ etna_screen_resource_alloc_ts(struct pipe_screen *pscreen,
 {
    struct etna_screen *screen = etna_screen(pscreen);
    size_t rt_ts_size, ts_layer_stride;
-   size_t ts_bits_per_tile, bytes_per_tile;
+   size_t bytes_per_tile;
    uint8_t ts_mode = TS_MODE_128B; /* only used by halti5 */
    int8_t ts_compress_fmt;
 
@@ -105,15 +105,14 @@ etna_screen_resource_alloc_ts(struct pipe_screen *pscreen,
       if (ts_compress_fmt >= 0)
          ts_mode = TS_MODE_256B;
 
-      ts_bits_per_tile = 4;
       bytes_per_tile = ts_mode == TS_MODE_256B ? 256 : 128;
    } else {
-      ts_bits_per_tile = screen->specs.bits_per_tile;
       bytes_per_tile = 64;
    }
 
    ts_layer_stride = align(DIV_ROUND_UP(rsc->levels[0].layer_stride,
-                                        bytes_per_tile * 8 / ts_bits_per_tile),
+                                        bytes_per_tile *
+                                        8 / screen->specs.bits_per_tile),
                            0x100 * screen->specs.pixel_pipes);
    rt_ts_size = ts_layer_stride * rsc->base.array_size;
    if (rt_ts_size == 0)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index efe827d0d9a..acf33ab6c5a 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -816,11 +816,12 @@ etna_get_specs(struct etna_screen *screen)
    screen->specs.can_supertile =
       VIV_FEATURE(screen, chipMinorFeatures0, SUPER_TILED);
    screen->specs.bits_per_tile =
-      VIV_FEATURE(screen, chipMinorFeatures0, 2BITPERTILE) ? 2 : 4;
+      !VIV_FEATURE(screen, chipMinorFeatures0, 2BITPERTILE) ||
+      VIV_FEATURE(screen, chipMinorFeatures6, CACHE128B256BPERLINE) ? 4 : 2;
+
    screen->specs.ts_clear_value =
-      VIV_FEATURE(screen, chipMinorFeatures5, BLT_ENGINE)  ? 0xffffffff :
-      VIV_FEATURE(screen, chipMinorFeatures0, 2BITPERTILE) ? 0x55555555 :
-                                                             0x11111111;
+      VIV_FEATURE(screen, chipMinorFeatures10, DEC400) ? 0xffffffff :
+      screen->specs.bits_per_tile == 4 ? 0x11111111 : 0x55555555;
 
    screen->specs.vs_need_z_div =
       screen->model < 0x1000 && screen->model != 0x880;



More information about the mesa-commit mailing list