From 369e46888904c6d379b8b477d9242cff1608e30e Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 8 Oct 2012 04:06:42 +0200 Subject: 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 --- src/gallium/auxiliary/vl/vl_idct.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/gallium/auxiliary/vl/vl_idct.c') diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index f848a78d18a..5adc72f7db6 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -713,28 +713,21 @@ vl_idct_upload_matrix(struct pipe_context *pipe, float scale) if (!matrix) goto error_matrix; - buf_transfer = pipe->get_transfer - ( - pipe, matrix, - 0, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE, - &rect - ); - if (!buf_transfer) - goto error_transfer; - - pitch = buf_transfer->stride / sizeof(float); - - f = pipe->transfer_map(pipe, buf_transfer); + f = pipe->transfer_map(pipe, matrix, 0, + PIPE_TRANSFER_WRITE | + PIPE_TRANSFER_DISCARD_RANGE, + &rect, &buf_transfer); if (!f) goto error_map; + pitch = buf_transfer->stride / sizeof(float); + for(i = 0; i < VL_BLOCK_HEIGHT; ++i) for(j = 0; j < VL_BLOCK_WIDTH; ++j) // transpose and scale f[i * pitch + j] = ((const float (*)[8])const_matrix)[j][i] * scale; pipe->transfer_unmap(pipe, buf_transfer); - pipe->transfer_destroy(pipe, buf_transfer); memset(&sv_templ, 0, sizeof(sv_templ)); u_sampler_view_default_template(&sv_templ, matrix, matrix->format); @@ -746,9 +739,6 @@ vl_idct_upload_matrix(struct pipe_context *pipe, float scale) return sv; error_map: - pipe->transfer_destroy(pipe, buf_transfer); - -error_transfer: pipe_resource_reference(&matrix, NULL); error_matrix: -- cgit v1.2.3