From 5f86ae057a645c03dc1e0c51c2fb1b2628a50e0a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 9 Jan 2008 13:40:40 -0800 Subject: [PATCH] [intel] Rename lost_hardware vtbl entry to new_batch. Both drivers have ended up relying on lost_hardware being called after each batch buffer, so update the name. This removes one of the calls on 965 whic h was outside of the batchbuffer handling code and just duplicating what had already happened through batchbuffer handling. --- src/mesa/drivers/dri/i915/i830_vtbl.c | 4 ++-- src/mesa/drivers/dri/i915/i915_vtbl.c | 9 +++++++-- src/mesa/drivers/dri/i915/intel_context.h | 2 +- src/mesa/drivers/dri/i915/intel_ioctl.c | 11 ----------- src/mesa/drivers/dri/i965/brw_vtbl.c | 15 +++++---------- src/mesa/drivers/dri/i965/intel_context.c | 1 - src/mesa/drivers/dri/i965/intel_context.h | 2 +- src/mesa/drivers/dri/i965/intel_ioctl.c | 6 ------ src/mesa/drivers/dri/intel/intel_batchbuffer.c | 3 ++- 9 files changed, 18 insertions(+), 35 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index c23c02c0606..412d146fe19 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -683,7 +683,7 @@ i830_update_color_z_regions(intelContextPtr intel, /* This isn't really handled at the moment. */ static void -i830_lost_hardware(struct intel_context *intel) +i830_new_batch(struct intel_context *intel) { struct i830_context *i830 = i830_context(&intel->ctx); i830->state.emitted = 0; @@ -713,7 +713,7 @@ i830InitVtbl(struct i830_context *i830) i830->intel.vtbl.check_vertex_size = i830_check_vertex_size; i830->intel.vtbl.destroy = i830_destroy_context; i830->intel.vtbl.emit_state = i830_emit_state; - i830->intel.vtbl.lost_hardware = i830_lost_hardware; + i830->intel.vtbl.new_batch = i830_new_batch; i830->intel.vtbl.reduced_primitive_state = i830_reduced_primitive_state; i830->intel.vtbl.set_draw_region = i830_set_draw_region; i830->intel.vtbl.update_texture_state = i830UpdateTextureState; diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 1de518ace1c..8b45cdacbb9 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -579,9 +579,14 @@ i915_set_draw_region(struct intel_context *intel, static void -i915_lost_hardware(struct intel_context *intel) +i915_new_batch(struct intel_context *intel) { struct i915_context *i915 = i915_context(&intel->ctx); + + /* Mark all state as needing to be emitted when starting a new batchbuffer. + * Using hardware contexts would be an alternative, but they have some + * difficulties associated with them (physical address requirements). + */ i915->state.emitted = 0; } @@ -607,7 +612,7 @@ i915InitVtbl(struct i915_context *i915) i915->intel.vtbl.check_vertex_size = i915_check_vertex_size; i915->intel.vtbl.destroy = i915_destroy_context; i915->intel.vtbl.emit_state = i915_emit_state; - i915->intel.vtbl.lost_hardware = i915_lost_hardware; + i915->intel.vtbl.new_batch = i915_new_batch; i915->intel.vtbl.reduced_primitive_state = i915_reduced_primitive_state; i915->intel.vtbl.render_start = i915_render_start; i915->intel.vtbl.render_prevalidate = i915_render_prevalidate; diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h index 528e749c33f..b1648cd85d7 100644 --- a/src/mesa/drivers/dri/i915/intel_context.h +++ b/src/mesa/drivers/dri/i915/intel_context.h @@ -85,7 +85,7 @@ struct intel_context { void (*destroy) (struct intel_context * intel); void (*emit_state) (struct intel_context * intel); - void (*lost_hardware) (struct intel_context * intel); + void (*new_batch) (struct intel_context * intel); void (*update_texture_state) (struct intel_context * intel); void (*render_start) (struct intel_context * intel); diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.c b/src/mesa/drivers/dri/i915/intel_ioctl.c index 3cd8344b48d..187a6e901b1 100644 --- a/src/mesa/drivers/dri/i915/intel_ioctl.c +++ b/src/mesa/drivers/dri/i915/intel_ioctl.c @@ -124,11 +124,6 @@ intel_batch_ioctl(struct intel_context *intel, UNLOCK_HARDWARE(intel); exit(1); } - - /* FIXME: use hardware contexts to avoid 'losing' hardware after - * each buffer flush. - */ - intel->vtbl.lost_hardware(intel); } void @@ -176,10 +171,4 @@ intel_exec_ioctl(struct intel_context *intel, exit(1); } *fence = fo; - - /* FIXME: use hardware contexts to avoid 'losing' hardware after - * each buffer flush. - */ - intel->vtbl.lost_hardware(intel); - } diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 2bc8849867c..4575ff03218 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -84,21 +84,16 @@ static void brw_set_draw_region( struct intel_context *intel, /* called from intelFlushBatchLocked */ -static void brw_lost_hardware( struct intel_context *intel ) +static void brw_new_batch( struct intel_context *intel ) { struct brw_context *brw = brw_context(&intel->ctx); - /* Note that we effectively lose the context after this. - * - * Setting this flag provokes a state buffer wrap and also flushes - * the hardware caches. + /* Mark all context state as needing to be re-emitted. + * This is probably not as severe as on 915, since almost all of our state + * is just in referenced buffers. */ brw->state.dirty.brw |= BRW_NEW_CONTEXT; - /* Which means there shouldn't be any commands already queued: - */ - assert(intel->batch->ptr == intel->batch->map); - brw->state.dirty.mesa |= ~0; brw->state.dirty.brw |= ~0; brw->state.dirty.cache |= ~0; @@ -169,7 +164,7 @@ void brwInitVtbl( struct brw_context *brw ) brw->intel.vtbl.invalidate_state = brw_invalidate_state; brw->intel.vtbl.note_fence = brw_note_fence; brw->intel.vtbl.note_unlock = brw_note_unlock; - brw->intel.vtbl.lost_hardware = brw_lost_hardware; + brw->intel.vtbl.new_batch = brw_new_batch; brw->intel.vtbl.destroy = brw_destroy_context; brw->intel.vtbl.set_draw_region = brw_set_draw_region; brw->intel.vtbl.flush_cmd = brw_flush_cmd; diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index abcd6d5aabe..4ee7ca6a261 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -755,7 +755,6 @@ static void intelContendedLock( struct intel_context *intel, GLuint flags ) sarea->ctxOwner, me); } sarea->ctxOwner = me; - intel->vtbl.lost_hardware( intel ); } /* If the last consumer of the texture memory wasn't us, notify the fake diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h index accb3069f02..6c7fd8c12f2 100644 --- a/src/mesa/drivers/dri/i965/intel_context.h +++ b/src/mesa/drivers/dri/i965/intel_context.h @@ -79,7 +79,7 @@ struct intel_context void (*destroy)( struct intel_context *intel ); void (*emit_state)( struct intel_context *intel ); void (*emit_invarient_state)( struct intel_context *intel ); - void (*lost_hardware)( struct intel_context *intel ); + void (*new_batch)( struct intel_context *intel ); void (*note_fence)( struct intel_context *intel, GLuint fence ); void (*note_unlock)( struct intel_context *intel ); void (*update_texture_state)( struct intel_context *intel ); diff --git a/src/mesa/drivers/dri/i965/intel_ioctl.c b/src/mesa/drivers/dri/i965/intel_ioctl.c index ebf5e3ae835..d55a19ff3b6 100644 --- a/src/mesa/drivers/dri/i965/intel_ioctl.c +++ b/src/mesa/drivers/dri/i965/intel_ioctl.c @@ -196,10 +196,4 @@ intel_exec_ioctl(struct intel_context *intel, exit(1); } *fence = fo; - - /* FIXME: use hardware contexts to avoid 'losing' hardware after - * each buffer flush. - */ - intel->vtbl.lost_hardware(intel); - } diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 7ad9a1a0a47..a6f19916d80 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -172,7 +172,6 @@ do_flush_locked(struct intel_batchbuffer *batch, sched_yield(); LOCK_HARDWARE(intel); } - intel->vtbl.lost_hardware(intel); } if (INTEL_DEBUG & DEBUG_BATCH) { @@ -184,6 +183,8 @@ do_flush_locked(struct intel_batchbuffer *batch, if (intel->vtbl.debug_batch != NULL) intel->vtbl.debug_batch(intel); } + + intel->vtbl.new_batch(intel); } void -- 2.30.2