Commit 4aa90970 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin Committed by Chris Wilson
Browse files

drm/i915: Re-arrange execbuf so context is known before engine

parent d90c06d5
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -2312,10 +2312,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
	if (args->flags & I915_EXEC_IS_PINNED)
	if (args->flags & I915_EXEC_IS_PINNED)
		eb.batch_flags |= I915_DISPATCH_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_FENCE_IN) {
	if (args->flags & I915_EXEC_FENCE_IN) {
		in_fence = sync_file_get_fence(lower_32_bits(args->rsvd2));
		in_fence = sync_file_get_fence(lower_32_bits(args->rsvd2));
		if (!in_fence)
		if (!in_fence)
@@ -2340,6 +2336,12 @@ i915_gem_do_execbuffer(struct drm_device *dev,
	if (unlikely(err))
	if (unlikely(err))
		goto err_destroy;
		goto err_destroy;


	eb.engine = eb_select_engine(eb.i915, file, args);
	if (!eb.engine) {
		err = -EINVAL;
		goto err_engine;
	}

	/*
	/*
	 * Take a local wakeref for preparing to dispatch the execbuf as
	 * Take a local wakeref for preparing to dispatch the execbuf as
	 * we expect to access the hardware fairly frequently in the
	 * we expect to access the hardware fairly frequently in the
@@ -2505,6 +2507,7 @@ err_unlock:
	mutex_unlock(&dev->struct_mutex);
	mutex_unlock(&dev->struct_mutex);
err_rpm:
err_rpm:
	intel_runtime_pm_put(eb.i915, wakeref);
	intel_runtime_pm_put(eb.i915, wakeref);
err_engine:
	i915_gem_context_put(eb.ctx);
	i915_gem_context_put(eb.ctx);
err_destroy:
err_destroy:
	eb_destroy(&eb);
	eb_destroy(&eb);