Skip to content

Commit

Permalink
drm/i915: hold ref on flip object until it completes
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
Signed-off-by: Eric Anholt <[email protected]>
  • Loading branch information
jbarnes993 authored and anholt committed Feb 11, 2010
1 parent 84b79f8 commit 75dfca8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/i915/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -4094,6 +4094,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)

mutex_lock(&work->dev->struct_mutex);
i915_gem_object_unpin(work->old_fb_obj);
drm_gem_object_unreference(work->pending_flip_obj);
drm_gem_object_unreference(work->old_fb_obj);
mutex_unlock(&work->dev->struct_mutex);
kfree(work);
Expand Down Expand Up @@ -4221,8 +4222,9 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
return ret;
}

/* Reference the old fb object for the scheduled work. */
/* Reference the objects for the scheduled work. */
drm_gem_object_reference(work->old_fb_obj);
drm_gem_object_reference(obj);

crtc->fb = fb;
i915_gem_object_flush_write_domain(obj);
Expand Down

0 comments on commit 75dfca8

Please sign in to comment.