On Friday, July 25, 2008 1:09 pm Robert Noland wrote:
> The changes that we discussed on irc are turning out to be slightly more
> difficult than I expected...  In the meantime, I'd like to push this to
> master to get things more or less working again.
>
> One thing I discovered was that, at least on bsd, the signal handler
> gets installed / uninstalled pretty often right now.  Each time that
> happens, we call drm_vblank_init and reset vblank_disable_allowed=0,
> meaning that a modeset or dpms must occur after the handler is installed
> each time to disable vblanks.
>
> This patch reverts most of my changes to i915's irq install / uninstall
> functions.  It does move the drm_vblank_init and drm_vblank_cleanup
> calls to the drivers respective load / unload routines.  Minor
> additional changes will be needed on the linux side.  Mostly just remove
> the drm_vblank_cleanup call from you irq_uninstall path.
>
> I have made the driver changes to i915 and radeon so far, but I am only
> able to test intel.
>
> I'm still working to allow the irq handlers to be installed at load
> time, but that is slightly more complicated surgery, at least on the bsd
> side of the house...

Given the way master is now, would this be a simpler fix?

It basically just makes drivers responsible for doing vblank init & cleanup.  
They can move it to load/unload or irq install/uninstall whenever they want.

Thanks,
Jesse
diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c
index 6e21d41..6df8b74 100644
--- a/bsd-core/drm_irq.c
+++ b/bsd-core/drm_irq.c
@@ -295,8 +295,6 @@ int drm_irq_uninstall(struct drm_device *dev)
 #elif defined(__NetBSD__) || defined(__OpenBSD__)
 	pci_intr_disestablish(&dev->pa.pa_pc, dev->irqh);
 #endif
-	drm_vblank_cleanup(dev);
-
 	return 0;
 }
 
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c
index d0d6f98..aaefee1 100644
--- a/linux-core/drm_irq.c
+++ b/linux-core/drm_irq.c
@@ -277,8 +277,6 @@ int drm_irq_uninstall(struct drm_device * dev)
 
 	free_irq(dev->irq, dev);
 
-	drm_vblank_cleanup(dev);
-
 	dev->locked_tasklet_func = NULL;
 
 	return 0;
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c
index 47f1f46..b2e0307 100644
--- a/shared-core/i915_dma.c
+++ b/shared-core/i915_dma.c
@@ -1104,6 +1104,8 @@ int i915_driver_unload(struct drm_device *dev)
 #endif
 #endif
 
+	drm_vblank_cleanup(dev);
+
 	drm_free(dev->dev_private, sizeof(drm_i915_private_t),
 		 DRM_MEM_DRIVER);
 #ifdef __linux__
diff --git a/shared-core/mach64_irq.c b/shared-core/mach64_irq.c
index 57879e8..1befa06 100644
--- a/shared-core/mach64_irq.c
+++ b/shared-core/mach64_irq.c
@@ -153,7 +153,7 @@ void mach64_driver_irq_uninstall(struct drm_device * dev)
 		return;
 
 	mach64_disable_vblank_local(dev, 0);
-
+	drm_vblank_cleanup(dev);
 	DRM_DEBUG("after uninstall CRTC_INT_CTNL: 0x%08x\n",
 		  MACH64_READ(MACH64_CRTC_INT_CNTL));
 }
diff --git a/shared-core/mga_irq.c b/shared-core/mga_irq.c
index 4fe8632..26e74b5 100644
--- a/shared-core/mga_irq.c
+++ b/shared-core/mga_irq.c
@@ -177,6 +177,6 @@ void mga_driver_irq_uninstall(struct drm_device * dev)
 
 	/* Disable *all* interrupts */
 	MGA_WRITE(MGA_IEN, 0);
-
 	dev->irq_enabled = 0;
+	drm_vblank_cleanup(dev);
 }
diff --git a/shared-core/r128_irq.c b/shared-core/r128_irq.c
index 5b95bd8..75580cc 100644
--- a/shared-core/r128_irq.c
+++ b/shared-core/r128_irq.c
@@ -111,6 +111,7 @@ void r128_driver_irq_uninstall(struct drm_device * dev)
 	if (!dev_priv)
 		return;
 
+	drm_vblank_cleanup(dev);
 	/* Disable *all* interrupts */
 	R128_WRITE(R128_GEN_INT_CNTL, 0);
 }
diff --git a/shared-core/radeon_irq.c b/shared-core/radeon_irq.c
index 6956996..e300bd5 100644
--- a/shared-core/radeon_irq.c
+++ b/shared-core/radeon_irq.c
@@ -363,7 +363,7 @@ void radeon_driver_irq_uninstall(struct drm_device * dev)
 		return;
 
 	dev_priv->irq_enabled = 0;
-
+	drm_vblank_cleanup(dev);
 	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690)
 		RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
 	/* Disable *all* interrupts */
diff --git a/shared-core/via_irq.c b/shared-core/via_irq.c
index c3279f8..36d2c44 100644
--- a/shared-core/via_irq.c
+++ b/shared-core/via_irq.c
@@ -348,6 +348,7 @@ void via_driver_irq_uninstall(struct drm_device * dev)
 		status = VIA_READ(VIA_REG_INTERRUPT);
 		VIA_WRITE(VIA_REG_INTERRUPT, status &
 			  ~(VIA_IRQ_VBLANK_ENABLE | dev_priv->irq_enable_mask));
+		drm_vblank_cleanup(dev);
 	}
 }
 
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to