[RFC] drm/lcdc: add TI LCD Controller DRM driver

Daniel Vetter daniel at ffwll.ch
Fri Dec 14 15:50:59 EST 2012


On Fri, Dec 14, 2012 at 1:04 AM, Rob Clark <robdclark at gmail.com> wrote:
> +static int lcdc_crtc_page_flip(struct drm_crtc *crtc,
> +               struct drm_framebuffer *fb,
> +               struct drm_pending_vblank_event *event)
> +{
> +       struct lcdc_crtc *lcdc_crtc = to_lcdc_crtc(crtc);
> +       struct drm_device *dev = crtc->dev;
> +
> +       if (lcdc_crtc->event) {
> +               dev_err(dev->dev, "already pending page flip!\n");
> +               return -EBUSY;
> +       }
> +
> +       // TODO we should hold a ref to the fb somewhere..

Note that with the current fb refcounting nothing prevents you from
fixing this. The ugly problems I've had to solve for the locking
rework are all due to the drm core (i.e. setcrtc/pageflip/...) ioctl
functions assuming that an fb can't suddenly disappear while holding
the mode_config lock. Since I wanted to remove that requirement I've
had to changed the refcounting in the drm core functions.

But drivers can already extend the lifetime of an fb simply by
grabbing a reference (as long as they grab that reference while
holding the struct mutex all the time between fb lookup and grabbing
the reference). And it will continue to work the same with the new
locking scheme.
-Daniel

> +       crtc->fb = fb;
> +       lcdc_crtc->event = event;
> +       update_scanout(crtc);
> +
> +       return 0;
> +}
> +



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



More information about the linux-arm-kernel mailing list