All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, stable@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH 2/8] drm/i915/sdvo: Setup DDC fully before output init
Date: Thu, 27 Oct 2022 17:49:53 +0300	[thread overview]
Message-ID: <Y1qake1Ow8eOCj6n@intel.com> (raw)
In-Reply-To: <87pmedcp07.fsf@intel.com>

On Thu, Oct 27, 2022 at 05:36:24PM +0300, Jani Nikula wrote:
> On Wed, 26 Oct 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Call intel_sdvo_select_ddc_bus() before initializing any
> > of the outputs. And before that is functional (assuming no VBT)
> > we have to set up the controlled_outputs thing. Otherwise DDC
> > won't be functional during the output init but LVDS really
> > needs it for the fixed mode setup.
> >
> > Note that the whole multi output support still looks very
> > bogus, and more work will be needed to make it correct.
> > But for now this should at least fix the LVDS EDID fixed mode
> > setup.
> >
> > Cc: stable@vger.kernel.org
> > Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/7301
> > Fixes: aa2b88074a56 ("drm/i915/sdvo: Fix multi function encoder stuff")
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_sdvo.c | 31 +++++++++--------------
> >  1 file changed, 12 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
> > index c6200a91a777..ccf81d616cb4 100644
> > --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> > +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> > @@ -2746,13 +2746,10 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
> >  	if (!intel_sdvo_connector)
> >  		return false;
> >  
> > -	if (device == 0) {
> > -		intel_sdvo->controlled_output |= SDVO_OUTPUT_TMDS0;
> > +	if (device == 0)
> >  		intel_sdvo_connector->output_flag = SDVO_OUTPUT_TMDS0;
> > -	} else if (device == 1) {
> > -		intel_sdvo->controlled_output |= SDVO_OUTPUT_TMDS1;
> > +	else if (device == 1)
> >  		intel_sdvo_connector->output_flag = SDVO_OUTPUT_TMDS1;
> > -	}
> >  
> >  	intel_connector = &intel_sdvo_connector->base;
> >  	connector = &intel_connector->base;
> > @@ -2807,7 +2804,6 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type)
> >  	encoder->encoder_type = DRM_MODE_ENCODER_TVDAC;
> >  	connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO;
> >  
> > -	intel_sdvo->controlled_output |= type;
> >  	intel_sdvo_connector->output_flag = type;
> >  
> >  	if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
> > @@ -2848,13 +2844,10 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device)
> >  	encoder->encoder_type = DRM_MODE_ENCODER_DAC;
> >  	connector->connector_type = DRM_MODE_CONNECTOR_VGA;
> >  
> > -	if (device == 0) {
> > -		intel_sdvo->controlled_output |= SDVO_OUTPUT_RGB0;
> > +	if (device == 0)
> >  		intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB0;
> > -	} else if (device == 1) {
> > -		intel_sdvo->controlled_output |= SDVO_OUTPUT_RGB1;
> > +	else if (device == 1)
> >  		intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB1;
> > -	}
> >  
> >  	if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
> >  		kfree(intel_sdvo_connector);
> > @@ -2884,13 +2877,10 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
> >  	encoder->encoder_type = DRM_MODE_ENCODER_LVDS;
> >  	connector->connector_type = DRM_MODE_CONNECTOR_LVDS;
> >  
> > -	if (device == 0) {
> > -		intel_sdvo->controlled_output |= SDVO_OUTPUT_LVDS0;
> > +	if (device == 0)
> >  		intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS0;
> > -	} else if (device == 1) {
> > -		intel_sdvo->controlled_output |= SDVO_OUTPUT_LVDS1;
> > +	else if (device == 1)
> >  		intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1;
> > -	}
> >  
> >  	if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
> >  		kfree(intel_sdvo_connector);
> > @@ -2945,8 +2935,14 @@ static u16 intel_sdvo_filter_output_flags(u16 flags)
> >  static bool
> >  intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, u16 flags)
> >  {
> > +	struct drm_i915_private *i915 = to_i915(intel_sdvo->base.base.dev);
> > +
> >  	flags = intel_sdvo_filter_output_flags(flags);
> >  
> > +	intel_sdvo->controlled_output = flags;
> > +
> > +	intel_sdvo_select_ddc_bus(i915, intel_sdvo);
> 
> AFAICT the ->controlled_outputs member could now be removed and just
> passed by value here.

Hmm. True. Though the whole thing is utter garbage anyway.
intel_sdvo_guess_ddc_bus() really expects controlled_outputs
to contain only a single bit. I guess it kinda works by luck
most or the time, at least for single output devices.
I suppose I can still include the controlled_outputs nukage
into this patch.

What we really need to do is to have a ddc adapter per each
connector, and then each one can properly figure out its
own ddc bus. Right now there is some kind of horrible hack
in intel_sdvo_tmds_sink_detect() that probes all the ddc
buses if it didn't find anything on the one that got
chosen initally. 

Fixing intel_sdvo_guess_ddc_bus() for that is trivial, but
I think fixing the VBT mapping stuff is a bit harder since
we now just parse that per SDVO port rather than per SDVO
output.

attached_output is another nonsense thing that needs to
get nuked, but that one should be a bit easier. Anyways,
more work clearly needed here...

> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

Thanks.

> 
> 
> > +
> >  	if (flags & SDVO_OUTPUT_TMDS0)
> >  		if (!intel_sdvo_dvi_init(intel_sdvo, 0))
> >  			return false;
> > @@ -2987,7 +2983,6 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, u16 flags)
> >  	if (flags == 0) {
> >  		unsigned char bytes[2];
> >  
> > -		intel_sdvo->controlled_output = 0;
> >  		memcpy(bytes, &intel_sdvo->caps.output_flags, 2);
> >  		DRM_DEBUG_KMS("%s: Unknown SDVO output type (0x%02x%02x)\n",
> >  			      SDVO_NAME(intel_sdvo),
> > @@ -3399,8 +3394,6 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv,
> >  	 */
> >  	intel_sdvo->base.cloneable = 0;
> >  
> > -	intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo);
> > -
> >  	/* Set the input timing to the screen. Assume always input 0. */
> >  	if (!intel_sdvo_set_target_input(intel_sdvo))
> >  		goto err_output;
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2022-10-27 14:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 10:11 [Intel-gfx] [PATCH 0/8] drm/i915/sdvo: Fix LVDS fixed mode setup and clean up output setup Ville Syrjala
2022-10-26 10:11 ` [Intel-gfx] [PATCH 1/8] drm/i915/sdvo: Filter out invalid outputs more sensibly Ville Syrjala
2022-10-26 10:11   ` Ville Syrjala
2022-10-27 14:32   ` [Intel-gfx] " Jani Nikula
2022-10-26 10:11 ` [Intel-gfx] [PATCH 2/8] drm/i915/sdvo: Setup DDC fully before output init Ville Syrjala
2022-10-26 10:11   ` Ville Syrjala
2022-10-27 14:36   ` [Intel-gfx] " Jani Nikula
2022-10-27 14:49     ` Ville Syrjälä [this message]
2022-10-27 14:54       ` Ville Syrjälä
2022-10-27 17:33         ` Jani Nikula
2022-10-26 10:11 ` [Intel-gfx] [PATCH 3/8] drm/i915/sdvo: Grab mode_config.mutex during LVDS init to avoid WARNs Ville Syrjala
2022-10-26 10:11   ` Ville Syrjala
2022-10-27 14:37   ` [Intel-gfx] " Jani Nikula
2022-10-26 10:11 ` [Intel-gfx] [PATCH 4/8] drm/i915/sdvo: Simplify output setup debugs Ville Syrjala
2022-10-27 14:38   ` Jani Nikula
2022-10-26 10:11 ` [Intel-gfx] [PATCH 5/8] drm/i915/sdvo: Don't add DDC modes for LVDS Ville Syrjala
2022-10-27 14:42   ` Jani Nikula
2022-10-26 10:11 ` [Intel-gfx] [PATCH 6/8] drm/i915/sdvo: Get rid of the output type<->device index stuff Ville Syrjala
2022-10-27 14:42   ` Jani Nikula
2022-10-26 10:11 ` [Intel-gfx] [PATCH 7/8] drm/i915/sdvo: Reduce copy-pasta in output setup Ville Syrjala
2022-10-27 14:45   ` Jani Nikula
2022-10-26 10:11 ` [Intel-gfx] [PATCH 8/8] drm/i915/sdvo: Fix debug print Ville Syrjala
2022-10-27 14:48   ` Jani Nikula
2022-10-26 11:25 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/sdvo: Fix LVDS fixed mode setup and clean up output setup Patchwork
2022-10-26 21:40 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1qake1Ow8eOCj6n@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.