diff options
author | Marek Olšák <[email protected]> | 2012-10-08 04:06:42 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-10-11 21:12:16 +0200 |
commit | 369e46888904c6d379b8b477d9242cff1608e30e (patch) | |
tree | 528b10f900f23af3acd22a0edcf50fde0eeee86e /src/gallium/state_trackers/xa | |
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 <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/xa')
-rw-r--r-- | src/gallium/state_trackers/xa/xa_context.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c index 2e9806bb0a9..93dae137ba1 100644 --- a/src/gallium/state_trackers/xa/xa_context.c +++ b/src/gallium/state_trackers/xa/xa_context.c @@ -103,15 +103,11 @@ xa_surface_dma(struct xa_context *ctx, w = boxes->x2 - boxes->x1; h = boxes->y2 - boxes->y1; - transfer = pipe_get_transfer(pipe, srf->tex, 0, 0, - transfer_direction, boxes->x1, boxes->y1, - w, h); - if (!transfer) - return -XA_ERR_NORES; - - map = pipe_transfer_map(ctx->pipe, transfer); + map = pipe_transfer_map(pipe, srf->tex, 0, 0, + transfer_direction, boxes->x1, boxes->y1, + w, h, &transfer); if (!map) - goto out_no_map; + return -XA_ERR_NORES; if (to_surface) { util_copy_rect(map, srf->tex->format, transfer->stride, @@ -122,14 +118,10 @@ xa_surface_dma(struct xa_context *ctx, 0); } pipe->transfer_unmap(pipe, transfer); - pipe->transfer_destroy(pipe, transfer); if (to_surface) pipe->flush(pipe, &ctx->last_fence); } return XA_ERR_NONE; - out_no_map: - pipe->transfer_destroy(pipe, transfer); - return -XA_ERR_NORES; } XA_EXPORT void * @@ -154,15 +146,12 @@ xa_surface_map(struct xa_context *ctx, if (!transfer_direction) return NULL; - srf->transfer = pipe_get_transfer(pipe, srf->tex, 0, 0, - transfer_direction, 0, 0, - srf->tex->width0, srf->tex->height0); - if (!srf->transfer) - return NULL; - - map = pipe_transfer_map(pipe, srf->transfer); + map = pipe_transfer_map(pipe, srf->tex, 0, 0, + transfer_direction, 0, 0, + srf->tex->width0, srf->tex->height0, + &srf->transfer); if (!map) - pipe->transfer_destroy(pipe, srf->transfer); + return NULL; srf->mapping_pipe = pipe; return map; @@ -175,7 +164,6 @@ xa_surface_unmap(struct xa_surface *srf) struct pipe_context *pipe = srf->mapping_pipe; pipe->transfer_unmap(pipe, srf->transfer); - pipe->transfer_destroy(pipe, srf->transfer); srf->transfer = NULL; } } |