[Intel-gfx] [PATCH 4/4] drm/i915/perf: add a parameter to control the size of OA buffer
Chris Wilson
chris at chris-wilson.co.uk
Wed Oct 10 17:07:07 UTC 2018
Quoting Lionel Landwerlin (2018-10-10 17:55:33)
> +static int
> +select_oa_buffer_size(struct drm_i915_private *i915,
> + u64 requested_size,
> + u32 *selected_size,
> + int *selected_exponent)
> +{
> + const u32 max_size = SZ_16M;
> +
> + /*
> + * When no size is specified, use the largest size supported
> + * by all generations.
> + */
> + if (!requested_size) {
> + *selected_size = SZ_16M;
> + *selected_exponent = 7;
> + return 0;
> + }
> +
> + /* Start with the smallest OA buffer size. */
> + *selected_size = 128 * 1024;
> + *selected_exponent = 0;
> + while (requested_size > *selected_size &&
> + *selected_size < max_size) {
> + *selected_size *= 2;
> + *selected_exponent += 1;
> + }
> +
> + if (requested_size > *selected_size)
> + return -EINVAL; /* TODO: ENOMEM? ENODEV? */
order = order_base_2(requested_size);
if (order > 24)
return -EINVAL;
order = max(order, 17);
*selected_size = 1 << order;
*selected_exponent = order - 17;
Returning both is a little redudnant?
return order; (< 0 -> error) ?
-Chris
More information about the Intel-gfx
mailing list