Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* A wrong DDI encoder override from HDMI to DP at hotplug
@ 2015-11-18 15:23 Takashi Iwai
  2015-11-18 15:38 ` Ville Syrjälä
  2015-11-18 15:38 ` Daniel Vetter
  0 siblings, 2 replies; 6+ messages in thread
From: Takashi Iwai @ 2015-11-18 15:23 UTC (permalink / raw)
  To: intel-gfx

Hi,

currently a DDI port may register both DP and HDMI and it shares the
same encoder.  The bug we've got a report is about this encoder type:
namely, a machine using DDI port D for HDMI is screwed up because the
encoder is switched to DP suddently.  The details are found in:
  http://bugzilla.opensuse.org/show_bug.cgi?id=955190

The problem happens in intel_dp_hpd_pulse().  Since the machine
declares both DP and HDMI, the driver registers this callback.  And at
a hotplug event, the function changes the encoder type like:

	if (intel_dig_port->base.type != INTEL_OUTPUT_EDP)
		intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;

After this point, the encoder is handled as DP although the same HDMI
monitor is connected.

Changing this to exclude INTEL_OUTPUT_HDMI makes the thing working in
the bug report above, but I'm not sure what's the right fix.

Any suggestions?


thanks,

Takashi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A wrong DDI encoder override from HDMI to DP at hotplug
  2015-11-18 15:23 A wrong DDI encoder override from HDMI to DP at hotplug Takashi Iwai
@ 2015-11-18 15:38 ` Ville Syrjälä
  2015-11-18 16:00   ` Takashi Iwai
  2015-11-18 15:38 ` Daniel Vetter
  1 sibling, 1 reply; 6+ messages in thread
From: Ville Syrjälä @ 2015-11-18 15:38 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: intel-gfx

On Wed, Nov 18, 2015 at 04:23:06PM +0100, Takashi Iwai wrote:
> Hi,
> 
> currently a DDI port may register both DP and HDMI and it shares the
> same encoder.  The bug we've got a report is about this encoder type:
> namely, a machine using DDI port D for HDMI is screwed up because the
> encoder is switched to DP suddently.  The details are found in:
>   http://bugzilla.opensuse.org/show_bug.cgi?id=955190
> 
> The problem happens in intel_dp_hpd_pulse().  Since the machine
> declares both DP and HDMI, the driver registers this callback.  And at
> a hotplug event, the function changes the encoder type like:
> 
> 	if (intel_dig_port->base.type != INTEL_OUTPUT_EDP)
> 		intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;
> 
> After this point, the encoder is handled as DP although the same HDMI
> monitor is connected.
> 
> Changing this to exclude INTEL_OUTPUT_HDMI makes the thing working in
> the bug report above, but I'm not sure what's the right fix.
> 
> Any suggestions?

This has been causing all sorts of troubles for years. I've suggested
several times that we should just split the encoder into two, like we
have for older platforms, but no one has taken the bait thus far.

This particular piece of code to change the encoder type in the
hpd_pulse hook came about with the mst code drop from Dave IIRC. At
least I never figured out what it's trying to do since -ENOCOMMENT.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A wrong DDI encoder override from HDMI to DP at hotplug
  2015-11-18 15:23 A wrong DDI encoder override from HDMI to DP at hotplug Takashi Iwai
  2015-11-18 15:38 ` Ville Syrjälä
@ 2015-11-18 15:38 ` Daniel Vetter
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2015-11-18 15:38 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: intel-gfx

On Wed, Nov 18, 2015 at 04:23:06PM +0100, Takashi Iwai wrote:
> Hi,
> 
> currently a DDI port may register both DP and HDMI and it shares the
> same encoder.  The bug we've got a report is about this encoder type:
> namely, a machine using DDI port D for HDMI is screwed up because the
> encoder is switched to DP suddently.  The details are found in:
>   http://bugzilla.opensuse.org/show_bug.cgi?id=955190
> 
> The problem happens in intel_dp_hpd_pulse().  Since the machine
> declares both DP and HDMI, the driver registers this callback.  And at
> a hotplug event, the function changes the encoder type like:
> 
> 	if (intel_dig_port->base.type != INTEL_OUTPUT_EDP)
> 		intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;
> 
> After this point, the encoder is handled as DP although the same HDMI
> monitor is connected.
> 
> Changing this to exclude INTEL_OUTPUT_HDMI makes the thing working in
> the bug report above, but I'm not sure what's the right fix.
> 
> Any suggestions?

The right fix is to adjust the encoder type in the modeset code and stop
frobbing it in the detect functions. Userspace tells us at modeset time
which connector it wants to us, so it's very well defined. Trying to
autodetect it will just result in bugs like the above.

Problem is a bit that encoder->type should be tracked in the
intel_crtc_config structure (since it can change). I though Maarten is
working on this ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A wrong DDI encoder override from HDMI to DP at hotplug
  2015-11-18 15:38 ` Ville Syrjälä
@ 2015-11-18 16:00   ` Takashi Iwai
  2015-11-18 21:30     ` Dave Airlie
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2015-11-18 16:00 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

On Wed, 18 Nov 2015 16:38:03 +0100,
Ville Syrjälä wrote:
> 
> On Wed, Nov 18, 2015 at 04:23:06PM +0100, Takashi Iwai wrote:
> > Hi,
> > 
> > currently a DDI port may register both DP and HDMI and it shares the
> > same encoder.  The bug we've got a report is about this encoder type:
> > namely, a machine using DDI port D for HDMI is screwed up because the
> > encoder is switched to DP suddently.  The details are found in:
> >   http://bugzilla.opensuse.org/show_bug.cgi?id=955190
> > 
> > The problem happens in intel_dp_hpd_pulse().  Since the machine
> > declares both DP and HDMI, the driver registers this callback.  And at
> > a hotplug event, the function changes the encoder type like:
> > 
> > 	if (intel_dig_port->base.type != INTEL_OUTPUT_EDP)
> > 		intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;
> > 
> > After this point, the encoder is handled as DP although the same HDMI
> > monitor is connected.
> > 
> > Changing this to exclude INTEL_OUTPUT_HDMI makes the thing working in
> > the bug report above, but I'm not sure what's the right fix.
> > 
> > Any suggestions?
> 
> This has been causing all sorts of troubles for years. I've suggested
> several times that we should just split the encoder into two, like we
> have for older platforms, but no one has taken the bait thus far.
> 
> This particular piece of code to change the encoder type in the
> hpd_pulse hook came about with the mst code drop from Dave IIRC. At
> least I never figured out what it's trying to do since -ENOCOMMENT.

Yeah, this was introduced in the commit

  0e32b39ceed665bfa4a77a4bc307b6652b991632
    drm/i915: add DP 1.2 MST support (v0.7)

so the problem exists for quite some time, since 3.17 kernel.

I guess the patch just overlooked the DDI use case with HDMI.
Maybe the code was meant like below?

	if (intel_dig_port->base.type == INTEL_OUTPUT_UNKNOWN ||
	    intel_dig_port->base.type == INTEL_OUTPUT_DP_MST)
		intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;


thanks,

Takashi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A wrong DDI encoder override from HDMI to DP at hotplug
  2015-11-18 16:00   ` Takashi Iwai
@ 2015-11-18 21:30     ` Dave Airlie
  2015-11-18 22:01       ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Airlie @ 2015-11-18 21:30 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: intel-gfx@lists.freedesktop.org

On 19 November 2015 at 02:00, Takashi Iwai <tiwai@suse.de> wrote:
> On Wed, 18 Nov 2015 16:38:03 +0100,
> Ville Syrjälä wrote:
>>
>> On Wed, Nov 18, 2015 at 04:23:06PM +0100, Takashi Iwai wrote:
>> > Hi,
>> >
>> > currently a DDI port may register both DP and HDMI and it shares the
>> > same encoder.  The bug we've got a report is about this encoder type:
>> > namely, a machine using DDI port D for HDMI is screwed up because the
>> > encoder is switched to DP suddently.  The details are found in:
>> >   http://bugzilla.opensuse.org/show_bug.cgi?id=955190
>> >
>> > The problem happens in intel_dp_hpd_pulse().  Since the machine
>> > declares both DP and HDMI, the driver registers this callback.  And at
>> > a hotplug event, the function changes the encoder type like:
>> >
>> >     if (intel_dig_port->base.type != INTEL_OUTPUT_EDP)
>> >             intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;
>> >
>> > After this point, the encoder is handled as DP although the same HDMI
>> > monitor is connected.
>> >
>> > Changing this to exclude INTEL_OUTPUT_HDMI makes the thing working in
>> > the bug report above, but I'm not sure what's the right fix.
>> >
>> > Any suggestions?
>>
>> This has been causing all sorts of troubles for years. I've suggested
>> several times that we should just split the encoder into two, like we
>> have for older platforms, but no one has taken the bait thus far.
>>
>> This particular piece of code to change the encoder type in the
>> hpd_pulse hook came about with the mst code drop from Dave IIRC. At
>> least I never figured out what it's trying to do since -ENOCOMMENT.
>
> Yeah, this was introduced in the commit
>
>   0e32b39ceed665bfa4a77a4bc307b6652b991632
>     drm/i915: add DP 1.2 MST support (v0.7)
>
> so the problem exists for quite some time, since 3.17 kernel.
>
> I guess the patch just overlooked the DDI use case with HDMI.
> Maybe the code was meant like below?
>
>         if (intel_dig_port->base.type == INTEL_OUTPUT_UNKNOWN ||
>             intel_dig_port->base.type == INTEL_OUTPUT_DP_MST)
>                 intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;
>

That code was copied from intel_dp_detect, which does that check.

But if the HDMI hdp is going via that path then yes it should check
more than EDP.

Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A wrong DDI encoder override from HDMI to DP at hotplug
  2015-11-18 21:30     ` Dave Airlie
@ 2015-11-18 22:01       ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2015-11-18 22:01 UTC (permalink / raw)
  To: Dave Airlie; +Cc: intel-gfx@lists.freedesktop.org

On Wed, 18 Nov 2015 22:30:32 +0100,
Dave Airlie wrote:
> 
> On 19 November 2015 at 02:00, Takashi Iwai <tiwai@suse.de> wrote:
> > On Wed, 18 Nov 2015 16:38:03 +0100,
> > Ville Syrjälä wrote:
> >>
> >> On Wed, Nov 18, 2015 at 04:23:06PM +0100, Takashi Iwai wrote:
> >> > Hi,
> >> >
> >> > currently a DDI port may register both DP and HDMI and it shares the
> >> > same encoder.  The bug we've got a report is about this encoder type:
> >> > namely, a machine using DDI port D for HDMI is screwed up because the
> >> > encoder is switched to DP suddently.  The details are found in:
> >> >   http://bugzilla.opensuse.org/show_bug.cgi?id=955190
> >> >
> >> > The problem happens in intel_dp_hpd_pulse().  Since the machine
> >> > declares both DP and HDMI, the driver registers this callback.  And at
> >> > a hotplug event, the function changes the encoder type like:
> >> >
> >> >     if (intel_dig_port->base.type != INTEL_OUTPUT_EDP)
> >> >             intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;
> >> >
> >> > After this point, the encoder is handled as DP although the same HDMI
> >> > monitor is connected.
> >> >
> >> > Changing this to exclude INTEL_OUTPUT_HDMI makes the thing working in
> >> > the bug report above, but I'm not sure what's the right fix.
> >> >
> >> > Any suggestions?
> >>
> >> This has been causing all sorts of troubles for years. I've suggested
> >> several times that we should just split the encoder into two, like we
> >> have for older platforms, but no one has taken the bait thus far.
> >>
> >> This particular piece of code to change the encoder type in the
> >> hpd_pulse hook came about with the mst code drop from Dave IIRC. At
> >> least I never figured out what it's trying to do since -ENOCOMMENT.
> >
> > Yeah, this was introduced in the commit
> >
> >   0e32b39ceed665bfa4a77a4bc307b6652b991632
> >     drm/i915: add DP 1.2 MST support (v0.7)
> >
> > so the problem exists for quite some time, since 3.17 kernel.
> >
> > I guess the patch just overlooked the DDI use case with HDMI.
> > Maybe the code was meant like below?
> >
> >         if (intel_dig_port->base.type == INTEL_OUTPUT_UNKNOWN ||
> >             intel_dig_port->base.type == INTEL_OUTPUT_DP_MST)
> >                 intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT;
> >
> 
> That code was copied from intel_dp_detect, which does that check.
> 
> But if the HDMI hdp is going via that path then yes it should check
> more than EDP.

OK, so we'd just need to add the check of INTEL_OUTPUT_HDMI in each
place, as a quick fix?  Since this bug has been present for a long
time (since 3.17), I'd love to have a quick fix that is applicable to
stable kernels, at first.


thanks,

Takashi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-18 22:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-18 15:23 A wrong DDI encoder override from HDMI to DP at hotplug Takashi Iwai
2015-11-18 15:38 ` Ville Syrjälä
2015-11-18 16:00   ` Takashi Iwai
2015-11-18 21:30     ` Dave Airlie
2015-11-18 22:01       ` Takashi Iwai
2015-11-18 15:38 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox