[Mesa-dev] [PATCH 2/4] radeonsi: unify CP DMA code determining various flags

Michel Dänzer michel at daenzer.net
Wed Nov 4 00:36:36 PST 2015


On 04.11.2015 08:46, Marek Olšák wrote:
> 
> @@ -115,7 +130,7 @@ static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst,
>  			    bool is_framebuffer)
>  {
>  	struct si_context *sctx = (struct si_context*)ctx;
> -	unsigned flush_flags, tc_l2_flag;
> +	unsigned tc_l2_flag = get_tc_l2_flag(sctx, is_framebuffer);
>  
>  	if (!size)
>  		return;
> @@ -139,19 +154,9 @@ 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. */
> -	if (is_framebuffer) {
> -		flush_flags = SI_CONTEXT_FLUSH_AND_INV_FRAMEBUFFER;
> -		tc_l2_flag = 0;
> -	} else {
> -		flush_flags = SI_CONTEXT_INV_TC_L1 |
> -			      (sctx->b.chip_class == SI ? SI_CONTEXT_INV_TC_L2 : 0) |
> -			      SI_CONTEXT_INV_KCACHE;
> -		tc_l2_flag = sctx->b.chip_class == SI ? 0 : CIK_CP_DMA_USE_L2;
> -	}
> -
> +	/* Flush the caches. */
>  	sctx->b.flags |= SI_CONTEXT_PS_PARTIAL_FLUSH |
> -			 flush_flags;
> +			 get_flush_flags(sctx, is_framebuffer);
>  
>  	while (size) {
>  		unsigned byte_count = MIN2(size, CP_DMA_MAX_BYTE_COUNT);
> @@ -184,7 +189,7 @@ 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. */
> -	sctx->b.flags |= flush_flags;
> +	sctx->b.flags |= get_flush_flags(sctx, is_framebuffer);

Might want to keep the flush_flags local variables instead of calling
get_flush_flags repeatedly. Either way, patches 1-3 are

Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list