Skip to content

Commit 7731cb6

Browse files
committed
Merge tag 'drm-msm-fixes-2023-10-07' of https://gitlab.freedesktop.org/drm/msm into drm-fixes
Fixes for v6.6-rc5 - fix to not reset the PHY everytime we start link training but only do it if link training fails. Without this, the PLL unlocked interrupt fires causing "Unexpected DP AUX IRQ 0x01000000 when not busy" spam in the logs since last 2-3 cycles - correct the highest bank bit to match downstream device tree for msm8998 - skip the video mode wait if the timing engine is not enabled. This was introduced after pre_enable flag for DSI video mode panels where we would end up waiting for the video mode done interrupt even before enabling timing engine causing error spam and long bootup times. - check the correct return code of irq_of_parse_and_map() in DSI code - avoid overflow issues in the dpu bandwidth calculation . This was exposed for high resolution displays and a critical fix to avoid atomic_check failure - minor fix to add new lines in DP print messages. - Fix to fail atomic_check() if the resolution exceeds max mdp clk. This leads to underflow otherwise if we try to allow that frame. Signed-off-by: Dave Airlie <[email protected]> From: Rob Clark <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGv-HNxQ=VBtZ8geGzYJum9jtManEdbvhcjo_WWF_J9Ziw@mail.gmail.com
2 parents dcad98b + 10f2062 commit 7731cb6

File tree

5 files changed

+42
-23
lines changed

5 files changed

+42
-23
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ static u64 _dpu_plane_calc_bw(const struct dpu_mdss_cfg *catalog,
119119
struct dpu_sw_pipe_cfg *pipe_cfg)
120120
{
121121
int src_width, src_height, dst_height, fps;
122+
u64 plane_pixel_rate, plane_bit_rate;
122123
u64 plane_prefill_bw;
123124
u64 plane_bw;
124125
u32 hw_latency_lines;
@@ -136,13 +137,12 @@ static u64 _dpu_plane_calc_bw(const struct dpu_mdss_cfg *catalog,
136137
scale_factor = src_height > dst_height ?
137138
mult_frac(src_height, 1, dst_height) : 1;
138139

139-
plane_bw =
140-
src_width * mode->vtotal * fps * fmt->bpp *
141-
scale_factor;
140+
plane_pixel_rate = src_width * mode->vtotal * fps;
141+
plane_bit_rate = plane_pixel_rate * fmt->bpp;
142142

143-
plane_prefill_bw =
144-
src_width * hw_latency_lines * fps * fmt->bpp *
145-
scale_factor * mode->vtotal;
143+
plane_bw = plane_bit_rate * scale_factor;
144+
145+
plane_prefill_bw = plane_bw * hw_latency_lines;
146146

147147
if ((vbp+vpw) > hw_latency_lines)
148148
do_div(plane_prefill_bw, (vbp+vpw));
@@ -733,9 +733,11 @@ static int dpu_plane_check_inline_rotation(struct dpu_plane *pdpu,
733733
static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
734734
struct dpu_sw_pipe *pipe,
735735
struct dpu_sw_pipe_cfg *pipe_cfg,
736-
const struct dpu_format *fmt)
736+
const struct dpu_format *fmt,
737+
const struct drm_display_mode *mode)
737738
{
738739
uint32_t min_src_size;
740+
struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
739741

740742
min_src_size = DPU_FORMAT_IS_YUV(fmt) ? 2 : 1;
741743

@@ -774,6 +776,12 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
774776
return -EINVAL;
775777
}
776778

779+
/* max clk check */
780+
if (_dpu_plane_calc_clk(mode, pipe_cfg) > kms->perf.max_core_clk_rate) {
781+
DPU_DEBUG_PLANE(pdpu, "plane exceeds max mdp core clk limits\n");
782+
return -E2BIG;
783+
}
784+
777785
return 0;
778786
}
779787

@@ -899,12 +907,13 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
899907
r_pipe_cfg->dst_rect.x1 = pipe_cfg->dst_rect.x2;
900908
}
901909

902-
ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt);
910+
ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt, &crtc_state->adjusted_mode);
903911
if (ret)
904912
return ret;
905913

