From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 7/9] drm/i915: Extract intel_panel_encoder_fixed_mode()
Date: Mon, 28 Mar 2022 14:32:27 +0300 [thread overview]
Message-ID: <87o81qe2ic.fsf@intel.com> (raw)
In-Reply-To: <20220323182935.4701-8-ville.syrjala@linux.intel.com>
On Wed, 23 Mar 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Apart from the EDID and VBT based mechanism we also sometimes
> use the encoder's current mode as the panel fixed mode. We
> currently have the same code for that duplicated in two places.
> Let's unify.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_dvo.c | 30 +++++-----------------
> drivers/gpu/drm/i915/display/intel_lvds.c | 7 +----
> drivers/gpu/drm/i915/display/intel_panel.c | 20 +++++++++++++++
> drivers/gpu/drm/i915/display/intel_panel.h | 4 +++
> 4 files changed, 31 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dvo.c b/drivers/gpu/drm/i915/display/intel_dvo.c
> index 90e026cef6ee..8c98897d8313 100644
> --- a/drivers/gpu/drm/i915/display/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/display/intel_dvo.c
> @@ -378,27 +378,6 @@ static const struct drm_encoder_funcs intel_dvo_enc_funcs = {
> .destroy = intel_dvo_enc_destroy,
> };
>
> -/*
> - * Attempts to get a fixed panel timing for LVDS (currently only the i830).
> - *
> - * Other chips with DVO LVDS will need to extend this to deal with the LVDS
> - * chip being on DVOB/C and having multiple pipes.
> - */
> -static struct drm_display_mode *
> -intel_dvo_get_current_mode(struct intel_encoder *encoder)
> -{
> - struct drm_display_mode *mode;
> -
> - mode = intel_encoder_current_mode(encoder);
> - if (mode) {
> - DRM_DEBUG_KMS("using current (BIOS) mode: " DRM_MODE_FMT "\n",
> - DRM_MODE_ARG(mode));
> - mode->type |= DRM_MODE_TYPE_PREFERRED;
> - }
> -
> - return mode;
> -}
> -
> static enum port intel_dvo_port(i915_reg_t dvo_reg)
> {
> if (i915_mmio_reg_equal(dvo_reg, DVOA))
> @@ -541,6 +520,8 @@ void intel_dvo_init(struct drm_i915_private *dev_priv)
>
> intel_connector_attach_encoder(intel_connector, intel_encoder);
> if (dvo->type == INTEL_DVO_CHIP_LVDS) {
> + struct drm_display_mode *fixed_mode;
> +
> /*
> * For our LVDS chipsets, we should hopefully be able
> * to dig the fixed panel mode out of the BIOS data.
> @@ -549,9 +530,10 @@ void intel_dvo_init(struct drm_i915_private *dev_priv)
> * headers, likely), so for now, just get the current
> * mode being output through DVO.
> */
> - intel_panel_init(intel_connector,
> - intel_dvo_get_current_mode(intel_encoder),
> - NULL);
> + fixed_mode = intel_panel_encoder_fixed_mode(intel_connector,
> + intel_encoder);
> +
> + intel_panel_init(intel_connector, fixed_mode, NULL);
> intel_dvo->panel_wants_dither = true;
> }
>
> diff --git a/drivers/gpu/drm/i915/display/intel_lvds.c b/drivers/gpu/drm/i915/display/intel_lvds.c
> index c3f017c3740c..5b2367bc3cd2 100644
> --- a/drivers/gpu/drm/i915/display/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/display/intel_lvds.c
> @@ -983,12 +983,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
> * on. If so, assume that whatever is currently programmed is the
> * correct mode.
> */
> - fixed_mode = intel_encoder_current_mode(intel_encoder);
> - if (fixed_mode) {
> - drm_dbg_kms(&dev_priv->drm, "using current (BIOS) mode: " DRM_MODE_FMT "\n",
> - DRM_MODE_ARG(fixed_mode));
> - fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
> - }
> + fixed_mode = intel_panel_encoder_fixed_mode(intel_connector, intel_encoder);
>
> /* If we still don't have a mode after all that, give up. */
> if (!fixed_mode)
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> index 7f59db8b9ede..882e424973d4 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -292,6 +292,26 @@ intel_panel_vbt_sdvo_fixed_mode(struct intel_connector *connector)
> return fixed_mode;
> }
>
> +struct drm_display_mode *
> +intel_panel_encoder_fixed_mode(struct intel_connector *connector,
> + struct intel_encoder *encoder)
> +{
> + struct drm_i915_private *i915 = to_i915(connector->base.dev);
> + struct drm_display_mode *fixed_mode;
> +
> + fixed_mode = intel_encoder_current_mode(encoder);
> + if (!fixed_mode)
> + return NULL;
> +
> + drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] using current (BIOS) mode: " DRM_MODE_FMT "\n",
> + connector->base.base.id, connector->base.name,
> + DRM_MODE_ARG(fixed_mode));
> +
> + fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
> +
> + return fixed_mode;
> +}
> +
> /* adjusted_mode has been preset to be the panel's fixed mode */
> static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
> const struct drm_connector_state *conn_state)
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.h b/drivers/gpu/drm/i915/display/intel_panel.h
> index 7e32c903a1e6..6a6ac338e9aa 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.h
> +++ b/drivers/gpu/drm/i915/display/intel_panel.h
> @@ -16,6 +16,7 @@ struct drm_display_mode;
> struct drm_i915_private;
> struct intel_connector;
> struct intel_crtc_state;
> +struct intel_encoder;
>
> int intel_panel_init(struct intel_connector *connector,
> struct drm_display_mode *fixed_mode,
> @@ -50,5 +51,8 @@ struct drm_display_mode *
> intel_panel_vbt_lfp_fixed_mode(struct intel_connector *connector);
> struct drm_display_mode *
> intel_panel_vbt_sdvo_fixed_mode(struct intel_connector *connector);
> +struct drm_display_mode *
> +intel_panel_encoder_fixed_mode(struct intel_connector *connector,
> + struct intel_encoder *encoder);
>
> #endif /* __INTEL_PANEL_H__ */
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2022-03-28 11:32 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 18:29 [Intel-gfx] [PATCH 0/9] drm/i915: More fixed_mode refactoring Ville Syrjala
2022-03-23 18:29 ` [Intel-gfx] [PATCH 1/9] drm/i915: Pass intel_connector to intel_panel_{init, fini}() Ville Syrjala
2022-03-28 11:24 ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 2/9] drm/i915: Use DRM_MODE_FMT+DRM_MODE_ARG() Ville Syrjala
2022-03-28 11:26 ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 3/9] drm/i915: Extract intel_edp_add_properties() Ville Syrjala
2022-03-28 11:27 ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 4/9] drm/i915: Use intel_panel_preferred_fixed_mode() more Ville Syrjala
2022-03-28 11:28 ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 5/9] drm/i915: Rename intel_panel_vbt_fixed_mode() Ville Syrjala
2022-03-28 11:30 ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 6/9] drm/i915: Extract intel_panel_vbt_sdvo_fixed_mode() Ville Syrjala
2022-03-28 11:31 ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 7/9] drm/i915: Extract intel_panel_encoder_fixed_mode() Ville Syrjala
2022-03-28 11:32 ` Jani Nikula [this message]
2022-03-23 18:29 ` [Intel-gfx] [PATCH 8/9] drm/i915: Use intel_panel_edid_fixed_mode() for sdvo Ville Syrjala
2022-03-28 11:34 ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 9/9] drm/i915: Change SDVO fixed mode handling Ville Syrjala
2022-03-28 11:35 ` Jani Nikula
2022-03-23 18:57 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915: More fixed_mode refactoring Patchwork
2022-03-23 19:07 ` Ville Syrjälä
2022-03-23 19:16 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-23 20:30 ` [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=87o81qe2ic.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox