summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/vega
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-10-08 04:06:42 +0200
committerMarek Olšák <[email protected]>2012-10-11 21:12:16 +0200
commit369e46888904c6d379b8b477d9242cff1608e30e (patch)
tree528b10f900f23af3acd22a0edcf50fde0eeee86e /src/gallium/state_trackers/vega
parentec4c74a9dc10039d97ad24c4f16bd2400517991d (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/vega')
-rw-r--r--src/gallium/state_trackers/vega/api_filters.c10
-rw-r--r--src/gallium/state_trackers/vega/api_images.c12
-rw-r--r--src/gallium/state_trackers/vega/image.c23
-rw-r--r--src/gallium/state_trackers/vega/paint.c10
4 files changed, 30 insertions, 25 deletions
diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c
index afa5213d9a8..f5856db4405 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -78,15 +78,15 @@ static INLINE struct pipe_resource *create_texture_1d(struct vg_context *ctx,
tex = screen->resource_create(screen, &templ);
{ /* upload color_data */
- struct pipe_transfer *transfer =
- pipe_get_transfer(pipe, tex,
+ struct pipe_transfer *transfer;
+ void *map =
+ pipe_transfer_map(pipe, tex,
0, 0,
PIPE_TRANSFER_READ_WRITE ,
- 0, 0, tex->width0, tex->height0);
- void *map = pipe->transfer_map(pipe, transfer);
+ 0, 0, tex->width0, tex->height0,
+ &transfer);
memcpy(map, color_data, sizeof(VGint)*color_data_len);
pipe->transfer_unmap(pipe, transfer);
- pipe->transfer_destroy(pipe, transfer);
}
return tex;
diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c
index 2cb5622f817..300868c252c 100644
--- a/src/gallium/state_trackers/vega/api_images.c
+++ b/src/gallium/state_trackers/vega/api_images.c
@@ -442,24 +442,26 @@ void vegaReadPixels(void * data, VGint dataStride,
{
VGint y = (stfb->height - sy) - 1, yStep = -1;
struct pipe_transfer *transfer;
+ void *map;
- transfer = pipe_get_transfer(pipe, strb->texture, 0, 0,
- PIPE_TRANSFER_READ,
- 0, 0, sx + width, stfb->height - sy);
+ map = pipe_transfer_map(pipe, strb->texture, 0, 0,
+ PIPE_TRANSFER_READ,
+ 0, 0, sx + width, stfb->height - sy,
+ &transfer);
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
#if 0
debug_printf("%d-%d == %d\n", sy, height, y);
#endif
- pipe_get_tile_rgba(pipe, transfer, sx, y, width, 1, df);
+ pipe_get_tile_rgba(transfer, map, sx, y, width, 1, df);
y += yStep;
_vega_pack_rgba_span_float(ctx, width, temp, dataFormat,
dst + yoffset + xoffset);
dst += dataStride;
}
- pipe->transfer_destroy(pipe, transfer);
+ pipe->transfer_unmap(pipe, transfer);
}
}
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index c42315e4bba..74a84e0a81d 100644
--- a/src/gallium/state_trackers/vega/image.c
+++ b/src/gallium/state_trackers/vega/image.c
@@ -418,17 +418,19 @@ void image_sub_data(struct vg_image *image,
}
{ /* upload color_data */
- struct pipe_transfer *transfer = pipe_get_transfer(
- pipe, texture, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0);
+ struct pipe_transfer *transfer;
+ void *map = pipe_transfer_map(pipe, texture, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ texture->width0, texture->height0,
+ &transfer);
src += (dataStride * yoffset);
for (i = 0; i < height; i++) {
_vega_unpack_float_span_rgba(ctx, width, xoffset, src, dataFormat, temp);
- pipe_put_tile_rgba(pipe, transfer, x+image->x, y+image->y, width, 1, df);
+ pipe_put_tile_rgba(transfer, map, x+image->x, y+image->y, width, 1, df);
y += yStep;
src += dataStride;
}
- pipe->transfer_destroy(pipe, transfer);
+ pipe->transfer_unmap(pipe, transfer);
}
}
@@ -448,25 +450,26 @@ void image_get_sub_data(struct vg_image * image,
VGubyte *dst = (VGubyte *)data;
{
- struct pipe_transfer *transfer =
- pipe_get_transfer(pipe,
+ struct pipe_transfer *transfer;
+ void *map =
+ pipe_transfer_map(pipe,
image->sampler_view->texture, 0, 0,
PIPE_TRANSFER_READ,
0, 0,
image->x + image->width,
- image->y + image->height);
+ image->y + image->height, &transfer);
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
#if 0
debug_printf("%d-%d == %d\n", sy, height, y);
#endif
- pipe_get_tile_rgba(pipe, transfer, sx+image->x, y, width, 1, df);
+ pipe_get_tile_rgba(transfer, map, sx+image->x, y, width, 1, df);
y += yStep;
_vega_pack_rgba_span_float(ctx, width, temp, dataFormat, dst);
dst += dataStride;
}
- pipe->transfer_destroy(pipe, transfer);
+ pipe->transfer_unmap(pipe, transfer);
}
}
diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c
index 40b4b2502f1..f73e60c9e6d 100644
--- a/src/gallium/state_trackers/vega/paint.c
+++ b/src/gallium/state_trackers/vega/paint.c
@@ -160,13 +160,13 @@ static INLINE struct pipe_resource *create_gradient_texture(struct vg_paint *p)
tex = screen->resource_create(screen, &templ);
{ /* upload color_data */
- struct pipe_transfer *transfer =
- pipe_get_transfer(p->base.ctx->pipe, tex, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0, 1024, 1);
- void *map = pipe->transfer_map(pipe, transfer);
+ struct pipe_transfer *transfer;
+ void *map =
+ pipe_transfer_map(p->base.ctx->pipe, tex, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0, 1024, 1,
+ &transfer);
memcpy(map, p->gradient.color_data, sizeof(VGint)*1024);
pipe->transfer_unmap(pipe, transfer);
- pipe->transfer_destroy(pipe, transfer);
}
return tex;