summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2017-09-21 09:50:50 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2017-09-29 13:41:55 +0100
commitae2df5eb2fd3b62a957b7330b85a87d91de961be (patch)
tree0428f0701c674cfa48b12bc61a79887b16c69630
parentaeb5f7100ef184c9846cf0fed7207a19e0f8595a (diff)
drm/i915: Re-arrange execbuf so context is known before engine
Needed for a following patch. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c38
1 files 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 8318b8c9c282..bc896c87f8fa 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -2244,24 +2244,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)
@@ -2286,6 +2268,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
@@ -2446,6 +2447,7 @@ err_vma:
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);