disp: msm: remove use of drm_display_mode vrefresh

Use of drm_display_mode vrefresh is being deprecated in
upstream DRM framework. Downstream driver need to use
drm_mode_vrefresh API from now on.

This change removes dependency on drm_display_mode vrefresh
and replaces it with drm_mode_vrefresh API in SDE, DSI and
DP driver. In addition, it also modifies drm_display_mode clock
to align with upstream approach where an uncompressed mode clock
is required to match drm_mode_vrefresh API.

Change-Id: Ie972a2e140adfd81c4e68df8e7bc69feaaca22e1
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
Signed-off-by: Amine Najahi <anajahi@codeaurora.org>
This commit is contained in:
Amine Najahi
2021-01-12 17:50:03 -05:00
szülő ab3f86f918
commit 08358fd857
13 fájl változott, egészen pontosan 54 új sor hozzáadva és 50 régi sor törölve

Fájl megtekintése

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/debugfs.h>
@@ -994,7 +994,7 @@ static ssize_t dp_debug_read_edid_modes(struct file *file,
list_for_each_entry(mode, &connector->modes, head) {
ret = snprintf(buf + len, max_size,
"%s %d %d %d %d %d 0x%x\n",
mode->name, mode->vrefresh, mode->picture_aspect_ratio,
mode->name, drm_mode_vrefresh(mode), mode->picture_aspect_ratio,
mode->htotal, mode->vtotal, mode->clock, mode->flags);
if (dp_debug_check_buffer_overflow(ret, &max_size, &len))
break;
@@ -1069,7 +1069,7 @@ static ssize_t dp_debug_read_edid_modes_mst(struct file *file,
list_for_each_entry(mode, &connector->modes, head) {
ret = snprintf(buf + len, max_size,
"%s %d %d %d %d %d 0x%x\n",
mode->name, mode->vrefresh,
mode->name, drm_mode_vrefresh(mode),
mode->picture_aspect_ratio, mode->htotal,
mode->vtotal, mode->clock, mode->flags);
if (dp_debug_check_buffer_overflow(ret, &max_size, &len))

Fájl megtekintése

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@@ -2824,7 +2824,7 @@ static void dp_display_validate_mst_connectors(struct dp_debug *debug,
_hdis = mode->hdisplay;
_vdis = mode->vdisplay;
_vref = mode->vrefresh;
_vref = drm_mode_vrefresh(mode);
_ar = mode->picture_aspect_ratio;
if (hdis == _hdis && vdis == _vdis && vref == _vref &&
@@ -2912,7 +2912,7 @@ static enum drm_mode_status dp_display_validate_mode(
if (debug->debug_en && (mode->hdisplay != debug->hdisplay ||
mode->vdisplay != debug->vdisplay ||
mode->vrefresh != debug->vrefresh ||
drm_mode_vrefresh(mode) != debug->vrefresh ||
mode->picture_aspect_ratio != debug->aspect_ratio))
goto end;

Fájl megtekintése

@@ -40,8 +40,8 @@ void convert_to_drm_mode(const struct dp_display_mode *dp_mode,
dp_mode->timing.v_sync_width;
drm_mode->vtotal = drm_mode->vsync_end + dp_mode->timing.v_back_porch;
drm_mode->vrefresh = dp_mode->timing.refresh_rate;
drm_mode->clock = dp_mode->timing.pixel_clk_khz;
drm_mode->clock = drm_mode->htotal * drm_mode->vtotal * dp_mode->timing.refresh_rate;
drm_mode->clock /= 1000;
if (dp_mode->timing.h_active_low)
flags |= DRM_MODE_FLAG_NHSYNC;
@@ -423,7 +423,7 @@ int dp_connector_get_mode_info(struct drm_connector *connector,
topology->num_enc = no_enc;
topology->num_intf = single_intf;
mode_info->frame_rate = drm_mode->vrefresh;
mode_info->frame_rate = drm_mode_vrefresh(drm_mode);
mode_info->vtotal = drm_mode->vtotal;
mode_info->wide_bus_en = dp_panel->widebus_en;
@@ -671,7 +671,6 @@ enum drm_mode_status dp_connector_mode_valid(struct drm_connector *connector,
}
dp_disp = display;
mode->vrefresh = drm_mode_vrefresh(mode);
rc = dp_disp->get_available_dp_resources(dp_disp, avail_res,
&avail_dp_res);

Fájl megtekintése

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
/*
@@ -1074,7 +1074,7 @@ static void dp_mst_bridge_pre_enable(struct drm_bridge *drm_bridge)
DP_MST_INFO("conn:%d mode:%s fps:%d dsc:%d vcpi:%d slots:%d to %d\n",
DP_MST_CONN_ID(bridge), bridge->drm_mode.name,
bridge->drm_mode.vrefresh,
drm_mode_vrefresh(&bridge->drm_mode),
bridge->dp_mode.timing.comp_info.comp_ratio,
bridge->vcpi, bridge->start_slot,
bridge->start_slot + bridge->num_slots);

Fájl megtekintése

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#include "dp_panel.h"
@@ -2944,8 +2944,7 @@ static void dp_panel_convert_to_dp_mode(struct dp_panel *dp_panel,
dp_mode->timing.v_front_porch = drm_mode->vsync_start -
drm_mode->vdisplay;
dp_mode->timing.refresh_rate = drm_mode->vrefresh;
dp_mode->timing.refresh_rate = drm_mode_vrefresh(drm_mode);
dp_mode->timing.pixel_clk_khz = drm_mode->clock;
dp_mode->timing.v_active_low =

Fájl megtekintése

@@ -6149,7 +6149,7 @@ static int dsi_display_ext_get_mode_info(struct drm_connector *connector,
return -EINVAL;
memset(mode_info, 0, sizeof(*mode_info));
mode_info->frame_rate = drm_mode->vrefresh;
mode_info->frame_rate = drm_mode_vrefresh(drm_mode);
mode_info->vtotal = drm_mode->vtotal;
topology = &mode_info->topology;
@@ -7040,8 +7040,7 @@ int dsi_display_find_mode(struct dsi_display *display,
if (cmp->timing.v_active == m->timing.v_active &&
cmp->timing.h_active == m->timing.h_active &&
cmp->timing.refresh_rate == m->timing.refresh_rate &&
cmp->pixel_clk_khz == m->pixel_clk_khz) {
cmp->timing.refresh_rate == m->timing.refresh_rate) {
*out_mode = m;
rc = 0;
break;

Fájl megtekintése

@@ -51,9 +51,7 @@ static void convert_to_dsi_mode(const struct drm_display_mode *drm_mode,
dsi_mode->timing.v_front_porch = drm_mode->vsync_start -
drm_mode->vdisplay;
dsi_mode->timing.refresh_rate = drm_mode->vrefresh;
dsi_mode->pixel_clk_khz = drm_mode->clock;
dsi_mode->timing.refresh_rate = drm_mode_vrefresh(drm_mode);
dsi_mode->timing.h_sync_polarity =
!!(drm_mode->flags & DRM_MODE_FLAG_PHSYNC);
@@ -123,8 +121,8 @@ void dsi_convert_to_drm_mode(const struct dsi_display_mode *dsi_mode,
dsi_mode->timing.v_sync_width;
drm_mode->vtotal = drm_mode->vsync_end + dsi_mode->timing.v_back_porch;
drm_mode->vrefresh = dsi_mode->timing.refresh_rate;
drm_mode->clock = dsi_mode->pixel_clk_khz;
drm_mode->clock = drm_mode->htotal * drm_mode->vtotal * dsi_mode->timing.refresh_rate;
drm_mode->clock /= 1000;
if (dsi_mode->timing.h_sync_polarity)
drm_mode->flags |= DRM_MODE_FLAG_PHSYNC;
@@ -132,9 +130,9 @@ void dsi_convert_to_drm_mode(const struct dsi_display_mode *dsi_mode,
drm_mode->flags |= DRM_MODE_FLAG_PVSYNC;
/* set mode name */
snprintf(drm_mode->name, DRM_DISPLAY_MODE_LEN, "%dx%dx%dx%d%s",
snprintf(drm_mode->name, DRM_DISPLAY_MODE_LEN, "%dx%dx%dx%u%s",
drm_mode->hdisplay, drm_mode->vdisplay,
drm_mode->vrefresh, drm_mode->clock,
drm_mode_vrefresh(drm_mode), dsi_mode->pixel_clk_khz,
panel_caps);
}
@@ -421,6 +419,7 @@ static bool dsi_bridge_mode_fixup(struct drm_bridge *bridge,
}
convert_to_dsi_mode(mode, &dsi_mode);
msm_parse_mode_priv_info(&conn_state->msm_mode, &dsi_mode);
/*
* retrieve dsi mode from dsi driver's cache since not safe to take
@@ -536,7 +535,7 @@ u64 dsi_drm_find_bit_clk_rate(void *display,
if ((dsi_mode->timing.v_active == drm_mode->vdisplay) &&
(dsi_mode->timing.h_active == drm_mode->hdisplay) &&
(dsi_mode->pixel_clk_khz == drm_mode->clock) &&
(dsi_mode->timing.refresh_rate == drm_mode->vrefresh)) {
(dsi_mode->timing.refresh_rate == drm_mode_vrefresh(drm_mode))) {
bit_clk_rate = dsi_mode->timing.clk_rate_hz;
break;
}
@@ -571,7 +570,7 @@ int dsi_conn_get_mode_info(struct drm_connector *connector,
mode_info->jitter_numer = dsi_mode->priv_info->panel_jitter_numer;
mode_info->jitter_denom = dsi_mode->priv_info->panel_jitter_denom;
mode_info->dfps_maxfps = dsi_drm_get_dfps_maxfps(display);
mode_info->clk_rate = dsi_drm_find_bit_clk_rate(display, drm_mode);
mode_info->clk_rate = dsi_mode->timing.clk_rate_hz;
mode_info->panel_mode_caps = dsi_mode->panel_mode_caps;
mode_info->mdp_transfer_time_us =
dsi_mode->priv_info->mdp_transfer_time_us;
@@ -1004,6 +1003,7 @@ enum drm_mode_status dsi_conn_mode_valid(struct drm_connector *connector,
{
struct dsi_display_mode dsi_mode;
struct dsi_display_mode *full_dsi_mode = NULL;
struct sde_connector_state *conn_state;
int rc;
if (!connector || !mode) {
@@ -1012,6 +1012,11 @@ enum drm_mode_status dsi_conn_mode_valid(struct drm_connector *connector,
}
convert_to_dsi_mode(mode, &dsi_mode);
conn_state = to_sde_connector_state(connector->state);
if (conn_state)
msm_parse_mode_priv_info(&conn_state->msm_mode, &dsi_mode);
rc = dsi_display_find_mode(display, &dsi_mode, &full_dsi_mode);
if (rc) {
DSI_ERR("could not find mode %s\n", mode->name);

Fájl megtekintése

@@ -1019,8 +1019,9 @@ static int sde_encoder_virt_atomic_check(
SDE_EVT32(DRMID(drm_enc), adj_mode->flags,
sde_conn_state->msm_mode.private_flags,
old_top, adj_mode->vrefresh, adj_mode->hdisplay,
old_top, drm_mode_vrefresh(adj_mode), adj_mode->hdisplay,
adj_mode->vdisplay, adj_mode->htotal, adj_mode->vtotal);
return ret;
}

Fájl megtekintése

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/
#define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
@@ -947,7 +947,7 @@ static int _get_tearcheck_threshold(struct sde_encoder_phys *phys_enc)
if (mode && (qsync_mode == SDE_RM_QSYNC_CONTINUOUS_MODE)) {
u32 qsync_min_fps = 0;
u32 default_fps = mode->vrefresh;
u32 default_fps = drm_mode_vrefresh(mode);
u32 yres = mode->vtotal;
u32 slow_time_ns;
u32 default_time_ns;
@@ -1013,6 +1013,7 @@ static void sde_encoder_phys_cmd_tearcheck_config(
struct drm_display_mode *mode;
bool tc_enable = true;
u32 vsync_hz;
int vrefresh;
struct msm_drm_private *priv;
struct sde_kms *sde_kms;
@@ -1047,6 +1048,7 @@ static void sde_encoder_phys_cmd_tearcheck_config(
}
priv = sde_kms->dev->dev_private;
vrefresh = drm_mode_vrefresh(mode);
/*
* TE default: dsi byte clock calculated base on 70 fps;
* around 14 ms to complete a kickoff cycle if te disabled;
@@ -1057,14 +1059,14 @@ static void sde_encoder_phys_cmd_tearcheck_config(
* frequency divided by the no. of rows (lines) in the LCDpanel.
*/
vsync_hz = sde_power_clk_get_rate(&priv->phandle, "vsync_clk");
if (!vsync_hz || !mode->vtotal || !mode->vrefresh) {
if (!vsync_hz || !mode->vtotal || vrefresh) {
SDE_DEBUG_CMDENC(cmd_enc,
"invalid params - vsync_hz %u vtot %u vrefresh %u\n",
vsync_hz, mode->vtotal, mode->vrefresh);
vsync_hz, mode->vtotal, vrefresh);
return;
}
tc_cfg.vsync_count = vsync_hz / (mode->vtotal * mode->vrefresh);
tc_cfg.vsync_count = vsync_hz / (mode->vtotal * vrefresh);
/* enable external TE after kickoff to avoid premature autorefresh */
tc_cfg.hw_vsync_mode = 0;
@@ -1086,7 +1088,7 @@ static void sde_encoder_phys_cmd_tearcheck_config(
"tc %d intf %d vsync_clk_speed_hz %u vtotal %u vrefresh %u\n",
phys_enc->hw_pp->idx - PINGPONG_0,
phys_enc->hw_intf->idx - INTF_0,
vsync_hz, mode->vtotal, mode->vrefresh);
vsync_hz, mode->vtotal, vrefresh);
SDE_DEBUG_CMDENC(cmd_enc,
"tc %d intf %d enable %u start_pos %u rd_ptr_irq %u wr_ptr_irq %u\n",
phys_enc->hw_pp->idx - PINGPONG_0,

Fájl megtekintése

@@ -92,7 +92,7 @@ static void drm_mode_to_intf_timing_params(
timing->underflow_clr = 0xff;
timing->hsync_skew = mode->hskew;
timing->v_front_porch_fixed = vid_enc->base.vfp_cached;
timing->vrefresh = mode->vrefresh;
timing->vrefresh = drm_mode_vrefresh(mode);
if (vid_enc->base.comp_type != MSM_DISPLAY_COMPRESSION_NONE) {
timing->compression_en = true;
@@ -328,13 +328,11 @@ static void _sde_encoder_phys_vid_setup_avr(
struct sde_encoder_phys *phys_enc, u32 qsync_min_fps)
{
struct sde_encoder_phys_vid *vid_enc;
struct drm_display_mode mode;
vid_enc = to_sde_encoder_phys_vid(phys_enc);
mode = phys_enc->cached_mode;
if (vid_enc->base.hw_intf->ops.avr_setup) {
struct intf_avr_params avr_params = {0};
u32 default_fps = mode.vrefresh;
u32 default_fps = drm_mode_vrefresh(&phys_enc->cached_mode);
int ret;
if (!default_fps) {
@@ -473,7 +471,8 @@ static void sde_encoder_phys_vid_setup_timing_engine(
exit:
if (phys_enc->parent_ops.get_qsync_fps)
phys_enc->parent_ops.get_qsync_fps(
phys_enc->parent, &qsync_min_fps, mode.vrefresh);
phys_enc->parent, &qsync_min_fps,
drm_mode_vrefresh(&phys_enc->cached_mode));
/* only panels which support qsync will have a non-zero min fps */
if (qsync_min_fps) {

Fájl megtekintése

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/
#define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
@@ -84,7 +84,7 @@ static void sde_encoder_phys_wb_set_ot_limit(
ot_params.width = wb_enc->wb_roi.w;
ot_params.height = wb_enc->wb_roi.h;
ot_params.is_wfd = true;
ot_params.frame_rate = phys_enc->cached_mode.vrefresh;
ot_params.frame_rate = drm_mode_vrefresh(&phys_enc->cached_mode);
ot_params.vbif_idx = hw_wb->caps->vbif_idx;
ot_params.clk_ctrl = hw_wb->caps->clk_ctrl;
ot_params.rd = false;
@@ -164,7 +164,7 @@ static void sde_encoder_phys_wb_set_qos(struct sde_encoder_phys *phys_enc)
}
perf = &phys_enc->sde_kms->catalog->perf;
frame_rate = phys_enc->cached_mode.vrefresh;
frame_rate = drm_mode_vrefresh(&phys_enc->cached_mode);
hw_wb = wb_enc->hw_wb;
qos_count = perf->qos_refresh_count;

Fájl megtekintése

@@ -926,13 +926,13 @@ static void _sde_kms_drm_check_dpms(struct drm_atomic_state *old_state,
if (!crtc)
continue;
new_fps = crtc->state->mode.vrefresh;
new_fps = drm_mode_vrefresh(&crtc->state->mode);
new_mode = _sde_kms_get_blank(crtc->state, connector->state);
if (old_conn_state->crtc) {
old_crtc_state = drm_atomic_get_existing_crtc_state(
old_state, old_conn_state->crtc);
old_fps = old_crtc_state->mode.vrefresh;
old_fps = drm_mode_vrefresh(&old_crtc_state->mode);
old_mode = _sde_kms_get_blank(old_crtc_state,
old_conn_state);
} else {
@@ -3291,7 +3291,7 @@ static int sde_kms_get_mixer_count(const struct msm_kms *kms,
hdisplay_fp = drm_int2fixp(mode->hdisplay);
htotal_fp = drm_int2fixp(mode->htotal);
vtotal_fp = drm_int2fixp(mode->vtotal);
vrefresh_fp = drm_int2fixp(mode->vrefresh);
vrefresh_fp = drm_int2fixp(drm_mode_vrefresh(mode));
mdp_fudge_factor = drm_fixp_from_fraction(105, 100);
/* mode clock = [(h * v * fps * 1.05) / (num_lm)] */
@@ -3319,7 +3319,7 @@ static int sde_kms_get_mixer_count(const struct msm_kms *kms,
mode_clock_hz = lm_clk_fp;
}
SDE_DEBUG("[%s] h=%d v=%d fps=%d lm=%d mode_clk=%llu max_clk=%llu\n",
mode->name, mode->htotal, mode->vtotal, mode->vrefresh,
mode->name, mode->htotal, mode->vtotal, drm_mode_vrefresh(mode),
*num_lm, drm_fixp2int(mode_clock_hz),
sde_kms->perf.max_core_clk_rate);
return 0;
@@ -3327,7 +3327,7 @@ static int sde_kms_get_mixer_count(const struct msm_kms *kms,
error:
SDE_ERROR("required mode clk exceeds max mdp clk\n");
SDE_ERROR("[%s] h=%d v=%d fps=%d lm=%d mode_clk=%llu max_clk=%llu\n",
mode->name, mode->htotal, mode->vtotal, mode->vrefresh,
mode->name, mode->htotal, mode->vtotal, drm_mode_vrefresh(mode),
*num_lm, drm_fixp2int(mode_clock_hz),
sde_kms->perf.max_core_clk_rate);
return rc;

Fájl megtekintése

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014-2020 The Linux Foundation. All rights reserved.
* Copyright (C) 2014-2021 The Linux Foundation. All rights reserved.
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
*
@@ -279,7 +279,7 @@ void _sde_plane_set_qos_lut(struct drm_plane *plane,
return;
}
frame_rate = crtc->mode.vrefresh;
frame_rate = drm_mode_vrefresh(&crtc->mode);
perf = &psde->catalog->perf;
qos_count = perf->qos_refresh_count;
while ((fps_index < qos_count) && perf->qos_refresh_rate) {
@@ -470,7 +470,7 @@ static void _sde_plane_set_ot_limit(struct drm_plane *plane,
ot_params.width = psde->pipe_cfg.src_rect.w;
ot_params.height = psde->pipe_cfg.src_rect.h;
ot_params.is_wfd = !psde->is_rt_pipe;
ot_params.frame_rate = crtc->mode.vrefresh;
ot_params.frame_rate = drm_mode_vrefresh(&crtc->mode);
ot_params.vbif_idx = VBIF_RT;
ot_params.clk_ctrl = psde->pipe_hw->cap->clk_ctrl;
ot_params.rd = true;