Эх сурвалжийг харах

disp: msm: sde: Add roi region for spr

Provide spr_roi region for spr over fetch in partial update.
Support different the roi size of connector and crtc.

Change-Id: Ic78a20badcafefd353a97532281dae26e5a772de
Signed-off-by: Qing Huang <[email protected]>
Qing Huang 2 жил өмнө
parent
commit
afeb7da4d7

+ 7 - 0
include/uapi/display/drm/sde_drm.h

@@ -519,15 +519,22 @@ struct sde_drm_wb_cfg {
 };
 
 #define SDE_MAX_ROI_V1	4
+#define SDE_DRM_SPR_ROI	1
+/* DRM_ROI_CONFIG_FLAGS */
+#define SDE_DRM_ROI_SPR_FLAG_EN	(1 << 0)
 
 /**
  * struct sde_drm_roi_v1 - list of regions of interest for a drm object
  * @num_rects: number of valid rectangles in the roi array
  * @roi: list of roi rectangles
+ * @roi_feature_flags: flags indicates that specific roi rect is valid or not
+ * @spr_roi: list of roi rectangles for spr
  */
 struct sde_drm_roi_v1 {
 	__u32 num_rects;
 	struct drm_clip_rect roi[SDE_MAX_ROI_V1];
+	__u32 roi_feature_flags;
+	struct drm_clip_rect spr_roi[SDE_MAX_ROI_V1];
 };
 
 /**

+ 4 - 0
msm/msm_drv.h

@@ -961,10 +961,14 @@ struct msm_display_info {
  * struct msm_roi_list - list of regions of interest for a drm object
  * @num_rects: number of valid rectangles in the roi array
  * @roi: list of roi rectangles
+ * @roi_feature_flags: flags indicates that specific roi rect is valid or not
+ * @spr_roi: list of roi rectangles for spr
  */
 struct msm_roi_list {
 	uint32_t num_rects;
 	struct drm_clip_rect roi[MSM_MAX_ROI];
+	uint32_t roi_feature_flags;
+	struct drm_clip_rect spr_roi[MSM_MAX_ROI];
 };
 
 /**

+ 2 - 2
msm/sde/sde_color_processing.c

@@ -957,9 +957,9 @@ static int _check_spr_pu_feature(struct sde_hw_dspp *hw_dspp,
 		return -EINVAL;
 	}
 
-	if ((roi_list->roi[0].x2 - roi_list->roi[0].x1) != hw_cfg->displayh) {
+	if ((roi_list->spr_roi[0].x2 - roi_list->spr_roi[0].x1) != hw_cfg->displayh) {
 		SDE_ERROR("pu region not full width %d\n",
-				(roi_list->roi[0].x2 - roi_list->roi[0].x1));
+				(roi_list->spr_roi[0].x2 - roi_list->spr_roi[0].x1));
 		return -EINVAL;
 	}
 

+ 28 - 6
msm/sde/sde_crtc.c

@@ -977,9 +977,18 @@ static int _sde_crtc_set_roi_v1(struct drm_crtc_state *state,
 		return -EINVAL;
 	}
 
+	cstate->user_roi_list.roi_feature_flags = roi_v1.roi_feature_flags;
 	cstate->user_roi_list.num_rects = roi_v1.num_rects;
 	for (i = 0; i < roi_v1.num_rects; ++i) {
 		cstate->user_roi_list.roi[i] = roi_v1.roi[i];
+		if (cstate->user_roi_list.roi_feature_flags & SDE_DRM_ROI_SPR_FLAG_EN)
+			cstate->user_roi_list.spr_roi[i] = roi_v1.spr_roi[i];
+		else
+			/*
+			 * backward compatible, spr_roi has the same value with roi,
+			 * it will have the same behavior with before.
+			 */
+			cstate->user_roi_list.spr_roi[i] = roi_v1.roi[i];
 		SDE_DEBUG("crtc%d: roi%d: roi (%d,%d) (%d,%d)\n",
 				DRMID(crtc), i,
 				cstate->user_roi_list.roi[i].x1,
@@ -991,6 +1000,17 @@ static int _sde_crtc_set_roi_v1(struct drm_crtc_state *state,
 				cstate->user_roi_list.roi[i].y1,
 				cstate->user_roi_list.roi[i].x2,
 				cstate->user_roi_list.roi[i].y2);
+		SDE_DEBUG("crtc%d, roi_feature_flags %d: spr roi%d: spr roi (%d,%d) (%d,%d)\n",
+				DRMID(crtc), roi_v1.roi_feature_flags, i,
+				roi_v1.spr_roi[i].x1,
+				roi_v1.spr_roi[i].y1,
+				roi_v1.spr_roi[i].x2,
+				roi_v1.spr_roi[i].y2);
+		SDE_EVT32_VERBOSE(DRMID(crtc), roi_v1.roi_feature_flags,
+				roi_v1.spr_roi[i].x1,
+				roi_v1.spr_roi[i].y1,
+				roi_v1.spr_roi[i].x2,
+				roi_v1.spr_roi[i].y2);
 	}
 
 	return 0;
