[Intel-gfx] [PATCH 11/19] drm/i915/perf: Store a pointer to oa_format in oa_buffer

Dixit, Ashutosh ashutosh.dixit at intel.com
Wed Sep 14 20:43:08 UTC 2022


On Tue, 23 Aug 2022 13:41:47 -0700, Umesh Nerlige Ramappa wrote:
>
> @@ -3184,15 +3184,12 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
>	stream->sample_flags = props->sample_flags;
>	stream->sample_size += format_size;
>
> -	stream->oa_buffer.format_size = format_size;
> -	if (drm_WARN_ON(&i915->drm, stream->oa_buffer.format_size == 0))
> +	stream->oa_buffer.format = &perf->oa_formats[props->oa_format];
> +	if (drm_WARN_ON(&i915->drm, stream->oa_buffer.format->size == 0))
>		return -EINVAL;

I would also move these 3 lines before the two lines on the top, eliminate
the format_size variable and assignment and just use
stream->oa_buffer.format->size. Otherwise:

Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>

>	stream->hold_preemption = props->hold_preemption;
>
> -	stream->oa_buffer.format =
> -		perf->oa_formats[props->oa_format].format;
> -
>	stream->periodic = props->oa_periodic;
>	if (stream->periodic)
>		stream->period_exponent = props->oa_period_exponent;
> diff --git a/drivers/gpu/drm/i915/i915_perf_types.h b/drivers/gpu/drm/i915/i915_perf_types.h
> index dc9bfd8086cf..e0c96b44eda8 100644
> --- a/drivers/gpu/drm/i915/i915_perf_types.h
> +++ b/drivers/gpu/drm/i915/i915_perf_types.h
> @@ -250,11 +250,10 @@ struct i915_perf_stream {
>	 * @oa_buffer: State of the OA buffer.
>	 */
>	struct {
> +		const struct i915_oa_format *format;
>		struct i915_vma *vma;
>		u8 *vaddr;
>		u32 last_ctx_id;
> -		int format;
> -		int format_size;
>		int size_exponent;
>


More information about the Intel-gfx mailing list