summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-09-30 10:31:12 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2013-09-30 10:31:12 +0200
commit4cf94a6f40bf760f5c3b9ddf0366601a4b05a64c (patch)
tree1647c3eaea886857b05c7aef0df637ffd8563aaf
parent3494cfc4851f94e6e5a814af6e930016b030ab20 (diff)
driver: add 'zero' debug flag to zero all resources on alloc
-rw-r--r--native/driver/etna_debug.h1
-rw-r--r--native/driver/etna_resource.c5
-rw-r--r--native/driver/etna_screen.c3
3 files changed, 8 insertions, 1 deletions
diff --git a/native/driver/etna_debug.h b/native/driver/etna_debug.h
index f75ae71..1274ffc 100644
--- a/native/driver/etna_debug.h
+++ b/native/driver/etna_debug.h
@@ -47,6 +47,7 @@
#define ETNA_DBG_MSAA_4X 0x40000 /* Force 4X MSAA for screen */
#define ETNA_DBG_FINISH_ALL 0x80000 /* Finish on every flush */
#define ETNA_DBG_FLUSH_ALL 0x100000 /* Flush after every rendered primitive */
+#define ETNA_DBG_ZERO 0x200000 /* Zero all resources after allocation */
extern uint32_t etna_mesa_debug; /* set in etna_screen.c from ETNA_DEBUG */
diff --git a/native/driver/etna_resource.c b/native/driver/etna_resource.c
index 6d52a92..bb9a143 100644
--- a/native/driver/etna_resource.c
+++ b/native/driver/etna_resource.c
@@ -249,6 +249,11 @@ static struct pipe_resource * etna_screen_resource_create(struct pipe_screen *sc
resource->ts = 0; /* TS is only created when first bound to surface */
pipe_reference_init(&resource->base.reference, 1);
+ if(DBG_ENABLED(ETNA_DBG_ZERO))
+ {
+ memset(resource->surface->logical, 0, rt_size);
+ }
+
for(unsigned ix=0; ix<=resource->base.last_level; ++ix)
{
struct etna_resource_level *mip = &resource->levels[ix];
diff --git a/native/driver/etna_screen.c b/native/driver/etna_screen.c
index c801645..d62b111 100644
--- a/native/driver/etna_screen.c
+++ b/native/driver/etna_screen.c
@@ -65,7 +65,8 @@ static void etna_set_debug_flags(const char *str)
{ "msaa2x", ETNA_DBG_MSAA_2X },
{ "msaa4x", ETNA_DBG_MSAA_4X },
{ "finish_all", ETNA_DBG_FINISH_ALL },
- { "flush_all", ETNA_DBG_FLUSH_ALL }
+ { "flush_all", ETNA_DBG_FLUSH_ALL },
+ { "zero", ETNA_DBG_ZERO }
};
int i;