diff mbox

[10/12] drm/tilcdc: make frame completion interrupt always enabled

Message ID 035887c267515417c8aa93997ad78a2b753cf0ce.1450202735.git.jsarha@ti.com
State New
Headers show

Commit Message

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

DRM allows vblank handling to be controlled dynamically. Therefore if
vblank interrupts are not needed by anybody they are disabled.
However on tilcdc a ping-pong dma is used and there is no way to find
out from the hardware which dma channel will be used for the next
frame to program the corresponding dma registers with the new
framebuffer address. The only way currently known is to use the vsync
handler to track the channel currently used. This means that disabling
the vsync is a bad idea because it is always needed to track the dma
channel.

This patch removes the enable/disable_vblank functions, moves the
enabling of the FRAME0/FRAME1_DONE interrupts into the
post_install_interrupt handler so they are always active and removes
the calls to drm_vblank_get, drm_vblank_put.

Signed-off-by: Darren Etheridge <detheridge@ti.com>
[Rewrapped descrription]
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c |  6 ------
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  | 26 +++-----------------------
 2 files changed, 3 insertions(+), 29 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 720a43a..8543d6b 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -89,7 +89,6 @@  static void set_scanout(struct drm_crtc *crtc, int n)
 static void update_scanout(struct drm_crtc *crtc)
 {
 	struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
-	struct drm_device *dev = crtc->dev;
 	struct drm_framebuffer *fb = crtc->primary->fb;
 	struct drm_gem_cma_object *gem;
 	unsigned int depth, bpp;
@@ -120,8 +119,6 @@  static void update_scanout(struct drm_crtc *crtc)
 			tilcdc_crtc->dirty |= LCDC_END_OF_FRAME0;
 			set_scanout(crtc, 1);
 		}
-
-		drm_vblank_get(dev, 0);
 	} else {
 		/* not enabled yet, so update registers immediately: */
 		set_scanout(crtc, 0);
@@ -706,8 +703,6 @@  irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
 			drm_send_vblank_event(dev, 0, event);
 		spin_unlock_irqrestore(&dev->event_lock, flags);
 
-		if (dirty && !tilcdc_crtc->dirty)
-			drm_vblank_put(dev, 0);
 	}
 
 	if (priv->rev == 2) {
@@ -736,7 +731,6 @@  void tilcdc_crtc_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file)
 	if (event && event->base.file_priv == file) {
 		tilcdc_crtc->event = NULL;
 		event->base.destroy(&event->base);
-		drm_vblank_put(dev, 0);
 	}
 	spin_unlock_irqrestore(&dev->event_lock, flags);
 }
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index f640b37..2b6d2dc 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -385,6 +385,8 @@  static int tilcdc_irq_postinstall(struct drm_device *dev)
 	else
 		tilcdc_set(dev, LCDC_INT_ENABLE_SET_REG,
 			   LCDC_V2_UNDERFLOW_INT_ENA |
+			   LCDC_V2_END_OF_FRAME0_INT_ENA |
+			   LCDC_V2_END_OF_FRAME1_INT_ENA |
 			   LCDC_FRAME_DONE);
 
 	return 0;
@@ -405,38 +407,16 @@  static void tilcdc_irq_uninstall(struct drm_device *dev)
 			LCDC_V2_END_OF_FRAME0_INT_ENA | LCDC_V2_END_OF_FRAME1_INT_ENA |
 			LCDC_FRAME_DONE);
 	}
-
-}
-
-static void enable_vblank(struct drm_device *dev, bool enable)
-{
-	struct tilcdc_drm_private *priv = dev->dev_private;
-	u32 reg, mask;
-
-	if (priv->rev == 1) {
-		reg = LCDC_DMA_CTRL_REG;
-		mask = LCDC_V1_END_OF_FRAME_INT_ENA;
-	} else {
-		reg = LCDC_INT_ENABLE_SET_REG;
-		mask = LCDC_V2_END_OF_FRAME0_INT_ENA |
-			LCDC_V2_END_OF_FRAME1_INT_ENA;
-	}
-
-	if (enable)
-		tilcdc_set(dev, reg, mask);
-	else
-		tilcdc_clear(dev, reg, mask);
 }
 
 static int tilcdc_enable_vblank(struct drm_device *dev, unsigned int pipe)
 {
-	enable_vblank(dev, true);
 	return 0;
 }
 
 static void tilcdc_disable_vblank(struct drm_device *dev, unsigned int pipe)
 {
-	enable_vblank(dev, false);
+	return;
 }
 
 #if defined(CONFIG_DEBUG_FS) || defined(CONFIG_PM_SLEEP)