diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2007-03-14 15:39:11 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2007-03-14 15:39:11 +0000 |
commit | 61c7591f24abe67ee4148d16ca30b9c6d5b6b4c6 (patch) | |
tree | 82b85c91e04f50f85e603da5ca28610d8051be0b | |
parent | 0b43da5227a85d2488df78d233b974ccf5f1afc5 (diff) |
Add intel_batchbuffer_set_reloc - add relocation at arbitary offset
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_batchbuffer.c | 32 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_batchbuffer.h | 6 |
2 files changed, 32 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c index 5d64344a90..acac17077d 100644 --- a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.c @@ -87,7 +87,8 @@ intel_dump_batchbuffer(struct intel_batchbuffer *batch, GLubyte *map) { GLuint *ptr = (GLuint *)map; GLuint count = batch->segment_finish_offset[0]; - GLuint buf = driBOOffset(batch->buffer); + GLuint buf0 = driBOOffset(batch->buffer); + GLuint buf = buf0;; fprintf(stderr, "\n\n\nIMMEDIATE: (%d)\n", count / 4); dump( buf, ptr, count/4 ); @@ -95,6 +96,7 @@ intel_dump_batchbuffer(struct intel_batchbuffer *batch, GLubyte *map) count = batch->segment_finish_offset[1] - batch->segment_start_offset[1]; ptr = (GLuint *)(map + batch->segment_start_offset[1]); + buf = buf0 + batch->segment_start_offset[1]; fprintf(stderr, "\n\n\nDYNAMIC: (%d)\n", count / 4); dump( buf, ptr, count/4 ); @@ -102,6 +104,7 @@ intel_dump_batchbuffer(struct intel_batchbuffer *batch, GLubyte *map) count = batch->segment_finish_offset[2] - batch->segment_start_offset[2]; ptr = (GLuint *)(map + batch->segment_start_offset[2]); + buf = buf0 + batch->segment_start_offset[2]; fprintf(stderr, "\n\n\nOTHER INDIRECT: (%d)\n", count / 4); dump( buf, ptr, count/4 ); @@ -232,6 +235,8 @@ do_flush_locked(struct intel_batchbuffer *batch, struct buffer_reloc *r = &batch->reloc[i]; ptr[r->offset / 4] = driBOOffset(r->buf) + r->delta; + _mesa_printf("reloc offset %x value 0x%x + 0x%x\n", + r->offset, driBOOffset(r->buf), r->delta); } /* if (INTEL_DEBUG & DEBUG_BATCH) */ @@ -358,12 +363,13 @@ intel_batchbuffer_finish(struct intel_batchbuffer *batch) /* This is the only way buffers get added to the validate list. */ GLboolean -intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, - GLuint segment, - struct _DriBufferObject *buffer, - GLuint flags, GLuint mask, GLuint delta) +intel_batchbuffer_set_reloc(struct intel_batchbuffer *batch, + GLuint offset, + struct _DriBufferObject *buffer, + GLuint flags, GLuint mask, GLuint delta) { assert(batch->nr_relocs < MAX_RELOCS); + assert((offset & 3) == 0); if (buffer != batch->buffer) driBOAddListItem(&batch->list, buffer, flags, mask); @@ -375,10 +381,24 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, driBOReference(buffer); r->buf = buffer; - r->offset = batch->segment_finish_offset[segment]; + r->offset = offset; r->delta = delta; } + return GL_TRUE; +} + + +GLboolean +intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, + GLuint segment, + struct _DriBufferObject *buffer, + GLuint flags, GLuint mask, GLuint delta) +{ + intel_batchbuffer_set_reloc( batch, + batch->segment_finish_offset[segment], + buffer, flags, mask, delta ); + batch->segment_finish_offset[segment] += 4; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h index 8b7f98852b..6bbbf336c0 100644 --- a/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/i915tex/intel_batchbuffer.h @@ -84,6 +84,12 @@ void intel_batchbuffer_release_space(struct intel_batchbuffer *batch, GLuint segment, GLuint bytes); +GLboolean +intel_batchbuffer_set_reloc(struct intel_batchbuffer *batch, + GLuint offset, + struct _DriBufferObject *buffer, + GLuint flags, GLuint mask, GLuint delta); + GLboolean intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, GLuint segment, struct _DriBufferObject *buffer, |