From 8f9e546fde27db75ea87bcf8ae333bc70616deb4 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Sat, 26 Feb 2011 21:40:52 +0100 Subject: [PATCH] i915g: kill relocs accouting No one ever cared. libdrm does dynamic resizing of its reloc-table, anyway. Signed-off-by: Daniel Vetter --- src/gallium/drivers/i915/i915_batch.h | 4 ++-- src/gallium/drivers/i915/i915_batchbuffer.h | 6 ++---- src/gallium/drivers/i915/i915_blit.c | 8 ++++---- src/gallium/drivers/i915/i915_flush.c | 4 ++-- src/gallium/drivers/i915/i915_prim_emit.c | 4 ++-- src/gallium/drivers/i915/i915_prim_vbuf.c | 12 ++++++------ src/gallium/drivers/i915/i915_state_emit.c | 11 ++--------- src/gallium/drivers/i915/i915_winsys.h | 1 - src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c | 3 --- src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c | 3 --- 10 files changed, 20 insertions(+), 36 deletions(-) diff --git a/src/gallium/drivers/i915/i915_batch.h b/src/gallium/drivers/i915/i915_batch.h index 6e93da76209..039c8713570 100644 --- a/src/gallium/drivers/i915/i915_batch.h +++ b/src/gallium/drivers/i915/i915_batch.h @@ -31,8 +31,8 @@ #include "i915_batchbuffer.h" -#define BEGIN_BATCH(dwords, relocs) \ - (i915_winsys_batchbuffer_check(i915->batch, dwords, relocs)) +#define BEGIN_BATCH(dwords) \ + (i915_winsys_batchbuffer_check(i915->batch, dwords)) #define OUT_BATCH(dword) \ i915_winsys_batchbuffer_dword(i915->batch, dword) diff --git a/src/gallium/drivers/i915/i915_batchbuffer.h b/src/gallium/drivers/i915/i915_batchbuffer.h index ada713b0cb9..9df82272604 100644 --- a/src/gallium/drivers/i915/i915_batchbuffer.h +++ b/src/gallium/drivers/i915/i915_batchbuffer.h @@ -41,11 +41,9 @@ i915_winsys_batchbuffer_space(struct i915_winsys_batchbuffer *batch) static INLINE boolean i915_winsys_batchbuffer_check(struct i915_winsys_batchbuffer *batch, - size_t dwords, - size_t relocs) + size_t dwords) { - return dwords * 4 <= i915_winsys_batchbuffer_space(batch) && - relocs <= (batch->max_relocs - batch->relocs); + return dwords * 4 <= i915_winsys_batchbuffer_space(batch); } static INLINE void diff --git a/src/gallium/drivers/i915/i915_blit.c b/src/gallium/drivers/i915/i915_blit.c index f885417f8ed..baaed3767ff 100644 --- a/src/gallium/drivers/i915/i915_blit.c +++ b/src/gallium/drivers/i915/i915_blit.c @@ -71,9 +71,9 @@ i915_fill_blit(struct i915_context *i915, return; } - if (!BEGIN_BATCH(6, 1)) { + if (!BEGIN_BATCH(6)) { FLUSH_BATCH(NULL); - assert(BEGIN_BATCH(6, 1)); + assert(BEGIN_BATCH(6)); } OUT_BATCH(CMD); OUT_BATCH(BR13); @@ -143,9 +143,9 @@ i915_copy_blit(struct i915_context *i915, */ assert (dst_pitch > 0 && src_pitch > 0); - if (!BEGIN_BATCH(8, 2)) { + if (!BEGIN_BATCH(8)) { FLUSH_BATCH(NULL); - assert(BEGIN_BATCH(8, 2)); + assert(BEGIN_BATCH(8)); } OUT_BATCH(CMD); OUT_BATCH(BR13); diff --git a/src/gallium/drivers/i915/i915_flush.c b/src/gallium/drivers/i915/i915_flush.c index 22a2c7b2cb4..f2044d661e3 100644 --- a/src/gallium/drivers/i915/i915_flush.c +++ b/src/gallium/drivers/i915/i915_flush.c @@ -59,9 +59,9 @@ static void i915_flush_pipe( struct pipe_context *pipe, if (flags & PIPE_FLUSH_TEXTURE_CACHE) flush |= FLUSH_MAP_CACHE; - if (!BEGIN_BATCH(1, 0)) { + if (!BEGIN_BATCH(1)) { FLUSH_BATCH(NULL); - assert(BEGIN_BATCH(1, 0)); + assert(BEGIN_BATCH(1)); } OUT_BATCH( flush ); } diff --git a/src/gallium/drivers/i915/i915_prim_emit.c b/src/gallium/drivers/i915/i915_prim_emit.c index dd997e2cf48..276e33d4b9d 100644 --- a/src/gallium/drivers/i915/i915_prim_emit.c +++ b/src/gallium/drivers/i915/i915_prim_emit.c @@ -144,7 +144,7 @@ emit_prim( struct draw_stage *stage, vertex_size = i915->current.vertex_info.size * 4; /* in bytes */ assert(vertex_size >= 12); /* never smaller than 12 bytes */ - if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) { + if (!BEGIN_BATCH( 1 + nr * vertex_size / 4)) { FLUSH_BATCH(NULL); /* Make sure state is re-emitted after a flush: @@ -152,7 +152,7 @@ emit_prim( struct draw_stage *stage, i915_update_derived( i915 ); i915_emit_hardware_state( i915 ); - if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) { + if (!BEGIN_BATCH( 1 + nr * vertex_size / 4)) { assert(0); return; } diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c index 3473c863970..fb4c0516dd8 100644 --- a/src/gallium/drivers/i915/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -465,7 +465,7 @@ draw_arrays_fallback(struct vbuf_render *render, if (i915->hardware_dirty) i915_emit_hardware_state(i915); - if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { + if (!BEGIN_BATCH(1 + (nr_indices + 1)/2)) { FLUSH_BATCH(NULL); /* Make sure state is re-emitted after a flush: @@ -474,7 +474,7 @@ draw_arrays_fallback(struct vbuf_render *render, i915_emit_hardware_state(i915); i915->vbo_flushed = 1; - if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { + if (!BEGIN_BATCH(1 + (nr_indices + 1)/2)) { assert(0); goto out; } @@ -514,7 +514,7 @@ i915_vbuf_render_draw_arrays(struct vbuf_render *render, if (i915->hardware_dirty) i915_emit_hardware_state(i915); - if (!BEGIN_BATCH(2, 0)) { + if (!BEGIN_BATCH(2)) { FLUSH_BATCH(NULL); /* Make sure state is re-emitted after a flush: @@ -523,7 +523,7 @@ i915_vbuf_render_draw_arrays(struct vbuf_render *render, i915_emit_hardware_state(i915); i915->vbo_flushed = 1; - if (!BEGIN_BATCH(2, 0)) { + if (!BEGIN_BATCH(2)) { assert(0); goto out; } @@ -635,7 +635,7 @@ i915_vbuf_render_draw_elements(struct vbuf_render *render, if (i915->hardware_dirty) i915_emit_hardware_state(i915); - if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { + if (!BEGIN_BATCH(1 + (nr_indices + 1)/2)) { FLUSH_BATCH(NULL); /* Make sure state is re-emitted after a flush: @@ -644,7 +644,7 @@ i915_vbuf_render_draw_elements(struct vbuf_render *render, i915_emit_hardware_state(i915); i915->vbo_flushed = 1; - if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { + if (!BEGIN_BATCH(1 + (nr_indices + 1)/2)) { assert(0); goto out; } diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c index cefc4d382f8..15350c0a5d7 100644 --- a/src/gallium/drivers/i915/i915_state_emit.c +++ b/src/gallium/drivers/i915/i915_state_emit.c @@ -403,13 +403,7 @@ void i915_emit_hardware_state(struct i915_context *i915 ) { unsigned batch_space; - /* XXX: there must be an easier way */ - const unsigned relocs = ( I915_TEX_UNITS + - 3 - ) * 3/2; /* plus 50% margin */ - uintptr_t save_ptr; - size_t save_relocs; if (I915_DBG_ON(DBG_ATOMS)) i915_dump_hardware_dirty(i915, __FUNCTION__); @@ -419,14 +413,13 @@ i915_emit_hardware_state(struct i915_context *i915 ) assert(i915_validate_state(i915, &batch_space)); } - if(!BEGIN_BATCH(batch_space, relocs)) { + if(!BEGIN_BATCH(batch_space)) { FLUSH_BATCH(NULL); assert(i915_validate_state(i915, &batch_space)); - assert(BEGIN_BATCH(batch_space, relocs)); + assert(BEGIN_BATCH(batch_space)); } save_ptr = (uintptr_t)i915->batch->ptr; - save_relocs = i915->batch->relocs; #define EMIT_ATOM(atom, hw_dirty) \ if (i915->hardware_dirty & hw_dirty) \ diff --git a/src/gallium/drivers/i915/i915_winsys.h b/src/gallium/drivers/i915/i915_winsys.h index 4ac2f5b9777..21cfdc9613e 100644 --- a/src/gallium/drivers/i915/i915_winsys.h +++ b/src/gallium/drivers/i915/i915_winsys.h @@ -76,7 +76,6 @@ struct i915_winsys_batchbuffer { size_t size; size_t relocs; - size_t max_relocs; /*@}*/ }; diff --git a/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c index 7cc5af89639..03aa1b1537a 100644 --- a/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c +++ b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c @@ -63,7 +63,6 @@ i915_drm_batchbuffer_create(struct i915_winsys *iws) batch->base.size = 0; batch->base.relocs = 0; - batch->base.max_relocs = 300;/*INTEL_DEFAULT_RELOCS;*/ batch->base.iws = iws; @@ -104,8 +103,6 @@ i915_drm_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch, unsigned offset; int ret = 0; - assert(batch->base.relocs < batch->base.max_relocs); - switch (usage) { case I915_USAGE_SAMPLER: write_domain = 0; diff --git a/src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c b/src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c index 3d0c1fa6224..3bf54011d9e 100644 --- a/src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c +++ b/src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c @@ -49,7 +49,6 @@ i915_sw_batchbuffer_create(struct i915_winsys *iws) batch->base.size = 0; batch->base.relocs = 0; - batch->base.max_relocs = 300;/*INTEL_DEFAULT_RELOCS;*/ batch->base.iws = iws; @@ -75,8 +74,6 @@ i915_sw_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch, struct i915_sw_batchbuffer *batch = i915_sw_batchbuffer(ibatch); int ret = 0; - assert(batch->base.relocs < batch->base.max_relocs); - if (usage == I915_USAGE_SAMPLER) { } else if (usage == I915_USAGE_RENDER) { -- 2.30.2