From: Jani Nikula <jani.nikula@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 6/9] drm/i915/display: description-based initialization for remaining ddi platforms
Date: Tue, 31 Dec 2019 12:25:21 +0200 [thread overview]
Message-ID: <87o8volrla.fsf@intel.com> (raw)
In-Reply-To: <20191223195850.25997-7-lucas.demarchi@intel.com>
On Mon, 23 Dec 2019, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Support remaining platforms under HAS_DDI() by providing a slightly more
> complex is_port_present() hook. The downside is that now we call
> I915_READ(SFUSE_STRAP) for each port being initialized, but that's only
> on initialization: a few more mmio reads won't hurt.
>
> Alternatives would be to provide one hook per port, or to have a
> "pre_init()" hook that takes care of the mmio read. However I think this
> is simpler - we may need to adapt if future platforms don't follow the
> same initialization "template".
All of this really makes me wonder if we end up being *more* complicated
overall by trying very hard to make this generic, when, in reality, it
doesn't seem to be all that generic.
As I said, two relatively low hanging improvements would be a) moving
VBT specific hacks to intel_bios.c and b) adding port mask to
intel_device_info. Those two alone would go a long way in simplifying
intel_setup_outputs().
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_display.c | 72 +++++++++++++-------
> 1 file changed, 46 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 6b4d320ff92c..ad85cf75c815 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16246,6 +16246,34 @@ static bool icl_is_port_present(struct drm_i915_private *i915,
> intel_bios_is_port_present(i915, PORT_F);
> }
>
> +static bool ddi_is_port_present(struct drm_i915_private *i915,
> + const struct intel_ddi_port_info *port_info)
> +{
> + /* keep I915_READ() happy */
Display could get rid of I915_READ and I915_WRITE after
https://patchwork.freedesktop.org/series/70298/ ...
BR,
Jani.
> + struct drm_i915_private *dev_priv = i915;
> +
> + if (port_info->port == PORT_A)
> + return I915_READ(DDI_BUF_CTL(PORT_A))
> + & DDI_INIT_DISPLAY_DETECTED;
> +
> + if (port_info->port == PORT_E)
> + return IS_GEN9_BC(dev_priv) &&
> + intel_bios_is_port_present(i915, PORT_E);
> +
> + switch (port_info->port) {
> + case PORT_B:
> + return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIB_DETECTED;
> + case PORT_C:
> + return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIC_DETECTED;
> + case PORT_D:
> + return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDID_DETECTED;
> + case PORT_F:
> + return I915_READ(SFUSE_STRAP) & SFUSE_STRAP_DDIF_DETECTED;
> + default:
> + return false;
> + }
> +}
> +
> static const struct intel_output tgl_output = {
> .dsi_init = icl_dsi_init,
> .ddi_ports = {
> @@ -16296,11 +16324,24 @@ static const struct intel_output gen9lp_output = {
> },
> };
>
> +static const struct intel_output ddi_output = {
> + .is_port_present = ddi_is_port_present,
> + .ddi_ports = {
> + { .port = PORT_A },
> + { .port = PORT_B },
> + { .port = PORT_C },
> + { .port = PORT_D },
> + { .port = PORT_E },
> + { .port = PORT_F },
> + { .port = PORT_NONE }
> + }
> +};
> +
> /*
> * Use a description-based approach for platforms that can be supported with a
> * static table
> */
> -static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
> +static void setup_ddi_outputs(struct drm_i915_private *i915)
> {
> const struct intel_output *output;
> const struct intel_ddi_port_info *port_info;
> @@ -16313,6 +16354,8 @@ static void setup_ddi_outputs_desc(struct drm_i915_private *i915)
> output = &icl_output;
> else if (IS_GEN9_LP(i915))
> output = &gen9lp_output;
> + else
> + output = &ddi_output;
>
> for (port_info = output->ddi_ports;
> port_info->port != PORT_NONE; port_info++) {
> @@ -16338,35 +16381,12 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
> return;
>
> if (INTEL_GEN(dev_priv) >= 11 || IS_GEN9_LP(dev_priv)) {
> - setup_ddi_outputs_desc(dev_priv);
> + setup_ddi_outputs(dev_priv);
> } else if (HAS_DDI(dev_priv)) {
> - int found;
> -
> if (intel_ddi_crt_present(dev_priv))
> intel_crt_init(dev_priv);
>
> - found = I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_INIT_DISPLAY_DETECTED;
> - if (found)
> - intel_ddi_init(dev_priv, PORT_A);
> -
> - /* DDI B, C, D, and F detection is indicated by the SFUSE_STRAP
> - * register */
> - found = I915_READ(SFUSE_STRAP);
> -
> - if (found & SFUSE_STRAP_DDIB_DETECTED)
> - intel_ddi_init(dev_priv, PORT_B);
> - if (found & SFUSE_STRAP_DDIC_DETECTED)
> - intel_ddi_init(dev_priv, PORT_C);
> - if (found & SFUSE_STRAP_DDID_DETECTED)
> - intel_ddi_init(dev_priv, PORT_D);
> - if (found & SFUSE_STRAP_DDIF_DETECTED)
> - intel_ddi_init(dev_priv, PORT_F);
> - /*
> - * 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))
> - intel_ddi_init(dev_priv, PORT_E);
> + setup_ddi_outputs(dev_priv);
> } else if (HAS_PCH_SPLIT(dev_priv)) {
> int found;
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-12-31 10:25 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-23 19:58 [Intel-gfx] [PATCH 0/9] RFC: display/ddi: keep register indexes in a table Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 1/9] drm/i915/display: nuke skl workaround for pre-production hw Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 2/9] drm/i915/display: remove alias to dig_port Lucas De Marchi
2019-12-23 21:05 ` Matt Roper
2019-12-23 19:58 ` [Intel-gfx] [PATCH 3/9] drm/i915/display: prefer the more common dig_port name Lucas De Marchi
2019-12-23 21:16 ` Matt Roper
2019-12-23 21:25 ` Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 4/9] drm/i915/display: start description-based ddi initialization Lucas De Marchi
2019-12-31 9:58 ` Jani Nikula
2020-01-02 7:19 ` Lucas De Marchi
2020-06-22 23:50 ` Lucas De Marchi
2020-07-03 13:22 ` Jani Nikula
2019-12-23 19:58 ` [Intel-gfx] [PATCH 5/9] drm/i915/display: move icl to description-based ddi init Lucas De Marchi
2019-12-24 0:00 ` Matt Roper
2019-12-31 10:14 ` Jani Nikula
2020-01-02 7:32 ` Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 6/9] drm/i915/display: description-based initialization for remaining ddi platforms Lucas De Marchi
2019-12-31 10:25 ` Jani Nikula [this message]
2019-12-31 10:26 ` Jani Nikula
2020-01-02 7:23 ` Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 7/9] drm/i915/display: add phy, vbt and ddi indexes Lucas De Marchi
2019-12-24 0:10 ` Matt Roper
2019-12-24 0:17 ` Lucas De Marchi
2019-12-31 10:33 ` Jani Nikula
2020-01-02 7:50 ` Lucas De Marchi
2019-12-23 19:58 ` [Intel-gfx] [PATCH 8/9] drm/i915/display: refer to vbt info as vbt_port_info Lucas De Marchi
2019-12-31 10:39 ` Jani Nikula
2019-12-23 19:58 ` [Intel-gfx] [PATCH 9/9] drm/i915/display: use port_info on intel_ddi_init Lucas De Marchi
2019-12-24 0:16 ` Matt Roper
2019-12-31 11:20 ` Jani Nikula
2020-06-23 1:11 ` Lucas De Marchi
2019-12-31 11:22 ` Jani Nikula
2019-12-23 20:14 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for RFC: display/ddi: keep register indexes in a table Patchwork
2019-12-23 20:57 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " 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=87o8volrla.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
/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.