[PATCH 4/9] drm/omap: make modesetting synchronous

Tomi Valkeinen tomi.valkeinen at ti.com
Wed Sep 3 04:55:05 PDT 2014


Currently modesetting is not done synchronously, but it queues work that
is done later. In theory this is fine, but the driver doesn't handle it
at properly. This means that if an application first does a full
modeset, then immediately afterwards starts page flipping, the page
flipping will not work properly as there's modeset work still in the
queue.

The result with my test application was that a backbuffer was shown on
the screen.

Fixing this properly would be rather big undertaking. Thus this patch
fixes the issue by making the modesetting synchronous, by waiting for
the queued work to be done at the end of omap_crtc->commit().

The ugly part here is that the background work takes crtc->mutex, and
the modesetting also holds that lock, which means that the background
work never gets done. To get around this, we unclock, wait, and lock
again.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ti.com>
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 193979f97bdb..3261fbf94957 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -277,8 +277,13 @@ static void omap_crtc_prepare(struct drm_crtc *crtc)
 static void omap_crtc_commit(struct drm_crtc *crtc)
 {
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+	struct drm_device *dev = crtc->dev;
 	DBG("%s", omap_crtc->name);
 	omap_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
+
+	drm_modeset_unlock_all(dev);
+	omap_crtc_flush(crtc);
+	drm_modeset_lock_all(dev);
 }
 
 static int omap_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
-- 
1.9.1



More information about the dri-devel mailing list