diff options
author | Eric Anholt <[email protected]> | 2008-01-09 14:08:12 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2008-01-09 14:41:53 -0800 |
commit | dc1608ae9d90a490ce32aa005488e3591a6d8369 (patch) | |
tree | d4c1c87e3a4e3ebedd35f7cf3c1a03d5bcc7107a /src/mesa/drivers | |
parent | 5f86ae057a645c03dc1e0c51c2fb1b2628a50e0a (diff) |
[965] Replace the always_update dirty flag with BRW_NEW_BATCH.
This allows us to avoid re-emitting some state when validate_state happens
multiple times per batchbuffer. Even though we flush batch per primitive
currently, that may still happen already if the primitive changed (this should
probably be fixed as well).
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_curbe.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_misc_state.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_state_upload.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vtbl.c | 3 |
5 files changed, 27 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index a4645effd43..0ffc9f62389 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -135,8 +135,13 @@ struct brw_context; #define BRW_NEW_METAOPS 0x1000 #define BRW_NEW_FENCE 0x2000 #define BRW_NEW_LOCK 0x4000 - - +/** + * Used for any batch entry with a relocated pointer that will be used + * by any 3D rendering. + */ +#define BRW_NEW_BATCH 0x8000 +/** brw->depth_region updated */ +#define BRW_NEW_DEPTH_BUFFER 0x10000 struct brw_state_flags { /** State update flags signalled by mesa internals */ @@ -328,7 +333,6 @@ struct brw_state_pointers { struct brw_tracked_state { struct brw_state_flags dirty; void (*update)( struct brw_context *brw ); - GLboolean always_update; }; /* Flags for brw->state.cache. diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 5d81703d361..3841c0a9cd0 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -342,10 +342,10 @@ const struct brw_tracked_state brw_constant_buffer = { BRW_NEW_VERTEX_PROGRAM | BRW_NEW_URB_FENCE | /* Implicit - hardware requires this, not used above */ BRW_NEW_PSP | /* Implicit - hardware requires this, not used above */ - BRW_NEW_CURBE_OFFSETS), + BRW_NEW_CURBE_OFFSETS | + BRW_NEW_BATCH), .cache = (CACHE_NEW_WM_PROG) }, .update = upload_constant_buffer, - .always_update = GL_TRUE, /* Has a relocation in the batchbuffer */ }; diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 37650dd9450..eefd22ecb23 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -93,8 +93,12 @@ static void upload_binding_table_pointers(struct brw_context *brw) } const struct brw_tracked_state brw_binding_table_pointers = { + .dirty = { + .mesa = 0, + .brw = BRW_NEW_BATCH, + .cache = CACHE_NEW_SURF_BIND, + }, .update = upload_binding_table_pointers, - .always_update = GL_TRUE, /* Has a relocation in the batchbuffer */ }; @@ -132,7 +136,7 @@ static void upload_pipelined_state_pointers(struct brw_context *brw ) const struct brw_tracked_state brw_pipelined_state_pointers = { .dirty = { .mesa = 0, - .brw = BRW_NEW_METAOPS, + .brw = BRW_NEW_METAOPS | BRW_NEW_BATCH, .cache = (CACHE_NEW_VS_UNIT | CACHE_NEW_GS_UNIT | CACHE_NEW_GS_PROG | @@ -142,7 +146,6 @@ const struct brw_tracked_state brw_pipelined_state_pointers = { CACHE_NEW_CC_UNIT) }, .update = upload_pipelined_state_pointers - .always_update = GL_TRUE, /* Has a relocation in the batchbuffer */ }; #endif @@ -157,7 +160,7 @@ static void upload_psp_urb_cbs(struct brw_context *brw ) const struct brw_tracked_state brw_psp_urb_cbs = { .dirty = { .mesa = 0, - .brw = BRW_NEW_URB_FENCE | BRW_NEW_METAOPS, + .brw = BRW_NEW_URB_FENCE | BRW_NEW_METAOPS | BRW_NEW_BATCH, .cache = (CACHE_NEW_VS_UNIT | CACHE_NEW_GS_UNIT | CACHE_NEW_GS_PROG | @@ -167,7 +170,6 @@ const struct brw_tracked_state brw_psp_urb_cbs = { CACHE_NEW_CC_UNIT) }, .update = upload_psp_urb_cbs, - .always_update = GL_TRUE, /* psp has relocations. */ }; /** @@ -226,8 +228,12 @@ static void upload_depthbuffer(struct brw_context *brw) } const struct brw_tracked_state brw_depthbuffer = { + .dirty = { + .mesa = 0, + .brw = BRW_NEW_DEPTH_BUFFER | BRW_NEW_BATCH, + .cache = 0, + }, .update = upload_depthbuffer, - .always_update = GL_TRUE, }; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 46ae49262d1..1c818a2cb2d 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -222,11 +222,10 @@ void brw_validate_state( struct brw_context *brw ) assert(atom->dirty.mesa || atom->dirty.brw || - atom->dirty.cache || - atom->always_update); + atom->dirty.cache); assert(atom->update); - if (check_state(state, &atom->dirty) || atom->always_update) { + if (check_state(state, &atom->dirty)) { atom->update( brw ); /* emit_foo(brw); */ @@ -247,7 +246,7 @@ void brw_validate_state( struct brw_context *brw ) for (i = 0; i < Elements(atoms); i++) { const struct brw_tracked_state *atom = brw->state.atoms[i]; - if (check_state(state, &atom->dirty) || atom->always_update) + if (check_state(state, &atom->dirty)) atom->update( brw ); } } diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 4575ff03218..277c8dca8b2 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -75,6 +75,9 @@ static void brw_set_draw_region( struct intel_context *intel, { struct brw_context *brw = brw_context(&intel->ctx); + if (brw->state.depth_region != depth_region) + brw->state.dirty.brw |= BRW_NEW_DEPTH_BUFFER; + intel_region_release(&brw->state.draw_region); intel_region_release(&brw->state.depth_region); intel_region_reference(&brw->state.draw_region, draw_region); |