aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2010-02-10 18:09:44 -0500
committerEric Anholt <eric@anholt.net>2010-02-10 20:34:46 -0500
commit75dfca80a610e4e87d3b9ccfb3f520692808697d (patch)
treef36aec97c8e6a6ff7c8c169a2ab5fc078074593c /drivers
parent84b79f8d2882b0a84330c04839ed4d3cefd2ff77 (diff)
drm/i915: hold ref on flip object until it completes
This will prevent things from falling over if the user frees the flip buffer before we complete the flip, since we'll hold an internal reference. Reported-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c161ace7132d..b27202d23ebc 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4094,6 +4094,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
4094 4094
4095 mutex_lock(&work->dev->struct_mutex); 4095 mutex_lock(&work->dev->struct_mutex);
4096 i915_gem_object_unpin(work->old_fb_obj); 4096 i915_gem_object_unpin(work->old_fb_obj);
4097 drm_gem_object_unreference(work->pending_flip_obj);
4097 drm_gem_object_unreference(work->old_fb_obj); 4098 drm_gem_object_unreference(work->old_fb_obj);
4098 mutex_unlock(&work->dev->struct_mutex); 4099 mutex_unlock(&work->dev->struct_mutex);
4099 kfree(work); 4100 kfree(work);
@@ -4221,8 +4222,9 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
4221 return ret; 4222 return ret;
4222 } 4223 }
4223 4224
4224 /* Reference the old fb object for the scheduled work. */ 4225 /* Reference the objects for the scheduled work. */
4225 drm_gem_object_reference(work->old_fb_obj); 4226 drm_gem_object_reference(work->old_fb_obj);
4227 drm_gem_object_reference(obj);
4226 4228
4227 crtc->fb = fb; 4229 crtc->fb = fb;
4228 i915_gem_object_flush_write_domain(obj); 4230 i915_gem_object_flush_write_domain(obj);