mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 18:49:22 -04:00
drm/i915:vrr: Separate out functions to compute vmin and vmax
Make helpers to compute vmin and vmax. v2: Make the adjusted mode const (Ville) Use reverse xmas tree order of declarations. (Ville) Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250311093751.1329043-3-ankit.k.nautiyal@intel.com
This commit is contained in:
@@ -222,6 +222,34 @@ cmrr_get_vtotal(struct intel_crtc_state *crtc_state, bool video_mode_required)
|
||||
return vtotal;
|
||||
}
|
||||
|
||||
static
|
||||
int intel_vrr_compute_vmin(struct intel_connector *connector,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
const struct drm_display_info *info = &connector->base.display_info;
|
||||
int vmin;
|
||||
|
||||
vmin = DIV_ROUND_UP(adjusted_mode->crtc_clock * 1000,
|
||||
adjusted_mode->crtc_htotal * info->monitor_range.max_vfreq);
|
||||
vmin = max_t(int, vmin, adjusted_mode->crtc_vtotal);
|
||||
|
||||
return vmin;
|
||||
}
|
||||
|
||||
static
|
||||
int intel_vrr_compute_vmax(struct intel_connector *connector,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
const struct drm_display_info *info = &connector->base.display_info;
|
||||
int vmax;
|
||||
|
||||
vmax = adjusted_mode->crtc_clock * 1000 /
|
||||
(adjusted_mode->crtc_htotal * info->monitor_range.min_vfreq);
|
||||
vmax = max_t(int, vmax, adjusted_mode->crtc_vtotal);
|
||||
|
||||
return vmax;
|
||||
}
|
||||
|
||||
void
|
||||
intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
|
||||
struct drm_connector_state *conn_state)
|
||||
@@ -232,7 +260,6 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
|
||||
struct intel_dp *intel_dp = intel_attached_dp(connector);
|
||||
bool is_edp = intel_dp_is_edp(intel_dp);
|
||||
struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
|
||||
const struct drm_display_info *info = &connector->base.display_info;
|
||||
int vmin, vmax;
|
||||
|
||||
/*
|
||||
@@ -253,13 +280,8 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
|
||||
if (HAS_LRR(display))
|
||||
crtc_state->update_lrr = true;
|
||||
|
||||
vmin = DIV_ROUND_UP(adjusted_mode->crtc_clock * 1000,
|
||||
adjusted_mode->crtc_htotal * info->monitor_range.max_vfreq);
|
||||
vmax = adjusted_mode->crtc_clock * 1000 /
|
||||
(adjusted_mode->crtc_htotal * info->monitor_range.min_vfreq);
|
||||
|
||||
vmin = max_t(int, vmin, adjusted_mode->crtc_vtotal);
|
||||
vmax = max_t(int, vmax, adjusted_mode->crtc_vtotal);
|
||||
vmin = intel_vrr_compute_vmin(connector, adjusted_mode);
|
||||
vmax = intel_vrr_compute_vmax(connector, adjusted_mode);
|
||||
|
||||
if (vmin >= vmax)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user