Message ID | 20210213190511.1017088-2-lucas.demarchi@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Simplify intel_setup_outputs() | expand |
On Sat, 13 Feb 2021, Lucas De Marchi <lucas.demarchi@intel.com> wrote: > On intel_ddi_init() we already check VBT if the port supports HDMI/DP > and bail out otherwise. Instad of checking if a single port is present > using VBT in intel_display.c, move the stronger check to > intel_ddi_init() and return early in case it's not supported. There > would be no way intel_bios_* would report support for hdmi/dp if the > port isn't present so this should cause no regressions for other > platforms. Sorry, but this will regress machines that have no VBT. I've been thinking about creating fake child devices for that case to reduce the exceptions. BR, Jani. > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> > --- > drivers/gpu/drm/i915/display/intel_ddi.c | 7 +++++++ > drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++-------- > 2 files changed, 13 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c > index 3b97c0091812..1235be0ba5d1 100644 > --- a/drivers/gpu/drm/i915/display/intel_ddi.c > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c > @@ -3972,6 +3972,13 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) > bool init_hdmi, init_dp; > enum phy phy = intel_port_to_phy(dev_priv, port); > > + if (!intel_bios_is_port_present(dev_priv, port)) { > + drm_dbg_kms(&dev_priv->drm, > + "VBT says port %c is not present, respect it\n", > + port_name(port)); > + return; > + } > + > /* > * On platforms with HTI (aka HDPORT), if it's enabled at boot it may > * have taken over some of the PHYs and made them unavailable to the > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index 23ec68498800..7aaf7a29d493 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -11904,13 +11904,13 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) > intel_ddi_init(dev_priv, PORT_C); > intel_ddi_init(dev_priv, PORT_D); > intel_ddi_init(dev_priv, PORT_E); > + > /* > - * On some ICL SKUs port F is not present. No strap bits for > - * this, so rely on VBT. > - * Work around broken VBTs on SKUs known to have no port F. > + * On some ICL SKUs port F is not present, but broken VBTs mark > + * the port as present. Only try to initialize port F for the > + * SKUs that may actually have it. > */ > - if (IS_ICL_WITH_PORT_F(dev_priv) && > - intel_bios_is_port_present(dev_priv, PORT_F)) > + if (IS_ICL_WITH_PORT_F(dev_priv)) > intel_ddi_init(dev_priv, PORT_F); > > icl_dsi_init(dev_priv); > @@ -11964,10 +11964,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) > /* > * On SKL we don't have a way to detect DDI-E so we rely on VBT. > */ > - if (IS_GEN9_BC(dev_priv) && > - intel_bios_is_port_present(dev_priv, PORT_E)) > + if (IS_GEN9_BC(dev_priv)) > intel_ddi_init(dev_priv, PORT_E); > - > } else if (HAS_PCH_SPLIT(dev_priv)) { > int found;
On Mon, Feb 15, 2021 at 12:35:50PM +0200, Jani Nikula wrote: >On Sat, 13 Feb 2021, Lucas De Marchi <lucas.demarchi@intel.com> wrote: >> On intel_ddi_init() we already check VBT if the port supports HDMI/DP >> and bail out otherwise. Instad of checking if a single port is present >> using VBT in intel_display.c, move the stronger check to >> intel_ddi_init() and return early in case it's not supported. There >> would be no way intel_bios_* would report support for hdmi/dp if the >> port isn't present so this should cause no regressions for other >> platforms. > >Sorry, but this will regress machines that have no VBT. I missed that init_vbt_missing_defaults() also sets the supports_*. > >I've been thinking about creating fake child devices for that case to >reduce the exceptions. Adding a fake child would indeed be a good option. Are you going to implement that soon or should I? thanks Lucas De Marchi > >BR, >Jani. > > > >> >> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> >> --- >> drivers/gpu/drm/i915/display/intel_ddi.c | 7 +++++++ >> drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++-------- >> 2 files changed, 13 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c >> index 3b97c0091812..1235be0ba5d1 100644 >> --- a/drivers/gpu/drm/i915/display/intel_ddi.c >> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c >> @@ -3972,6 +3972,13 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) >> bool init_hdmi, init_dp; >> enum phy phy = intel_port_to_phy(dev_priv, port); >> >> + if (!intel_bios_is_port_present(dev_priv, port)) { >> + drm_dbg_kms(&dev_priv->drm, >> + "VBT says port %c is not present, respect it\n", >> + port_name(port)); >> + return; >> + } >> + >> /* >> * On platforms with HTI (aka HDPORT), if it's enabled at boot it may >> * have taken over some of the PHYs and made them unavailable to the >> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c >> index 23ec68498800..7aaf7a29d493 100644 >> --- a/drivers/gpu/drm/i915/display/intel_display.c >> +++ b/drivers/gpu/drm/i915/display/intel_display.c >> @@ -11904,13 +11904,13 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) >> intel_ddi_init(dev_priv, PORT_C); >> intel_ddi_init(dev_priv, PORT_D); >> intel_ddi_init(dev_priv, PORT_E); >> + >> /* >> - * On some ICL SKUs port F is not present. No strap bits for >> - * this, so rely on VBT. >> - * Work around broken VBTs on SKUs known to have no port F. >> + * On some ICL SKUs port F is not present, but broken VBTs mark >> + * the port as present. Only try to initialize port F for the >> + * SKUs that may actually have it. >> */ >> - if (IS_ICL_WITH_PORT_F(dev_priv) && >> - intel_bios_is_port_present(dev_priv, PORT_F)) >> + if (IS_ICL_WITH_PORT_F(dev_priv)) >> intel_ddi_init(dev_priv, PORT_F); >> >> icl_dsi_init(dev_priv); >> @@ -11964,10 +11964,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) >> /* >> * On SKL we don't have a way to detect DDI-E so we rely on VBT. >> */ >> - if (IS_GEN9_BC(dev_priv) && >> - intel_bios_is_port_present(dev_priv, PORT_E)) >> + if (IS_GEN9_BC(dev_priv)) >> intel_ddi_init(dev_priv, PORT_E); >> - >> } else if (HAS_PCH_SPLIT(dev_priv)) { >> int found; > >-- >Jani Nikula, Intel Open Source Graphics Center
On Mon, 15 Feb 2021, Lucas De Marchi <lucas.demarchi@intel.com> wrote: > On Mon, Feb 15, 2021 at 12:35:50PM +0200, Jani Nikula wrote: >>On Sat, 13 Feb 2021, Lucas De Marchi <lucas.demarchi@intel.com> wrote: >>> On intel_ddi_init() we already check VBT if the port supports HDMI/DP >>> and bail out otherwise. Instad of checking if a single port is present >>> using VBT in intel_display.c, move the stronger check to >>> intel_ddi_init() and return early in case it's not supported. There >>> would be no way intel_bios_* would report support for hdmi/dp if the >>> port isn't present so this should cause no regressions for other >>> platforms. >> >>Sorry, but this will regress machines that have no VBT. > > I missed that init_vbt_missing_defaults() also sets > the supports_*. > >> >>I've been thinking about creating fake child devices for that case to >>reduce the exceptions. > > Adding a fake child would indeed be a good option. Are you going to > implement that soon or should I? I'm working on it. Got a bit carried away with what I've had in mind for ages regarding some other refactoring (e.g. getting rid of i915->vbt.ddi_port_info[] altogether in order to bring pre- and post-ddi platforms closer together). I'll try to get a smaller set ready first. BR, Jani. > > thanks > Lucas De Marchi > >> >>BR, >>Jani. >> >> >> >>> >>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> >>> --- >>> drivers/gpu/drm/i915/display/intel_ddi.c | 7 +++++++ >>> drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++-------- >>> 2 files changed, 13 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c >>> index 3b97c0091812..1235be0ba5d1 100644 >>> --- a/drivers/gpu/drm/i915/display/intel_ddi.c >>> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c >>> @@ -3972,6 +3972,13 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) >>> bool init_hdmi, init_dp; >>> enum phy phy = intel_port_to_phy(dev_priv, port); >>> >>> + if (!intel_bios_is_port_present(dev_priv, port)) { >>> + drm_dbg_kms(&dev_priv->drm, >>> + "VBT says port %c is not present, respect it\n", >>> + port_name(port)); >>> + return; >>> + } >>> + >>> /* >>> * On platforms with HTI (aka HDPORT), if it's enabled at boot it may >>> * have taken over some of the PHYs and made them unavailable to the >>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c >>> index 23ec68498800..7aaf7a29d493 100644 >>> --- a/drivers/gpu/drm/i915/display/intel_display.c >>> +++ b/drivers/gpu/drm/i915/display/intel_display.c >>> @@ -11904,13 +11904,13 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) >>> intel_ddi_init(dev_priv, PORT_C); >>> intel_ddi_init(dev_priv, PORT_D); >>> intel_ddi_init(dev_priv, PORT_E); >>> + >>> /* >>> - * On some ICL SKUs port F is not present. No strap bits for >>> - * this, so rely on VBT. >>> - * Work around broken VBTs on SKUs known to have no port F. >>> + * On some ICL SKUs port F is not present, but broken VBTs mark >>> + * the port as present. Only try to initialize port F for the >>> + * SKUs that may actually have it. >>> */ >>> - if (IS_ICL_WITH_PORT_F(dev_priv) && >>> - intel_bios_is_port_present(dev_priv, PORT_F)) >>> + if (IS_ICL_WITH_PORT_F(dev_priv)) >>> intel_ddi_init(dev_priv, PORT_F); >>> >>> icl_dsi_init(dev_priv); >>> @@ -11964,10 +11964,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) >>> /* >>> * On SKL we don't have a way to detect DDI-E so we rely on VBT. >>> */ >>> - if (IS_GEN9_BC(dev_priv) && >>> - intel_bios_is_port_present(dev_priv, PORT_E)) >>> + if (IS_GEN9_BC(dev_priv)) >>> intel_ddi_init(dev_priv, PORT_E); >>> - >>> } else if (HAS_PCH_SPLIT(dev_priv)) { >>> int found; >> >>-- >>Jani Nikula, Intel Open Source Graphics Center
On Tue, Feb 16, 2021 at 09:50:03PM +0200, Jani Nikula wrote: >On Mon, 15 Feb 2021, Lucas De Marchi <lucas.demarchi@intel.com> wrote: >> On Mon, Feb 15, 2021 at 12:35:50PM +0200, Jani Nikula wrote: >>>On Sat, 13 Feb 2021, Lucas De Marchi <lucas.demarchi@intel.com> wrote: >>>> On intel_ddi_init() we already check VBT if the port supports HDMI/DP >>>> and bail out otherwise. Instad of checking if a single port is present >>>> using VBT in intel_display.c, move the stronger check to >>>> intel_ddi_init() and return early in case it's not supported. There >>>> would be no way intel_bios_* would report support for hdmi/dp if the >>>> port isn't present so this should cause no regressions for other >>>> platforms. >>> >>>Sorry, but this will regress machines that have no VBT. >> >> I missed that init_vbt_missing_defaults() also sets >> the supports_*. >> >>> >>>I've been thinking about creating fake child devices for that case to >>>reduce the exceptions. >> >> Adding a fake child would indeed be a good option. Are you going to >> implement that soon or should I? > >I'm working on it. Got a bit carried away with what I've had in mind for >ages regarding some other refactoring (e.g. getting rid of >i915->vbt.ddi_port_info[] altogether in order to bring pre- and post-ddi >platforms closer together). I'll try to get a smaller set ready first. now that those patches are applied, can you take a look in these? thanks Lucas De Marchi > >BR, >Jani. > > >> >> thanks >> Lucas De Marchi >> >>> >>>BR, >>>Jani. >>> >>> >>> >>>> >>>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> >>>> --- >>>> drivers/gpu/drm/i915/display/intel_ddi.c | 7 +++++++ >>>> drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++-------- >>>> 2 files changed, 13 insertions(+), 8 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c >>>> index 3b97c0091812..1235be0ba5d1 100644 >>>> --- a/drivers/gpu/drm/i915/display/intel_ddi.c >>>> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c >>>> @@ -3972,6 +3972,13 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) >>>> bool init_hdmi, init_dp; >>>> enum phy phy = intel_port_to_phy(dev_priv, port); >>>> >>>> + if (!intel_bios_is_port_present(dev_priv, port)) { >>>> + drm_dbg_kms(&dev_priv->drm, >>>> + "VBT says port %c is not present, respect it\n", >>>> + port_name(port)); >>>> + return; >>>> + } >>>> + >>>> /* >>>> * On platforms with HTI (aka HDPORT), if it's enabled at boot it may >>>> * have taken over some of the PHYs and made them unavailable to the >>>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c >>>> index 23ec68498800..7aaf7a29d493 100644 >>>> --- a/drivers/gpu/drm/i915/display/intel_display.c >>>> +++ b/drivers/gpu/drm/i915/display/intel_display.c >>>> @@ -11904,13 +11904,13 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) >>>> intel_ddi_init(dev_priv, PORT_C); >>>> intel_ddi_init(dev_priv, PORT_D); >>>> intel_ddi_init(dev_priv, PORT_E); >>>> + >>>> /* >>>> - * On some ICL SKUs port F is not present. No strap bits for >>>> - * this, so rely on VBT. >>>> - * Work around broken VBTs on SKUs known to have no port F. >>>> + * On some ICL SKUs port F is not present, but broken VBTs mark >>>> + * the port as present. Only try to initialize port F for the >>>> + * SKUs that may actually have it. >>>> */ >>>> - if (IS_ICL_WITH_PORT_F(dev_priv) && >>>> - intel_bios_is_port_present(dev_priv, PORT_F)) >>>> + if (IS_ICL_WITH_PORT_F(dev_priv)) >>>> intel_ddi_init(dev_priv, PORT_F); >>>> >>>> icl_dsi_init(dev_priv); >>>> @@ -11964,10 +11964,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) >>>> /* >>>> * On SKL we don't have a way to detect DDI-E so we rely on VBT. >>>> */ >>>> - if (IS_GEN9_BC(dev_priv) && >>>> - intel_bios_is_port_present(dev_priv, PORT_E)) >>>> + if (IS_GEN9_BC(dev_priv)) >>>> intel_ddi_init(dev_priv, PORT_E); >>>> - >>>> } else if (HAS_PCH_SPLIT(dev_priv)) { >>>> int found; >>> >>>-- >>>Jani Nikula, Intel Open Source Graphics Center > >-- >Jani Nikula, Intel Open Source Graphics Center
On Sat, 13 Feb 2021, Lucas De Marchi <lucas.demarchi@intel.com> wrote: > On intel_ddi_init() we already check VBT if the port supports HDMI/DP > and bail out otherwise. Instad of checking if a single port is present > using VBT in intel_display.c, move the stronger check to > intel_ddi_init() and return early in case it's not supported. There > would be no way intel_bios_* would report support for hdmi/dp if the > port isn't present so this should cause no regressions for other > platforms. > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> > --- > drivers/gpu/drm/i915/display/intel_ddi.c | 7 +++++++ > drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++-------- > 2 files changed, 13 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c > index 3b97c0091812..1235be0ba5d1 100644 > --- a/drivers/gpu/drm/i915/display/intel_ddi.c > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c > @@ -3972,6 +3972,13 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) > bool init_hdmi, init_dp; > enum phy phy = intel_port_to_phy(dev_priv, port); > > + if (!intel_bios_is_port_present(dev_priv, port)) { > + drm_dbg_kms(&dev_priv->drm, > + "VBT says port %c is not present, respect it\n", > + port_name(port)); > + return; > + } > + We now have this: devdata = intel_bios_encoder_data_lookup(dev_priv, port); if (!devdata) { drm_dbg_kms(&dev_priv->drm, "VBT says port %c is not present\n", port_name(port)); return; } added in 45c0673aac97 ("drm/i915/bios: start using the intel_bios_encoder_data directly"). With that, the below hunks are Reviewed-by: Jani Nikula <jani.nikula@intel.com> > /* > * On platforms with HTI (aka HDPORT), if it's enabled at boot it may > * have taken over some of the PHYs and made them unavailable to the > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index 23ec68498800..7aaf7a29d493 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -11904,13 +11904,13 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) > intel_ddi_init(dev_priv, PORT_C); > intel_ddi_init(dev_priv, PORT_D); > intel_ddi_init(dev_priv, PORT_E); > + > /* > - * On some ICL SKUs port F is not present. No strap bits for > - * this, so rely on VBT. > - * Work around broken VBTs on SKUs known to have no port F. > + * On some ICL SKUs port F is not present, but broken VBTs mark > + * the port as present. Only try to initialize port F for the > + * SKUs that may actually have it. > */ > - if (IS_ICL_WITH_PORT_F(dev_priv) && > - intel_bios_is_port_present(dev_priv, PORT_F)) > + if (IS_ICL_WITH_PORT_F(dev_priv)) > intel_ddi_init(dev_priv, PORT_F); > > icl_dsi_init(dev_priv); > @@ -11964,10 +11964,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) > /* > * On SKL we don't have a way to detect DDI-E so we rely on VBT. > */ > - if (IS_GEN9_BC(dev_priv) && > - intel_bios_is_port_present(dev_priv, PORT_E)) > + if (IS_GEN9_BC(dev_priv)) > intel_ddi_init(dev_priv, PORT_E); > - > } else if (HAS_PCH_SPLIT(dev_priv)) { > int found;
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index 3b97c0091812..1235be0ba5d1 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -3972,6 +3972,13 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) bool init_hdmi, init_dp; enum phy phy = intel_port_to_phy(dev_priv, port); + if (!intel_bios_is_port_present(dev_priv, port)) { + drm_dbg_kms(&dev_priv->drm, + "VBT says port %c is not present, respect it\n", + port_name(port)); + return; + } + /* * On platforms with HTI (aka HDPORT), if it's enabled at boot it may * have taken over some of the PHYs and made them unavailable to the diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 23ec68498800..7aaf7a29d493 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -11904,13 +11904,13 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) intel_ddi_init(dev_priv, PORT_C); intel_ddi_init(dev_priv, PORT_D); intel_ddi_init(dev_priv, PORT_E); + /* - * On some ICL SKUs port F is not present. No strap bits for - * this, so rely on VBT. - * Work around broken VBTs on SKUs known to have no port F. + * On some ICL SKUs port F is not present, but broken VBTs mark + * the port as present. Only try to initialize port F for the + * SKUs that may actually have it. */ - if (IS_ICL_WITH_PORT_F(dev_priv) && - intel_bios_is_port_present(dev_priv, PORT_F)) + if (IS_ICL_WITH_PORT_F(dev_priv)) intel_ddi_init(dev_priv, PORT_F); icl_dsi_init(dev_priv); @@ -11964,10 +11964,8 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) /* * On SKL we don't have a way to detect DDI-E so we rely on VBT. */ - if (IS_GEN9_BC(dev_priv) && - intel_bios_is_port_present(dev_priv, PORT_E)) + if (IS_GEN9_BC(dev_priv)) intel_ddi_init(dev_priv, PORT_E); - } else if (HAS_PCH_SPLIT(dev_priv)) { int found;
On intel_ddi_init() we already check VBT if the port supports HDMI/DP and bail out otherwise. Instad of checking if a single port is present using VBT in intel_display.c, move the stronger check to intel_ddi_init() and return early in case it's not supported. There would be no way intel_bios_* would report support for hdmi/dp if the port isn't present so this should cause no regressions for other platforms. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> --- drivers/gpu/drm/i915/display/intel_ddi.c | 7 +++++++ drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-)