[Intel-gfx] [PATCH 21/53] drm/i915: Set context in request from creation even in legacy mode
John.C.Harrison at Intel.com
John.C.Harrison at Intel.com
Thu Mar 5 05:42:10 PST 2015
From: John Harrison <John.C.Harrison at Intel.com>
In execlist mode, the context object pointer is written in to the request
structure (and reference counted) at the point of request creation. In legacy
mode, this only happens inside i915_add_request().
This patch updates the legacy code path to match the execlist version. This
allows all the intermediate code between request creation and request submission
to get at the context object given only a request structure. Thus negating the
need to pass context pointers here, there and everywhere.
v2: Moved the context reference so it does not need to be undone if the
get_seqno() fails.
For: VIZ-5115
Signed-off-by: John Harrison <John.C.Harrison at Intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 9 +--------
drivers/gpu/drm/i915/intel_ringbuffer.c | 3 +++
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 151ddb5..e237aa0 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2482,14 +2482,7 @@ int __i915_add_request(struct intel_engine_cs *ring,
WARN_ON(request->batch_obj && obj);
request->batch_obj = obj;
- if (!i915.enable_execlists) {
- /* Hold a reference to the current context so that we can inspect
- * it later in case a hangcheck error event fires.
- */
- request->ctx = ring->last_context;
- if (request->ctx)
- i915_gem_context_reference(request->ctx);
- }
+ WARN_ON(request->ctx != ring->last_context);
request->emitted_jiffies = jiffies;
list_add_tail(&request->list, &ring->request_list);
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index e7dd3cf..4550676 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -2244,6 +2244,9 @@ intel_ring_alloc_request(struct intel_engine_cs *ring,
return ret;
}
+ request->ctx = ctx;
+ i915_gem_context_reference(request->ctx);
+
*req_out = ring->outstanding_lazy_request = request;
return 0;
}
--
1.7.9.5
More information about the Intel-gfx
mailing list