summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-09-17 21:39:30 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2013-09-17 21:39:30 +0200
commitf8c0a8da991ec2cb63acb3068c0363d07989740c (patch)
treeca4b7f3af7c906d50162f4586d22d592d88b93eb
parent0fbc321bd617561d46e9785940fd272f43885af0 (diff)
driver: implement auto disable
These counters disable TS after a certain number of cleared tiles, for depth and color. Auto-disable is enabled in the pipe_clear() function and disabled when a new framebuffer is bound.
-rw-r--r--native/driver/etna_clear_blit.c42
-rw-r--r--native/driver/etna_debug.h13
-rw-r--r--native/driver/etna_pipe.c8
-rw-r--r--native/driver/etna_screen.c1
-rw-r--r--native/etnaviv/common.xml.h2
-rw-r--r--native/etnaviv/isa.xml.h2
-rw-r--r--native/etnaviv/state.xml.h2
-rw-r--r--native/etnaviv/state_2d.xml.h2
-rw-r--r--native/etnaviv/state_3d.xml.h6
-rw-r--r--native/etnaviv/state_hi.xml.h2
-rw-r--r--native/etnaviv/state_vg.xml.h2
-rwxr-xr-xnative/fb/sync_cubox.sh2
-rw-r--r--rnndb/state_3d.xml4
13 files changed, 55 insertions, 33 deletions
diff --git a/native/driver/etna_clear_blit.c b/native/driver/etna_clear_blit.c
index 0b0793a..f8c6128 100644
--- a/native/driver/etna_clear_blit.c
+++ b/native/driver/etna_clear_blit.c
@@ -105,9 +105,25 @@ static void etna_pipe_clear(struct pipe_context *pipe,
*/
etna_set_state(priv->ctx, VIVS_GL_FLUSH_CACHE, VIVS_GL_FLUSH_CACHE_COLOR | VIVS_GL_FLUSH_CACHE_DEPTH);
etna_stall(priv->ctx, SYNC_RECIPIENT_RA, SYNC_RECIPIENT_PE);
- /* Flush the TS. This must be done after flushing color and depth, otherwise it can result in crashes
- * at least on cubox. */
- etna_set_state(priv->ctx, VIVS_TS_FLUSH_CACHE, VIVS_TS_FLUSH_CACHE_FLUSH); /* XXX only needed if cbuf or zbuf has TS */
+ /* Preparation: Flush the TS. This must be done after flushing color and depth, otherwise it can
+ * result in crashes */
+ bool need_ts_flush = false;
+ if((buffers & PIPE_CLEAR_COLOR) && priv->framebuffer_s.nr_cbufs)
+ {
+ struct etna_surface *surf = etna_surface(priv->framebuffer_s.cbufs[0]);
+ if(surf->surf.ts_address)
+ need_ts_flush = true;
+ }
+ if((buffers & PIPE_CLEAR_DEPTHSTENCIL) && priv->framebuffer_s.zsbuf != NULL)
+ {
+ struct etna_surface *surf = etna_surface(priv->framebuffer_s.zsbuf);
+ if(surf->surf.ts_address)
+ need_ts_flush = true;
+ }
+ if(need_ts_flush)
+ {
+ etna_set_state(priv->ctx, VIVS_TS_FLUSH_CACHE, VIVS_TS_FLUSH_CACHE_FLUSH);
+ }
/* No need to set up the TS here with sync_context.
* RS clear operations (in contrast to resolve and copy) do not require the TS state.
*/
@@ -122,11 +138,15 @@ static void etna_pipe_clear(struct pipe_context *pipe,
uint32_t new_clear_value = translate_clear_color(surf->base.format, &color[idx]);
if(surf->surf.ts_address) /* TS: use precompiled clear command */
{
- if(unlikely(priv->framebuffer.TS_COLOR_CLEAR_VALUE != new_clear_value))
+ /* Set new clear color */
+ priv->framebuffer.TS_COLOR_CLEAR_VALUE = new_clear_value;
+ if(!DBG_ENABLED(ETNA_DBG_NO_AUTODISABLE))
{
- priv->framebuffer.TS_COLOR_CLEAR_VALUE = new_clear_value;
- priv->dirty_bits |= ETNA_STATE_TS;
+ /* Set number of color tiles to be filled */
+ etna_set_state(priv->ctx, VIVS_TS_COLOR_AUTO_DISABLE_COUNT, surf->surf.padded_width*surf->surf.padded_height/16);
+ priv->framebuffer.TS_MEM_CONFIG |= VIVS_TS_MEM_CONFIG_COLOR_AUTO_DISABLE;
}
+ priv->dirty_bits |= ETNA_STATE_TS;
}
else if(unlikely(new_clear_value != surf->level->clear_value)) /* Queue normal RS clear for non-TS surfaces */
{
@@ -142,11 +162,15 @@ static void etna_pipe_clear(struct pipe_context *pipe,
uint32_t new_clear_value = translate_clear_depth_stencil(surf->base.format, depth, stencil);
if(surf->surf.ts_address) /* TS: use precompiled clear command */
{
- if(unlikely(priv->framebuffer.TS_COLOR_CLEAR_VALUE != new_clear_value))
+ /* Set new clear color */
+ priv->framebuffer.TS_DEPTH_CLEAR_VALUE = new_clear_value;
+ if(!DBG_ENABLED(ETNA_DBG_NO_AUTODISABLE))
{
- priv->framebuffer.TS_DEPTH_CLEAR_VALUE = new_clear_value;
- priv->dirty_bits |= ETNA_STATE_TS;
+ /* Set number of depth tiles to be filled */
+ etna_set_state(priv->ctx, VIVS_TS_DEPTH_AUTO_DISABLE_COUNT, surf->surf.padded_width*surf->surf.padded_height/16);
+ priv->framebuffer.TS_MEM_CONFIG |= VIVS_TS_MEM_CONFIG_DEPTH_AUTO_DISABLE;
}
+ priv->dirty_bits |= ETNA_STATE_TS;
} else if(unlikely(new_clear_value != surf->level->clear_value)) /* Queue normal RS clear for non-TS surfaces */
{
etna_rs_gen_clear_surface(&surf->clear_command, surf, new_clear_value);
diff --git a/native/driver/etna_debug.h b/native/driver/etna_debug.h
index 49cc2ef..7b08f26 100644
--- a/native/driver/etna_debug.h
+++ b/native/driver/etna_debug.h
@@ -39,15 +39,16 @@
/* Bypasses */
#define ETNA_DBG_NO_TS 0x1000 /* Disable TS */
-#define ETNA_DBG_CFLUSH_ALL 0x2000 /* Flush before every state update + draw call */
-#define ETNA_DBG_MSAA_2X 0x4000 /* Force 2X MSAA for screen */
-#define ETNA_DBG_MSAA_4X 0x8000 /* Force 4X MSAA for screen */
-#define ETNA_DBG_FINISH_ALL 0x10000 /* Finish on every flush */
-#define ETNA_DBG_FLUSH_ALL 0x20000 /* Flush after every rendered primitive */
+#define ETNA_DBG_NO_AUTODISABLE 0x2000 /* Disable autodisable */
+#define ETNA_DBG_CFLUSH_ALL 0x4000 /* Flush before every state update + draw call */
+#define ETNA_DBG_MSAA_2X 0x8000 /* Force 2X MSAA for screen */
+#define ETNA_DBG_MSAA_4X 0x10000 /* Force 4X MSAA for screen */
+#define ETNA_DBG_FINISH_ALL 0x20000 /* Finish on every flush */
+#define ETNA_DBG_FLUSH_ALL 0x40000 /* Flush after every rendered primitive */
extern uint32_t etna_mesa_debug; /* set in etna_screen.c from ETNA_DEBUG */
-#define DBG_ENABLED(flag) (etna_mesa_debug & (flag))
+#define DBG_ENABLED(flag) unlikely(etna_mesa_debug & (flag))
#define DBG_F(flag, fmt, ...) \
do { if (etna_mesa_debug & (flag)) \
diff --git a/native/driver/etna_pipe.c b/native/driver/etna_pipe.c
index b442028..fd7e4c3 100644
--- a/native/driver/etna_pipe.c
+++ b/native/driver/etna_pipe.c
@@ -312,6 +312,8 @@ static void sync_context(struct pipe_context *restrict pipe)
}
if(unlikely(dirty & (ETNA_STATE_TEXTURE_CACHES)))
to_flush |= VIVS_GL_FLUSH_CACHE_TEXTURE;
+ if(unlikely(dirty & (ETNA_STATE_FRAMEBUFFER))) /* Framebuffer config changed? */
+ to_flush |= VIVS_GL_FLUSH_CACHE_COLOR | VIVS_GL_FLUSH_CACHE_DEPTH;
if(DBG_ENABLED(ETNA_DBG_CFLUSH_ALL))
to_flush |= VIVS_GL_FLUSH_CACHE_TEXTURE | VIVS_GL_FLUSH_CACHE_COLOR | VIVS_GL_FLUSH_CACHE_DEPTH;
if(to_flush)
@@ -748,12 +750,6 @@ static void sync_context(struct pipe_context *restrict pipe)
/**** End of state update ****/
#undef EMIT_STATE
#undef EMIT_STATE_FIXP
- /**** Post processing ****/
- if(unlikely(dirty & (ETNA_STATE_FRAMEBUFFER | ETNA_STATE_TS)))
- {
- /* Wait rasterizer until RS (PE) finished configuration. */
- etna_stall(ctx, SYNC_RECIPIENT_RA, SYNC_RECIPIENT_PE);
- }
e->dirty_bits = 0;
}
diff --git a/native/driver/etna_screen.c b/native/driver/etna_screen.c
index 54e9953..b0e1e6d 100644
--- a/native/driver/etna_screen.c
+++ b/native/driver/etna_screen.c
@@ -58,6 +58,7 @@ static void etna_set_debug_flags(const char *str)
{ "linker_msgs", ETNA_DBG_LINKER_MSGS },
{ "dump_shaders", ETNA_DBG_DUMP_SHADERS },
{ "no_ts", ETNA_DBG_NO_TS },
+ { "no_autodisable", ETNA_DBG_NO_AUTODISABLE },
{ "cflush_all", ETNA_DBG_CFLUSH_ALL },
{ "msaa2x", ETNA_DBG_MSAA_2X },
{ "msaa4x", ETNA_DBG_MSAA_4X },
diff --git a/native/etnaviv/common.xml.h b/native/etnaviv/common.xml.h
index abe01e1..072885e 100644
--- a/native/etnaviv/common.xml.h
+++ b/native/etnaviv/common.xml.h
@@ -12,7 +12,7 @@ The rules-ng-ng source files this header was generated from are:
- /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22)
- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37)
- /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22)
-- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59)
+- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54270 bytes, from 2013-09-17 15:37:52)
- /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22)
Copyright (C) 2013
diff --git a/native/etnaviv/isa.xml.h b/native/etnaviv/isa.xml.h
index 9182782..9bbe022 100644
--- a/native/etnaviv/isa.xml.h
+++ b/native/etnaviv/isa.xml.h
@@ -8,7 +8,7 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
git clone git://0x04.net/rules-ng-ng
The rules-ng-ng source files this header was generated from are:
-- /home/orion/projects/etna_viv/rnndb/isa.xml ( 19334 bytes, from 2013-09-01 10:53:22)
+- /home/orion/projects/etna_viv/rnndb/isa.xml ( 19194 bytes, from 2013-09-17 13:47:14)
Copyright (C) 2013
*/
diff --git a/native/etnaviv/state.xml.h b/native/etnaviv/state.xml.h
index 915ee82..0b8b92b 100644
--- a/native/etnaviv/state.xml.h
+++ b/native/etnaviv/state.xml.h
@@ -12,7 +12,7 @@ The rules-ng-ng source files this header was generated from are:
- /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22)
- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37)
- /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22)
-- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59)
+- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54270 bytes, from 2013-09-17 15:37:52)
- /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22)
Copyright (C) 2013
diff --git a/native/etnaviv/state_2d.xml.h b/native/etnaviv/state_2d.xml.h
index 28d17aa..3c77032 100644
--- a/native/etnaviv/state_2d.xml.h
+++ b/native/etnaviv/state_2d.xml.h
@@ -12,7 +12,7 @@ The rules-ng-ng source files this header was generated from are:
- /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22)
- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37)
- /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22)
-- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59)
+- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54270 bytes, from 2013-09-17 15:37:52)
- /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22)
Copyright (C) 2013
diff --git a/native/etnaviv/state_3d.xml.h b/native/etnaviv/state_3d.xml.h
index 6c605de..c7f07ed 100644
--- a/native/etnaviv/state_3d.xml.h
+++ b/native/etnaviv/state_3d.xml.h
@@ -12,7 +12,7 @@ The rules-ng-ng source files this header was generated from are:
- /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22)
- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37)
- /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22)
-- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59)
+- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54270 bytes, from 2013-09-17 15:37:52)
- /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22)
Copyright (C) 2013
@@ -873,9 +873,9 @@ Copyright (C) 2013
#define VIVS_TS_DEPTH_CLEAR_VALUE 0x0000166c
-#define VIVS_TS_COLOR_AUTO_DISABLE_COUNT 0x00001670
+#define VIVS_TS_DEPTH_AUTO_DISABLE_COUNT 0x00001670
-#define VIVS_TS_DEPTH_AUTO_DISABLE_COUNT 0x00001674
+#define VIVS_TS_COLOR_AUTO_DISABLE_COUNT 0x00001674
#define VIVS_TS_HDEPTH_STATUS_BASE 0x000016a4
diff --git a/native/etnaviv/state_hi.xml.h b/native/etnaviv/state_hi.xml.h
index 863ac0b..2203bc0 100644
--- a/native/etnaviv/state_hi.xml.h
+++ b/native/etnaviv/state_hi.xml.h
@@ -12,7 +12,7 @@ The rules-ng-ng source files this header was generated from are:
- /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22)
- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37)
- /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22)
-- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59)
+- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54270 bytes, from 2013-09-17 15:37:52)
- /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22)
Copyright (C) 2013
diff --git a/native/etnaviv/state_vg.xml.h b/native/etnaviv/state_vg.xml.h
index 9e0965a..f143015 100644
--- a/native/etnaviv/state_vg.xml.h
+++ b/native/etnaviv/state_vg.xml.h
@@ -12,7 +12,7 @@ The rules-ng-ng source files this header was generated from are:
- /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22)
- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37)
- /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22)
-- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59)
+- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54270 bytes, from 2013-09-17 15:37:52)
- /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22)
Copyright (C) 2013
diff --git a/native/fb/sync_cubox.sh b/native/fb/sync_cubox.sh
index 0ccce34..53d4c08 100755
--- a/native/fb/sync_cubox.sh
+++ b/native/fb/sync_cubox.sh
@@ -2,7 +2,7 @@
TARGET=cubox
rsync -zv alpha_blend cube_companion cubemap_sphere displacement etna_gears mip_cube particle_system rotate_cube stencil_test \
- viv_profile viv_gpu_top ps_sandbox downsample_test $TARGET:
+ ps_sandbox downsample_test $TARGET:
cd ../../../
rsync -zar --include \*/ \
--include \*.c \
diff --git a/rnndb/state_3d.xml b/rnndb/state_3d.xml
index 154be87..b60911a 100644
--- a/rnndb/state_3d.xml
+++ b/rnndb/state_3d.xml
@@ -755,8 +755,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
<reg32 offset="0x01664" name="DEPTH_STATUS_BASE" brief="Depth tile status base address" value="0x00000000" type="VIVM"/>
<reg32 offset="0x01668" name="DEPTH_SURFACE_BASE" brief="Depth surface base address" value="0x00000000" type="VIVM"/>
<reg32 offset="0x0166C" name="DEPTH_CLEAR_VALUE" brief="Depth clear value" value="0x00000000"/>
- <reg32 offset="0x01670" name="COLOR_AUTO_DISABLE_COUNT" brief="Auto disable depth counter" value="0x00000000"/>
- <reg32 offset="0x01674" name="DEPTH_AUTO_DISABLE_COUNT" brief="Auto disable color counter" value="0x00000000"/>
+ <reg32 offset="0x01670" name="DEPTH_AUTO_DISABLE_COUNT" brief="Auto disable depth counter" value="0x00000000"/>
+ <reg32 offset="0x01674" name="COLOR_AUTO_DISABLE_COUNT" brief="Auto disable color counter" value="0x00000000"/>
<reg32 offset="0x016A4" name="HDEPTH_STATUS_BASE" value="0x00000000" type="VIVM">
<doc>Hierarchical Z allocates multiple depth buffers for one surface, which have their own TS.</doc>
</reg32>