diff options
author | Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com> | 2015-12-11 13:09:06 -0800 |
---|---|---|
committer | Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com> | 2015-12-11 13:09:06 -0800 |
commit | 21d5e52da862af7e6f4509ae70667b12d2280b47 (patch) | |
tree | 85cf39a299a117bc2212596be4dbd2463011b41f /src/gallium/drivers/radeonsi/si_cp_dma.c | |
parent | 6ae4e59faca7875322a9a8a64e9d7b4a5a87ed48 (diff) | |
parent | c51f133197437d01696abd9513fbcda4b16b897c (diff) | |
download | external_mesa3d-21d5e52da862af7e6f4509ae70667b12d2280b47.zip external_mesa3d-21d5e52da862af7e6f4509ae70667b12d2280b47.tar.gz external_mesa3d-21d5e52da862af7e6f4509ae70667b12d2280b47.tar.bz2 |
Merge ../mesa into vulkan
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_cp_dma.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_cp_dma.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/gallium/drivers/radeonsi/si_cp_dma.c b/src/gallium/drivers/radeonsi/si_cp_dma.c index 0bf85a0..dc62415 100644 --- a/src/gallium/drivers/radeonsi/si_cp_dma.c +++ b/src/gallium/drivers/radeonsi/si_cp_dma.c @@ -176,7 +176,7 @@ static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst, /* Fallback for unaligned clears. */ if (offset % 4 != 0 || size % 4 != 0) { - uint8_t *map = sctx->b.ws->buffer_map(r600_resource(dst)->cs_buf, + uint8_t *map = sctx->b.ws->buffer_map(r600_resource(dst)->buf, sctx->b.gfx.cs, PIPE_TRANSFER_WRITE); map += offset; @@ -273,22 +273,26 @@ void si_copy_buffer(struct si_context *sctx, dst_offset += r600_resource(dst)->gpu_address; src_offset += r600_resource(src)->gpu_address; - /* If the size is not aligned, we must add a dummy copy at the end - * just to align the internal counter. Otherwise, the DMA engine - * would slow down by an order of magnitude for following copies. - */ - if (size % CP_DMA_ALIGNMENT) - realign_size = CP_DMA_ALIGNMENT - (size % CP_DMA_ALIGNMENT); - - /* If the copy begins unaligned, we must start copying from the next - * aligned block and the skipped part should be copied after everything - * else has been copied. Only the src alignment matters, not dst. - */ - if (src_offset % CP_DMA_ALIGNMENT) { - skipped_size = CP_DMA_ALIGNMENT - (src_offset % CP_DMA_ALIGNMENT); - /* The main part will be skipped if the size is too small. */ - skipped_size = MIN2(skipped_size, size); - size -= skipped_size; + /* The workarounds aren't needed on Fiji and beyond. */ + if (sctx->b.family <= CHIP_CARRIZO || + sctx->b.family == CHIP_STONEY) { + /* If the size is not aligned, we must add a dummy copy at the end + * just to align the internal counter. Otherwise, the DMA engine + * would slow down by an order of magnitude for following copies. + */ + if (size % CP_DMA_ALIGNMENT) + realign_size = CP_DMA_ALIGNMENT - (size % CP_DMA_ALIGNMENT); + + /* If the copy begins unaligned, we must start copying from the next + * aligned block and the skipped part should be copied after everything + * else has been copied. Only the src alignment matters, not dst. + */ + if (src_offset % CP_DMA_ALIGNMENT) { + skipped_size = CP_DMA_ALIGNMENT - (src_offset % CP_DMA_ALIGNMENT); + /* The main part will be skipped if the size is too small. */ + skipped_size = MIN2(skipped_size, size); + size -= skipped_size; + } } /* Flush the caches. */ |