rpms/kernel/F-12 drm-i915-fix-sync-to-vbl-when-vga-is-off.patch, NONE, 1.1 kernel.spec, 1.1940, 1.1941

Kyle McMartin kyle at fedoraproject.org
Mon Nov 30 19:13:30 UTC 2009


Author: kyle

Update of /cvs/pkgs/rpms/kernel/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv30786

Modified Files:
	kernel.spec 
Added Files:
	drm-i915-fix-sync-to-vbl-when-vga-is-off.patch 
Log Message:
* Mon Nov 30 2009 Kyle McMartin <kyle at redhat.com>
- drm-i915-fix-sync-to-vbl-when-vga-is-off.patch: add (rhbz#541670)


drm-i915-fix-sync-to-vbl-when-vga-is-off.patch:
 drivers/gpu/drm/drm_irq.c            |   34 ++++++++++++++++++++++++++--------
 drivers/gpu/drm/i915/intel_display.c |    1 +
 include/drm/drmP.h                   |    1 +
 3 files changed, 28 insertions(+), 8 deletions(-)

--- NEW FILE drm-i915-fix-sync-to-vbl-when-vga-is-off.patch ---
>From patchwork Mon Nov  9 04:51:22 2009
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: drm/i915: Fix sync to vblank when VGA output is turned off
Date: Mon, 09 Nov 2009 04:51:22 -0000
From: Li Peng <peng.li at linux.intel.com>
X-Patchwork-Id: 58658

In current vblank-wait implementation, if we turn off VGA output,
drm_wait_vblank will still wait on the disabled pipe until timeout,
because vblank on the pipe is assumed be enabled. This would cause
slow system response on some system such as moblin.

This patch resolve the issue by adding a drm helper function
drm_vblank_off which explicitly clear vblank_enabled[crtc], wake up
any waiting queue and save last vblank counter before turning off
crtc. It also slightly change drm_vblank_get to ensure that we will
will return immediately if trying to wait on a disabled pipe.

Signed-off-by: Li Peng <peng.li at intel.com>
Reviewed-by: Jesse Barnes <jbarnes at virtuousgeek.org>

---
drivers/gpu/drm/drm_irq.c            |   34 ++++++++++++++++++++++++++--------
 drivers/gpu/drm/i915/intel_display.c |    1 +
 include/drm/drmP.h                   |    1 +
 3 files changed, 28 insertions(+), 8 deletions(-)

diff -Nur linux-2.6.31.noarch/drivers/gpu/drm/drm_irq.c linux-2.6.31.noarch~/drivers/gpu/drm/drm_irq.c
--- linux-2.6.31.noarch/drivers/gpu/drm/drm_irq.c	2009-11-30 14:08:56.000000000 -0500
+++ linux-2.6.31.noarch~/drivers/gpu/drm/drm_irq.c	2009-11-30 14:08:23.000000000 -0500
@@ -429,15 +429,21 @@
 
 	spin_lock_irqsave(&dev->vbl_lock, irqflags);
 	/* Going from 0->1 means we have to enable interrupts again */
-	if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1 &&
-	    !dev->vblank_enabled[crtc]) {
-		ret = dev->driver->enable_vblank(dev, crtc);
-		DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n", crtc, ret);
-		if (ret)
+	if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1) {
+		if (!dev->vblank_enabled[crtc]) {
+			ret = dev->driver->enable_vblank(dev, crtc);
+			DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n", crtc, ret);
+			if (ret)
+				atomic_dec(&dev->vblank_refcount[crtc]);
+			else {
+				dev->vblank_enabled[crtc] = 1;
+				drm_update_vblank_count(dev, crtc);
+			}
+		}
+	} else {
+		if (!dev->vblank_enabled[crtc]) {
 			atomic_dec(&dev->vblank_refcount[crtc]);
-		else {
-			dev->vblank_enabled[crtc] = 1;
-			drm_update_vblank_count(dev, crtc);
+			ret = -EINVAL;
 		}
 	}
 	spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
@@ -464,6 +470,18 @@
 }
 EXPORT_SYMBOL(drm_vblank_put);
 
