Mesa (master): r300g: remove redundant state variable hyperz_locked

Marek Olšák mareko at kemper.freedesktop.org
Mon May 9 18:03:58 UTC 2011


Module: Mesa
Branch: master
Commit: 56b39fcd8b6810a35db36c4d93129890b3e93052
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=56b39fcd8b6810a35db36c4d93129890b3e93052

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sat May  7 23:29:23 2011 +0200

r300g: remove redundant state variable hyperz_locked

---

 src/gallium/drivers/r300/r300_blit.c          |    6 +++---
 src/gallium/drivers/r300/r300_context.h       |    2 --
 src/gallium/drivers/r300/r300_hyperz.c        |    4 ++--
 src/gallium/drivers/r300/r300_state.c         |   12 ++++++------
 src/gallium/drivers/r300/r300_state_derived.c |    2 +-
 5 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index 1217488..04ed86c 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -323,7 +323,7 @@ static void r300_clear_depth_stencil(struct pipe_context *pipe,
     struct pipe_framebuffer_state *fb =
         (struct pipe_framebuffer_state*)r300->fb_state.state;
 
-    if (r300->zmask_in_use && !r300->hyperz_locked) {
+    if (r300->zmask_in_use && !r300->locked_zbuffer) {
         if (fb->zsbuf->texture == dst->texture) {
             r300_decompress_zmask(r300);
         }
@@ -341,7 +341,7 @@ void r300_decompress_zmask(struct r300_context *r300)
     struct pipe_framebuffer_state *fb =
         (struct pipe_framebuffer_state*)r300->fb_state.state;
 
-    if (!r300->zmask_in_use || r300->hyperz_locked)
+    if (!r300->zmask_in_use || r300->locked_zbuffer)
         return;
 
     r300->zmask_decompress = TRUE;
@@ -423,7 +423,7 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
         return;
     }
 
-    if (r300->zmask_in_use && !r300->hyperz_locked) {
+    if (r300->zmask_in_use && !r300->locked_zbuffer) {
         if (fb->zsbuf->texture == src ||
             fb->zsbuf->texture == dst) {
             r300_decompress_zmask(r300);
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 8a0a54c..0704021 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -597,8 +597,6 @@ struct r300_context {
     /* Whether ZMASK is being decompressed. */
     boolean zmask_decompress;
     /* Whether ZMASK/HIZ is locked, i.e. should be disabled and cannot be taken over. */
-    boolean hyperz_locked;
-    /* The zbuffer the ZMASK of which is locked. */
     struct pipe_surface *locked_zbuffer;
     /* Whether HIZ is enabled. */
     boolean hiz_in_use;
diff --git a/src/gallium/drivers/r300/r300_hyperz.c b/src/gallium/drivers/r300/r300_hyperz.c
index ef330f3..b68a346 100644
--- a/src/gallium/drivers/r300/r300_hyperz.c
+++ b/src/gallium/drivers/r300/r300_hyperz.c
@@ -156,7 +156,7 @@ static void r300_update_hyperz(struct r300_context* r300)
         return;
 
     /* Zbuffer compression. */
-    if (r300->zmask_in_use && !r300->hyperz_locked) {
+    if (r300->zmask_in_use && !r300->locked_zbuffer) {
         z->zb_bw_cntl |= R300_FAST_FILL_ENABLE |
                          /*R300_FORCE_COMPRESSED_STENCIL_VALUE_ENABLE |*/
                          R300_RD_COMP_ENABLE;
@@ -171,7 +171,7 @@ static void r300_update_hyperz(struct r300_context* r300)
     }
 
     /* HiZ. */
-    if (r300->hiz_in_use && !r300->hyperz_locked) {
+    if (r300->hiz_in_use && !r300->locked_zbuffer) {
         /* Set the HiZ function if needed. */
         if (r300->hiz_func == HIZ_FUNC_NONE) {
             r300->hiz_func = r300_get_hiz_func(r300);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 24b41d5..fc7dcb1 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -813,6 +813,7 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
     struct pipe_framebuffer_state *old_state = r300->fb_state.state;
     unsigned max_width, max_height, i;
     uint32_t zbuffer_bpp = 0;
+    boolean unlock_zbuffer = FALSE;
 
     if (r300->screen->caps.is_r500) {
         max_width = max_height = 4096;
@@ -828,7 +829,7 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
         return;
     }
 
-    if (old_state->zsbuf && r300->zmask_in_use && !r300->hyperz_locked) {
+    if (old_state->zsbuf && r300->zmask_in_use && !r300->locked_zbuffer) {
         /* There is a zmask in use, what are we gonna do? */
         if (state->zsbuf) {
             if (!pipe_surface_equal(old_state->zsbuf, state->zsbuf)) {
@@ -838,10 +839,9 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
             }
         } else {
             /* We don't bind another zbuffer, so lock the current one. */
-            r300->hyperz_locked = TRUE;
             pipe_surface_reference(&r300->locked_zbuffer, old_state->zsbuf);
         }
-    } else if (r300->hyperz_locked && r300->locked_zbuffer) {
+    } else if (r300->locked_zbuffer) {
         /* We have a locked zbuffer now, what are we gonna do? */
         if (state->zsbuf) {
             if (!pipe_surface_equal(r300->locked_zbuffer, state->zsbuf)) {
@@ -851,11 +851,11 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
                 r300->hiz_in_use = FALSE;
             } else {
                 /* We are binding the locked zbuffer again, so unlock it. */
-                r300->hyperz_locked = FALSE;
+                unlock_zbuffer = TRUE;
             }
         }
     }
-    assert(state->zsbuf || r300->hyperz_locked || !r300->zmask_in_use);
+    assert(state->zsbuf || (r300->locked_zbuffer && !unlock_zbuffer) || !r300->zmask_in_use);
 
     /* Need to reset clamping or colormask. */
     r300_mark_atom_dirty(r300, &r300->blend_state);
@@ -870,7 +870,7 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
 
     util_copy_framebuffer_state(r300->fb_state.state, state);
 
-    if (!r300->hyperz_locked) {
+    if (unlock_zbuffer) {
         pipe_surface_reference(&r300->locked_zbuffer, NULL);
     }
 
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index afc1451..04499c7 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -965,7 +965,7 @@ static void r300_decompress_depth_textures(struct r300_context *r300)
                           state->sampler_state_count);
     unsigned i;
 
-    if (!r300->hyperz_locked || !r300->locked_zbuffer) {
+    if (!r300->locked_zbuffer) {
         return;
     }
 




More information about the mesa-commit mailing list