Commit c5ee2343 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Implement static DRRS

Let's start supporting static DRRS by trying to match the refresh
rate the user has requested, assuming the panel supports suitable
timings.

For now we stick to just our current two timings:
- fixed_mode: the panel's preferred mode
- downclock_mode: the lowest refresh rate mode we found
Some panels may support more timings than that, but we'll
have to convert our fixed_mode/downclock_mode pointers
into a full list before we can handle that.

v2: Rebase due to intel_panel_get_modes()

Reviewed-by: Jani Nikula <jani.nikula@intel.com> #v1
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220311172428.14685-16-ville.syrjala@linux.intel.com
parent c2f12155
...@@ -390,7 +390,7 @@ intel_drrs_init(struct intel_connector *connector, ...@@ -390,7 +390,7 @@ intel_drrs_init(struct intel_connector *connector,
return NULL; return NULL;
} }
if (dev_priv->vbt.drrs_type != DRRS_TYPE_SEAMLESS) { if (dev_priv->vbt.drrs_type == DRRS_TYPE_NONE) {
drm_dbg_kms(&dev_priv->drm, drm_dbg_kms(&dev_priv->drm,
"[CONNECTOR:%d:%s] DRRS not supported according to VBT\n", "[CONNECTOR:%d:%s] DRRS not supported according to VBT\n",
connector->base.base.id, connector->base.name); connector->base.base.id, connector->base.name);
......
...@@ -55,14 +55,30 @@ const struct drm_display_mode * ...@@ -55,14 +55,30 @@ const struct drm_display_mode *
intel_panel_fixed_mode(struct intel_connector *connector, intel_panel_fixed_mode(struct intel_connector *connector,
const struct drm_display_mode *mode) const struct drm_display_mode *mode)
{ {
return connector->panel.fixed_mode; const struct drm_display_mode *fixed_mode = connector->panel.fixed_mode;
const struct drm_display_mode *downclock_mode = connector->panel.downclock_mode;
/* pick the one that is closer in terms of vrefresh */
/* FIXME make this a a list of modes so we can have more than two */
if (fixed_mode && downclock_mode &&
abs(drm_mode_vrefresh(downclock_mode) - drm_mode_vrefresh(mode)) <
abs(drm_mode_vrefresh(fixed_mode) - drm_mode_vrefresh(mode)))
return downclock_mode;
else
return fixed_mode;
} }
const struct drm_display_mode * const struct drm_display_mode *
intel_panel_downclock_mode(struct intel_connector *connector, intel_panel_downclock_mode(struct intel_connector *connector,
const struct drm_display_mode *adjusted_mode) const struct drm_display_mode *adjusted_mode)
{ {
return connector->panel.downclock_mode; const struct drm_display_mode *downclock_mode = connector->panel.downclock_mode;
if (downclock_mode &&
drm_mode_vrefresh(downclock_mode) < drm_mode_vrefresh(adjusted_mode))
return downclock_mode;
else
return NULL;
} }
int intel_panel_get_modes(struct intel_connector *connector) int intel_panel_get_modes(struct intel_connector *connector)
...@@ -80,6 +96,17 @@ int intel_panel_get_modes(struct intel_connector *connector) ...@@ -80,6 +96,17 @@ int intel_panel_get_modes(struct intel_connector *connector)
} }
} }
if (connector->panel.downclock_mode) {
struct drm_display_mode *mode;
mode = drm_mode_duplicate(connector->base.dev,
connector->panel.downclock_mode);
if (mode) {
drm_mode_probed_add(&connector->base, mode);
num_modes++;
}
}
return num_modes; return num_modes;
} }
......
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