[igt-dev] [PATCH i-g-t v4 03/25] lib/intel_batchbuffer: add intel_bb_blit_copy wrapper

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Tue Sep 22 13:44:33 UTC 2020


On Tue, Sep 22, 2020 at 01:52:07PM +0200, Dominik Grzegorzek wrote:
> This patch adds intel_bb_copy_intel_buf to make copying a whole
> intel_buf easier and more readable.
> 
> Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  lib/intel_batchbuffer.c | 23 +++++++++++++++++++++++
>  lib/intel_batchbuffer.h |  3 +++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> index 079d6389..259b15c5 100644
> --- a/lib/intel_batchbuffer.c
> +++ b/lib/intel_batchbuffer.c
> @@ -2545,6 +2545,29 @@ void intel_bb_blt_copy(struct intel_bb *ibb,
>  	intel_bb_flush_blit(ibb);
>  }
>  
> +/**
> + * intel_bb_copy_intel_buf:
> + * @batch: batchbuffer object
> + * @src: source buffer (intel_buf)
> + * @dst: destination libdrm buffer object
> + * @size: size of the copy range in bytes
> + *
> + * Tmits a copy operation using blitter commands into the supplied batch
> + * buffer object. A total of @size bytes from the start of @src is copied
> + * over to @dst. Note that @size must be page-aligned.
> + */

Small nits:

s/Tmits/Emits/

s/batch buffer object/intel_bb/ or just batch. 

> +void intel_bb_copy_intel_buf(struct intel_bb *ibb,
> +			     struct intel_buf *dst, struct intel_buf *src,
> +			     long int size)
> +{
> +	igt_assert(size % 4096 == 0);
> +
> +	intel_bb_blt_copy(ibb,
> +		       src, 0, 0, 4096,
> +		       dst, 0, 0, 4096,
> +		       4096/4, size/4096, 32);
> +}
> +
>  /**
>   * igt_get_huc_copyfunc:
>   * @devid: pci device id
> diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
> index cbfbe25f..a23ba9af 100644
> --- a/lib/intel_batchbuffer.h
> +++ b/lib/intel_batchbuffer.h
> @@ -654,6 +654,9 @@ void intel_bb_blt_copy(struct intel_bb *ibb,
>  		       struct intel_buf *dst,
>  		       int dst_x1, int dst_y1, int dst_pitch,
>  		       int width, int height, int bpp);
> +void intel_bb_copy_intel_buf(struct intel_bb *ibb,
> +			     struct intel_buf *dst, struct intel_buf *src,
> +			     long int size);
                             |
                             ^---- I guess indentation is not valid.

Then:

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

>  
>  /**
>   * igt_huc_copyfunc_t:
> -- 
> 2.20.1
> 


More information about the igt-dev mailing list