+void drm_vblank_off(struct drm_device *dev, int crtc)
+{
+	unsigned long irqflags;
+
+	spin_lock_irqsave(&dev->vbl_lock, irqflags);
+	DRM_WAKEUP(&dev->vbl_queue[crtc]);
+	dev->vblank_enabled[crtc] = 0;
+	dev->last_vblank[crtc] = dev->driver->get_vblank_counter(dev, crtc);
+	spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
+}
+EXPORT_SYMBOL(drm_vblank_off);
+
 /**
  * drm_vblank_pre_modeset - account for vblanks across mode sets
  * @dev: DRM device
diff -Nur linux-2.6.31.noarch/drivers/gpu/drm/i915/intel_display.c linux-2.6.31.noarch~/drivers/gpu/drm/i915/intel_display.c
--- linux-2.6.31.noarch/drivers/gpu/drm/i915/intel_display.c	2009-11-30 14:08:56.000000000 -0500
+++ linux-2.6.31.noarch~/drivers/gpu/drm/i915/intel_display.c	2009-11-30 14:08:23.000000000 -0500
@@ -1599,6 +1599,7 @@
 		intel_update_watermarks(dev);
 		/* Give the overlay scaler a chance to disable if it's on this pipe */
 		//intel_crtc_dpms_video(crtc, FALSE); TODO
+		drm_vblank_off(dev, pipe);
 
 		/* Disable the VGA plane that we never use */
 		i915_disable_vga(dev);
diff -Nur linux-2.6.31.noarch/include/drm/drmP.h linux-2.6.31.noarch~/include/drm/drmP.h
--- linux-2.6.31.noarch/include/drm/drmP.h	2009-11-30 14:08:56.000000000 -0500
+++ linux-2.6.31.noarch~/include/drm/drmP.h	2009-11-30 14:08:23.000000000 -0500
@@ -1295,6 +1295,7 @@
 extern void drm_handle_vblank(struct drm_device *dev, int crtc);
 extern int drm_vblank_get(struct drm_device *dev, int crtc);
 extern void drm_vblank_put(struct drm_device *dev, int crtc);
+extern void drm_vblank_off(struct drm_device *dev, int crtc);
 extern void drm_vblank_cleanup(struct drm_device *dev);
 /* Modesetting support */
 extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-12/kernel.spec,v
retrieving revision 1.1940
retrieving revision 1.1941
diff -u -p -r1.1940 -r1.1941
--- kernel.spec	30 Nov 2009 05:59:35 -0000	1.1940
+++ kernel.spec	30 Nov 2009 19:13:30 -0000	1.1941
@@ -724,6 +724,7 @@ Patch1832: drm-edid-retry.patch
 Patch1834: drm-edid-header-fixup.patch
 Patch1835: drm-default-mode.patch
 Patch1836: drm-radeon-hdp-cache-flush.patch
+Patch1837: drm-i915-fix-sync-to-vbl-when-vga-is-off.patch
 
 # vga arb
 Patch1900: linux-2.6-vga-arb.patch
@@ -1436,6 +1437,7 @@ ApplyOptionalPatch drm-intel-next.patch
 #ApplyPatch drm-intel-pm.patch
 ApplyPatch drm-intel-no-tv-hotplug.patch
 ApplyPatch drm-i915-fix-tvmode-oops.patch
+ApplyPatch drm-i915-fix-sync-to-vbl-when-vga-is-off.patch
 #ApplyPatch drm-disable-r600-aspm.patch
 
 # VGA arb + drm
@@ -2153,6 +2155,9 @@ fi
 # and build.
 
 %changelog
+* Mon Nov 30 2009 Kyle McMartin <kyle at redhat.com>
+- drm-i915-fix-sync-to-vbl-when-vga-is-off.patch: add (rhbz#541670)
+
 * Sun Nov 29 2009 Kyle McMartin <kyle at redhat.com>
 - Drop linux-2.6-sysrq-c.patch, made consistent upstream.
 




More information about the fedora-extras-commits mailing list