From: Oscar Mateo <oscar.mateo@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [PATCH 5/5] drm/i915: Use the engine class to get the context size
Date: Wed, 5 Apr 2017 02:30:37 -0700 [thread overview]
Message-ID: <1491384637-971-6-git-send-email-oscar.mateo@intel.com> (raw)
In-Reply-To: <1491384637-971-1-git-send-email-oscar.mateo@intel.com>
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Technically speaking, the context size is per engine class, not per
instance.
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>
---
drivers/gpu/drm/i915/intel_lrc.c | 34 ++++++++++++++++++++++------------
drivers/gpu/drm/i915/intel_lrc.h | 7 ++++++-
2 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 0dc1cc4..6b1fc4a 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1908,8 +1908,10 @@ static void execlists_init_reg_state(u32 *regs,
}
/**
- * intel_lr_context_size() - return the size of the context for an engine
- * @engine: which engine to find the context size for
+ * intel_lr_class_context_size() - return the size of the context for a given
+ * engine class
+ * @dev_priv: i915 device private
+ * @class: which engine class to find the context size for
*
* Each engine may require a different amount of space for a context image,
* so when allocating (or copying) an image, this function can be used to
@@ -1921,25 +1923,33 @@ static void execlists_init_reg_state(u32 *regs,
* in LRC mode, but does not include the "shared data page" used with
* GuC submission. The caller should account for this if using the GuC.
*/
-uint32_t intel_lr_context_size(struct intel_engine_cs *engine)
+uint32_t intel_lr_class_context_size(struct drm_i915_private *dev_priv,
+ enum intel_engine_class class)
{
int ret = 0;
- WARN_ON(INTEL_GEN(engine->i915) < 8);
+ WARN_ON(INTEL_GEN(dev_priv) < 8);
- switch (engine->id) {
- case RCS:
- if (INTEL_GEN(engine->i915) >= 9)
+ switch (class) {
+ case RENDER_CLASS:
+ switch (INTEL_GEN(dev_priv)) {
+ default:
+ DRM_ERROR("Unknown context size for GEN\n");
+ case 9:
ret = GEN9_LR_CONTEXT_RENDER_SIZE;
- else
+ break;
+ case 8:
ret = GEN8_LR_CONTEXT_RENDER_SIZE;
+ break;
+ }
break;
- case VCS:
- case BCS:
- case VECS:
- case VCS2:
+ case VIDEO_DECODE_CLASS:
+ case VIDEO_ENHANCEMENT_CLASS:
+ case COPY_ENGINE_CLASS:
ret = GEN8_LR_CONTEXT_OTHER_SIZE;
break;
+ default:
+ MISSING_CASE(class);
}
return ret;
diff --git a/drivers/gpu/drm/i915/intel_lrc.h b/drivers/gpu/drm/i915/intel_lrc.h
index e8015e7..b3a4331 100644
--- a/drivers/gpu/drm/i915/intel_lrc.h
+++ b/drivers/gpu/drm/i915/intel_lrc.h
@@ -78,7 +78,12 @@ enum {
struct drm_i915_private;
struct i915_gem_context;
-uint32_t intel_lr_context_size(struct intel_engine_cs *engine);
+uint32_t intel_lr_class_context_size(struct drm_i915_private *dev_priv,
+ enum intel_engine_class class);
+static inline uint32_t intel_lr_context_size(struct intel_engine_cs *engine)
+{
+ return intel_lr_class_context_size(engine->i915, engine->class);
+}
void intel_lr_context_resume(struct drm_i915_private *dev_priv);
uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-04-05 16:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 9:30 [PATCH 0/5] Classify the engines in class + instance Oscar Mateo
2017-04-05 9:30 ` [PATCH 1/5] drm/i915: " Oscar Mateo
2017-04-06 17:45 ` Tvrtko Ursulin
2017-04-05 9:30 ` [PATCH 2/5] drm/i915: Use the same vfunc for BSD2 ring init Oscar Mateo
2017-04-06 17:48 ` Tvrtko Ursulin
2017-04-06 11:14 ` Oscar Mateo
2017-04-05 9:30 ` [PATCH 3/5] drm/i915: Generate the engine name based on the instance number Oscar Mateo
2017-04-06 18:02 ` Tvrtko Ursulin
2017-04-06 11:22 ` Oscar Mateo
2017-04-06 18:37 ` Tvrtko Ursulin
2017-04-06 18:44 ` Chris Wilson
2017-04-06 18:10 ` Chris Wilson
2017-04-05 9:30 ` [PATCH 4/5] drm/i915: Split the engine info table in two levels, using class + instance Oscar Mateo
2017-04-06 18:09 ` Tvrtko Ursulin
2017-04-05 9:30 ` Oscar Mateo [this message]
2017-04-06 18:19 ` [PATCH 5/5] drm/i915: Use the engine class to get the context size Tvrtko Ursulin
2017-04-05 16:58 ` ✓ Fi.CI.BAT: success for Classify the engines in class + instance Patchwork
-- strict thread matches above, loose matches on Subject: below --
2017-04-06 12:55 [PATCH 0/5] Classify the engines in class + instance (v2) Oscar Mateo
2017-04-06 12:55 ` [PATCH 5/5] drm/i915: Use the engine class to get the context size Oscar Mateo
2017-04-06 15:00 [PATCH 0/5] Classify the engines in class + instance (v3) Oscar Mateo
2017-04-06 15:00 ` [PATCH 5/5] drm/i915: Use the engine class to get the context size Oscar Mateo
2017-04-07 9:15 [PATCH 0/5] Classify the engines in class + instance (v4) Oscar Mateo
2017-04-07 9:15 ` [PATCH 5/5] drm/i915: Use the engine class to get the context size Oscar Mateo
2017-04-10 14:34 [PATCH 0/5] Classify the engines in class + instance (v5) Oscar Mateo
2017-04-10 14:34 ` [PATCH 5/5] drm/i915: Use the engine class to get the context size Oscar Mateo
2017-04-11 10:25 ` Chris Wilson
2017-04-11 11:32 ` Tvrtko Ursulin
2017-04-11 12:27 ` 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=1491384637-971-6-git-send-email-oscar.mateo@intel.com \
--to=oscar.mateo@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=paulo.r.zanoni@intel.com \
--cc=rodrigo.vivi@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox