diff options
-rw-r--r-- | src/gallium/auxiliary/util/u_upload_mgr.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index 9528495038c..4bb14d6218b 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -1,8 +1,8 @@ /************************************************************************** - * + * * Copyright 2009 VMware, Inc. * All Rights Reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -10,11 +10,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -22,7 +22,7 @@ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * **************************************************************************/ /* Helper utility for uploading user buffers & other data, and @@ -59,7 +59,7 @@ struct u_upload_mgr * u_upload_create(struct pipe_context *pipe, unsigned default_size, unsigned bind, enum pipe_resource_usage usage) { - struct u_upload_mgr *upload = CALLOC_STRUCT( u_upload_mgr ); + struct u_upload_mgr *upload = CALLOC_STRUCT(u_upload_mgr); if (!upload) return NULL; @@ -104,7 +104,8 @@ u_upload_clone(struct pipe_context *pipe, struct u_upload_mgr *upload) upload->usage); } -static void upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying) +static void +upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying) { if (!destroying && upload->map_persistent) return; @@ -124,30 +125,32 @@ static void upload_unmap_internal(struct u_upload_mgr *upload, boolean destroyin } -void u_upload_unmap( struct u_upload_mgr *upload ) +void +u_upload_unmap(struct u_upload_mgr *upload) { upload_unmap_internal(upload, FALSE); } -static void u_upload_release_buffer(struct u_upload_mgr *upload) +static void +u_upload_release_buffer(struct u_upload_mgr *upload) { /* Unmap and unreference the upload buffer. */ upload_unmap_internal(upload, TRUE); - pipe_resource_reference( &upload->buffer, NULL ); + pipe_resource_reference(&upload->buffer, NULL); } -void u_upload_destroy( struct u_upload_mgr *upload ) +void +u_upload_destroy(struct u_upload_mgr *upload) { - u_upload_release_buffer( upload ); - FREE( upload ); + u_upload_release_buffer(upload); + FREE(upload); } static void -u_upload_alloc_buffer(struct u_upload_mgr *upload, - unsigned min_size) +u_upload_alloc_buffer(struct u_upload_mgr *upload, unsigned min_size) { struct pipe_screen *screen = upload->pipe->screen; struct pipe_resource buffer; @@ -155,9 +158,9 @@ u_upload_alloc_buffer(struct u_upload_mgr *upload, /* Release the old buffer, if present: */ - u_upload_release_buffer( upload ); + u_upload_release_buffer(upload); - /* Allocate a new one: + /* Allocate a new one: */ size = align(MAX2(upload->default_size, min_size), 4096); @@ -232,7 +235,7 @@ u_upload_alloc(struct u_upload_mgr *upload, offset, buffer_size - offset, upload->map_flags, - &upload->transfer); + &upload->transfer); if (unlikely(!upload->map)) { upload->transfer = NULL; *out_offset = ~0; @@ -256,13 +259,14 @@ u_upload_alloc(struct u_upload_mgr *upload, upload->offset = offset + size; } -void u_upload_data(struct u_upload_mgr *upload, - unsigned min_out_offset, - unsigned size, - unsigned alignment, - const void *data, - unsigned *out_offset, - struct pipe_resource **outbuf) +void +u_upload_data(struct u_upload_mgr *upload, + unsigned min_out_offset, + unsigned size, + unsigned alignment, + const void *data, + unsigned *out_offset, + struct pipe_resource **outbuf) { uint8_t *ptr; |