All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v3 16/21] drm/i915: Move the magical deferred context allocation into the request
Date: Sun, 24 Apr 2016 19:10:14 +0100	[thread overview]
Message-ID: <1461521419-18086-16-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1461521419-18086-1-git-send-email-chris@chris-wilson.co.uk>

We can hide more details of execlists from higher level code by removing
the explicit call to create an execlist context from execbuffer and
into its first use by execlists.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  8 --------
 drivers/gpu/drm/i915/intel_lrc.c           | 23 +++++++++++++++--------
 drivers/gpu/drm/i915/intel_lrc.h           |  2 --
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 6f4f2a6cdf93..e0ee5d1ac372 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1085,14 +1085,6 @@ i915_gem_validate_context(struct drm_device *dev, struct drm_file *file,
 		return ERR_PTR(-EIO);
 	}
 
-	if (i915.enable_execlists && !ctx->engine[engine->id].state) {
-		int ret = intel_lr_context_deferred_alloc(ctx, engine);
-		if (ret) {
-			DRM_DEBUG("Could not create LRC %u: %d\n", ctx_id, ret);
-			return ERR_PTR(ret);
-		}
-	}
-
 	return ctx;
 }
 
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index eeb8be695288..23bc5fca6595 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -227,6 +227,8 @@ enum {
 #define GEN8_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x17
 #define GEN9_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x26
 
+static int execlists_context_deferred_alloc(struct intel_context *ctx,
+					    struct intel_engine_cs *engine);
 static int intel_lr_context_pin(struct intel_context *ctx,
 				struct intel_engine_cs *engine);
 
@@ -675,8 +677,6 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
 	struct intel_engine_cs *engine = request->engine;
 	int ret;
 
-	request->ringbuf = request->ctx->engine[engine->id].ringbuf;
-
 	if (i915.enable_guc_submission) {
 		/*
 		 * Check that the GuC has space for the request before
@@ -690,6 +690,14 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
 			return ret;
 	}
 
+	if (request->ctx->engine[engine->id].state == NULL) {
+		ret = execlists_context_deferred_alloc(request->ctx, engine);
+		if (ret)
+			return ret;
+	}
+
+	request->ringbuf = request->ctx->engine[engine->id].ringbuf;
+
 	ret = intel_lr_context_pin(request->ctx, engine);
 	if (ret)
 		return ret;
@@ -2134,7 +2142,7 @@ logical_ring_init(struct drm_device *dev, struct intel_engine_cs *engine)
 	if (ret)
 		goto error;
 
-	ret = intel_lr_context_deferred_alloc(dctx, engine);
+	ret = execlists_context_deferred_alloc(dctx, engine);
 	if (ret)
 		goto error;
 
@@ -2608,9 +2616,9 @@ uint32_t intel_lr_context_size(struct intel_engine_cs *engine)
 }
 
 /**
- * intel_lr_context_deferred_alloc() - create the LRC specific bits of a context
+ * execlists_context_deferred_alloc() - create the LRC specific bits of a context
  * @ctx: LR context to create.
- * @ring: engine to be used with the context.
+ * @engine: engine to be used with the context.
  *
  * This function can be called more than once, with different engines, if we plan
  * to use the context with them. The context backing objects and the ringbuffers
@@ -2620,9 +2628,8 @@ uint32_t intel_lr_context_size(struct intel_engine_cs *engine)
  *
  * Return: non-zero on error.
  */
-
-int intel_lr_context_deferred_alloc(struct intel_context *ctx,
-				    struct intel_engine_cs *engine)
+static int execlists_context_deferred_alloc(struct intel_context *ctx,
+					    struct intel_engine_cs *engine)
 {
 	struct drm_device *dev = engine->dev;
 	struct drm_i915_gem_object *ctx_obj;
diff --git a/drivers/gpu/drm/i915/intel_lrc.h b/drivers/gpu/drm/i915/intel_lrc.h
index b17ab79333aa..8bea937973f6 100644
--- a/drivers/gpu/drm/i915/intel_lrc.h
+++ b/drivers/gpu/drm/i915/intel_lrc.h
@@ -102,8 +102,6 @@ static inline void intel_logical_ring_emit_reg(struct intel_ringbuffer *ringbuf,
 
 void intel_lr_context_free(struct intel_context *ctx);
 uint32_t intel_lr_context_size(struct intel_engine_cs *engine);
-int intel_lr_context_deferred_alloc(struct intel_context *ctx,
-				    struct intel_engine_cs *engine);
 void intel_lr_context_unpin(struct intel_context *ctx,
 			    struct intel_engine_cs *engine);
 
-- 
2.8.1

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

  parent reply	other threads:[~2016-04-24 18:10 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-24 18:09 [PATCH v3 01/21] drm/i915/fbdev: Call intel_unpin_fb_obj() on release Chris Wilson
2016-04-24 18:10 ` [PATCH v3 02/21] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr Chris Wilson
2016-04-24 18:10 ` [PATCH v3 03/21] io-mapping: Specify mapping size for io_mapping_map_wc() Chris Wilson
2016-04-24 18:10   ` Chris Wilson
2016-04-24 18:10   ` Chris Wilson
2016-04-24 18:10 ` [PATCH v3 04/21] drm/i915: Introduce i915_vm_to_ggtt() Chris Wilson
2016-04-24 18:10 ` [PATCH v3 05/21] drm/i915: Move ioremap_wc tracking onto VMA Chris Wilson
2016-04-24 18:10 ` [PATCH v3 06/21] drm/i915: Use i915_vma_pin_iomap on the ringbuffer object Chris Wilson
2016-04-24 18:10 ` [PATCH v3 07/21] drm/i915: Mark the current context as lost on suspend Chris Wilson
2016-04-24 18:10 ` [PATCH v3 08/21] drm/i915: L3 cache remapping is part of context switching Chris Wilson
2016-04-24 18:10 ` [PATCH v3 09/21] drm/i915: Consolidate L3 remapping LRI Chris Wilson
2016-04-24 18:10 ` [PATCH v3 10/21] drm/i915: Remove early l3-remap Chris Wilson
2016-04-24 18:10 ` [PATCH v3 11/21] drm/i915: Rearrange switch_context to load the aliasing ppgtt on first use Chris Wilson
2016-04-24 18:10 ` [PATCH v3 12/21] drm/i915: Assign every HW context a unique ID Chris Wilson
2016-04-24 18:10 ` [PATCH v3 13/21] drm/i915: Replace the pinned context address with its " Chris Wilson
2016-04-25 15:21   ` Dave Gordon
2016-04-25 15:48     ` Chris Wilson
2016-04-26  8:06       ` Dave Gordon
2016-04-26  8:40         ` Chris Wilson
2016-04-24 18:10 ` [PATCH v3 14/21] drm/i915: Refactor execlists default context pinning Chris Wilson
2016-04-24 18:10 ` [PATCH v3 15/21] drm/i915: Move context initialisation to first-use Chris Wilson
2016-04-24 18:10 ` Chris Wilson [this message]
2016-04-24 18:10 ` [PATCH v3 17/21] drm/i915: Move releasing of the GEM request from free to retire/cancel Chris Wilson
2016-04-24 18:10 ` [PATCH v3 18/21] drm/i915: Track the previous pinned context inside the request Chris Wilson
2016-04-24 18:10 ` [PATCH v3 19/21] drm/i915: Store LRC hardware id in " Chris Wilson
2016-04-24 18:10 ` [PATCH v3 20/21] drm/i915: Stop tracking execlists retired requests Chris Wilson
2016-04-24 18:10 ` [PATCH v3 21/21] drm/i915: Unify GPU resets upon shutdown Chris Wilson
2016-04-25  9:42   ` Mika Kuoppala
2016-04-25 17:25   ` Ville Syrjälä
2016-04-25 17:45     ` Chris Wilson
2016-04-25 18:42       ` Ville Syrjälä
2016-04-25  8:20 ` ✗ Fi.CI.BAT: warning for series starting with [v3,01/21] drm/i915/fbdev: Call intel_unpin_fb_obj() on release Patchwork

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=1461521419-18086-16-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --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.