[Intel-gfx] [PATCH 09/15] drm/i915: Make ring buffer size configurable

Zhi Wang zhi.a.wang at intel.com
Sun May 15 17:32:47 UTC 2016


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 48f4d6e..4ac88b2 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;
 		bool skip_init_context;
+		u32 ring_buffer_size;
 	} engine[I915_NUM_ENGINES];
 
 	struct list_head link;
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 08eeaf3..3f04784 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -2502,7 +2502,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;
 
@@ -2520,7 +2520,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->engine[engine->id].ring_buffer_size;
+	if (!ring_buffer_size)
+		ring_buffer_size = 4 * PAGE_SIZE;
+
+	ringbuf = intel_engine_create_ringbuffer(engine, ring_buffer_size);
 	if (IS_ERR(ringbuf)) {
 		ret = PTR_ERR(ringbuf);
 		goto error_deref_obj;
-- 
1.9.1



More information about the Intel-gfx mailing list