aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-09-01 07:02:39 -0400
committerEric Anholt <eric@anholt.net>2009-09-02 13:49:02 -0400
commit58c2fb647a3cf70a90d7b33a3f2a8396a20a0bc4 (patch)
tree7c7b029f4af50f1cd61531bc46ed62cfe464857d
parentbcc24fb42585dc9f490cf7789a917358414bdab5 (diff)
drm/i915: Unref old_obj on get_fence_reg() error path
Remember to release the local reference if we fail to wait on the rendering. (Also whilst in the vicinity add some whitespace so that the phasing of the operations is clearer.) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0c07a755b3a3..7edb5b9d5792 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2267,8 +2267,6 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj)
2267 fence_list) { 2267 fence_list) {
2268 old_obj = old_obj_priv->obj; 2268 old_obj = old_obj_priv->obj;
2269 2269
2270 reg = &dev_priv->fence_regs[old_obj_priv->fence_reg];
2271
2272 if (old_obj_priv->pin_count) 2270 if (old_obj_priv->pin_count)
2273 continue; 2271 continue;
2274 2272
@@ -2290,8 +2288,11 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj)
2290 */ 2288 */
2291 i915_gem_object_flush_gpu_write_domain(old_obj); 2289 i915_gem_object_flush_gpu_write_domain(old_obj);
2292 ret = i915_gem_object_wait_rendering(old_obj); 2290 ret = i915_gem_object_wait_rendering(old_obj);
2293 if (ret != 0) 2291 if (ret != 0) {
2292 drm_gem_object_unreference(old_obj);
2294 return ret; 2293 return ret;
2294 }
2295
2295 break; 2296 break;
2296 } 2297 }
2297 2298
@@ -2299,10 +2300,14 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj)
2299 * Zap this virtual mapping so we can set up a fence again 2300 * Zap this virtual mapping so we can set up a fence again
2300 * for this object next time we need it. 2301 * for this object next time we need it.
2301 */ 2302 */
2302 i915_gem_release_mmap(reg->obj); 2303 i915_gem_release_mmap(old_obj);
2304
2303 i = old_obj_priv->fence_reg; 2305 i = old_obj_priv->fence_reg;
2306 reg = &dev_priv->fence_regs[i];
2307
2304 old_obj_priv->fence_reg = I915_FENCE_REG_NONE; 2308 old_obj_priv->fence_reg = I915_FENCE_REG_NONE;
2305 list_del_init(&old_obj_priv->fence_list); 2309 list_del_init(&old_obj_priv->fence_list);
2310
2306 drm_gem_object_unreference(old_obj); 2311 drm_gem_object_unreference(old_obj);
2307 } 2312 }
2308 2313