Bladeren bron

Merge "disp: msm: sde: provide rm status through debugfs node"

qctecmdr 4 jaren geleden
bovenliggende
commit
10766ebd0f
3 gewijzigde bestanden met toevoegingen van 71 en 0 verwijderingen
  1. 1 0
      msm/sde/sde_kms.c
  2. 64 0
      msm/sde/sde_rm.c
  3. 6 0
      msm/sde/sde_rm.h

+ 1 - 0
msm/sde/sde_kms.c

@@ -156,6 +156,7 @@ static int _sde_debugfs_init(struct sde_kms *sde_kms)
 		SDE_ERROR("failed to init perf %d\n", rc);
 		return rc;
 	}
+	sde_rm_debugfs_init(&sde_kms->rm, debugfs_root);
 
 	if (sde_kms->catalog->qdss_count)
 		debugfs_create_u32("qdss", 0600, debugfs_root,

+ 64 - 0
msm/sde/sde_rm.c

@@ -101,6 +101,22 @@ static const struct sde_rm_topology_def g_top_table_v1[SDE_RM_TOPOLOGY_MAX] = {
 			MSM_DISPLAY_COMPRESSION_DSC },
 };
 
+char sde_hw_blk_str[SDE_HW_BLK_MAX][SDE_HW_BLK_NAME_LEN] = {
+	"top",
+	"sspp",
+	"lm",
+	"dspp",
+	"ds",
+	"ctl",
+	"cdm",
+	"pingpong",
+	"intf",
+	"wb",
+	"dsc",
+	"vdc",
+	"merge_3d",
+	"qdss",
+};
 
 /**
  * struct sde_rm_requirements - Reservation requirements parameter bundle
@@ -726,6 +742,54 @@ fail:
 	return rc;
 }
 
+#ifdef CONFIG_DEBUG_FS
+static int _sde_rm_status_show(struct seq_file *s, void *data)
+{
+	struct sde_rm *rm;
+	struct sde_rm_hw_blk *blk;
+	u32 type, allocated, unallocated;
+
+	if (!s || !s->private)
+		return -EINVAL;
+
+	rm = s->private;
+	for (type = SDE_HW_BLK_LM; type < SDE_HW_BLK_MAX; type++) {
+		allocated = 0;
+		unallocated = 0;
+		list_for_each_entry(blk, &rm->hw_blks[type], list) {
+			if (!blk->rsvp && !blk->rsvp_nxt)
+				unallocated++;
+			else
+				allocated++;
+		}
+		seq_printf(s, "type:%d blk:%s allocated:%d unallocated:%d\n",
+			type, sde_hw_blk_str[type], allocated, unallocated);
+	}
+
+	return 0;
+}
+
+static int _sde_rm_debugfs_status_open(struct inode *inode,
+		struct file *file)
+{
+	return single_open(file, _sde_rm_status_show, inode->i_private);
+}
+
+void sde_rm_debugfs_init(struct sde_rm *sde_rm, struct dentry *parent)
+{
+	static const struct file_operations debugfs_rm_status_fops = {
+		.open =		_sde_rm_debugfs_status_open,
+		.read =		seq_read,
+	};
+
+	debugfs_create_file("rm_status", 0400, parent, sde_rm, &debugfs_rm_status_fops);
+}
+#else
+void sde_rm_debugfs_init(struct sde_rm *rm, struct dentry *parent)
+{
+}
+#endif
+
 int sde_rm_init(struct sde_rm *rm,
 		struct sde_mdss_cfg *cat,
 		void __iomem *mmio,

+ 6 - 0
msm/sde/sde_rm.h

@@ -215,6 +215,12 @@ struct sde_rm_hw_request {
 enum sde_rm_topology_name sde_rm_get_topology_name(struct sde_rm *rm,
 		struct msm_display_topology topology);
 
+/**
+ * sde_rm_debugfs_init - setup debugfs node for rm module
+ * @rm: SDE resource manager handle
+ * @parent: debugfs parent directory node
+ */
+void sde_rm_debugfs_init(struct sde_rm *rm, struct dentry *parent);
 
 /**
  * sde_rm_init - Read hardware catalog and create reservation tracking objects