diff options
author | Marek Olšák <[email protected]> | 2013-11-27 12:43:40 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-12-12 18:34:11 +0100 |
commit | 171e4842ec8be269d3eb7c6ad741fac576b8e7dd (patch) | |
tree | 70f5779d128dd741b8fae6dc38a8edd9c4a47518 /src/gallium | |
parent | 0aea43db9369a55de3d1e283b9d78f837ec53523 (diff) |
r600g: use common interfaces in buffer_transfer_unmap
i.e. dma_copy and resource_copy_region.
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_blit.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_buffer.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 6 |
5 files changed, 22 insertions, 14 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index a4a4e3e9451..065ac6f7a7a 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -3769,6 +3769,12 @@ static boolean evergreen_dma_blit(struct pipe_context *ctx, if (rctx->b.rings.dma.cs == NULL) { return FALSE; } + + if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) { + evergreen_dma_copy(rctx, dst, src, dst_x, src_box->x, src_box->width); + return TRUE; + } + if (src->format != dst->format) { return FALSE; } diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index f33bb43b8c6..8680f797a67 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -599,8 +599,8 @@ static void r600_clear_depth_stencil(struct pipe_context *ctx, r600_blitter_end(ctx); } -void r600_copy_buffer(struct pipe_context *ctx, struct pipe_resource *dst, unsigned dstx, - struct pipe_resource *src, const struct pipe_box *src_box) +static void r600_copy_buffer(struct pipe_context *ctx, struct pipe_resource *dst, unsigned dstx, + struct pipe_resource *src, const struct pipe_box *src_box) { struct r600_context *rctx = (struct r600_context*)ctx; diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 107538a86e0..8d5c255bcfd 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -196,24 +196,22 @@ static void r600_buffer_transfer_unmap(struct pipe_context *pipe, if (rtransfer->staging) { struct pipe_resource *dst, *src; unsigned soffset, doffset, size; + struct pipe_box box; dst = transfer->resource; src = &rtransfer->staging->b.b; size = transfer->box.width; doffset = transfer->box.x; soffset = rtransfer->offset + transfer->box.x % R600_MAP_BUFFER_ALIGNMENT; + + u_box_1d(soffset, size, &box); + /* Copy the staging buffer into the original one. */ - if (rctx->b.rings.dma.cs && !(size % 4) && !(doffset % 4) && !(soffset % 4)) { - if (rctx->screen->b.chip_class >= EVERGREEN) { - evergreen_dma_copy(rctx, dst, src, doffset, soffset, size); - } else { - r600_dma_copy(rctx, dst, src, doffset, soffset, size); - } + if (!(size % 4) && !(doffset % 4) && !(soffset % 4) && + rctx->b.dma_copy(pipe, dst, 0, doffset, 0, 0, src, 0, &box)) { + /* DONE. */ } else { - struct pipe_box box; - - u_box_1d(soffset, size, &box); - r600_copy_buffer(pipe, dst, doffset, src, &box); + pipe->resource_copy_region(pipe, dst, 0, doffset, 0, 0, src, 0, &box); } pipe_resource_reference((struct pipe_resource**)&rtransfer->staging, NULL); } diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index f0d4be48142..d58cd2e66c8 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -598,8 +598,6 @@ void evergreen_init_color_surface_rat(struct r600_context *rctx, void evergreen_update_db_shader_control(struct r600_context * rctx); /* r600_blit.c */ -void r600_copy_buffer(struct pipe_context *ctx, struct pipe_resource *dst, unsigned dstx, - struct pipe_resource *src, const struct pipe_box *src_box); void r600_init_blit_functions(struct r600_context *rctx); void r600_decompress_depth_textures(struct r600_context *rctx, struct r600_samplerview_state *textures); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 41e9c5dfbdb..b938c33f7ce 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -3149,6 +3149,12 @@ static boolean r600_dma_blit(struct pipe_context *ctx, if (rctx->b.rings.dma.cs == NULL) { return FALSE; } + + if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) { + r600_dma_copy(rctx, dst, src, dst_x, src_box->x, src_box->width); + return TRUE; + } + if (src->format != dst->format) { return FALSE; } |