From: Nick Hoath <nicholas.hoath@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: daniel.vetter@ffwll.ch
Subject: [PATCH 1/4] drm/i915: execlist request keeps ptr/ref to gem_request
Date: Thu, 15 Jan 2015 13:10:36 +0000 [thread overview]
Message-ID: <1421327439-13166-2-git-send-email-nicholas.hoath@intel.com> (raw)
In-Reply-To: <1421327439-13166-1-git-send-email-nicholas.hoath@intel.com>
Add a reference and pointer from the execlist queue item to the associated
gem request. For execlist requests that don't have a request, create one
as a placeholder.
Issue: VIZ-4274
v1: Rebase after upstream of "Replace seqno values with request structures" patchset.
Signed-off-by: Nick Hoath <nicholas.hoath@intel.com>
---
drivers/gpu/drm/i915/intel_lrc.c | 31 +++++++++++++++++++++++++------
drivers/gpu/drm/i915/intel_lrc.h | 6 +++++-
2 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 7670a0f..d9eaf2d 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -534,7 +534,8 @@ void intel_lrc_irq_handler(struct intel_engine_cs *ring)
static int execlists_context_queue(struct intel_engine_cs *ring,
struct intel_context *to,
- u32 tail)
+ u32 tail,
+ struct drm_i915_gem_request *request)
{
struct intel_ctx_submit_request *req = NULL, *cursor;
struct drm_i915_private *dev_priv = ring->dev->dev_private;
@@ -553,6 +554,21 @@ static int execlists_context_queue(struct intel_engine_cs *ring,
req->ring = ring;
req->tail = tail;
+ if (!request) {
+ /*
+ * If there isn't a request associated with this submission,
+ * create one as a temporary holder.
+ */
+ WARN(1, "execlist context submission without request");
+ request = kzalloc(sizeof(*request), GFP_KERNEL);
+ if (request == NULL)
+ return -ENOMEM;
+ request->ctx = to;
+ request->ring = ring;
+ }
+ req->request = request;
+ i915_gem_request_reference(request);
+
intel_runtime_pm_get(dev_priv);
spin_lock_irqsave(&ring->execlist_lock, flags);
@@ -766,6 +782,7 @@ void intel_execlists_retire_requests(struct intel_engine_cs *ring)
intel_lr_context_unpin(ring, ctx);
intel_runtime_pm_put(dev_priv);
i915_gem_context_unreference(req->ctx);
+ i915_gem_request_unreference(req->request);
list_del(&req->execlist_link);
kfree(req);
}
@@ -818,7 +835,8 @@ int logical_ring_flush_all_caches(struct intel_ringbuffer *ringbuf)
* on a queue waiting for the ELSP to be ready to accept a new context submission. At that
* point, the tail *inside* the context is updated and the ELSP written to.
*/
-void intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf)
+void intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf,
+ struct drm_i915_gem_request *request)
{
struct intel_engine_cs *ring = ringbuf->ring;
struct intel_context *ctx = ringbuf->FIXME_lrc_ctx;
@@ -828,7 +846,7 @@ void intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf)
if (intel_ring_stopped(ring))
return;
- execlists_context_queue(ring, ctx, ringbuf->tail);
+ execlists_context_queue(ring, ctx, ringbuf->tail, request);
}
static int intel_lr_context_pin(struct intel_engine_cs *ring,
@@ -972,7 +990,7 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf,
return ret;
/* Force the context submission in case we have been skipping it */
- intel_logical_ring_advance_and_submit(ringbuf);
+ intel_logical_ring_advance_and_submit(ringbuf, NULL);
/* With GEM the hangcheck timer should kick us out of the loop,
* leaving it early runs the risk of corrupting GEM state (due
@@ -1310,7 +1328,8 @@ static void gen8_set_seqno(struct intel_engine_cs *ring, u32 seqno)
intel_write_status_page(ring, I915_GEM_HWS_INDEX, seqno);
}
-static int gen8_emit_request(struct intel_ringbuffer *ringbuf)
+static int gen8_emit_request(struct intel_ringbuffer *ringbuf,
+ struct drm_i915_gem_request *request)
{
struct intel_engine_cs *ring = ringbuf->ring;
u32 cmd;
@@ -1332,7 +1351,7 @@ static int gen8_emit_request(struct intel_ringbuffer *ringbuf)
i915_gem_request_get_seqno(ring->outstanding_lazy_request));
intel_logical_ring_emit(ringbuf, MI_USER_INTERRUPT);
intel_logical_ring_emit(ringbuf, MI_NOOP);
- intel_logical_ring_advance_and_submit(ringbuf);
+ intel_logical_ring_advance_and_submit(ringbuf, request);
return 0;
}
diff --git a/drivers/gpu/drm/i915/intel_lrc.h b/drivers/gpu/drm/i915/intel_lrc.h
index 960fcbd..7a82bc9 100644
--- a/drivers/gpu/drm/i915/intel_lrc.h
+++ b/drivers/gpu/drm/i915/intel_lrc.h
@@ -39,7 +39,9 @@ void intel_logical_ring_cleanup(struct intel_engine_cs *ring);
int intel_logical_rings_init(struct drm_device *dev);
int logical_ring_flush_all_caches(struct intel_ringbuffer *ringbuf);
-void intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf);
+void intel_logical_ring_advance_and_submit(
+ struct intel_ringbuffer *ringbuf,
+ struct drm_i915_gem_request *request);
/**
* intel_logical_ring_advance() - advance the ringbuffer tail
* @ringbuf: Ringbuffer to advance.
@@ -110,6 +112,8 @@ struct intel_ctx_submit_request {
struct list_head execlist_link;
int elsp_submitted;
+
+ struct drm_i915_gem_request *request;
};
void intel_lrc_irq_handler(struct intel_engine_cs *ring);
--
2.1.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-01-15 13:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-15 13:10 [PATCH 0/4] drm/i915: Untangle execlist tracking Nick Hoath
2015-01-15 13:10 ` Nick Hoath [this message]
2015-01-15 13:10 ` [PATCH 2/4] drm/i915: Removed duplicate members from submit_request Nick Hoath
2015-01-15 13:10 ` [PATCH 3/4] drm/i915: Remove FIXME_lrc_ctx backpointer Nick Hoath
2015-01-15 13:10 ` [PATCH 4/4] drm/i915: Subsume intel_ctx_submit_request in to drm_i915_gem_request Nick Hoath
2015-01-16 7:23 ` shuang.he
2015-01-29 15:42 ` Tvrtko Ursulin
2015-01-16 9:48 ` [PATCH 0/4] drm/i915: Untangle execlist tracking Daniel, Thomas
2015-01-20 9:41 ` Daniel Vetter
-- strict thread matches above, loose matches on Subject: below --
2015-01-12 15:33 Nick Hoath
2015-01-12 15:33 ` [PATCH 1/4] drm/i915: execlist request keeps ptr/ref to gem_request Nick Hoath
2014-12-22 9:37 [PATCH 0/4] drm/i915: Untangle execlist tracking Nick Hoath
2014-12-22 9:37 ` [PATCH 1/4] drm/i915: execlist request keeps ptr/ref to gem_request Nick Hoath
2014-12-16 12:32 [PATCH 0/4] drm/i915: Untangle execlist tracking Nick Hoath
2014-12-16 12:32 ` [PATCH 1/4] drm/i915: execlist request keeps ptr/ref to gem_request Nick Hoath
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=1421327439-13166-2-git-send-email-nicholas.hoath@intel.com \
--to=nicholas.hoath@intel.com \
--cc=daniel.vetter@ffwll.ch \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox