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 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx