[Openchrome-devel] drm-openchrome: drivers/gpu/drm

James Simmons jsimmons at kemper.freedesktop.org
Sat Mar 30 12:22:15 PDT 2013


 drivers/gpu/drm/via/via_drv.c |   15 ++++++++-------
 drivers/gpu/drm/via/via_irq.c |    5 +++++
 2 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit b853ddcddd71d963caed596fbf1f73e040099f6f
Author: James Simmons <jsimmons at infradead.org>
Date:   Sat Mar 30 15:22:06 2013 -0400

    Enabling vsync handling on the second crtc exposed a bug for IRQ handling. We need to enable IRQ after vblank setup. Also the docs recommend starting the hotplug irq handling after at least two frames have been displayed.

diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c
index 323c363..9e089bd 100644
--- a/drivers/gpu/drm/via/via_drv.c
+++ b/drivers/gpu/drm/via/via_drv.c
@@ -261,6 +261,8 @@ static int via_driver_unload(struct drm_device *dev)
 	if (ret)
 		return ret;
 
+	drm_irq_uninstall(dev);
+
 	if (drm_core_check_feature(dev, DRIVER_MODESET))
 		via_modeset_fini(dev);
 
@@ -268,8 +270,6 @@ static int via_driver_unload(struct drm_device *dev)
 
 	drm_vblank_cleanup(dev);
 
-	drm_irq_uninstall(dev);
-
 	/* destroy work queue. */
 	destroy_workqueue(dev_priv->wq);
 
@@ -390,10 +390,6 @@ via_driver_load(struct drm_device *dev, unsigned long chipset)
 		goto out_err;
 	}
 
-	ret = drm_irq_install(dev);
-	if (ret)
-		goto out_err;
-
 	ret = drm_vblank_init(dev, 2);
 	if (ret)
 		goto out_err;
@@ -402,8 +398,13 @@ via_driver_load(struct drm_device *dev, unsigned long chipset)
 	if (ret)
 		goto out_err;
 
-	if (drm_core_check_feature(dev, DRIVER_MODESET))
+	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
 		ret = via_modeset_init(dev);
+		if (ret)
+			goto out_err;
+	}
+
+	ret = drm_irq_install(dev);
 out_err:
 	if (ret)
 		via_driver_unload(dev);
diff --git a/drivers/gpu/drm/via/via_irq.c b/drivers/gpu/drm/via/via_irq.c
index 79ac545..6c1a511 100644
--- a/drivers/gpu/drm/via/via_irq.c
+++ b/drivers/gpu/drm/via/via_irq.c
@@ -277,6 +277,11 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
 		ret = IRQ_HANDLED;
 	}
 
+	if (status & VIA_IRQ_IGA2_VSYNC_STATUS) {
+		drm_handle_vblank(dev, 1);
+		ret = IRQ_HANDLED;
+	}
+
 	for (i = 0; i < dev_priv->num_irqs; ++i) {
 		if (status & cur_irq->pending_mask) {
 			struct via_fence_engine *eng = NULL;


More information about the Openchrome-devel mailing list