[PATCH i-g-t 3/8] lib/intel_bufops: repurpose intel_buf_create_using_handle_and_size()

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon Feb 12 14:04:12 UTC 2024


On Fri, Feb 09, 2024 at 06:34:28PM +0000, Matthew Auld wrote:
> From an api pov user this should be the same as intel_buf_create, except
> with existing buffer handle and bo_size. There are no current users for
> this, but in upcoming patch we will remove
> intel_buf_create_using_handle() and convert all users over to this api,
> such that we don't have to guess the bo_size deep in the lib code.
> 
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> ---
>  lib/intel_bufops.c | 6 +++---
>  lib/intel_bufops.h | 3 +--
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
> index 46eba3fb4..a299cdba7 100644
> --- a/lib/intel_bufops.c
> +++ b/lib/intel_bufops.c
> @@ -1120,6 +1120,7 @@ struct intel_buf *intel_buf_create(struct buf_ops *bops,
>   * @alignment: alignment of the stride for linear surfaces
>   * @tiling: surface tiling
>   * @compression: surface compression type
> + * @size: real bo size
>   *
>   * Function creates intel_buf with passed BO handle from the caller. Doesn't
>   * take ownership of the buffer. close()/destroy() paths doesn't close
> @@ -1151,11 +1152,10 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,
>  							 int bpp, int alignment,
>  							 uint32_t req_tiling,
>  							 uint32_t compression,
> -							 uint64_t size,
> -							 int stride)
> +							 uint64_t size)
>  {
>  	return intel_buf_create_full(bops, handle, width, height, bpp, alignment,
> -				     req_tiling, compression, size, stride, -1,
> +				     req_tiling, compression, size, 0, -1,

I'm going to add some render-copy tests which exercise different
buffer sizes but I need to find out what changes I'll need here.
So that's not blocking your change and you may add:

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

--
Zbigniew
>  				     DEFAULT_PAT_INDEX);
>  }
>  
> diff --git a/lib/intel_bufops.h b/lib/intel_bufops.h
> index b6048402b..54a143c5b 100644
> --- a/lib/intel_bufops.h
> +++ b/lib/intel_bufops.h
> @@ -185,8 +185,7 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,
>  							 int bpp, int alignment,
>  							 uint32_t req_tiling,
>  							 uint32_t compression,
> -							 uint64_t size,
> -							 int stride);
> +							 uint64_t size);
>  
>  struct intel_buf *intel_buf_create_full(struct buf_ops *bops,
>  					uint32_t handle,
> -- 
> 2.43.0
> 


More information about the igt-dev mailing list