فهرست منبع

disp: msm: sde: disable CWB in quad pipe

Disable CWB in quad pipe for quad LM CWB not supported
to avoid out of bound access.

Change-Id: I7e64cf132489401f91621ccde31cba68c8076d28
Signed-off-by: GG Hou <[email protected]>
GG Hou 2 سال پیش
والد
کامیت
8360bd82c9
1فایلهای تغییر یافته به همراه14 افزوده شده و 1 حذف شده
  1. 14 1
      msm/sde/sde_encoder_phys_wb.c

+ 14 - 1
msm/sde/sde_encoder_phys_wb.c

@@ -605,6 +605,13 @@ static void _sde_encoder_phys_wb_setup_cwb(struct sde_encoder_phys *phys_enc, bo
 		return;
 	}
 
+	if (crtc->num_mixers > MAX_CWB_PER_CTL_V1) {
+		SDE_ERROR("[enc:%d wb:%d] %d LM %d CWB case not supported\n",
+				DRMID(phys_enc->parent), WBID(wb_enc),
+				crtc->num_mixers, MAX_CWB_PER_CTL_V1);
+		return;
+	}
+
 	hw_ctl = crtc->mixers[0].hw_ctl;
 	if (hw_ctl && hw_ctl->ops.setup_intf_cfg_v1 &&
 			(test_bit(SDE_WB_CWB_CTRL, &hw_wb->caps->features) ||
@@ -914,7 +921,7 @@ static int _sde_enc_phys_wb_validate_cwb(struct sde_encoder_phys *phys_enc,
 	struct sde_rect wb_roi = {0,}, pu_roi = {0,};
 	u32  out_width = 0, out_height = 0;
 	const struct sde_format *fmt;
-	int prog_line, ret = 0;
+	int num_lm, prog_line, ret = 0;
 
 	fb = sde_wb_connector_state_get_output_fb(conn_state);
 	if (!fb) {
@@ -922,6 +929,12 @@ static int _sde_enc_phys_wb_validate_cwb(struct sde_encoder_phys *phys_enc,
 		return 0;
 	}
 
+	num_lm = sde_crtc_get_num_datapath(crtc_state->crtc, conn_state->connector, crtc_state);
+	if (num_lm > MAX_CWB_PER_CTL_V1) {
+		SDE_ERROR("%d LM %d CWB case not supported\n", num_lm, MAX_CWB_PER_CTL_V1);
+		return -EINVAL;
+	}
+
 	fmt = sde_get_sde_format_ext(fb->format->format, fb->modifier);
 	if (!fmt) {
 		SDE_ERROR("unsupported output pixel format:%x\n", fb->format->format);