[Intel-gfx] [PATCH 09/11] drm/i915: fixup execbuf failure path

Daniel Vetter daniel.vetter at ffwll.ch
Fri Jan 15 13:24:16 CET 2010


Objects were unconditionally unreferenced in the error path.
Fix this up like with the object pinning.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/i915/i915_gem.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6bf4481..23fae9a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3718,7 +3718,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 	struct drm_i915_gem_object *obj_priv;
 	struct drm_clip_rect *cliprects = NULL;
 	struct drm_i915_gem_relocation_entry *relocs;
-	int ret = 0, ret2, i, pinned = 0;
+	int ret = 0, ret2, i, pinned = 0, referenced;
 	uint64_t exec_offset;
 	uint32_t seqno, flush_domains, reloc_index;
 	int pin_tries, flips;
@@ -3787,6 +3787,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 			DRM_ERROR("Invalid object handle %d at index %d\n",
 				   exec_list[i].handle, i);
 			ret = -EBADF;
+			referenced = i + 1;
 			goto err;
 		}
 
@@ -3795,11 +3796,13 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 			DRM_ERROR("Object %p appears more than once in object list\n",
 				   object_list[i]);
 			ret = -EBADF;
+			referenced = i + 1;
 			goto err;
 		}
 		obj_priv->in_execbuffer = true;
 		flips += atomic_read(&obj_priv->pending_flip);
 	}
+	referenced = args->buffer_count;
 
 	if (flips > 0) {
 		ret = i915_gem_wait_for_pending_flip(dev, object_list,
@@ -3980,7 +3983,7 @@ err:
 	for (i = 0; i < pinned; i++)
 		i915_gem_object_unpin(object_list[i]);
 
-	for (i = 0; i < args->buffer_count; i++) {
+	for (i = 0; i < referenced; i++) {
 		if (object_list[i]) {
 			obj_priv = object_list[i]->driver_private;
 			obj_priv->in_execbuffer = false;
-- 
1.6.6




More information about the Intel-gfx mailing list