[PATCH 2/4] drm/i915: clarify eb_get_batch()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 eb_get_batch() with the equivalent but more explicit
	"list_last_entry(&eb->vmas,...)"
and of course add an explanatory comment.

Signed-off-by: Dave Gordon <david.s.gordon@xxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 08bc37c..bc97670 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1354,7 +1354,8 @@ static bool only_mappable_for_reloc(unsigned int flags)
 static struct drm_i915_gem_object *
 eb_get_batch(struct eb_vmas *eb)
 {
-	struct i915_vma *vma = list_entry(eb->vmas.prev, typeof(*vma), exec_list);
+	/* The batch is always the LAST item in the VMA list */
+	struct i915_vma *vma = list_last_entry(&eb->vmas, typeof(*vma), exec_list);
 
 	/*
 	 * SNA is doing fancy tricks with compressing batch buffers, which leads
-- 
1.9.1

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux