[Intel-gfx] [PATCH, RFC] Output hotplug support

ykzhao yakui.zhao at intel.com
Fri Oct 9 09:32:08 CEST 2009


On Tue, 2009-10-06 at 02:21 +0800, Jesse Barnes wrote:
> On Mon, 05 Oct 2009 14:05:34 -0400
> Adam Jackson <ajax at redhat.com> wrote:
> 
> > I'm shipping the following patch in Fedora 12 to enable output
> > hotplug:
> > 
> > http://cvs.fedoraproject.org/viewvc/F-12/xorg-x11-drv-intel/uevent.patch?revision=1.1
> > 
> > And it pretty much works!  We get hotplug events from the DRM, rescan
> > RANDR when that happens, events go out, userspace adapts.  It's all
> > quite cool.  It's not really mergeable yet for all the reasons in the
> > comments in the patch itself, but it's a start.
> 
> There are events for other stuff these days, including hangs and
> errors.  Just checking the environment for HOTPLUG=1 should be
> sufficient.
> 
> > 
> > However, in order to actually ship this, I had to also ship this for
> > the kernel:
> > 
> > http://cvs.fedoraproject.org/viewvc/F-12/kernel/drm-intel-no-tv-hotplug.patch?revision=1.1
> > 
> > Otherwise, I'd get stuck in a loop where (afaict) output scan would
> > trigger a TV interrupt, which would trigger a scan, etc.  TV load
> > detection not being the fastest thing in the world, X would process
> > requests ve-ry slow-ly.
> > 
> > If anyone actually understands the TV output code and wanted to take a
> > look at this, I'd appreciate it.
> 
> I know I had it working at one point, but there have been a lot of
> changes to the KMS TV code since then.  I'll take a look.  Sounds like
> the fundamental bug is that TV scanning causes a TV hotplug event?

HI, Ajax
    Will you please try the following patch and see whether it is
helpful?
    
Disable the TV hotplug interrupt in course of TV detection
---
 drivers/gpu/drm/i915/intel_tv.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/gpu/drm/i915/intel_tv.c
===================================================================
--- linux-2.6.orig/drivers/gpu/drm/i915/intel_tv.c	2009-10-09
11:38:43.000000000 +0800
+++ linux-2.6/drivers/gpu/drm/i915/intel_tv.c	2009-10-09
15:24:39.000000000 +0800
@@ -1372,6 +1372,7 @@
 	u32 tv_ctl, save_tv_ctl;
 	u32 tv_dac, save_tv_dac;
 	int type = DRM_MODE_CONNECTOR_Unknown;
+	unsigned int hotplug_en, hotplug_stat;
 
 	tv_dac = I915_READ(TV_DAC);
 
@@ -1380,7 +1381,9 @@
 	i915_disable_pipestat(dev_priv, 0, PIPE_HOTPLUG_INTERRUPT_ENABLE |
 			      PIPE_HOTPLUG_TV_INTERRUPT_ENABLE);
 	spin_unlock_irqrestore(&dev_priv->user_irq_lock, irqflags);
-
+	/* disable the TV hotplug */
+	hotplug_en = I915_READ(PORT_HOTPLUG_EN);
+	I915_WRITE(PORT_HOTPLUG_EN, hotplug_en & ~(TV_HOTPLUG_INT_EN));
 	/*
 	 * Detect TV by polling)
 	 */
@@ -1429,6 +1432,10 @@
 		type = -1;
 	}
 
+	/* clear the TV hotplug status bit */
+	I915_WRITE(PORT_HOTPLUG_STAT, TV_HOTPLUG_INT_STATUS);
+	/* Restore the TV hotplug interrupt setting */
+	I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
 	/* Restore interrupt config */
 	spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
 	i915_enable_pipestat(dev_priv, 0, PIPE_HOTPLUG_INTERRUPT_ENABLE |

> 




More information about the Intel-gfx mailing list