Commit 7634bef1 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Allow an arbitrary number of downclock modes

Remove the "two fixed modes only" limit and grab as many
downclock modes from the EDID as we can find.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220331112822.11462-8-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent ccaa9101
...@@ -159,42 +159,24 @@ static bool is_downclock_mode(const struct drm_display_mode *downclock_mode, ...@@ -159,42 +159,24 @@ static bool is_downclock_mode(const struct drm_display_mode *downclock_mode,
downclock_mode->clock < fixed_mode->clock; downclock_mode->clock < fixed_mode->clock;
} }
static void intel_panel_add_edid_downclock_mode(struct intel_connector *connector) static void intel_panel_add_edid_downclock_modes(struct intel_connector *connector)
{ {
struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
const struct drm_display_mode *fixed_mode = const struct drm_display_mode *fixed_mode =
intel_panel_preferred_fixed_mode(connector); intel_panel_preferred_fixed_mode(connector);
struct drm_display_mode *scan, *best_mode = NULL; struct drm_display_mode *mode, *next;
int best_clock = fixed_mode->clock;
list_for_each_entry(scan, &connector->base.probed_modes, head) {
/*
* If one mode has the same resolution with the fixed_panel
* mode while they have the different refresh rate, it means
* that the reduced downclock is found. In such
* case we can set the different FPx0/1 to dynamically select
* between low and high frequency.
*/
if (is_downclock_mode(scan, fixed_mode) &&
scan->clock < best_clock) {
/*
* The downclock is already found. But we
* expect to find the lower downclock.
*/
best_clock = scan->clock;
best_mode = scan;
}
}
if (!best_mode) list_for_each_entry_safe(mode, next, &connector->base.probed_modes, head) {
return; if (!is_downclock_mode(mode, fixed_mode))
continue;
drm_dbg_kms(&dev_priv->drm, drm_dbg_kms(&dev_priv->drm,
"[CONNECTOR:%d:%s] using EDID downclock mode: " DRM_MODE_FMT "\n", "[CONNECTOR:%d:%s] using EDID downclock mode: " DRM_MODE_FMT "\n",
connector->base.base.id, connector->base.name, connector->base.base.id, connector->base.name,
DRM_MODE_ARG(best_mode)); DRM_MODE_ARG(mode));
list_move_tail(&best_mode->head, &connector->panel.fixed_modes); list_move_tail(&mode->head, &connector->panel.fixed_modes);
}
} }
static void intel_panel_add_edid_fixed_mode(struct intel_connector *connector) static void intel_panel_add_edid_fixed_mode(struct intel_connector *connector)
...@@ -243,7 +225,7 @@ void intel_panel_add_edid_fixed_modes(struct intel_connector *connector, bool ha ...@@ -243,7 +225,7 @@ void intel_panel_add_edid_fixed_modes(struct intel_connector *connector, bool ha
{ {
intel_panel_add_edid_fixed_mode(connector); intel_panel_add_edid_fixed_mode(connector);
if (intel_panel_preferred_fixed_mode(connector) && has_drrs) if (intel_panel_preferred_fixed_mode(connector) && has_drrs)
intel_panel_add_edid_downclock_mode(connector); intel_panel_add_edid_downclock_modes(connector);
intel_panel_destroy_probed_modes(connector); intel_panel_destroy_probed_modes(connector);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment