소스 검색

disp: msm: sde: allocate dsc block based on capability

Certain DSC hw blocks only support 444 mode, while others
support both 444 and 422 modes. This change adds support in
resource manager to check the hw resource requirement with
the capability of the block and then reserve the correct
hw resource.

Change-Id: If85beb2f2f25e9eb7f8a8321c94b57878d048369
Signed-off-by: Abhijit Kulkarni <[email protected]>
Abhijit Kulkarni 6 년 전
부모
커밋
e2726c7b1a
3개의 변경된 파일36개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 0
      msm/sde/sde_encoder.c
  2. 2 0
      msm/sde/sde_encoder.h
  3. 33 5
      msm/sde/sde_rm.c

+ 1 - 0
msm/sde/sde_encoder.c

@@ -480,6 +480,7 @@ void sde_encoder_get_hw_resources(struct drm_encoder *drm_enc,
 	 */
 	sde_connector_state_get_mode_info(conn_state, &mode_info);
 	hw_res->topology = mode_info.topology;
+	hw_res->comp_info = &sde_enc->mode_info.comp_info;
 	hw_res->display_type = sde_enc->disp_info.display_type;
 }
 

+ 2 - 0
msm/sde/sde_encoder.h

@@ -58,6 +58,7 @@
  *                          interface
  * @display_type: Type of the display
  * @topology:   Topology of the display
+ * @comp_info: Compression parameters information
  */
 struct sde_encoder_hw_resources {
 	enum sde_intf_mode intfs[INTF_MAX];
@@ -66,6 +67,7 @@ struct sde_encoder_hw_resources {
 	u32 display_num_of_h_tiles;
 	enum sde_connector_display display_type;
 	struct msm_display_topology topology;
+	struct msm_compression_info *comp_info;
 };
 
 /**

+ 33 - 5
msm/sde/sde_rm.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
  */
 
 #define pr_fmt(fmt)	"[drm:%s] " fmt, __func__
@@ -1236,6 +1236,7 @@ static bool _sde_rm_check_dsc(struct sde_rm *rm,
 static int _sde_rm_reserve_dsc(
 		struct sde_rm *rm,
 		struct sde_rm_rsvp *rsvp,
+		struct msm_display_dsc_info *dsc_info,
 		const struct sde_rm_topology_def *top,
 		u8 *_dsc_ids)
 {
@@ -1245,20 +1246,40 @@ static int _sde_rm_reserve_dsc(
 	int num_dsc_enc = top->num_comp_enc;
 	int i;
 
-	if (!top->num_comp_enc)
+	if ((!top->num_comp_enc) || !dsc_info) {
+		SDE_DEBUG("invalid topoplogy params: %d, %d\n",
+				top->num_comp_enc,
+				!(dsc_info == NULL));
 		return 0;
+	}
 
 	sde_rm_init_hw_iter(&iter_i, 0, SDE_HW_BLK_DSC);
 
 	/* Find a first DSC */
 	while (alloc_count != num_dsc_enc &&
 			_sde_rm_get_hw_locked(rm, &iter_i)) {
+		const struct sde_hw_dsc *hw_dsc = to_sde_hw_dsc(
+				iter_i.blk->hw);
+		unsigned long features = hw_dsc->caps->features;
+		bool has_422_420_support =
+			BIT(SDE_DSC_NATIVE_422_EN) & features;
+
+		SDE_DEBUG("blk id = %d, is_422_420_req:%d ,is_supported:%d\n",
+				iter_i.blk->id,
+				(dsc_info->config.native_422 ||
+				dsc_info->config.native_420),
+				has_422_420_support);
 		memset(&dsc, 0, sizeof(dsc));
 		alloc_count = 0;
 
 		if (_dsc_ids && (iter_i.blk->id != _dsc_ids[alloc_count]))
 			continue;
 
+		/* if this hw block does not support required feature */
+		if ((dsc_info->config.native_422 ||
+			dsc_info->config.native_420) && !has_422_420_support)
+			continue;
+
 		if (!_sde_rm_check_dsc(rm, rsvp, iter_i.blk, NULL))
 			continue;
 
@@ -1540,20 +1561,27 @@ static int _sde_rm_make_dsc_rsvp(struct sde_rm *rm, struct sde_rm_rsvp *rsvp,
 		struct sde_rm_requirements *reqs,
 		struct sde_splash_display *splash_display)
 {
-	int ret, i;
+	int i;
 	u8 *hw_ids = NULL;
 
 	/* Check if splash data provided dsc_ids */
 	if (splash_display) {
 		hw_ids = splash_display->dsc_ids;
+		if (splash_display->dsc_cnt)
+			reqs->hw_res.comp_info->comp_type =
+				MSM_DISPLAY_COMPRESSION_DSC;
 		for (i = 0; i < splash_display->dsc_cnt; i++)
 			SDE_DEBUG("splash_data.dsc_ids[%d] = %d\n",
 				i, splash_display->dsc_ids[i]);
 	}
 
-	ret = _sde_rm_reserve_dsc(rm, rsvp, reqs->topology, hw_ids);
+	if ( reqs->hw_res.comp_info->comp_type ==
+			MSM_DISPLAY_COMPRESSION_DSC)
+		return  _sde_rm_reserve_dsc(rm, rsvp,
+				&reqs->hw_res.comp_info->dsc_info,
+				reqs->topology, hw_ids);
 
-	return ret;
+	return 0;
 }
 
 static int _sde_rm_make_next_rsvp(struct sde_rm *rm, struct drm_encoder *enc,