浏览代码

disp: msm: sde: correct llcc_slice_getd/putd usage

The llcc_slice_getd/putd APIs were previously used to get/put the
slice descriptor reference, for every time the driver needed the
descriptor. However, the APIs should be used to get the reference
once, and only put after completing usage of the slice
(ie. if the slice is still active, the descriptor cannot be putd).

This change corrects the usage of the llcc_slice_getd/putd APIs by
storing the descriptor after initialization.

Change-Id: I33e6448290ff7a4d8bfa72e1e6bc8ca133283e12
Signed-off-by: Nilaan Gunabalachandran <[email protected]>
Nilaan Gunabalachandran 2 年之前
父节点
当前提交
825dd16313
共有 3 个文件被更改,包括 8 次插入11 次删除
  1. 1 10
      msm/sde/sde_core_perf.c
  2. 5 1
      msm/sde/sde_hw_catalog.c
  3. 2 0
      msm/sde/sde_hw_catalog.h

+ 1 - 10
msm/sde/sde_core_perf.c

@@ -323,7 +323,6 @@ void sde_core_perf_llcc_stale_configure(struct sde_mdss_cfg *sde_cfg, struct llc
 
 void sde_core_perf_llcc_stale_frame(struct drm_crtc *crtc, enum sde_sys_cache_type type)
 {
-	struct llcc_slice_desc *slice;
 	struct sde_kms *kms;
 
 	if (!crtc) {
@@ -341,15 +340,7 @@ void sde_core_perf_llcc_stale_frame(struct drm_crtc *crtc, enum sde_sys_cache_ty
 			!kms->perf.llcc_active[type])
 		return;
 
-	slice =  llcc_slice_getd(kms->catalog->sc_cfg[type].llcc_uid);
-	if (IS_ERR_OR_NULL(slice)) {
-		SDE_DEBUG("failed to get system cache for scid:%u", type);
-		return;
-	}
-
-	llcc_notif_staling_inc_counter(slice);
-
-	llcc_slice_putd(slice);
+	llcc_notif_staling_inc_counter(kms->catalog->sc_cfg[type].slice);
 }
 #else
 void sde_core_perf_llcc_stale_configure(struct sde_mdss_cfg *sde_cfg, struct llcc_slice_desc *slice)

+ 5 - 1
msm/sde/sde_hw_catalog.c

@@ -3688,13 +3688,13 @@ static int sde_cache_parse_dt(struct device_node *np,
 		}
 
 		sc_cfg->llcc_uid = usecase_id;
+		sc_cfg->slice = slice;
 		sc_cfg->llcc_scid = llcc_get_slice_id(slice);
 		sc_cfg->llcc_slice_size = llcc_get_slice_size(slice);
 		sde_core_perf_llcc_stale_configure(sde_cfg, slice);
 
 		SDE_DEBUG("img cache:%d usecase_id:%d, scid:%d slice_size:%zu kb\n",
 				i, usecase_id, sc_cfg->llcc_scid, sc_cfg->llcc_slice_size);
-		llcc_slice_putd(slice);
 	}
 
 	return 0;
@@ -5592,6 +5592,10 @@ void sde_hw_catalog_deinit(struct sde_mdss_cfg *sde_cfg)
 			kfree(sde_cfg->vbif[i].qos_tbl[j].priority_lvl);
 	}
 
+	for (i = 0; i < SDE_SYS_CACHE_MAX; i++)
+		if (sde_cfg->sc_cfg[i].slice)
+			llcc_slice_putd(sde_cfg->sc_cfg[i].slice);
+
 	kfree(sde_cfg->perf.qos_refresh_rate);
 	kfree(sde_cfg->perf.danger_lut);
 	kfree(sde_cfg->perf.safe_lut);

+ 2 - 0
msm/sde/sde_hw_catalog.h

@@ -1764,11 +1764,13 @@ struct sde_perf_cdp_cfg {
 
 /**
  * struct sde_sc_cfg - define system cache configuration
+ * @slice:     llcc slice descriptor
  * @llcc_uuid: llcc use case id for the system cache
  * @llcc_scid: scid for the system cache
  * @llcc_slice_size: slice size of the system cache
  */
 struct sde_sc_cfg {
+	struct llcc_slice_desc *slice;
 	int llcc_uid;
 	int llcc_scid;
 	size_t llcc_slice_size;