aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm/omap_crtc.c
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2014-04-02 07:31:57 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-04-14 05:34:14 -0400
commite2f8fd74ec1bf15cb2abc1b11f7d9fa09581024e (patch)
tree020db67510226850520f26769da44549f46d050f /drivers/gpu/drm/omapdrm/omap_crtc.c
parentea7e3a662814447cd329390feddd04b9ec0a4b82 (diff)
drm/omap: fix race issue when unloading omapdrm
At module unload, omap_fbdev_free() gets called which releases the framebuffers. However, the framebuffers are still used by crtcs, and will be released only later at vsync. The driver doesn't wait for this, and goes on to release the rest of the resources, which often causes a crash. This patchs adds a omap_crtc_flush() function which waits until the crtc has finished with its apply queue and page flips. The function utilizes a simple polling while-loop, as the performance is not an issue here. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_crtc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 0acbe62901d9..161a74a3ac5e 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -621,6 +621,25 @@ static void omap_crtc_post_apply(struct omap_drm_apply *apply)
621 /* nothing needed for post-apply */ 621 /* nothing needed for post-apply */
622} 622}
623 623
624void omap_crtc_flush(struct drm_crtc *crtc)
625{
626 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
627 int loops = 0;
628
629 while (!list_empty(&omap_crtc->pending_applies) ||
630 !list_empty(&omap_crtc->queued_applies) ||
631 omap_crtc->event || omap_crtc->old_fb) {
632
633 if (++loops > 10) {
634 dev_err(crtc->dev->dev,
635 "omap_crtc_flush() timeout\n");
636 break;
637 }
638
639 schedule_timeout_uninterruptible(msecs_to_jiffies(20));
640 }
641}
642
624static const char *channel_names[] = { 643static const char *channel_names[] = {
625 [OMAP_DSS_CHANNEL_LCD] = "lcd", 644 [OMAP_DSS_CHANNEL_LCD] = "lcd",
626 [OMAP_DSS_CHANNEL_DIGIT] = "tv", 645 [OMAP_DSS_CHANNEL_DIGIT] = "tv",