All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Intel graphics driver community testing & development
	<intel-gfx@lists.freedesktop.org>
Subject: [PATCH 2/2] drm/i915: Sanitize hardware context computation
Date: Wed, 26 Apr 2017 12:11:54 +0300	[thread overview]
Message-ID: <1493197914-12383-2-git-send-email-joonas.lahtinen@linux.intel.com> (raw)
In-Reply-To: <1493197914-12383-1-git-send-email-joonas.lahtinen@linux.intel.com>

Inspired by the engine context size sanitization, lets also clean the
legacy hardware context computation.

Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 8bd0c49..d82135d 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -94,29 +94,23 @@
 
 static int get_context_size(struct drm_i915_private *dev_priv)
 {
-	int ret;
 	u32 reg;
 
 	switch (INTEL_GEN(dev_priv)) {
-	case 6:
-		reg = I915_READ(CXT_SIZE);
-		ret = GEN6_CXT_TOTAL_SIZE(reg) * 64;
-		break;
+	default:
+		MISSING_CASE(INTEL_GEN(dev_priv));
+	case 8:
+		return GEN8_CXT_TOTAL_SIZE;
 	case 7:
-		reg = I915_READ(GEN7_CXT_SIZE);
 		if (IS_HASWELL(dev_priv))
-			ret = HSW_CXT_TOTAL_SIZE;
-		else
-			ret = GEN7_CXT_TOTAL_SIZE(reg) * 64;
-		break;
-	case 8:
-		ret = GEN8_CXT_TOTAL_SIZE;
-		break;
-	default:
-		BUG();
-	}
+			return HSW_CXT_TOTAL_SIZE;
 
-	return ret;
+		reg = I915_READ(GEN7_CXT_SIZE);
+		return GEN7_CXT_TOTAL_SIZE(reg) * 64;
+	case 6:
+		reg = I915_READ(CXT_SIZE);
+		return GEN6_CXT_TOTAL_SIZE(reg) * 64;
+	}
 }
 
 void i915_gem_context_free(struct kref *ctx_ref)
-- 
2.7.4

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

  parent reply	other threads:[~2017-04-26  9:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26  9:11 [PATCH 1/2] drm/i915: Pre-calculate engine context size Joonas Lahtinen
2017-04-26  9:10 ` Zhi Wang
2017-04-26  9:52   ` Joonas Lahtinen
2017-04-26  9:47     ` About the context image size on GEN8+ Zhi Wang
2017-04-26  9:57     ` [PATCH 1/2] drm/i915: Pre-calculate engine context size Zhi Wang
2017-04-26 16:20       ` Daniele Ceraolo Spurio
2017-04-27  2:11         ` Zhi Wang
2017-04-26  9:11 ` Joonas Lahtinen [this message]
2017-04-26  9:36 ` Chris Wilson
2017-04-26  9:43 ` ✗ Fi.CI.BAT: warning for series starting with [1/2] " Patchwork
2017-04-26 10:43   ` Saarinen, Jani
2017-04-26 12:36     ` Joonas Lahtinen
2017-04-26 12:43       ` Saarinen, Jani
2017-04-26 13:04         ` Chris Wilson

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=1493197914-12383-2-git-send-email-joonas.lahtinen@linux.intel.com \
    --to=joonas.lahtinen@linux.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.