diff options
author | Marek Olšák <maraeo@gmail.com> | 2012-10-08 04:06:42 +0200 |
---|---|---|
committer | Marek Olšák <maraeo@gmail.com> | 2012-10-11 21:12:16 +0200 |
commit | 369e46888904c6d379b8b477d9242cff1608e30e (patch) | |
tree | 528b10f900f23af3acd22a0edcf50fde0eeee86e /src/gallium/winsys | |
parent | ec4c74a9dc10039d97ad24c4f16bd2400517991d (diff) |
gallium: unify transfer functions
"get_transfer + transfer_map" becomes "transfer_map".
"transfer_unmap + transfer_destroy" becomes "transfer_unmap".
transfer_map must create and return the transfer object and transfer_unmap
must destroy it.
transfer_map is successful if the returned buffer pointer is not NULL.
If transfer_map fails, the pointer to the transfer object remains unchanged
(i.e. doesn't have to be NULL).
Acked-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c index 51245766d1c..24e679dec48 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c @@ -90,17 +90,18 @@ wsw_dt_get_stride(struct wrapper_sw_displaytarget *wdt, unsigned *stride) struct pipe_context *pipe = wdt->winsys->pipe; struct pipe_resource *tex = wdt->tex; struct pipe_transfer *tr; + void *map; - tr = pipe_get_transfer(pipe, tex, 0, 0, - PIPE_TRANSFER_READ_WRITE, - 0, 0, wdt->tex->width0, wdt->tex->height0); - if (!tr) + map = pipe_transfer_map(pipe, tex, 0, 0, + PIPE_TRANSFER_READ_WRITE, + 0, 0, wdt->tex->width0, wdt->tex->height0, &tr); + if (!map) return FALSE; *stride = tr->stride; wdt->stride = tr->stride; - pipe->transfer_destroy(pipe, tr); + pipe->transfer_unmap(pipe, tr); return TRUE; } @@ -204,13 +205,9 @@ wsw_dt_map(struct sw_winsys *ws, assert(!wdt->transfer); - tr = pipe_get_transfer(pipe, tex, 0, 0, - PIPE_TRANSFER_READ_WRITE, - 0, 0, wdt->tex->width0, wdt->tex->height0); - if (!tr) - return NULL; - - ptr = pipe->transfer_map(pipe, tr); + ptr = pipe_transfer_map(pipe, tex, 0, 0, + PIPE_TRANSFER_READ_WRITE, + 0, 0, wdt->tex->width0, wdt->tex->height0, &tr); if (!ptr) goto err; @@ -226,7 +223,7 @@ wsw_dt_map(struct sw_winsys *ws, return wdt->ptr; err: - pipe->transfer_destroy(pipe, tr); + pipe->transfer_unmap(pipe, tr); return NULL; } @@ -245,7 +242,6 @@ wsw_dt_unmap(struct sw_winsys *ws, return; pipe->transfer_unmap(pipe, wdt->transfer); - pipe->transfer_destroy(pipe, wdt->transfer); pipe->flush(pipe, NULL); wdt->transfer = NULL; } |