diff options
author | Marek Olšák <[email protected]> | 2019-02-12 15:03:13 -0500 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-04-23 11:36:33 -0400 |
commit | c59d238bb04a1cbbc01b31fabdb7d93306788110 (patch) | |
tree | b0f0985fa68de895f2c007a599fbbd95b5b5603c /src/gallium/drivers/radeonsi/si_cp_dma.c | |
parent | 694e320643f7fc6a4f1a9cf3e4ac274c37cccdfb (diff) |
radeonsi: add si_cp_copy_data
Tested-by: Dieter Nützel <[email protected]>
Acked-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_cp_dma.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_cp_dma.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_cp_dma.c b/src/gallium/drivers/radeonsi/si_cp_dma.c index f349325202c..404117d1813 100644 --- a/src/gallium/drivers/radeonsi/si_cp_dma.c +++ b/src/gallium/drivers/radeonsi/si_cp_dma.c @@ -606,3 +606,31 @@ void si_cp_write_data(struct si_context *sctx, struct si_resource *buf, radeon_emit(cs, va >> 32); radeon_emit_array(cs, (const uint32_t*)data, size/4); } + +void si_cp_copy_data(struct si_context *sctx, + unsigned dst_sel, struct si_resource *dst, unsigned dst_offset, + unsigned src_sel, struct si_resource *src, unsigned src_offset) +{ + struct radeon_cmdbuf *cs = sctx->gfx_cs; + + if (dst) { + radeon_add_to_buffer_list(sctx, cs, dst, + RADEON_USAGE_WRITE, RADEON_PRIO_CP_DMA); + } + if (src) { + radeon_add_to_buffer_list(sctx, cs, src, + RADEON_USAGE_READ, RADEON_PRIO_CP_DMA); + } + + uint64_t dst_va = (dst ? dst->gpu_address : 0ull) + dst_offset; + uint64_t src_va = (src ? src->gpu_address : 0ull) + src_offset; + + radeon_emit(cs, PKT3(PKT3_COPY_DATA, 4, 0)); + radeon_emit(cs, COPY_DATA_SRC_SEL(src_sel) | + COPY_DATA_DST_SEL(dst_sel) | + COPY_DATA_WR_CONFIRM); + radeon_emit(cs, src_va); + radeon_emit(cs, src_va >> 32); + radeon_emit(cs, dst_va); + radeon_emit(cs, dst_va >> 32); +} |