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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux