diff mbox

[PULL] topic/vblank-rework, take 2

Message ID 20141008132148.GA32477@ulmo (mailing list archive)
State New, archived
Headers show

Commit Message

Thierry Reding Oct. 8, 2014, 1:21 p.m. UTC
On Fri, Sep 12, 2014 at 09:48:59AM +0200, Daniel Vetter wrote:
[...]
> Ville Syrjälä (16):
>       drm: Always reject drm_vblank_get() after drm_vblank_off()

This particular commit seems to be wreaking havoc. Inki already reported
this at some point and Andrzej and Joonyoung tried to fix this on Exynos
already, but it seems like a couple more drivers would suffer from this.
At least those using drm_vblank_off() but not drm_vblank_on() would see
the same issue.

A quick grep indicate that Armada, Exynos, GMA500 and STI would all
suffer from the same problem. Adding the respective maintainers. I've
used the attached patch to fix the issue on Tegra.

Ville, does that conversion look right? Perhaps it would be safer to
call drm_crtc_vblank_on() before activating the CRTC to avoid a
potential race? It seems like drm_vblank_on() and drm_vblank_off()
would replace drm_vblank_{pre,post}_modeset() completely, so I've
removed them as part of the patch as well.

I suppose the attached patch and equivalent ones for the other drivers
would need to be carried in this series to avoid regressions.

Thierry
diff mbox

Patch

From 1b7539953054f8f4b102570c21ddee36a65f4a06 Mon Sep 17 00:00:00 2001
From: Thierry Reding <treding@nvidia.com>
Date: Wed, 8 Oct 2014 14:48:51 +0200
Subject: [PATCH] drm/tegra: dc: Add missing call to drm_vblank_on()

When the CRTC is enabled, make sure the VBLANK machinery is enabled.
Failure to do so will cause drm_vblank_get() to not enable the VBLANK on
the CRTC and VBLANK-synchronized page-flips won't work.

While at it, get rid of the legacy drm_vblank_pre_modeset() and
drm_vblank_post_modeset() calls that are replaced by drm_vblank_on()
and drm_vblank_off().

Reported-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/tegra/dc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 2bc344b1fcd5..2aeaa4960d21 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -741,7 +741,6 @@  static const struct drm_crtc_funcs tegra_crtc_funcs = {
 
 static void tegra_crtc_disable(struct drm_crtc *crtc)
 {
-	struct tegra_dc *dc = to_tegra_dc(crtc);
 	struct drm_device *drm = crtc->dev;
 	struct drm_plane *plane;
 
@@ -757,7 +756,7 @@  static void tegra_crtc_disable(struct drm_crtc *crtc)
 		}
 	}
 
-	drm_vblank_off(drm, dc->pipe);
+	drm_crtc_vblank_off(crtc);
 }
 
 static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc,
@@ -846,8 +845,6 @@  static int tegra_crtc_mode_set(struct drm_crtc *crtc,
 	u32 value;
 	int err;
 
-	drm_vblank_pre_modeset(crtc->dev, dc->pipe);
-
 	err = tegra_crtc_setup_clk(crtc, mode);
 	if (err) {
 		dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err);
@@ -948,7 +945,7 @@  static void tegra_crtc_commit(struct drm_crtc *crtc)
 	value = GENERAL_ACT_REQ | WIN_A_ACT_REQ;
 	tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL);
 
-	drm_vblank_post_modeset(crtc->dev, dc->pipe);
+	drm_crtc_vblank_on(crtc);
 }
 
 static void tegra_crtc_load_lut(struct drm_crtc *crtc)
-- 
2.1.0