public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Intel-gfx@lists.freedesktop.org
Subject: [RFC 05/10] drm/i915: Re-arrange execbuf so context is known before engine
Date: Thu, 25 Jan 2018 13:33:28 +0000	[thread overview]
Message-ID: <20180125133333.13425-6-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20180125133333.13425-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Needed for a following patch.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 38 ++++++++++++++++--------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3abe8a69e313..384b6bd9a4a7 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -2273,24 +2273,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
 	if (args->flags & I915_EXEC_IS_PINNED)
 		eb.batch_flags |= I915_DISPATCH_PINNED;
 
-	eb.engine = eb_select_engine(eb.i915, file, args);
-	if (!eb.engine)
-		return -EINVAL;
-
-	if (args->flags & I915_EXEC_RESOURCE_STREAMER) {
-		if (!HAS_RESOURCE_STREAMER(eb.i915)) {
-			DRM_DEBUG("RS is only allowed for Haswell, Gen8 and above\n");
-			return -EINVAL;
-		}
-		if (eb.engine->id != RCS) {
-			DRM_DEBUG("RS is not available on %s\n",
-				 eb.engine->name);
-			return -EINVAL;
-		}
-
-		eb.batch_flags |= I915_DISPATCH_RS;
-	}
-
 	if (args->flags & I915_EXEC_FENCE_IN) {
 		in_fence = sync_file_get_fence(lower_32_bits(args->rsvd2));
 		if (!in_fence)
@@ -2315,6 +2297,25 @@ i915_gem_do_execbuffer(struct drm_device *dev,
 	if (unlikely(err))
 		goto err_destroy;
 
+	err = -EINVAL;
+	eb.engine = eb_select_engine(eb.i915, file, args);
+	if (!eb.engine)
+		goto err_engine;
+
+	if (args->flags & I915_EXEC_RESOURCE_STREAMER) {
+		if (!HAS_RESOURCE_STREAMER(eb.i915)) {
+			DRM_DEBUG("RS is only allowed for Haswell, Gen8 and above\n");
+			goto err_engine;
+		}
+		if (eb.engine->id != RCS) {
+			DRM_DEBUG("RS is not available on %s\n",
+				  eb.engine->name);
+			goto err_engine;
+		}
+
+		eb.batch_flags |= I915_DISPATCH_RS;
+	}
+
 	/*
 	 * Take a local wakeref for preparing to dispatch the execbuf as
 	 * we expect to access the hardware fairly frequently in the
@@ -2475,6 +2476,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
 	mutex_unlock(&dev->struct_mutex);
 err_rpm:
 	intel_runtime_pm_put(eb.i915);
+err_engine:
 	i915_gem_context_put(eb.ctx);
 err_destroy:
 	eb_destroy(&eb);
-- 
2.14.1

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

  parent reply	other threads:[~2018-01-25 13:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25 13:33 [RFC 00/10] Virtual queue/engine uAPI prototype Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 01/10] move-timeline-to-ctx Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 02/10] drm/i915: Extend CREATE_CONTEXT to allow inheritance ala clone() Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 03/10] drm/i915: Select engines via class and instance in execbuffer2 Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 04/10] drm/i915: Engine capabilities uAPI Tvrtko Ursulin
2018-01-25 13:33 ` Tvrtko Ursulin [this message]
2018-01-25 13:33 ` [RFC 06/10] drm/i915: Refactor eb_select_engine to take eb Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 07/10] drm/i915: Track latest request per engine class Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 08/10] drm/i915: Allow creating virtual contexts Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 09/10] drm/i915: Trivial virtual engine implementation Tvrtko Ursulin
2018-01-25 13:57   ` Chris Wilson
2018-01-25 14:26     ` Tvrtko Ursulin
2018-01-25 14:32       ` Chris Wilson
2018-01-25 14:36         ` Tvrtko Ursulin
2018-01-25 13:33 ` [RFC 10/10] drm/i915: Naive engine busyness based load balancing Tvrtko Ursulin
2018-01-25 14:12 ` ✗ Fi.CI.BAT: failure for Virtual queue/engine uAPI prototype 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=20180125133333.13425-6-tvrtko.ursulin@linux.intel.com \
    --to=tursulin@ursulin.net \
    --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