Commit 00aff3f6 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin Committed by Chris Wilson

drm/i915: Improve execbuf debug

Convert i915_gem_check_execbuffer to return the error code instead of
a boolean so our neat EINVAL debugging trick works within this function.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20191209122314.16289-1-tvrtko.ursulin@linux.intel.com
parent c81471f5
...@@ -1915,15 +1915,15 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb) ...@@ -1915,15 +1915,15 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
return err; return err;
} }
static bool i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec) static int i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec)
{ {
if (exec->flags & __I915_EXEC_ILLEGAL_FLAGS) if (exec->flags & __I915_EXEC_ILLEGAL_FLAGS)
return false; return -EINVAL;
/* Kernel clipping was a DRI1 misfeature */ /* Kernel clipping was a DRI1 misfeature */
if (!(exec->flags & I915_EXEC_FENCE_ARRAY)) { if (!(exec->flags & I915_EXEC_FENCE_ARRAY)) {
if (exec->num_cliprects || exec->cliprects_ptr) if (exec->num_cliprects || exec->cliprects_ptr)
return false; return -EINVAL;
} }
if (exec->DR4 == 0xffffffff) { if (exec->DR4 == 0xffffffff) {
...@@ -1931,12 +1931,12 @@ static bool i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec) ...@@ -1931,12 +1931,12 @@ static bool i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec)
exec->DR4 = 0; exec->DR4 = 0;
} }
if (exec->DR1 || exec->DR4) if (exec->DR1 || exec->DR4)
return false; return -EINVAL;
if ((exec->batch_start_offset | exec->batch_len) & 0x7) if ((exec->batch_start_offset | exec->batch_len) & 0x7)
return false; return -EINVAL;
return true; return 0;
} }
static int i915_reset_gen7_sol_offsets(struct i915_request *rq) static int i915_reset_gen7_sol_offsets(struct i915_request *rq)
...@@ -2768,8 +2768,9 @@ i915_gem_execbuffer_ioctl(struct drm_device *dev, void *data, ...@@ -2768,8 +2768,9 @@ i915_gem_execbuffer_ioctl(struct drm_device *dev, void *data,
exec2.flags = I915_EXEC_RENDER; exec2.flags = I915_EXEC_RENDER;
i915_execbuffer2_set_context_id(exec2, 0); i915_execbuffer2_set_context_id(exec2, 0);
if (!i915_gem_check_execbuffer(&exec2)) err = i915_gem_check_execbuffer(&exec2);
return -EINVAL; if (err)
return err;
/* Copy in the exec list from userland */ /* Copy in the exec list from userland */
exec_list = kvmalloc_array(count, sizeof(*exec_list), exec_list = kvmalloc_array(count, sizeof(*exec_list),
...@@ -2846,8 +2847,9 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data, ...@@ -2846,8 +2847,9 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data,
return -EINVAL; return -EINVAL;
} }
if (!i915_gem_check_execbuffer(args)) err = i915_gem_check_execbuffer(args);
return -EINVAL; if (err)
return err;
/* Allocate an extra slot for use by the command parser */ /* Allocate an extra slot for use by the command parser */
exec2_list = kvmalloc_array(count + 1, eb_element_size(), exec2_list = kvmalloc_array(count + 1, eb_element_size(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment