diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2008-01-25 17:01:01 +0100 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2008-01-25 17:01:01 +0100 |
commit | 756d52ec12c41ee90ee9598dc9028cc134806bd2 (patch) | |
tree | a112f0b2a933faccb8e759c3b039f8b492daa8ed /src/mesa/pipe/pipebuffer | |
parent | 7a207682aafc05c62cbc5851cc6c98c43aa3d9bd (diff) |
gallium: Simplify winsys buffer interface.
The properties of a buffer represented by struct pipe_buffer_handle are now
basically constant over its lifetime. The state tracker gets to deal with any
more complex buffer semantics it may need to provide.
Diffstat (limited to 'src/mesa/pipe/pipebuffer')
-rw-r--r-- | src/mesa/pipe/pipebuffer/pb_buffer_handle.c | 52 | ||||
-rw-r--r-- | src/mesa/pipe/pipebuffer/pb_buffer_handle.h | 4 | ||||
-rw-r--r-- | src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c | 3 | ||||
-rw-r--r-- | src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c | 4 |
4 files changed, 11 insertions, 52 deletions
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_handle.c b/src/mesa/pipe/pipebuffer/pb_buffer_handle.c index 5a5eaee7ac..9aeff976f3 100644 --- a/src/mesa/pipe/pipebuffer/pb_buffer_handle.c +++ b/src/mesa/pipe/pipebuffer/pb_buffer_handle.c @@ -46,8 +46,8 @@ static struct pipe_buffer_handle * buffer_handle_create(struct pipe_winsys *winsys, unsigned alignment, - unsigned flags, - unsigned hint) + unsigned usage, + unsigned size) { struct pipe_buffer_handle *handle; @@ -57,8 +57,8 @@ buffer_handle_create(struct pipe_winsys *winsys, handle->refcount = 1; handle->alignment = alignment; - handle->flags = flags; - handle->hint = hint; + handle->usage = usage; + handle->size = size; handle->buf = &null_buffer; @@ -73,7 +73,7 @@ buffer_handle_create_user(struct pipe_winsys *winsys, struct pipe_buffer_handle *handle; struct pipe_buffer *buf; - handle = buffer_handle_create(winsys, 1, 0, 0); + handle = buffer_handle_create(winsys, 1, 0, size); if(!handle) return NULL; @@ -129,46 +129,6 @@ buffer_handle_reference(struct pipe_winsys *winsys, } -static int -buffer_handle_subdata(struct pipe_winsys *winsys, - struct pipe_buffer_handle *handle, - unsigned long offset, - unsigned long size, - const void *data) -{ - void *map; - assert(handle); - assert(data); - map = buffer_handle_map(winsys, handle, PIPE_BUFFER_FLAG_WRITE); - if(map) { - memcpy((char *)map + offset, data, size); - buffer_handle_unmap(winsys, handle); - return 0; - } - return -1; -} - - -static int -buffer_handle_get_subdata(struct pipe_winsys *winsys, - struct pipe_buffer_handle *handle, - unsigned long offset, - unsigned long size, - void *data) -{ - void *map; - assert(handle); - assert(data); - map = buffer_handle_map(winsys, handle, PIPE_BUFFER_FLAG_READ); - if(map) { - memcpy(data, (char *)map + offset, size); - buffer_handle_unmap(winsys, handle); - return 0; - } - return -1; -} - - void buffer_handle_init_winsys(struct pipe_winsys *winsys) { @@ -177,6 +137,4 @@ buffer_handle_init_winsys(struct pipe_winsys *winsys) winsys->buffer_map = buffer_handle_map; winsys->buffer_unmap = buffer_handle_unmap; winsys->buffer_reference = buffer_handle_reference; - winsys->buffer_subdata = buffer_handle_subdata; - winsys->buffer_get_subdata = buffer_handle_get_subdata; } diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_handle.h b/src/mesa/pipe/pipebuffer/pb_buffer_handle.h index 076eec2fdc..34133c9fba 100644 --- a/src/mesa/pipe/pipebuffer/pb_buffer_handle.h +++ b/src/mesa/pipe/pipebuffer/pb_buffer_handle.h @@ -55,8 +55,8 @@ struct pipe_buffer_handle /** Allocation characteristics */ unsigned alignment; - unsigned flags; - unsigned hint; + unsigned usage; + unsigned size; /** * The actual buffer. diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c b/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c index e9bc34b4a4..d174f24e32 100644 --- a/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c +++ b/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c @@ -241,7 +241,8 @@ mm_bufmgr_create_from_buffer(struct pipe_buffer *buffer, mm->buffer = buffer; mm->map = buffer_map(mm->buffer, - PIPE_BUFFER_FLAG_READ | PIPE_BUFFER_FLAG_WRITE ); + PIPE_BUFFER_USAGE_CPU_READ | + PIPE_BUFFER_USAGE_CPU_WRITE); if(!mm->map) goto failure; diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c b/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c index ee6fa62500..e6a8c78668 100644 --- a/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c +++ b/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c @@ -246,8 +246,8 @@ pool_bufmgr_create(struct buffer_manager *provider, goto failure; pool->map = buffer_map(pool->buffer, - PIPE_BUFFER_FLAG_READ | - PIPE_BUFFER_FLAG_WRITE ); + PIPE_BUFFER_USAGE_CPU_READ | + PIPE_BUFFER_USAGE_CPU_WRITE); if(!pool->map) goto failure; |