[Mesa-dev] [PATCH 32/33] i965: Remove the memcpy()ed atoms array now that everything is emit()-based.

Eric Anholt eric at anholt.net
Mon Oct 24 14:17:19 PDT 2011


---
 src/mesa/drivers/dri/i965/brw_context.h      |    4 ++--
 src/mesa/drivers/dri/i965/brw_state_upload.c |   17 +++++++----------
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 7886766..71bb015 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -870,8 +870,8 @@ struct brw_context
     */
    GLuint program_id;
 
-   int num_prepare_atoms, num_emit_atoms;
-   struct brw_tracked_state prepare_atoms[64], emit_atoms[64];
+   int num_atoms;
+   const struct brw_tracked_state **atoms;
 
    /* If (INTEL_DEBUG & DEBUG_BATCH) */
    struct {
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 66f27e2..79d9188 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -254,17 +254,16 @@ void brw_init_state( struct brw_context *brw )
       num_atoms = ARRAY_SIZE(gen4_atoms);
    }
 
+   brw->atoms = atoms;
+   brw->num_atoms = num_atoms;
+
    while (num_atoms--) {
       assert((*atoms)->dirty.mesa |
 	     (*atoms)->dirty.brw |
 	     (*atoms)->dirty.cache);
-
-      assert(!(*atoms)->prepare);
       assert((*atoms)->emit);
-      brw->emit_atoms[brw->num_emit_atoms++] = **atoms;
       atoms++;
    }
-   assert(brw->num_emit_atoms <= ARRAY_SIZE(brw->emit_atoms));
 }
 
 
@@ -426,8 +425,6 @@ void brw_upload_state(struct brw_context *brw)
    struct gl_context *ctx = &brw->intel.ctx;
    struct intel_context *intel = &brw->intel;
    struct brw_state_flags *state = &brw->state.dirty;
-   const struct brw_tracked_state *atoms = brw->emit_atoms;
-   int num_atoms = brw->num_emit_atoms;
    int i;
    static int dirty_count = 0;
 
@@ -466,8 +463,8 @@ void brw_upload_state(struct brw_context *brw)
       memset(&examined, 0, sizeof(examined));
       prev = *state;
 
-      for (i = 0; i < num_atoms; i++) {
-	 const struct brw_tracked_state *atom = &atoms[i];
+      for (i = 0; i < brw->num_atoms; i++) {
+	 const struct brw_tracked_state *atom = brw->atoms[i];
 	 struct brw_state_flags generated;
 
 	 if (brw->intel.Fallback)
@@ -489,8 +486,8 @@ void brw_upload_state(struct brw_context *brw)
       }
    }
    else {
-      for (i = 0; i < num_atoms; i++) {
-	 const struct brw_tracked_state *atom = &atoms[i];
+      for (i = 0; i < brw->num_atoms; i++) {
+	 const struct brw_tracked_state *atom = brw->atoms[i];
 
 	 if (brw->intel.Fallback)
 	    break;
-- 
1.7.7



More information about the mesa-dev mailing list