[PATCH i-g-t v3 5/6] lib/igt_fb: put intel blt cleanup into its own function

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Thu May 9 10:31:04 UTC 2024


On Tue, Apr 30, 2024 at 07:29:38PM +0300, Juha-Pekka Heikkila wrote:
> make blitcopy function bit easier to handle

s/make/Make/

Please other patches, I've notice small letter on other patches as
well.

> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  lib/igt_fb.c | 33 +++++++++++++++++++++------------
>  1 file changed, 21 insertions(+), 12 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 1730f6394..5b4670e8d 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -2938,6 +2938,25 @@ static void setup_context_and_memory_region(const struct igt_fb *fb, uint32_t *c
>  	}
>  }
>  
> +static void cleanup_blt_resources(uint32_t ctx, uint64_t ahnd, bool is_xe,
> +				  uint32_t xe_bb, uint32_t exec_queue,
> +				  uint32_t vm, intel_ctx_t *xe_ctx,
> +				  int fd, const intel_ctx_t *ictx)
> +{
> +	if (ctx)
> +		gem_context_destroy(fd, ctx);
> +	put_ahnd(ahnd);
> +
> +	if(is_xe) {

Checkpatch is complaining about missing space after if.

With this fixed:

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

--
Zbigniew

> +		gem_close(fd, xe_bb);
> +		xe_exec_queue_destroy(fd, exec_queue);
> +		xe_vm_destroy(fd, vm);
> +		free(xe_ctx);
> +	}
> +
> +	intel_ctx_destroy(fd, ictx);
> +}
> +
>  static void blitcopy(const struct igt_fb *dst_fb,
>  		     const struct igt_fb *src_fb)
>  {
> @@ -3078,18 +3097,8 @@ static void blitcopy(const struct igt_fb *dst_fb,
>  		}
>  	}
>  
> -	if (ctx)
> -		gem_context_destroy(dst_fb->fd, ctx);
> -	put_ahnd(ahnd);
> -
> -	if(is_xe) {
> -		gem_close(dst_fb->fd, xe_bb);
> -		xe_exec_queue_destroy(dst_fb->fd, exec_queue);
> -		xe_vm_destroy(dst_fb->fd, vm);
> -		free(xe_ctx);
> -	}
> -
> -	intel_ctx_destroy(src_fb->fd, ictx);
> +	cleanup_blt_resources(ctx, ahnd, is_xe, bb, exec_queue, vm, xe_ctx,
> +			      src_fb->fd, ictx);
>  }
>  
>  static void free_linear_mapping(struct fb_blit_upload *blit)
> -- 
> 2.25.1
> 


More information about the igt-dev mailing list