[Mesa-dev] [PATCH 1/5] r600g: disable CP DMA on r7xx
Marek Olšák
maraeo at gmail.com
Tue Feb 26 13:41:05 PST 2013
also don't require dword alignment with CP DMA for buffer transfers, which
is a leftover from the days when we used streamout to copy buffers
NOTE: This is a candidate for the 9.1 branch.
---
src/gallium/drivers/r600/r600_blit.c | 3 +--
src/gallium/drivers/r600/r600_buffer.c | 7 ++++---
src/gallium/drivers/r600/r600_hw_context.c | 7 +------
src/gallium/drivers/r600/r600_pipe.c | 3 +++
src/gallium/drivers/r600/r600_pipe.h | 1 +
5 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 3e0d89c..0d879c9 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -508,8 +508,7 @@ void r600_copy_buffer(struct pipe_context *ctx, struct pipe_resource *dst, unsig
{
struct r600_context *rctx = (struct r600_context*)ctx;
- /* CP DMA doesn't work on R600 (flushing seems to be unreliable). */
- if (rctx->screen->info.drm_minor >= 27 && rctx->chip_class >= R700) {
+ if (rctx->screen->has_cp_dma) {
r600_cp_dma_copy_buffer(rctx, dst, dstx, src, src_box->x, src_box->width);
}
else if (rctx->screen->has_streamout &&
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 6df0d91..e0ac047 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -139,9 +139,10 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
}
else if ((usage & PIPE_TRANSFER_DISCARD_RANGE) &&
!(usage & PIPE_TRANSFER_UNSYNCHRONIZED) &&
- rctx->screen->has_streamout &&
- /* The buffer range must be aligned to 4. */
- box->x % 4 == 0 && box->width % 4 == 0) {
+ (rctx->screen->has_cp_dma ||
+ (rctx->screen->has_streamout &&
+ /* The buffer range must be aligned to 4 with streamout. */
+ box->x % 4 == 0 && box->width % 4 == 0))) {
assert(usage & PIPE_TRANSFER_WRITE);
/* Check if mapping this buffer would cause waiting for the GPU. */
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index ec098c1..6a87abc 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -1107,12 +1107,7 @@ void r600_cp_dma_copy_buffer(struct r600_context *rctx,
struct radeon_winsys_cs *cs = rctx->rings.gfx.cs;
assert(size);
- assert(rctx->chip_class != R600);
-
- /* CP DMA doesn't work on R600 (flushing seems to be unreliable). */
- if (rctx->chip_class == R600) {
- return;
- }
+ assert(rctx->screen->has_cp_dma);
dst_offset += r600_resource_va(&rctx->screen->screen, dst);
src_offset += r600_resource_va(&rctx->screen->screen, src);
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index f1019f4..e2d86e9 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -1111,6 +1111,9 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
break;
}
+ /* CP DMA doesn't work on R600-R700 (flushing seems to be unreliable). */
+ rscreen->has_cp_dma = rscreen->info.drm_minor >= 27 && rscreen->chip_class >= EVERGREEN;
+
if (r600_init_tiling(rscreen)) {
FREE(rscreen);
return NULL;
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 88b587e..2a5457e 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -236,6 +236,7 @@ struct r600_screen {
struct radeon_info info;
bool has_streamout;
bool has_msaa;
+ bool has_cp_dma;
enum r600_msaa_texture_mode msaa_texture_support;
bool use_hyperz;
struct r600_tiling_info tiling_info;
--
1.7.10.4
More information about the mesa-dev
mailing list