diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-04-16 22:35:20 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-06-12 22:52:50 +0300 |
commit | 1cfe19aa611b332e182cd9976e91a205121ac956 (patch) | |
tree | 7342a0f14709646415a7874dd570f5cdcc40eb4a /drivers/gpu/drm/omapdrm/omap_crtc.c | |
parent | 55613acf1d1e4e6511e85d823e9235941236e6d3 (diff) | |
download | linux-1cfe19aa611b332e182cd9976e91a205121ac956.tar.bz2 |
drm: omapdrm: Support unlinking page flip events prematurely
DRM page flip vblank events requested by page flips or atomic commits
are created by the DRM core and then passed to driver through CRTC
states (for atomic commit) or directly to the page flip handler (for
legacy page flips). The events are then kept aside until the page flip
completes, at which point drivers queue them for delivery with a call to
drm_send_vblank_event().
When a DRM file handle is closed events pending for delivery are cleaned
up automatically by the DRM core. Events that have been passed to the
driver but haven't completed yet, however, are not handled by the DRM
core. Drivers are responsible for destroying them and must not attempt
to queue them for delivery. This is usually handled by drivers'
preclose() handlers that cancel and destroy page flip events that
reference the file handle being closed.
With asynchronous atomic updates the story becomes more complex. Several
asynchronous atomic updates can be pending, each of them carrying
per-CRTC events. As the atomic_commit() operation doesn't receive a file
handle context, drivers can't know which file handle a pending update
refers to, making it difficult to cancel or wait for completion of
updates related to the file handle being closed.
It should be noted that cancelling page flips or waiting for atomic
updates completion isn't required by the DRM core when closing a file
handle. The only requirement is that no event gets queued for delivery
after the preclose() operation returns. This can easily be achieved by
storing events for atomic commits in a list, unlinking events from the
file handle being closed by setting the file_priv field to NULL, and
skipping delivery of unlinked events.
This logic replaces the page flip cancellation completely.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_crtc.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 8cbac72a1015..aa719ebfe787 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -254,30 +254,6 @@ static const struct dss_mgr_ops mgr_ops = { * Setup, Flush and Page Flip */ -void omap_crtc_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file) -{ - struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - struct drm_pending_vblank_event *event; - struct drm_device *dev = crtc->dev; - unsigned long flags; - - /* Destroy the pending vertical blanking event associated with the - * pending page flip, if any, and disable vertical blanking interrupts. - */ - - spin_lock_irqsave(&dev->event_lock, flags); - - event = omap_crtc->event; - omap_crtc->event = NULL; - - if (event && event->base.file_priv == file) { - event->base.destroy(&event->base); - drm_crtc_vblank_put(crtc); - } - - spin_unlock_irqrestore(&dev->event_lock, flags); -} - static void omap_crtc_complete_page_flip(struct drm_crtc *crtc) { struct omap_crtc *omap_crtc = to_omap_crtc(crtc); @@ -291,7 +267,17 @@ static void omap_crtc_complete_page_flip(struct drm_crtc *crtc) omap_crtc->event = NULL; if (event) { - drm_crtc_send_vblank_event(crtc, event); + list_del(&event->base.link); + + /* + * Queue the event for delivery if it's still linked to a file + * handle, otherwise just destroy it. + */ + if (event->base.file_priv) + drm_crtc_send_vblank_event(crtc, event); + else + event->base.destroy(&event->base); + wake_up(&omap_crtc->flip_wait); drm_crtc_vblank_put(crtc); } |