diff options
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_blit.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_descriptors.c | 51 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.h | 2 |
4 files changed, 32 insertions, 25 deletions
diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index 4744154c7e2..1f2c4082dbc 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -556,7 +556,7 @@ void si_resource_copy_region(struct pipe_context *ctx, /* Fallback for buffers. */ if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) { - si_copy_buffer(sctx, dst, src, dstx, src_box->x, src_box->width); + si_copy_buffer(sctx, dst, src, dstx, src_box->x, src_box->width, false); return; } diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index d46f4e522e6..c9599617ede 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -1054,9 +1054,11 @@ static void si_invalidate_buffer(struct pipe_context *ctx, struct pipe_resource #define CP_DMA_MAX_BYTE_COUNT ((1 << 21) - 8) static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst, - unsigned offset, unsigned size, unsigned value) + unsigned offset, unsigned size, unsigned value, + bool is_framebuffer) { struct si_context *sctx = (struct si_context*)ctx; + unsigned flush_flags; if (!size) return; @@ -1081,12 +1083,15 @@ static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst, uint64_t va = r600_resource(dst)->gpu_address + offset; /* Flush the caches where the resource is bound. */ - /* XXX only flush the caches where the buffer is bound. */ - sctx->b.flags |= SI_CONTEXT_INV_TC_L1 | - SI_CONTEXT_INV_TC_L2 | - SI_CONTEXT_INV_KCACHE | - SI_CONTEXT_FLUSH_AND_INV_FRAMEBUFFER; - sctx->b.flags |= SI_CONTEXT_PS_PARTIAL_FLUSH; + if (is_framebuffer) + flush_flags = SI_CONTEXT_FLUSH_AND_INV_FRAMEBUFFER; + else + flush_flags = SI_CONTEXT_INV_TC_L1 | + SI_CONTEXT_INV_TC_L2 | + SI_CONTEXT_INV_KCACHE; + + sctx->b.flags |= SI_CONTEXT_PS_PARTIAL_FLUSH | + flush_flags; while (size) { unsigned byte_count = MIN2(size, CP_DMA_MAX_BYTE_COUNT); @@ -1120,17 +1125,16 @@ static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst, /* Flush the caches again in case the 3D engine has been prefetching * the resource. */ - /* XXX only flush the caches where the buffer is bound. */ - sctx->b.flags |= SI_CONTEXT_INV_TC_L1 | - SI_CONTEXT_INV_TC_L2 | - SI_CONTEXT_INV_KCACHE | - SI_CONTEXT_FLUSH_AND_INV_FRAMEBUFFER; + sctx->b.flags |= flush_flags; } void si_copy_buffer(struct si_context *sctx, struct pipe_resource *dst, struct pipe_resource *src, - uint64_t dst_offset, uint64_t src_offset, unsigned size) + uint64_t dst_offset, uint64_t src_offset, unsigned size, + bool is_framebuffer) { + unsigned flush_flags; + if (!size) return; @@ -1144,11 +1148,15 @@ void si_copy_buffer(struct si_context *sctx, src_offset += r600_resource(src)->gpu_address; /* Flush the caches where the resource is bound. */ - sctx->b.flags |= SI_CONTEXT_INV_TC_L1 | - SI_CONTEXT_INV_TC_L2 | - SI_CONTEXT_INV_KCACHE | - SI_CONTEXT_FLUSH_AND_INV_FRAMEBUFFER | - SI_CONTEXT_PS_PARTIAL_FLUSH; + if (is_framebuffer) + flush_flags = SI_CONTEXT_FLUSH_AND_INV_FRAMEBUFFER; + else + flush_flags = SI_CONTEXT_INV_TC_L1 | + SI_CONTEXT_INV_TC_L2 | + SI_CONTEXT_INV_KCACHE; + + sctx->b.flags |= SI_CONTEXT_PS_PARTIAL_FLUSH | + flush_flags; while (size) { unsigned sync_flags = 0; @@ -1180,10 +1188,9 @@ void si_copy_buffer(struct si_context *sctx, dst_offset += byte_count; } - sctx->b.flags |= SI_CONTEXT_INV_TC_L1 | - SI_CONTEXT_INV_TC_L2 | - SI_CONTEXT_INV_KCACHE | - SI_CONTEXT_FLUSH_AND_INV_FRAMEBUFFER; + /* Flush the caches again in case the 3D engine has been prefetching + * the resource. */ + sctx->b.flags |= flush_flags; } /* INIT/DEINIT */ diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 4d8fd65d981..38bff31e005 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -155,7 +155,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, void * /* Clear the NULL constant buffer, because loads should return zeros. */ sctx->b.clear_buffer(&sctx->b.b, sctx->null_const_buf.buffer, 0, - sctx->null_const_buf.buffer->width0, 0); + sctx->null_const_buf.buffer->width0, 0, false); } return &sctx->b.b; diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index 8927e50644b..3cd252c0e64 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -238,7 +238,7 @@ void si_release_all_descriptors(struct si_context *sctx); void si_all_descriptors_begin_new_cs(struct si_context *sctx); void si_copy_buffer(struct si_context *sctx, struct pipe_resource *dst, struct pipe_resource *src, - uint64_t dst_offset, uint64_t src_offset, unsigned size); + uint64_t dst_offset, uint64_t src_offset, unsigned size, bool is_framebuffer); void si_upload_const_buffer(struct si_context *sctx, struct r600_resource **rbuffer, const uint8_t *ptr, unsigned size, uint32_t *const_offset); |