[Mesa-dev] [PATCH 1/2] i965: Add missing state reset at the end of blorp.

Eric Anholt eric at anholt.net
Thu Jun 27 13:14:14 PDT 2013


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().
---
 src/mesa/drivers/dri/i965/brw_blorp.cpp       | 2 ++
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 9 +++++----
 src/mesa/drivers/dri/i965/intel_batchbuffer.h | 1 +
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index c7e7cd2..92bee3e 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -216,6 +216,8 @@ brw_blorp_exec(struct intel_context *intel, const brw_blorp_params *params)
    brw->state.dirty.cache = ~0;
    brw->state_batch_count = 0;
    intel->batch.need_workaround_flush = true;
+   brw->ib.type = -1;
+   intel_batchbuffer_clear_cache(intel);
 
    /* 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 8c6524e..5d4e4e9 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -41,7 +41,8 @@ struct cached_batch_item {
    uint16_t size;
 };
 
-static void clear_cache( struct intel_context *intel )
+void
+intel_batchbuffer_clear_cache(struct intel_context *intel)
 {
    struct cached_batch_item *item = intel->batch.cached_items;
 
@@ -84,7 +85,7 @@ intel_batchbuffer_reset(struct intel_context *intel)
    }
    intel->batch.last_bo = intel->batch.bo;
 
-   clear_cache(intel);
+   intel_batchbuffer_clear_cache(intel);
 
    intel->batch.bo = drm_intel_bo_alloc(intel->bufmgr, "batchbuffer",
 					intel->maxBatchSize, 4096);
@@ -117,7 +118,7 @@ intel_batchbuffer_reset_to_saved(struct intel_context *intel)
    /* 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(intel);
+   intel_batchbuffer_clear_cache(intel);
 }
 
 void
@@ -127,7 +128,7 @@ intel_batchbuffer_free(struct intel_context *intel)
    drm_intel_bo_unreference(intel->batch.last_bo);
    drm_intel_bo_unreference(intel->batch.bo);
    drm_intel_bo_unreference(intel->batch.workaround_bo);
-   clear_cache(intel);
+   intel_batchbuffer_clear_cache(intel);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h b/src/mesa/drivers/dri/i965/intel_batchbuffer.h
index 1a6d1aa..10fb6b4 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 intel_context *intel);
 void intel_batchbuffer_free(struct intel_context *intel);
 void intel_batchbuffer_save_state(struct intel_context *intel);
 void intel_batchbuffer_reset_to_saved(struct intel_context *intel);
+void intel_batchbuffer_clear_cache(struct intel_context *intel);
 
 int _intel_batchbuffer_flush(struct intel_context *intel,
 			     const char *file, int line);
-- 
1.8.3.rc0



More information about the mesa-dev mailing list