[PATCH i-g-t v3 09/14] lib/intel_batchbuffer: Add helper to get pointer at specified offset

Grzegorzek, Dominik dominik.grzegorzek at intel.com
Mon Aug 19 10:10:44 UTC 2024


On Fri, 2024-08-09 at 14:38 +0200, Christoph Manszewski wrote:
> From: Andrzej Hajda <andrzej.hajda at intel.com>
> 
> The helper will be used to access data placed in batchbuffer.
> 
> Signed-off-by: Andrzej Hajda <andrzej.hajda at intel.com>
> Cc: Mika Kuoppala <mika.kuoppala at intel.com>
> Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
> Signed-off-by: Christoph Manszewski <christoph.manszewski at intel.com>
Acked-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
> ---
>  lib/intel_batchbuffer.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
> index cb32206e5..7caf6c518 100644
> --- a/lib/intel_batchbuffer.h
> +++ b/lib/intel_batchbuffer.h
> @@ -353,6 +353,11 @@ static inline uint32_t intel_bb_offset(struct intel_bb *ibb)
>  	return (uint32_t) ((uint8_t *) ibb->ptr - (uint8_t *) ibb->batch);
>  }
>  
> +static inline void *intel_bb_ptr_get(struct intel_bb *ibb, uint32_t offset)
> +{
> +	return ((uint8_t *) ibb->batch + offset);
> +}
> +
>  static inline void intel_bb_ptr_set(struct intel_bb *ibb, uint32_t offset)
>  {
>  	ibb->ptr = (void *) ((uint8_t *) ibb->batch + offset);



More information about the igt-dev mailing list