Mesa (master): i965: Add missing state reset at the end of blorp.

Eric Anholt anholt at kemper.freedesktop.org
Fri Aug 30 18:31:29 UTC 2013


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jun 18 14:54:18 2013 -0700

i965: Add missing state reset at the end of blorp.

These are things that happen to be occurring because of the batch flush at
the start of the blorp op (which exists to prevent batch space or aperture
space overflow), but the intention was for this sequence of state resets at
the end of blorp to be everything necessary for the next draw call.

Found when debugging the next commit, by comparing brw_new_batch() and
intel_batchbuffer_reset() to brw_blorp_exec().

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Paul Berry <stereotype441 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_blorp.cpp       |    2 ++
 src/mesa/drivers/dri/i965/intel_batchbuffer.c |   10 +++++-----
 src/mesa/drivers/dri/i965/intel_batchbuffer.h |    1 +
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index 20ea09e..1576ff2 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -214,6 +214,8 @@ brw_blorp_exec(struct brw_context *brw, const brw_blorp_params *params)
    brw->state.dirty.cache = ~0;
    brw->state_batch_count = 0;
    brw->batch.need_workaround_flush = true;
+   brw->ib.type = -1;
+   intel_batchbuffer_clear_cache(brw);
 
    /* Flush the sampler cache so any texturing from the destination is
     * coherent.
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 5604829..0aa2551 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -41,8 +41,8 @@ struct cached_batch_item {
    uint16_t size;
 };
 
-static void
-clear_cache(struct brw_context *brw)
+void
+intel_batchbuffer_clear_cache(struct brw_context *brw)
 {
    struct cached_batch_item *item = brw->batch.cached_items;
 
@@ -85,7 +85,7 @@ intel_batchbuffer_reset(struct brw_context *brw)
    }
    brw->batch.last_bo = brw->batch.bo;
 
-   clear_cache(brw);
+   intel_batchbuffer_clear_cache(brw);
 
    brw->batch.bo = drm_intel_bo_alloc(brw->bufmgr, "batchbuffer",
 					BATCH_SZ, 4096);
@@ -118,7 +118,7 @@ intel_batchbuffer_reset_to_saved(struct brw_context *brw)
    /* Cached batch state is dead, since we just cleared some unknown part of the
     * batchbuffer.  Assume that the caller resets any other state necessary.
     */
-   clear_cache(brw);
+   intel_batchbuffer_clear_cache(brw);
 }
 
 void
@@ -128,7 +128,7 @@ intel_batchbuffer_free(struct brw_context *brw)
    drm_intel_bo_unreference(brw->batch.last_bo);
    drm_intel_bo_unreference(brw->batch.bo);
    drm_intel_bo_unreference(brw->batch.workaround_bo);
-   clear_cache(brw);
+   intel_batchbuffer_clear_cache(brw);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
index 15a9ca1..d46f48e 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
@@ -28,6 +28,7 @@ void intel_batchbuffer_init(struct brw_context *brw);
 void intel_batchbuffer_free(struct brw_context *brw);
 void intel_batchbuffer_save_state(struct brw_context *brw);
 void intel_batchbuffer_reset_to_saved(struct brw_context *brw);
+void intel_batchbuffer_clear_cache(struct brw_context *brw);
 
 int _intel_batchbuffer_flush(struct brw_context *brw,
 			     const char *file, int line);




More information about the mesa-commit mailing list