[09/12] drm/tilcdc: correct the dmachannel tracking logic

Message ID 29001cedc1e85b98cf0789623f0c76ae987e473d.1450202735.git.jsarha@ti.com
State New
Headers show

Commit Message

Jyri Sarha Dec. 15, 2015, 7:03 p.m.
From: Darren Etheridge <detheridge@ti.com>

dma_channel_completed should be reset to channel 0 when the start
function is called and the dma channel in use should be tracked even
when no flip is pending.

Signed-off-by: Darren Etheridge <detheridge@ti.com>
[Rewrapped description]
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Patch

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 50384fa..720a43a 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -133,6 +133,7 @@  static void start(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
 	struct tilcdc_drm_private *priv = dev->dev_private;
+	struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
 
 	if (priv->rev == 2) {
 		tilcdc_set(dev, LCDC_CLK_RESET_REG, LCDC_CLK_MAIN_RESET);
@@ -141,6 +142,8 @@  static void start(struct drm_crtc *crtc)
 		msleep(1);
 	}
 
+	tilcdc_crtc->dma_completed_channel = 0;
+
 	tilcdc_set(dev, LCDC_DMA_CTRL_REG, LCDC_DUAL_FRAME_BUFFER_ENABLE);
 	tilcdc_set(dev, LCDC_RASTER_CTRL_REG, LCDC_PALETTE_LOAD_MODE(DATA_ONLY));
 	tilcdc_set(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ENABLE);
@@ -680,15 +683,17 @@  irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
 
 		spin_lock_irqsave(&tilcdc_crtc->irq_lock, irq_flags);
 
-		if (dirty & LCDC_END_OF_FRAME0) {
-			set_scanout(crtc, 0);
+		if (stat & LCDC_END_OF_FRAME0)
 			tilcdc_crtc->dma_completed_channel = 0;
-		}
 
-		if (dirty & LCDC_END_OF_FRAME1) {
-			set_scanout(crtc, 1);
+		if (stat & LCDC_END_OF_FRAME1)
 			tilcdc_crtc->dma_completed_channel = 1;
-		}
+
+		if (dirty & LCDC_END_OF_FRAME0)
+			set_scanout(crtc, 0);
+
+		if (dirty & LCDC_END_OF_FRAME1)
+			set_scanout(crtc, 1);
 
 		spin_unlock_irqrestore(&tilcdc_crtc->irq_lock, irq_flags);