mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
drm/i915/intel_panel: Avoid calls to intel_panel_fixed_mode() in mode_valid
Currently, most callers of intel_panel_mode_valid() also call intel_panel_fixed_mode(). This is done either to check for the presence of a fixed mode for the connector or to get the clock of the fixed mode, which is then compared against the max dotclock for the pipe. Since intel_panel_mode_valid() already calls intel_panel_fixed_mode() internally, we can avoid yet another call to intel_panel_fixed_mode() from the caller. Remove the redundant call to intel_panel_fixed_mode() in mode_valid paths. To get the clock for the fixed mode, extend the helper intel_panel_mode_valid() to accept 'target_clock' as an out param. The 'target_clock' can then be used by the callers to check against the max dotclock. Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> Link: https://patch.msgid.link/20260430131220.3891497-3-ankit.k.nautiyal@intel.com
This commit is contained in:
parent
dae483da59
commit
9cdd4ec956
|
|
@ -1571,7 +1571,6 @@ intel_dp_mode_valid(struct drm_connector *_connector,
|
|||
struct intel_connector *connector = to_intel_connector(_connector);
|
||||
const struct drm_display_info *info = &connector->base.display_info;
|
||||
struct intel_dp *intel_dp = intel_attached_dp(connector);
|
||||
const struct drm_display_mode *fixed_mode;
|
||||
int target_clock = mode->clock;
|
||||
enum drm_mode_status status;
|
||||
|
||||
|
|
@ -1588,13 +1587,10 @@ intel_dp_mode_valid(struct drm_connector *_connector,
|
|||
if (intel_dp_hdisplay_bad(display, mode->hdisplay))
|
||||
return MODE_H_ILLEGAL;
|
||||
|
||||
fixed_mode = intel_panel_fixed_mode(connector, mode);
|
||||
if (intel_dp_is_edp(intel_dp) && fixed_mode) {
|
||||
status = intel_panel_mode_valid(connector, mode);
|
||||
if (intel_dp_is_edp(intel_dp)) {
|
||||
status = intel_panel_mode_valid(connector, mode, &target_clock);
|
||||
if (status != MODE_OK)
|
||||
return status;
|
||||
|
||||
target_clock = fixed_mode->clock;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -63,18 +63,17 @@ enum drm_mode_status intel_dsi_mode_valid(struct drm_connector *connector,
|
|||
{
|
||||
struct intel_display *display = to_intel_display(connector->dev);
|
||||
struct intel_connector *intel_connector = to_intel_connector(connector);
|
||||
const struct drm_display_mode *fixed_mode =
|
||||
intel_panel_fixed_mode(intel_connector, mode);
|
||||
int max_dotclk = display->cdclk.max_dotclk_freq;
|
||||
enum drm_mode_status status;
|
||||
int target_clock;
|
||||
|
||||
drm_dbg_kms(display->drm, "\n");
|
||||
|
||||
status = intel_panel_mode_valid(intel_connector, mode);
|
||||
status = intel_panel_mode_valid(intel_connector, mode, &target_clock);
|
||||
if (status != MODE_OK)
|
||||
return status;
|
||||
|
||||
if (fixed_mode->clock > max_dotclk)
|
||||
if (target_clock > max_dotclk)
|
||||
return MODE_CLOCK_HIGH;
|
||||
|
||||
return intel_mode_valid_max_plane_size(display, mode, 1);
|
||||
|
|
|
|||
|
|
@ -223,8 +223,6 @@ intel_dvo_mode_valid(struct drm_connector *_connector,
|
|||
struct intel_display *display = to_intel_display(_connector->dev);
|
||||
struct intel_connector *connector = to_intel_connector(_connector);
|
||||
struct intel_dvo *intel_dvo = intel_attached_dvo(connector);
|
||||
const struct drm_display_mode *fixed_mode =
|
||||
intel_panel_fixed_mode(connector, mode);
|
||||
int max_dotclk = display->cdclk.max_dotclk_freq;
|
||||
int target_clock = mode->clock;
|
||||
enum drm_mode_status status;
|
||||
|
|
@ -234,16 +232,9 @@ intel_dvo_mode_valid(struct drm_connector *_connector,
|
|||
return status;
|
||||
|
||||
/* XXX: Validate clock range */
|
||||
|
||||
if (fixed_mode) {
|
||||
enum drm_mode_status status;
|
||||
|
||||
status = intel_panel_mode_valid(connector, mode);
|
||||
if (status != MODE_OK)
|
||||
return status;
|
||||
|
||||
target_clock = fixed_mode->clock;
|
||||
}
|
||||
status = intel_panel_mode_valid(connector, mode, &target_clock);
|
||||
if (status != MODE_OK)
|
||||
return status;
|
||||
|
||||
if (target_clock > max_dotclk)
|
||||
return MODE_CLOCK_HIGH;
|
||||
|
|
|
|||
|
|
@ -395,20 +395,19 @@ intel_lvds_mode_valid(struct drm_connector *_connector,
|
|||
{
|
||||
struct intel_display *display = to_intel_display(_connector->dev);
|
||||
struct intel_connector *connector = to_intel_connector(_connector);
|
||||
const struct drm_display_mode *fixed_mode =
|
||||
intel_panel_fixed_mode(connector, mode);
|
||||
int max_pixclk = display->cdclk.max_dotclk_freq;
|
||||
enum drm_mode_status status;
|
||||
int target_clock;
|
||||
|
||||
status = intel_cpu_transcoder_mode_valid(display, mode);
|
||||
if (status != MODE_OK)
|
||||
return status;
|
||||
|
||||
status = intel_panel_mode_valid(connector, mode);
|
||||
status = intel_panel_mode_valid(connector, mode, &target_clock);
|
||||
if (status != MODE_OK)
|
||||
return status;
|
||||
|
||||
if (fixed_mode->clock > max_pixclk)
|
||||
if (target_clock > max_pixclk)
|
||||
return MODE_CLOCK_HIGH;
|
||||
|
||||
return MODE_OK;
|
||||
|
|
|
|||
|
|
@ -396,11 +396,15 @@ intel_panel_detect(struct drm_connector *connector, bool force)
|
|||
|
||||
enum drm_mode_status
|
||||
intel_panel_mode_valid(struct intel_connector *connector,
|
||||
const struct drm_display_mode *mode)
|
||||
const struct drm_display_mode *mode,
|
||||
int *target_clock)
|
||||
{
|
||||
const struct drm_display_mode *fixed_mode =
|
||||
intel_panel_fixed_mode(connector, mode);
|
||||
|
||||
if (target_clock)
|
||||
*target_clock = mode->clock;
|
||||
|
||||
if (!fixed_mode)
|
||||
return MODE_OK;
|
||||
|
||||
|
|
@ -413,6 +417,9 @@ intel_panel_mode_valid(struct intel_connector *connector,
|
|||
if (drm_mode_vrefresh(mode) != drm_mode_vrefresh(fixed_mode))
|
||||
return MODE_PANEL;
|
||||
|
||||
if (target_clock)
|
||||
*target_clock = fixed_mode->clock;
|
||||
|
||||
return MODE_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ int intel_panel_get_modes(struct intel_connector *connector);
|
|||
enum drrs_type intel_panel_drrs_type(struct intel_connector *connector);
|
||||
enum drm_mode_status
|
||||
intel_panel_mode_valid(struct intel_connector *connector,
|
||||
const struct drm_display_mode *mode);
|
||||
const struct drm_display_mode *mode,
|
||||
int *target_clock);
|
||||
int intel_panel_compute_config(struct intel_connector *connector,
|
||||
struct drm_display_mode *adjusted_mode);
|
||||
void intel_panel_add_edid_fixed_modes(struct intel_connector *connector,
|
||||
|
|
|
|||
|
|
@ -1967,15 +1967,13 @@ intel_sdvo_mode_valid(struct drm_connector *connector,
|
|||
|
||||
if (IS_LVDS(intel_sdvo_connector)) {
|
||||
enum drm_mode_status status;
|
||||
const struct drm_display_mode *fixed_mode;
|
||||
int target_clock;
|
||||
|
||||
status = intel_panel_mode_valid(&intel_sdvo_connector->base, mode);
|
||||
status = intel_panel_mode_valid(&intel_sdvo_connector->base, mode, &target_clock);
|
||||
if (status != MODE_OK)
|
||||
return status;
|
||||
|
||||
fixed_mode = intel_panel_fixed_mode(&intel_sdvo_connector->base, mode);
|
||||
|
||||
if (fixed_mode && fixed_mode->clock > max_dotclk)
|
||||
if (target_clock > max_dotclk)
|
||||
return MODE_CLOCK_HIGH;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user