aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_state.c
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-07-01 18:41:20 -0400
committerJonathan Marek <[email protected]>2019-07-04 14:05:18 -0400
commit5feb8adb0fa472aaeb7f7c5a75f0de5ac71a4ae7 (patch)
tree647a6a0b57f74fb5180a70a56a1932e9f508cbc0 /src/gallium/drivers/etnaviv/etnaviv_state.c
parentf6a0d17abe854999b1ab984b4e94263b16ee0bc0 (diff)
etnaviv: implement buffer compression
Vivante GPUs have lossless buffer compression using the tile-status bits, which can reduce memory access and thus improve performance. This patch only enables compression for "V4" compression GPUs, but the implementation is tested on GC2000(V1) and GC3000(V2). V1/V2 compresssion looks absolutely useless, so it is not enabled. I couldn't test if this patch breaks MSAA, because it looks like MSAA is already broken. Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_state.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_state.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c
index 1cefed0a130..8df00ab1db2 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_state.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_state.c
@@ -176,13 +176,16 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
cs->TS_COLOR_SURFACE_BASE.flags = ETNA_RELOC_READ | ETNA_RELOC_WRITE;
pe_mem_config |= VIVS_PE_MEM_CONFIG_COLOR_TS_MODE(cbuf->level->ts_mode);
- }
- /* MSAA */
- if (cbuf->base.texture->nr_samples > 1) {
- ts_mem_config |=
- VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION |
- VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION_FORMAT(translate_ts_format(cbuf->base.format));
+ if (cbuf->level->ts_compress_fmt >= 0) {
+ /* overwrite bit breaks v1/v2 compression */
+ if (!ctx->specs.v4_compression)
+ cs->PE_COLOR_FORMAT &= ~VIVS_PE_COLOR_FORMAT_OVERWRITE;
+
+ ts_mem_config |=
+ VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION |
+ VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION_FORMAT(cbuf->level->ts_compress_fmt);
+ }
}
nr_samples_color = cbuf->base.texture->nr_samples;
@@ -246,16 +249,17 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
cs->TS_DEPTH_SURFACE_BASE.flags = ETNA_RELOC_READ | ETNA_RELOC_WRITE;
pe_mem_config |= VIVS_PE_MEM_CONFIG_DEPTH_TS_MODE(zsbuf->level->ts_mode);
+
+ if (zsbuf->level->ts_compress_fmt >= 0) {
+ ts_mem_config |=
+ VIVS_TS_MEM_CONFIG_DEPTH_COMPRESSION |
+ COND(zsbuf->level->ts_compress_fmt == COMPRESSION_FORMAT_D24S8,
+ VIVS_TS_MEM_CONFIG_STENCIL_ENABLE);
+ }
}
ts_mem_config |= COND(depth_bits == 16, VIVS_TS_MEM_CONFIG_DEPTH_16BPP);
- /* MSAA */
- if (zsbuf->base.texture->nr_samples > 1)
- /* XXX VIVS_TS_MEM_CONFIG_DEPTH_COMPRESSION;
- * Disable without MSAA for now, as it causes corruption in glquake. */
- ts_mem_config |= VIVS_TS_MEM_CONFIG_DEPTH_COMPRESSION;
-
nr_samples_depth = zsbuf->base.texture->nr_samples;
} else {
cs->PE_DEPTH_CONFIG = VIVS_PE_DEPTH_CONFIG_DEPTH_MODE_NONE;