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 v2 06/11] drm/i915: Stop duplicating the EDID fixed/downclock modes
Date: Thu, 31 Mar 2022 16:34:22 +0300 [thread overview]
Message-ID: <874k3e9rfl.fsf@intel.com> (raw)
In-Reply-To: <20220331112822.11462-7-ville.syrjala@linux.intel.com>
On Thu, 31 Mar 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Instead of duplicating the fixed/downclock modes we can just grab
> the originals straight from the probed_modes list and keep them.
> The next .get_modes() is going to repopulate the probed_modes list
> anyway so whatever we leave there is just going to sit around until
> that time wasting memory. In fact let's clear out the probed modes
> list entirely to make sure we get 100% consistent behaviour starting
> already from the very first real .get_modes().
>
> 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_panel.c | 62 ++++++++++------------
> 1 file changed, 29 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> index 3b1da9aa023f..5d08b2bf27ec 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -164,8 +164,7 @@ static void intel_panel_add_edid_downclock_mode(struct intel_connector *connecto
> struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> const struct drm_display_mode *fixed_mode =
> intel_panel_preferred_fixed_mode(connector);
> - const struct drm_display_mode *scan, *best_mode = NULL;
> - struct drm_display_mode *downclock_mode;
> + struct drm_display_mode *scan, *best_mode = NULL;
> int best_clock = fixed_mode->clock;
>
> list_for_each_entry(scan, &connector->base.probed_modes, head) {
> @@ -190,58 +189,54 @@ static void intel_panel_add_edid_downclock_mode(struct intel_connector *connecto
> if (!best_mode)
> return;
>
> - downclock_mode = drm_mode_duplicate(&dev_priv->drm, best_mode);
> - if (!downclock_mode)
> - return;
> -
> drm_dbg_kms(&dev_priv->drm,
> - "[CONNECTOR:%d:%s] using downclock mode from EDID: " DRM_MODE_FMT "\n",
> + "[CONNECTOR:%d:%s] using EDID downclock mode: " DRM_MODE_FMT "\n",
> connector->base.base.id, connector->base.name,
> - DRM_MODE_ARG(downclock_mode));
> + DRM_MODE_ARG(best_mode));
>
> - list_add_tail(&downclock_mode->head, &connector->panel.fixed_modes);
> + list_move_tail(&best_mode->head, &connector->panel.fixed_modes);
> }
>
> static void intel_panel_add_edid_fixed_mode(struct intel_connector *connector)
> {
> struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> - const struct drm_display_mode *scan;
> - struct drm_display_mode *fixed_mode;
> + struct drm_display_mode *scan, *fixed_mode = NULL;
>
> if (list_empty(&connector->base.probed_modes))
> return;
>
> - /* prefer fixed mode from EDID if available */
> + /* make sure the preferred mode is first */
> list_for_each_entry(scan, &connector->base.probed_modes, head) {
> - if ((scan->type & DRM_MODE_TYPE_PREFERRED) == 0)
> - continue;
> -
> - fixed_mode = drm_mode_duplicate(&dev_priv->drm, scan);
> - if (!fixed_mode)
> - return;
> -
> - drm_dbg_kms(&dev_priv->drm,
> - "[CONNECTOR:%d:%s] using preferred mode from EDID: " DRM_MODE_FMT "\n",
> - connector->base.base.id, connector->base.name,
> - DRM_MODE_ARG(fixed_mode));
> -
> - list_add_tail(&fixed_mode->head, &connector->panel.fixed_modes);
> - return;
> + if (scan->type & DRM_MODE_TYPE_PREFERRED) {
> + fixed_mode = scan;
> + break;
> + }
> }
>
> - scan = list_first_entry(&connector->base.probed_modes,
> - typeof(*scan), head);
> - fixed_mode = drm_mode_duplicate(&dev_priv->drm, scan);
> if (!fixed_mode)
> - return;
> + fixed_mode = list_first_entry(&connector->base.probed_modes,
> + typeof(*fixed_mode), head);
>
> - fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
> drm_dbg_kms(&dev_priv->drm,
> - "[CONNECTOR:%d:%s] using first mode from EDID: " DRM_MODE_FMT "\n",
> + "[CONNECTOR:%d:%s] using %s EDID fixed mode: " DRM_MODE_FMT "\n",
> connector->base.base.id, connector->base.name,
> + fixed_mode->type & DRM_MODE_TYPE_PREFERRED ? "preferred" : "first",
> DRM_MODE_ARG(fixed_mode));
>
> - list_add_tail(&fixed_mode->head, &connector->panel.fixed_modes);
> + fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
> +
> + list_move_tail(&fixed_mode->head, &connector->panel.fixed_modes);
> +}
> +
> +static void intel_panel_destroy_probed_modes(struct intel_connector *connector)
> +{
> + struct drm_i915_private *i915 = to_i915(connector->base.dev);
> + struct drm_display_mode *mode, *next;
> +
> + list_for_each_entry_safe(mode, next, &connector->base.probed_modes, head) {
> + list_del(&mode->head);
> + drm_mode_destroy(&i915->drm, mode);
> + }
> }
>
> void intel_panel_add_edid_fixed_modes(struct intel_connector *connector, bool has_drrs)
> @@ -249,6 +244,7 @@ void intel_panel_add_edid_fixed_modes(struct intel_connector *connector, bool ha
> intel_panel_add_edid_fixed_mode(connector);
> if (intel_panel_preferred_fixed_mode(connector) && has_drrs)
> intel_panel_add_edid_downclock_mode(connector);
> + intel_panel_destroy_probed_modes(connector);
> }
>
> static void intel_panel_add_fixed_mode(struct intel_connector *connector,
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2022-03-31 13:34 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 11:28 [Intel-gfx] [PATCH v2 00/11] drm/i915: Finish off static DRRS Ville Syrjala
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 01/11] drm/i915: Extract intel_edp_has_drrs() Ville Syrjala
2022-04-04 12:24 ` Jani Nikula
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 02/11] drm/i915: Put fixed modes directly onto the panel's fixed_modes list Ville Syrjala
2022-03-31 13:04 ` Jani Nikula
2022-03-31 13:15 ` Jani Nikula
2022-03-31 13:16 ` Ville Syrjälä
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 03/11] drm/i915: Refactor non-EDID fixed mode duplication Ville Syrjala
2022-03-31 13:23 ` Jani Nikula
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 04/11] drm/i915: Nuke intel_drrs_init() Ville Syrjala
2022-03-31 13:25 ` Jani Nikula
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 05/11] drm/i915: Combine the EDID fixed_mode+downclock_mode lookup into one Ville Syrjala
2022-03-31 13:26 ` Jani Nikula
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 06/11] drm/i915: Stop duplicating the EDID fixed/downclock modes Ville Syrjala
2022-03-31 13:34 ` Jani Nikula [this message]
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 07/11] drm/i915: Allow an arbitrary number of downclock modes Ville Syrjala
2022-03-31 13:37 ` Jani Nikula
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 08/11] drm/i915: Allow higher refresh rate alternate fixed modes Ville Syrjala
2022-03-31 13:43 ` Jani Nikula
2022-03-31 16:55 ` Ville Syrjälä
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 09/11] drm/i915: Move intel_drrs_compute_config() into intel_dp.c Ville Syrjala
2022-03-31 13:46 ` Jani Nikula
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 10/11] drm/i915: Allow static DRRS on all eDP ports Ville Syrjala
2022-03-31 13:57 ` Jani Nikula
2022-03-31 11:28 ` [Intel-gfx] [PATCH v2 11/11] drm/i915: Allow static DRRS on LVDS Ville Syrjala
2022-03-31 13:59 ` Jani Nikula
2022-03-31 14:05 ` Ville Syrjälä
2022-04-01 15:09 ` Ville Syrjälä
2022-03-31 14:46 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Finish off static DRRS (rev2) Patchwork
2022-03-31 17:38 ` [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=874k3e9rfl.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 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.