[PATCH] drm/omap: Take a fb reference in omap_plane_update()

Daniel Vetter daniel at ffwll.ch
Tue Apr 9 06:41:42 PDT 2013


On Tue, Apr 9, 2013 at 3:17 PM, Rob Clark <robdclark at gmail.com> wrote:
>>> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
>>> index 2882cda..8d225d7 100644
>>> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
>>> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
>>> @@ -247,6 +247,12 @@ static int omap_plane_update(struct drm_plane *plane,
>>>  {
>>>       struct omap_plane *omap_plane = to_omap_plane(plane);
>>>       omap_plane->enabled = true;
>>> +
>>> +     if (plane->fb)
>>> +             drm_framebuffer_unreference(plane->fb);
>>
>> Shouldn't the unref only happen once the flip has completed? Otherwise we
>> might free the memory which is still being scanned out and put some other
>> crap there.
>
> yup, there is a 2nd ref grabbed when we start scanout and dropped when
> we finish scanout..  so that part was already covered.  What wasn't
> covered before was the time between the ioctl and the worker thread
> (which was grabbing/dropping the scanout ref)

Ah, I see. And the ordering doesn't seem to matter here since it's all
protected by locks (against races with the worker thread) anyway.
Thanks for the explanation.
-Daniel

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list