[Mesa-dev] [PATCH 072/140] radeonsi/gfx9: enable SDMA buffer copying & clearing
Marek Olšák
maraeo at gmail.com
Mon Mar 20 22:43:22 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/drivers/radeonsi/cik_sdma.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/cik_sdma.c b/src/gallium/drivers/radeonsi/cik_sdma.c
index fdcf22f..500afb0 100644
--- a/src/gallium/drivers/radeonsi/cik_sdma.c
+++ b/src/gallium/drivers/radeonsi/cik_sdma.c
@@ -50,21 +50,21 @@ static void cik_sdma_copy_buffer(struct si_context *ctx,
src_offset += rsrc->gpu_address;
ncopy = DIV_ROUND_UP(size, CIK_SDMA_COPY_MAX_SIZE);
r600_need_dma_space(&ctx->b, ncopy * 7, rdst, rsrc);
for (i = 0; i < ncopy; i++) {
csize = MIN2(size, CIK_SDMA_COPY_MAX_SIZE);
radeon_emit(cs, CIK_SDMA_PACKET(CIK_SDMA_OPCODE_COPY,
CIK_SDMA_COPY_SUB_OPCODE_LINEAR,
0));
- radeon_emit(cs, csize);
+ radeon_emit(cs, ctx->b.chip_class >= GFX9 ? csize - 1 : csize);
radeon_emit(cs, 0); /* src/dst endian swap */
radeon_emit(cs, src_offset);
radeon_emit(cs, src_offset >> 32);
radeon_emit(cs, dst_offset);
radeon_emit(cs, dst_offset >> 32);
dst_offset += csize;
src_offset += csize;
size -= csize;
}
}
@@ -96,21 +96,21 @@ static void cik_sdma_clear_buffer(struct pipe_context *ctx,
ncopy = DIV_ROUND_UP(size, CIK_SDMA_COPY_MAX_SIZE);
r600_need_dma_space(&sctx->b, ncopy * 5, rdst, NULL);
for (i = 0; i < ncopy; i++) {
csize = MIN2(size, CIK_SDMA_COPY_MAX_SIZE);
radeon_emit(cs, CIK_SDMA_PACKET(CIK_SDMA_PACKET_CONSTANT_FILL, 0,
0x8000 /* dword copy */));
radeon_emit(cs, offset);
radeon_emit(cs, offset >> 32);
radeon_emit(cs, clear_value);
- radeon_emit(cs, csize);
+ radeon_emit(cs, sctx->b.chip_class >= GFX9 ? csize - 1 : csize);
offset += csize;
size -= csize;
}
}
static unsigned minify_as_blocks(unsigned width, unsigned level, unsigned blk_w)
{
width = u_minify(width, level);
return DIV_ROUND_UP(width, blk_w);
}
@@ -527,21 +527,22 @@ static void cik_sdma_copy(struct pipe_context *ctx,
struct si_context *sctx = (struct si_context *)ctx;
if (!sctx->b.dma.cs)
goto fallback;
if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
cik_sdma_copy_buffer(sctx, dst, src, dstx, src_box->x, src_box->width);
return;
}
- if (cik_sdma_copy_texture(sctx, dst, dst_level, dstx, dsty, dstz,
+ if ((sctx->b.chip_class == CIK || sctx->b.chip_class == VI) &&
+ cik_sdma_copy_texture(sctx, dst, dst_level, dstx, dsty, dstz,
src, src_level, src_box))
return;
fallback:
si_resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
src, src_level, src_box);
}
void cik_init_sdma_functions(struct si_context *sctx)
{
--
2.7.4
More information about the mesa-dev
mailing list