diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2006-01-26 14:50:02 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2006-01-26 14:50:02 +0000 |
commit | 33ca04f3797ec93ba6d4e437d64a15475aaa96c1 (patch) | |
tree | b867203eaaa0b26a71f2204794c6cf8ee91b74f6 /src/mesa/drivers/dri/i915/intel_regions.c | |
parent | 398cb30c72cbc44723801d3e87b6b8571dfdebac (diff) |
Expand the buffer manager to include a notion of multiple pools within
a memory space. Allow some pools to be excluded from the upload/evict
processing, meaning that any buffers within those pools are effectively
fixed. Add a mechanism to create buffers in those pools.
This allows the legacy fixed front/depth/back buffers to be represented
in this scheme and will allow other future pinned buffers to be allocated
from fixed pools in such a way that they cannot fragment the rest of
the texture memory.
Diffstat (limited to 'src/mesa/drivers/dri/i915/intel_regions.c')
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_regions.c | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_regions.c b/src/mesa/drivers/dri/i915/intel_regions.c index 2709c068d0f..ff9dda6d936 100644 --- a/src/mesa/drivers/dri/i915/intel_regions.c +++ b/src/mesa/drivers/dri/i915/intel_regions.c @@ -102,6 +102,47 @@ void intel_region_release( struct intel_context *intel, } +struct intel_region *intel_region_create_static( struct intel_context *intel, + GLuint mem_type, + GLuint offset, + void *virtual, + GLuint cpp, + GLuint pitch, + GLuint height ) +{ + struct intel_region *region = calloc(sizeof(*region), 1); + GLuint size = cpp * pitch * height; + GLint pool; + + _mesa_printf("%s\n", __FUNCTION__); + + region->cpp = cpp; + region->pitch = pitch; + region->height = height; /* needed? */ + region->refcount = 1; + + /* Recipe for creating a static buffer - create a static pool with + * the right offset and size, generate a buffer and use a special + * call to bind it to all of the memory in that pool. + */ + pool = bmInitPool(intel->bm, offset, virtual, size, + (BM_MEM_AGP | + BM_NO_UPLOAD | + BM_NO_EVICT | + BM_NO_MOVE)); + if (pool < 0) { + _mesa_printf("bmInitPool failed for static region\n"); + exit(1); + } + + bmGenBuffers(intel->bm, 1, ®ion->buffer); + bmBufferStatic(intel->bm, region->buffer, size, pool); + + return region; +} + + + static void _mesa_copy_rect( GLubyte *dst, GLuint cpp, GLuint dst_pitch, @@ -243,11 +284,10 @@ void intel_region_copy( struct intel_context *intel, assert(src->cpp == dst->cpp); LOCK_HARDWARE(intel); - bmAddBuffer(intel->bm, list, dst->buffer, BM_WRITE, NULL, &dst_offset); - bmAddBuffer(intel->bm, list, src->buffer, BM_READ, NULL, &src_offset); + bmAddBuffer(list, dst->buffer, BM_WRITE, NULL, &dst_offset); + bmAddBuffer(list, src->buffer, BM_READ, NULL, &src_offset); - /* What I really want to do is query if both buffers are already - * uploaded: + /* Query if both buffers are already uploaded: */ if (bmValidateBufferList(intel->bm, list, BM_NO_EVICT|BM_NO_UPLOAD)) { intelEmitCopyBlitLocked(intel, @@ -293,7 +333,7 @@ void intel_region_fill( struct intel_context *intel, _mesa_printf("%s\n", __FUNCTION__); LOCK_HARDWARE(intel); - bmAddBuffer(intel->bm, list, dst->buffer, BM_WRITE, NULL, &dst_offset); + bmAddBuffer(list, dst->buffer, BM_WRITE, NULL, &dst_offset); if (bmValidateBufferList(intel->bm, list, BM_NO_EVICT)) { intelEmitFillBlitLocked(intel, |