906914
if (r_pipe->sspp) {
907-
ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, fmt);
915+
ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, fmt,
916+
&crtc_state->adjusted_mode);
908917
if (ret)
909918
return ret;
910919
}

drivers/gpu/drm/msm/dp/dp_ctrl.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,13 +1774,6 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
17741774
return rc;
17751775

17761776
while (--link_train_max_retries) {
1777-
rc = dp_ctrl_reinitialize_mainlink(ctrl);
1778-
if (rc) {
1779-
DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n",
1780-
rc);
1781-
break;
1782-
}
1783-
17841777
training_step = DP_TRAINING_NONE;
17851778
rc = dp_ctrl_setup_main_link(ctrl, &training_step);
17861779
if (rc == 0) {
@@ -1832,6 +1825,12 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
18321825
/* stop link training before start re training */
18331826
dp_ctrl_clear_training_pattern(ctrl);
18341827
}
1828+
1829+
rc = dp_ctrl_reinitialize_mainlink(ctrl);
1830+
if (rc) {
1831+
DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n", rc);
1832+
break;
1833+
}
18351834
}
18361835

18371836
if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN)

drivers/gpu/drm/msm/dp/dp_link.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ int dp_link_process_request(struct dp_link *dp_link)
10901090
} else if (dp_link_read_psr_error_status(link)) {
10911091
DRM_ERROR("PSR IRQ_HPD received\n");
10921092
} else if (dp_link_psr_capability_changed(link)) {
1093-
drm_dbg_dp(link->drm_dev, "PSR Capability changed");
1093+
drm_dbg_dp(link->drm_dev, "PSR Capability changed\n");
10941094
} else {
10951095
ret = dp_link_process_link_status_update(link);
10961096
if (!ret) {
@@ -1107,7 +1107,7 @@ int dp_link_process_request(struct dp_link *dp_link)
11071107
}
11081108
}
11091109

1110-
drm_dbg_dp(link->drm_dev, "sink request=%#x",
1110+
drm_dbg_dp(link->drm_dev, "sink request=%#x\n",
11111111
dp_link->sink_request);
11121112
return ret;
11131113
}

drivers/gpu/drm/msm/dsi/dsi_host.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,9 +1082,21 @@ static void dsi_wait4video_done(struct msm_dsi_host *msm_host)
10821082

10831083
static void dsi_wait4video_eng_busy(struct msm_dsi_host *msm_host)
10841084
{
1085+
u32 data;
1086+
10851087
if (!(msm_host->mode_flags & MIPI_DSI_MODE_VIDEO))
10861088
return;
10871089

1090+
data = dsi_read(msm_host, REG_DSI_STATUS0);
1091+
1092+
/* if video mode engine is not busy, its because
1093+
* either timing engine was not turned on or the
1094+
* DSI controller has finished transmitting the video
1095+
* data already, so no need to wait in those cases
1096+
*/
1097+
if (!(data & DSI_STATUS0_VIDEO_MODE_ENGINE_BUSY))
1098+
return;
1099+
10881100
if (msm_host->power_on && msm_host->enabled) {
10891101
dsi_wait4video_done(msm_host);
10901102
/* delay 4 ms to skip BLLP */
@@ -1894,10 +1906,9 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)
18941906
}
18951907

18961908
msm_host->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
1897-
if (msm_host->irq < 0) {
1898-
ret = msm_host->irq;
1899-
dev_err(&pdev->dev, "failed to get irq: %d\n", ret);
1900-
return ret;
1909+
if (!msm_host->irq) {
1910+
dev_err(&pdev->dev, "failed to get irq\n");
1911+
return -EINVAL;
19011912
}
19021913

19031914
/* do not autoenable, will be enabled later */

drivers/gpu/drm/msm/msm_mdss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static int mdss_remove(struct platform_device *pdev)
511511
static const struct msm_mdss_data msm8998_data = {
512512
.ubwc_enc_version = UBWC_1_0,
513513
.ubwc_dec_version = UBWC_1_0,
514-
.highest_bank_bit = 1,
514+
.highest_bank_bit = 2,
515515
};
516516

517517
static const struct msm_mdss_data qcm2290_data = {

0 commit comments

Comments
 (0)