[PATCH 3/3] drm: Track framebuffer references at the point of assignment

Chris Wilson chris at chris-wilson.co.uk
Mon Nov 28 08:46:11 UTC 2016


On Mon, Nov 28, 2016 at 08:48:34AM +0100, Daniel Vetter wrote:
> On Fri, Nov 25, 2016 at 03:32:31PM +0000, Chris Wilson wrote:
> > --- a/drivers/gpu/drm/drm_atomic.c
> > +++ b/drivers/gpu/drm/drm_atomic.c
> > @@ -1253,7 +1253,7 @@ drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
> >  		DRM_DEBUG_ATOMIC("Set [NOFB] for plane state %p\n",
> >  				 plane_state);
> >  
> > -	drm_framebuffer_assign(&plane_state->fb, fb);
> > +	drm_framebuffer_assign(__mkwrite_drm_framebuffer(&plane_state->fb), fb);
> 
> Feels like const gone the wrong way round? Or I'm not entirely clear on
> what this is supposed to achieve. Just dropping the const would still be a
> nice improvement.

No one is supposed to be writing to it. Adding the const generates a
compiler warning for incorrect code that doesn't do the refcounting -
but doesn't generate a warning for anything simply checking the value.
It is the moral equivalent to calling it _fb to catch all the users.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the dri-devel mailing list