[Mesa-dev] [PATCH 3/3] radeonsi: don't flush DB for fast color clears

Nicolai Hähnle nhaehnle at gmail.com
Wed Apr 27 23:45:18 UTC 2016


r600_screen_clear_buffer is always called with last parameter true, also 
for the initial HTILE clear, so that doesn't seem quite right to me.

Nicolai

On 22.04.2016 03:52, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>   src/gallium/drivers/r600/r600_blit.c          |  2 +-
>   src/gallium/drivers/radeon/r600_pipe_common.c |  4 ++--
>   src/gallium/drivers/radeon/r600_pipe_common.h |  4 ++--
>   src/gallium/drivers/radeonsi/si_cp_dma.c      | 23 ++++++++++++-----------
>   src/gallium/drivers/radeonsi/si_pipe.h        |  2 +-
>   5 files changed, 18 insertions(+), 17 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
> index 2d30807..a7ed026 100644
> --- a/src/gallium/drivers/r600/r600_blit.c
> +++ b/src/gallium/drivers/r600/r600_blit.c
> @@ -582,7 +582,7 @@ static void r600_copy_global_buffer(struct pipe_context *ctx,
>
>   static void r600_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,
>   			      uint64_t offset, uint64_t size, unsigned value,
> -			      bool is_framebuffer)
> +			      bool is_color_meta)
>   {
>   	struct r600_context *rctx = (struct r600_context*)ctx;
>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 929fecb..9a2a956 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -984,12 +984,12 @@ bool r600_can_dump_shader(struct r600_common_screen *rscreen,
>
>   void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_resource *dst,
>   			      uint64_t offset, uint64_t size, unsigned value,
> -			      bool is_framebuffer)
> +			      bool is_color_meta)
>   {
>   	struct r600_common_context *rctx = (struct r600_common_context*)rscreen->aux_context;
>
>   	pipe_mutex_lock(rscreen->aux_context_lock);
> -	rctx->clear_buffer(&rctx->b, dst, offset, size, value, is_framebuffer);
> +	rctx->clear_buffer(&rctx->b, dst, offset, size, value, is_color_meta);
>   	rscreen->aux_context->flush(rscreen->aux_context, NULL, 0);
>   	pipe_mutex_unlock(rscreen->aux_context_lock);
>   }
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
> index 44ab675..0283fd2 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
> @@ -513,7 +513,7 @@ struct r600_common_context {
>
>   	void (*clear_buffer)(struct pipe_context *ctx, struct pipe_resource *dst,
>   			     uint64_t offset, uint64_t size, unsigned value,
> -			     bool is_framebuffer);
> +			     bool is_color_meta);
>
>   	void (*blit_decompress_depth)(struct pipe_context *ctx,
>   				      struct r600_texture *texture,
> @@ -585,7 +585,7 @@ bool r600_can_dump_shader(struct r600_common_screen *rscreen,
>   			  unsigned processor);
>   void r600_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_resource *dst,
>   			      uint64_t offset, uint64_t size, unsigned value,
> -			      bool is_framebuffer);
> +			      bool is_color_meta);
>   struct pipe_resource *r600_resource_create_common(struct pipe_screen *screen,
>   						  const struct pipe_resource *templ);
>   const char *r600_get_llvm_processor_name(enum radeon_family family);
> diff --git a/src/gallium/drivers/radeonsi/si_cp_dma.c b/src/gallium/drivers/radeonsi/si_cp_dma.c
> index bca9cc5..14224fa 100644
> --- a/src/gallium/drivers/radeonsi/si_cp_dma.c
> +++ b/src/gallium/drivers/radeonsi/si_cp_dma.c
> @@ -107,19 +107,20 @@ static void si_emit_cp_dma_clear_buffer(struct si_context *sctx,
>   	}
>   }
>
> -static unsigned get_flush_flags(struct si_context *sctx, bool is_framebuffer)
> +static unsigned get_flush_flags(struct si_context *sctx, bool is_color_meta)
>   {
> -	if (is_framebuffer)
> -		return SI_CONTEXT_FLUSH_AND_INV_FRAMEBUFFER;
> +	if (is_color_meta)
> +		return SI_CONTEXT_FLUSH_AND_INV_CB |
> +		       SI_CONTEXT_FLUSH_AND_INV_CB_META;
>
>   	return SI_CONTEXT_INV_SMEM_L1 |
>   	       SI_CONTEXT_INV_VMEM_L1 |
>   	       (sctx->b.chip_class == SI ? SI_CONTEXT_INV_GLOBAL_L2 : 0);
>   }
>
> -static unsigned get_tc_l2_flag(struct si_context *sctx, bool is_framebuffer)
> +static unsigned get_tc_l2_flag(struct si_context *sctx, bool is_color_meta)
>   {
> -	return is_framebuffer || sctx->b.chip_class == SI ? 0 : CIK_CP_DMA_USE_L2;
> +	return is_color_meta || sctx->b.chip_class == SI ? 0 : CIK_CP_DMA_USE_L2;
>   }
>
>   static void si_cp_dma_prepare(struct si_context *sctx, struct pipe_resource *dst,
> @@ -159,11 +160,11 @@ static void si_cp_dma_prepare(struct si_context *sctx, struct pipe_resource *dst
>
>   static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,
>   			    uint64_t offset, uint64_t size, unsigned value,
> -			    bool is_framebuffer)
> +			    bool is_color_meta)
>   {
>   	struct si_context *sctx = (struct si_context*)ctx;
> -	unsigned tc_l2_flag = get_tc_l2_flag(sctx, is_framebuffer);
> -	unsigned flush_flags = get_flush_flags(sctx, is_framebuffer);
> +	unsigned tc_l2_flag = get_tc_l2_flag(sctx, is_color_meta);
> +	unsigned flush_flags = get_flush_flags(sctx, is_color_meta);
>
>   	if (!size)
>   		return;
> @@ -250,13 +251,13 @@ static void si_cp_dma_realign_engine(struct si_context *sctx, unsigned size)
>   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,
> -		    bool is_framebuffer)
> +		    bool is_color_meta)
>   {
>   	uint64_t main_dst_offset, main_src_offset;
>   	unsigned skipped_size = 0;
>   	unsigned realign_size = 0;
> -	unsigned tc_l2_flag = get_tc_l2_flag(sctx, is_framebuffer);
> -	unsigned flush_flags = get_flush_flags(sctx, is_framebuffer);
> +	unsigned tc_l2_flag = get_tc_l2_flag(sctx, is_color_meta);
> +	unsigned flush_flags = get_flush_flags(sctx, is_color_meta);
>
>   	if (!size)
>   		return;
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
> index 13946a5..bfdbf4d 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.h
> +++ b/src/gallium/drivers/radeonsi/si_pipe.h
> @@ -349,7 +349,7 @@ void si_resource_copy_region(struct pipe_context *ctx,
>   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,
> -		    bool is_framebuffer);
> +		    bool is_color_meta);
>   void si_init_cp_dma_functions(struct si_context *sctx);
>
>   /* si_debug.c */
>


More information about the mesa-dev mailing list