@@ -1055,13 +1075,15 @@ static int _sde_crtc_set_crtc_roi(struct drm_crtc *crtc,
 			continue;
 
 		/*
-		 * current driver only supports same connector and crtc size,
-		 * but if support for different sizes is added, driver needs
-		 * to check the connector roi here to make sure is full screen
-		 * for dsc 3d-mux topology that doesn't support partial update.
+		 * When enable spr 2D filter in PU, it require over fetch lines.
+		 * In this case, the roi size of connector and crtc are different.
+		 * But the spr_roi is the original roi with over fetch lines,
+		 * that should same with connector size.
 		 */
-		if (memcmp(&sde_conn_state->rois, &crtc_state->user_roi_list,
-				sizeof(crtc_state->user_roi_list))) {
+		if (memcmp(&sde_conn_state->rois.roi, &crtc_state->user_roi_list.spr_roi,
+				sizeof(crtc_state->user_roi_list.spr_roi)) &&
+				(sde_conn_state->rois.num_rects !=
+				crtc_state->user_roi_list.num_rects)) {
 			SDE_ERROR("%s: crtc -> conn roi scaling unsupported\n",
 					sde_crtc->name);
 			return -EINVAL;

+ 6 - 6
msm/sde/sde_hw_reg_dma_v1_color_proc.c

@@ -5902,14 +5902,14 @@ int reg_dmav1_setup_spr_pu_common(struct sde_hw_dspp *ctx, struct sde_hw_cp_cfg
 			return -EINVAL;
 		}
 
-		if ((roi_list->roi[0].x2 - roi_list->roi[0].x1) != hw_cfg->displayh) {
+		if ((roi_list->spr_roi[0].x2 - roi_list->spr_roi[0].x1) != hw_cfg->displayh) {
 			DRM_ERROR("pu region not full width %d\n",
-					(roi_list->roi[0].x2 - roi_list->roi[0].x1));
+					(roi_list->spr_roi[0].x2 - roi_list->spr_roi[0].x1));
 			return -EINVAL;
 		}
 
-		reg = APPLY_MASK_AND_SHIFT(roi_list->roi[0].x1, 16, 0) |
-			APPLY_MASK_AND_SHIFT(roi_list->roi[0].y1, 16, 16);
+		reg = APPLY_MASK_AND_SHIFT(roi_list->spr_roi[0].x1, 16, 0) |
+			APPLY_MASK_AND_SHIFT(roi_list->spr_roi[0].y1, 16, 16);
 	}
 
 	REG_DMA_INIT_OPS(dma_write_cfg, MDSS, SPR_PU_CFG, buffer);
@@ -6007,10 +6007,10 @@ void reg_dmav1_setup_spr_pu_cfgv2(struct sde_hw_dspp *ctx, void *cfg)
 		uint32_t reg = ctx->spr_cfg_18_default;
 
 		//No ROI list means full screen update so apply without modification
-		if (roi_list && roi_list->roi[0].y1 != 0)
+		if (roi_list && roi_list->spr_roi[0].y1 != 0)
 			reg &= 0xFFFFFFFC;
 
-		if (roi_list && roi_list->roi[0].y2 != hw_cfg->displayv)
+		if (roi_list && roi_list->spr_roi[0].y2 != hw_cfg->displayv)
 			reg &= 0xFFFFFFCF;
 
 		base_off = ctx->hw.blk_off + ctx->cap->sblk->spr.base;