All of lore.kernel.org
 help / color / mirror / Atom feed
From: yu.dai@intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 16/18] drm/i915: Ring Context allocating for GuC
Date: Fri,  3 Apr 2015 11:08:42 -0700	[thread overview]
Message-ID: <1428084524-28437-17-git-send-email-yu.dai@intel.com> (raw)
In-Reply-To: <1428084524-28437-1-git-send-email-yu.dai@intel.com>

From: Alex Dai <yu.dai@intel.com>

GuC firmware uses the one page after Ring Context as shared data.
However, GuC uses same offset to address this page for all rings.
So we have to allocate same size of lrc context for all rings.

Also, reduce ring buffer size to 4 pages. In GuC, work queue tail is
referenced by 11 bits (WQ_RING_TAIL_MASK). It is in QW, so total 14
bits (4 pages).

Issue: VIZ-4884
Signed-off-by: Alex Dai <yu.dai@intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c        | 23 ++++++++---------------
 drivers/gpu/drm/i915/intel_ringbuffer.c |  2 +-
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index cb5a617..1948de8 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1760,20 +1760,10 @@ uint32_t get_lr_context_size(struct intel_engine_cs *ring)
 
 	WARN_ON(INTEL_INFO(ring->dev)->gen < 8);
 
-	switch (ring->id) {
-	case RCS:
-		if (INTEL_INFO(ring->dev)->gen >= 9)
-			ret = GEN9_LR_CONTEXT_RENDER_SIZE;
-		else
-			ret = GEN8_LR_CONTEXT_RENDER_SIZE;
-		break;
-	case VCS:
-	case BCS:
-	case VECS:
-	case VCS2:
-		ret = GEN8_LR_CONTEXT_OTHER_SIZE;
-		break;
-	}
+	if (INTEL_INFO(ring->dev)->gen >= 9)
+		ret = GEN9_LR_CONTEXT_RENDER_SIZE;
+	else
+		ret = GEN8_LR_CONTEXT_RENDER_SIZE;
 
 	return ret;
 }
@@ -1822,6 +1812,9 @@ int intel_lr_context_deferred_create(struct intel_context *ctx,
 	WARN_ON(ctx->engine[ring->id].state);
 
 	context_size = round_up(get_lr_context_size(ring), 4096);
+	/* One extra page as the sharing data between driver and GuC */
+	if (i915.enable_guc_scheduling)
+		context_size += PAGE_SIZE;
 
 	ctx_obj = i915_gem_alloc_context_obj(dev, context_size);
 	if (IS_ERR(ctx_obj)) {
@@ -1850,7 +1843,7 @@ int intel_lr_context_deferred_create(struct intel_context *ctx,
 
 	ringbuf->ring = ring;
 
-	ringbuf->size = 32 * PAGE_SIZE;
+	ringbuf->size = 4 * PAGE_SIZE;
 	ringbuf->effective_size = ringbuf->size;
 	ringbuf->head = 0;
 	ringbuf->tail = 0;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 44c7b99..a3873f9 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1980,7 +1980,7 @@ static int intel_init_ring_buffer(struct drm_device *dev,
 	INIT_LIST_HEAD(&ring->active_list);
 	INIT_LIST_HEAD(&ring->request_list);
 	INIT_LIST_HEAD(&ring->execlist_queue);
-	ringbuf->size = 32 * PAGE_SIZE;
+	ringbuf->size = 4 * PAGE_SIZE;
 	ringbuf->ring = ring;
 	memset(ring->semaphore.sync_seqno, 0, sizeof(ring->semaphore.sync_seqno));
 
-- 
1.9.1

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

  parent reply	other threads:[~2015-04-03 18:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-03 18:08 [PATCH v2 00/18] *** Command submission via GuC for SKL *** yu.dai
2015-04-03 18:08 ` [PATCH v2 01/18] drm/i915: Add guc firmware interface headers yu.dai
2015-04-03 18:08 ` [PATCH v2 02/18] drm/i915: Add i915_gem_object_write() to i915_gem.c yu.dai
2015-04-03 18:08 ` [PATCH v2 03/18] drm/i915: Unified firmware loading mechanism yu.dai
2015-04-03 18:08 ` [PATCH v2 04/18] drm/i915: GuC firmware loader yu.dai
2015-04-03 18:08 ` [PATCH v2 05/18] drm/i915: Add firmware version check yu.dai
2015-04-03 18:08 ` [PATCH v2 06/18] drm/i915: Defer default hardware context initialisation until first open yu.dai
2015-04-03 18:08 ` [PATCH v2 07/18] drm/i915: Move execlists defines from .c to .h yu.dai
2015-04-03 18:08 ` [PATCH v2 08/18] drm/i915: Make several execlist helper functions external yu.dai
2015-04-03 18:08 ` [PATCH v2 09/18] drm/i915: Add functions to allocate / release gem obj for GuC yu.dai
2015-04-03 18:08 ` [PATCH v2 10/18] drm/i915: Functions to support command submission via GuC yu.dai
2015-04-03 18:08 ` [PATCH v2 11/18] drm/i915: Integration of GuC client yu.dai
2015-04-03 18:08 ` [PATCH v2 12/18] drm/i915: Interrupt routing for GuC scheduler yu.dai
2015-04-03 18:08 ` [PATCH v2 13/18] drm/i915: Enable commands submission via GuC yu.dai
2015-04-03 18:08 ` [PATCH v2 14/18] drm/i915: debugfs of GuC status yu.dai
2015-04-03 18:08 ` [PATCH v2 15/18] drm/i915: Enable GuC firmware log yu.dai
2015-04-03 18:08 ` yu.dai [this message]
2015-04-03 18:08 ` [PATCH v2 17/18] drm/i915: Taking forcewake during GuC load yu.dai
2015-04-03 18:08 ` [PATCH v2 18/18] Documentation/drm: kerneldoc for GuC yu.dai
2015-04-09 13:24   ` shuang.he
2015-04-09 13:28     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428084524-28437-17-git-send-email-yu.dai@intel.com \
    --to=yu.dai@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.