[Intel-gfx] [PATCH 1/5] drm/i915: execbuffer simplification

Ben Widawsky ben at bwidawsk.net
Wed Oct 12 06:43:49 CEST 2011


I find this to be easier to understand.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3693e83..cc69861 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -963,6 +963,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 	struct list_head objects;
 	struct eb_objects *eb;
 	struct drm_i915_gem_object *batch_obj;
+	struct drm_i915_gem_object *obj = NULL;
 	struct drm_clip_rect *cliprects = NULL;
 	struct intel_ring_buffer *ring;
 	u32 exec_start, exec_len;
@@ -1083,7 +1084,6 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 	/* Look up object handles */
 	INIT_LIST_HEAD(&objects);
 	for (i = 0; i < args->buffer_count; i++) {
-		struct drm_i915_gem_object *obj;
 
 		obj = to_intel_bo(drm_gem_object_lookup(dev, file,
 							exec[i].handle));
@@ -1108,10 +1108,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 		eb_add_object(eb, obj);
 	}
 
-	/* take note of the batch buffer before we might reorder the lists */
-	batch_obj = list_entry(objects.prev,
-			       struct drm_i915_gem_object,
-			       exec_list);
+	/* The last object is the batch */
+	batch_obj = obj;
 
 	/* Move the objects en-masse into the GTT, evicting if necessary. */
 	ret = i915_gem_execbuffer_reserve(ring, file, &objects);
-- 
1.7.7




More information about the Intel-gfx mailing list