summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2007-03-16 12:35:51 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2007-03-16 12:35:51 +0000
commit8649272b5f6d4c7907592557c85ffd722faf2388 (patch)
tree25b95c9fe46510f081ec6097d1e2e450c6500f6c
parent83b7647450b860f1e282d3db22edf206373583bc (diff)
Get indirect state emit working
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_cache.c25
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_state_dynamic.c4
2 files changed, 12 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i915tex/i915_cache.c b/src/mesa/drivers/dri/i915tex/i915_cache.c
index 45644d77e4..73511c3649 100644
--- a/src/mesa/drivers/dri/i915tex/i915_cache.c
+++ b/src/mesa/drivers/dri/i915tex/i915_cache.c
@@ -72,7 +72,7 @@ static void emit_load_indirect( struct intel_context *intel,
GLuint state_type,
GLuint force_load_flag,
GLuint offset,
- GLuint size )
+ GLuint dwords )
{
BEGIN_BATCH(3,0);
OUT_BATCH( _3DSTATE_LOAD_INDIRECT | state_type | (1<<14) | 1);
@@ -80,15 +80,15 @@ static void emit_load_indirect( struct intel_context *intel,
DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE,
DRM_BO_MASK_MEM | DRM_BO_FLAG_EXE,
( offset | force_load_flag | SIS0_BUFFER_VALID ) );
- OUT_BATCH( (size/4)-1 );
+ OUT_BATCH( dwords - 1 );
ADVANCE_BATCH();
}
static GLuint emit_packet( struct intel_context *intel,
- const struct i915_cache_packet *packet,
- GLuint size )
+ const struct i915_cache_packet *packet )
{
+ GLuint size = packet->nr_dwords * sizeof(GLuint);
GLuint segment = SEGMENT_OTHER_INDIRECT;
GLuint offset = intel->batch->segment_finish_offset[segment];
GLuint i;
@@ -113,6 +113,7 @@ static GLuint emit_packet( struct intel_context *intel,
packet->dword[packet->reloc[i].dword].u );
}
+
return offset;
}
@@ -207,14 +208,8 @@ static GLuint upload_cache( struct i915_cache *cache,
/* Copy data to the buffer and emit relocations:
*/
- item->offset = emit_packet( intel, packet, size );
+ item->offset = emit_packet( intel, packet );
- if (INTEL_DEBUG & DEBUG_STATE)
- _mesa_printf("upload %s: %d bytes to batchbuffer offset %x\n",
- cache->name,
- size,
- item->offset);
-
return item->offset;
}
@@ -233,7 +228,7 @@ void i915_cache_emit(struct i915_cache_context *cctx,
{
struct intel_context *intel = &cctx->i915->intel;
GLuint size = packet_size( packet );
-#if 0
+#if 1
GLuint hash = hash_packet( packet, size );
struct i915_cache *cache = &cctx->cache[packet->cache_id];
GLuint addr;
@@ -246,9 +241,11 @@ void i915_cache_emit(struct i915_cache_context *cctx,
* same as last time!
*/
if (addr != cache->last_addr) {
- emit_load_indirect( intel, cache->state_type,
+ emit_load_indirect( intel,
+ cache->state_type,
cache->force_load_flag,
- addr, size );
+ addr,
+ packet->nr_dwords );
cache->force_load_flag = 0;
cache->last_addr = addr;
diff --git a/src/mesa/drivers/dri/i915tex/i915_state_dynamic.c b/src/mesa/drivers/dri/i915tex/i915_state_dynamic.c
index 8239976ce5..0654a25922 100644
--- a/src/mesa/drivers/dri/i915tex/i915_state_dynamic.c
+++ b/src/mesa/drivers/dri/i915tex/i915_state_dynamic.c
@@ -63,7 +63,7 @@ static void set_dynamic_indirect( struct intel_context *intel,
const GLuint *src,
GLuint size )
{
-#if 0
+#if 1
struct i915_context *i915 = i915_context( &intel->ctx );
GLuint *dest = i915->dyn_indirect.buf + offset;
GLuint i;
@@ -356,8 +356,6 @@ static void emit_indirect( struct intel_context *intel )
struct i915_context *i915 = i915_context( &intel->ctx );
GLuint buf[I915_DYNAMIC_SIZE], count = 0;
- return;
-
CHECK( I915_DYNAMIC_MODES4, 1 );
CHECK( I915_DYNAMIC_DEPTHSCALE_0, 2 );
CHECK( I915_DYNAMIC_IAB, 1 );