drm/i915: refactor eb_get_batch()
authorDave Gordon <david.s.gordon@intel.com>
Thu, 14 Jul 2016 13:52:04 +0000 (14:52 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 19 Jul 2016 07:06:32 +0000 (09:06 +0200)
commit4bfa339aa40c2faa7aa7b7e488e6cd55c54b9055
tree9fcb38ea445106706d16ef73af1c6e472cd95db0
parent9e2793f6e4e2ca452457e459f013cc8e6b08a789
drm/i915: refactor eb_get_batch()

Precursor for fix to secure batch execution. We will need to be able to
retrieve the batch VMA (as well as the batch itself) from the eb list,
so this patch extracts that part of eb_get_batch() into a separate
function, and moves both parts to a more logical place in the file, near
where the eb list is created.

Also, it may not be obvious, but the current execbuffer2 ioctl interface
requires that the buffer object containing the batch-to-be-executed be
the LAST entry in the exec2_list[] array (I expected it to be the
first!).

To clarify this, we can replace the rather obscure construct
"list_entry(eb->vmas.prev, ...)"
in the old version of eb_get_batch() with the equivalent but more
explicit
"list_last_entry(&eb->vmas,...)"
in the new eb_get_batch_vma() and of course add an explanatory comment.

Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1468504324-12690-2-git-send-email-david.s.gordon@intel.com
drivers/gpu/drm/i915/i915_gem_execbuffer.c