[Mesa-dev] [PATCH 4/7] i965: Move update_state from brw_meta_resolve_color() to after all resolves

Chris Wilson chris at chris-wilson.co.uk
Wed Sep 9 06:38:58 PDT 2015


Now that we moved the resolving from out of the _mesa_update_state()
callback we can remove the trick of calling _mesa_update_state() again
from inside the resolver (as we no longer need to adhere to the
_mesa_update_state() contract). However, we still need to make sure that
the context is up to date before proceeding on with the vbo draw.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Jason Ekstrand <jason.ekstrand at intel.com>
Cc: Kenneth Graunke <kenneth at whitecape.org>
Cc: Francisco Jerez <currojerez at riseup.net>
---
 src/mesa/drivers/dri/i965/brw_draw.c            | 7 +++++++
 src/mesa/drivers/dri/i965/brw_meta_fast_clear.c | 9 ---------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index d1b6279..1269b65 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -366,6 +366,13 @@ brw_draw_resolve(struct gl_context *ctx)
       intel_miptree_resolve_color(brw, tex_obj->mt);
       brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
    }
+
+   /* As we may have resolved using meta operations and so left the
+    * context in a dirty state, we need to complete the invalidations
+    * before continuing on with the vbo draw (and its context checks).
+    */
+   if (ctx->NewState)
+      _mesa_update_state(ctx);
 }
 
 
diff --git a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
index f5ecbb5..dd7f148 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
@@ -710,13 +710,4 @@ brw_meta_resolve_color(struct brw_context *brw,
    _mesa_DeleteFramebuffers(1, &fbo);
 
    _mesa_meta_end(ctx);
-
-   /* We're typically called from intel_update_state() and we're supposed to
-    * return with the state all updated to what it was before
-    * brw_meta_resolve_color() was called.  The meta rendering will have
-    * messed up the state and we need to call _mesa_update_state() again to
-    * get back to where we were supposed to be when resolve was called.
-    */
-   if (ctx->NewState)
-      _mesa_update_state(ctx);
 }
-- 
2.5.1



More information about the mesa-dev mailing list