[Openchrome-devel] drm-openchrome: Branch 'drm-next-4.13' - drivers/gpu/drm

Kevin Brace kevinbrace at kemper.freedesktop.org
Thu Aug 24 18:33:23 UTC 2017


 drivers/gpu/drm/openchrome/via_crtc.c |    4 ++++
 drivers/gpu/drm/openchrome/via_drv.c  |    3 ---
 drivers/gpu/drm/openchrome/via_drv.h  |    4 ++--
 drivers/gpu/drm/openchrome/via_irq.c  |   30 ++++++++++++------------------
 4 files changed, 18 insertions(+), 23 deletions(-)

New commits:
commit fc54deca1fe4d5433d24d52e7ba8b496217bbf76
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Aug 24 11:31:34 2017 -0700

    Use vblank callbacks of drm_crtc_funcs instead of drm_driver
    
    vblank callbacks provided by drm_driver struct were deprecated,
    hence, the need for conversion.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/via_crtc.c b/drivers/gpu/drm/openchrome/via_crtc.c
index c4200e4e2656..44c973bd5c5f 100644
--- a/drivers/gpu/drm/openchrome/via_crtc.c
+++ b/drivers/gpu/drm/openchrome/via_crtc.c
@@ -465,6 +465,8 @@ static const struct drm_crtc_funcs via_iga1_funcs = {
     .gamma_set = via_iga1_gamma_set,
     .set_config = drm_crtc_helper_set_config,
     .destroy = via_crtc_destroy,
+    .enable_vblank = via_enable_vblank,
+    .disable_vblank = via_disable_vblank,
 };
 
 static const struct drm_crtc_funcs via_iga2_funcs = {
@@ -473,6 +475,8 @@ static const struct drm_crtc_funcs via_iga2_funcs = {
     .gamma_set = via_iga2_gamma_set,
     .set_config = drm_crtc_helper_set_config,
     .destroy = via_crtc_destroy,
+    .enable_vblank = via_enable_vblank,
+    .disable_vblank = via_disable_vblank,
 };
 
 static void
diff --git a/drivers/gpu/drm/openchrome/via_drv.c b/drivers/gpu/drm/openchrome/via_drv.c
index 58cdd9f7e38c..40515729687b 100644
--- a/drivers/gpu/drm/openchrome/via_drv.c
+++ b/drivers/gpu/drm/openchrome/via_drv.c
@@ -468,9 +468,6 @@ static struct drm_driver via_driver = {
 	.unload = via_driver_unload,
 	.preclose = via_reclaim_buffers_locked,
 	.context_dtor = via_final_context,
-	.get_vblank_counter = drm_vblank_count,
-	.enable_vblank = via_enable_vblank,
-	.disable_vblank = via_disable_vblank,
 	.irq_preinstall = via_driver_irq_preinstall,
 	.irq_postinstall = via_driver_irq_postinstall,
 	.irq_uninstall = via_driver_irq_uninstall,
diff --git a/drivers/gpu/drm/openchrome/via_drv.h b/drivers/gpu/drm/openchrome/via_drv.h
index 0ae0be53f822..b39a14d7688b 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -237,8 +237,8 @@ extern int via_wait_idle(struct via_device *dev_priv);
 
 extern int via_vram_init(struct via_device *dev_priv);
 
-extern int via_enable_vblank(struct drm_device *dev, int crtc);
-extern void via_disable_vblank(struct drm_device *dev, int crtc);
+extern int via_enable_vblank(struct drm_crtc *crtc);
+extern void via_disable_vblank(struct drm_crtc *crtc);
 
 extern irqreturn_t via_driver_irq_handler(int irq, void *arg);
 extern void via_driver_irq_preinstall(struct drm_device *dev);
diff --git a/drivers/gpu/drm/openchrome/via_irq.c b/drivers/gpu/drm/openchrome/via_irq.c
index 5fc6e59d0d5d..6cfd269dab22 100644
--- a/drivers/gpu/drm/openchrome/via_irq.c
+++ b/drivers/gpu/drm/openchrome/via_irq.c
@@ -268,22 +268,19 @@ irqreturn_t via_driver_irq_handler(int irq, void *arg)
 	return ret;
 }
 
-int
-via_enable_vblank(struct drm_device *dev, int crtc)
+int via_enable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
 	struct via_device *dev_priv = dev->dev_private;
 	u32 status;
 
-	if (crtc < 0 || crtc >= dev->num_crtcs) {
-		DRM_ERROR("%s: Invalid crtc %d\n", __func__, crtc);
-		return -EINVAL;
-	}
-
 	status = VIA_READ(INTERRUPT_CTRL_REG1);
-	if (crtc == 1)
+	if (iga->index) {
 		status |= VIA_IRQ_IGA2_VSYNC_ENABLE | VIA_IRQ_IGA2_VSYNC_STATUS;
-	else if (!crtc)
+	} else {
 		status |= VIA_IRQ_IGA1_VSYNC_ENABLE | VIA_IRQ_IGA1_VSYNC_STATUS;
+	}
 
 	svga_wcrt_mask(VGABASE, 0xF3, 0, BIT(1));
 	svga_wcrt_mask(VGABASE, 0x11, BIT(4), BIT(4));
@@ -292,22 +289,19 @@ via_enable_vblank(struct drm_device *dev, int crtc)
 	return 0;
 }
 
-void
-via_disable_vblank(struct drm_device *dev, int crtc)
+void via_disable_vblank(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
+	struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
 	struct via_device *dev_priv = dev->dev_private;
 	u32 status;
 
-	if (crtc < 0 || crtc >= dev->num_crtcs) {
-		DRM_ERROR("%s: Invalid crtc %d\n", __func__, crtc);
-		return;
-	}
-
 	status = VIA_READ(INTERRUPT_CTRL_REG1);
-	if (crtc == 1)
+	if (iga->index) {
 		status &= ~VIA_IRQ_IGA2_VSYNC_ENABLE;
-	else if (!crtc)
+	} else {
 		status &= ~VIA_IRQ_IGA1_VSYNC_ENABLE;
+	}
 
 	VIA_WRITE(INTERRUPT_CTRL_REG1, status);
 }


More information about the Openchrome-devel mailing list