[Intel-gfx] [PATCH 5/9] drm/i915: Make ring buffer size configurable
Chris Wilson
chris at chris-wilson.co.uk
Fri May 20 12:01:46 UTC 2016
On Tue, May 17, 2016 at 04:19:05AM -0400, Zhi Wang wrote:
> This patch introduces an option for configuring ring buffer size during
> context creation. If no ring buffer size is specified, the default size
> (4 * PAGE_SIZE) will be used.
>
> Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/intel_lrc.c | 8 ++++++--
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index ea04352..cc83f2d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -883,6 +883,7 @@ struct intel_context {
> uint32_t *lrc_reg_state;
> bool initialised;
> } engine[I915_NUM_ENGINES];
> + u32 ring_buffer_size;
>
> struct list_head link;
> };
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index db10c96..d52c806 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -2495,7 +2495,7 @@ static int execlists_context_deferred_alloc(struct intel_context *ctx,
> struct intel_engine_cs *engine)
> {
> struct drm_i915_gem_object *ctx_obj;
> - uint32_t context_size;
> + uint32_t context_size, ring_buffer_size;
> struct intel_ringbuffer *ringbuf;
> int ret;
>
> @@ -2513,7 +2513,11 @@ static int execlists_context_deferred_alloc(struct intel_context *ctx,
> return PTR_ERR(ctx_obj);
> }
>
> - ringbuf = intel_engine_create_ringbuffer(engine, 4 * PAGE_SIZE);
> + ring_buffer_size = ctx->ring_buffer_size;
> + if (!ring_buffer_size)
> + ring_buffer_size = 4 * PAGE_SIZE;
Just don't let it be zero (during construction).
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list