[Intel-gfx] [PATCH 4/9] drm/i915: Wrap drm_gem_object_reference in i915_gem_object_get

Chris Wilson chris at chris-wilson.co.uk
Wed Jul 20 11:45:21 UTC 2016


On Wed, Jul 20, 2016 at 12:38:24PM +0100, Dave Gordon wrote:
> On 20/07/16 09:59, Chris Wilson wrote:
> >diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> >index 77d320584478..84904a2d3fcd 100644
> >--- a/drivers/gpu/drm/i915/intel_display.c
> >+++ b/drivers/gpu/drm/i915/intel_display.c
> >@@ -11649,7 +11649,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
> >
> >  	/* Reference the objects for the scheduled work. */
> >  	drm_framebuffer_reference(work->old_fb);
> >-	drm_gem_object_reference(&obj->base);
> >
> >  	crtc->primary->fb = fb;
> >  	update_state_fb(crtc->primary);
> >@@ -11657,7 +11656,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
> >  	intel_fbc_pre_update(intel_crtc, intel_crtc->config,
> >  			     to_intel_plane_state(primary->state));
> >
> >-	work->pending_flip_obj = obj;
> >+	work->pending_flip_obj = i915_gem_object_get(obj);
> >
> >  	ret = i915_mutex_lock_interruptible(dev);
> >  	if (ret)
> 
> This last one moves the point at which the reference is taken past
> several function calls; is that intentional, or at least harmless?

It is harmless. The function owns a reference to the framebuffer (which
owns the obj), what is required is an extra reference for the deferred
work item.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list