Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ea81356 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: refactor mdp debug statistics"

parents 1a94bce9 e91432fd
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -2003,13 +2003,15 @@ static int mdp3_panel_register_done(struct mdss_panel_data *pdata)
	return rc;
}

static int mdp3_debug_dump_stats(void *data, char *buf, int len)
static int mdp3_debug_dump_stats_show(struct seq_file *s, void *v)
{
	int total = 0;
	total = scnprintf(buf, len, "underrun: %08u\n",
			mdp3_res->underrun_cnt);
	return total;
	struct mdp3_hw_resource *res = (struct mdp3_hw_resource *)s->private;

	seq_printf(s, "underrun: %08u\n", res->underrun_cnt);

	return 0;
}
DEFINE_MDSS_DEBUGFS_SEQ_FOPS(mdp3_debug_dump_stats);

static void mdp3_debug_enable_clock(int on)
{
@@ -2024,6 +2026,7 @@ static int mdp3_debug_init(struct platform_device *pdev)
{
	int rc;
	struct mdss_data_type *mdata;
	struct mdss_debug_data *mdd;

	mdata = devm_kzalloc(&pdev->dev, sizeof(*mdata), GFP_KERNEL);
	if (!mdata)
@@ -2031,13 +2034,19 @@ static int mdp3_debug_init(struct platform_device *pdev)

	mdss_res = mdata;

	mdata->debug_inf.debug_dump_stats = mdp3_debug_dump_stats;
	mdata->debug_inf.debug_enable_clock = mdp3_debug_enable_clock;

	rc = mdss_debugfs_init(mdata);
	if (rc)
		return rc;

	mdd = mdata->debug_inf.debug_data;
	if (!mdd)
		return -EINVAL;

	debugfs_create_file("stat", 0644, mdd->root, mdp3_res,
				&mdp3_debug_dump_stats_fops);

	rc = mdss_debug_register_base(NULL, mdp3_res->mdp_base ,
					mdp3_res->mdp_reg_size);

+0 −1
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ struct mdss_hw_settings {

struct mdss_debug_inf {
	void *debug_data;
	int (*debug_dump_stats)(void *data, char *buf, int len);
	void (*debug_enable_clock)(int on);
};

+0 −50
Original line number Diff line number Diff line
@@ -285,55 +285,6 @@ off_fail:
	return -ENODEV;
}


static int mdss_debug_stat_open(struct inode *inode, struct file *file)
{
	/* non-seekable */
	file->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
	file->private_data = inode->i_private;
	return 0;
}

static int mdss_debug_stat_release(struct inode *inode, struct file *file)
{
	return 0;
}

static ssize_t mdss_debug_stat_read(struct file *file, char __user *buff,
		size_t count, loff_t *ppos)
{
	struct mdss_data_type *mdata = file->private_data;
	int len, tot;
	char bp[512];

	if (*ppos)
		return 0;	/* the end */

	len = sizeof(bp);

	tot = scnprintf(bp, len, "\nmdp:\n");

	if (mdata->debug_inf.debug_dump_stats)
		tot += mdata->debug_inf.debug_dump_stats(mdata,
						bp + tot, len - tot);


	tot += scnprintf(bp + tot, len - tot, "\n");

	if (copy_to_user(buff, bp, tot))
		return -EFAULT;

	*ppos += tot;	/* increase offset */

	return tot;
}

static const struct file_operations mdss_stat_fops = {
	.open = mdss_debug_stat_open,
	.release = mdss_debug_stat_release,
	.read = mdss_debug_stat_read,
};

static ssize_t mdss_debug_factor_write(struct file *file,
		    const char __user *user_buf, size_t count, loff_t *ppos)
{
@@ -551,7 +502,6 @@ int mdss_debugfs_init(struct mdss_data_type *mdata)
		       PTR_ERR(mdd->root));
		goto err;
	}
	debugfs_create_file("stat", 0644, mdd->root, mdata, &mdss_stat_fops);

	mdd->perf = debugfs_create_dir("perf", mdd->root);
	if (IS_ERR_OR_NULL(mdd->perf)) {
+0 −56
Original line number Diff line number Diff line
@@ -1058,61 +1058,6 @@ int mdss_iommu_init(struct mdss_data_type *mdata)
	return 0;
}

static int mdss_debug_stat_ctl_dump(struct mdss_mdp_ctl *ctl,
		char *bp, int len)
{
	int total = 0;

	if (!ctl->ref_cnt)
		return 0;

	if (ctl->intf_num) {
		total = scnprintf(bp, len,
			"intf%d: play: %08u \tvsync: %08u \tunderrun: %08u\n",
				ctl->intf_num, ctl->play_cnt,
				ctl->vsync_cnt, ctl->underrun_cnt);
	} else {
		total = scnprintf(bp, len, "wb: \tmode=%x \tplay: %08u\n",
				ctl->opmode, ctl->play_cnt);
	}

	return total;
}

static int mdss_debug_dump_stats(void *data, char *buf, int len)
{
	struct mdss_data_type *mdata = data;
	struct mdss_mdp_pipe *pipe;
	int i, total = 0;

	for (i = 0; i < mdata->nctl; i++)
		total += mdss_debug_stat_ctl_dump(mdata->ctl_off + i,
			buf + total, len - total);

	total += scnprintf(buf + total, len - total, "\n");

	for (i = 0; i < mdata->nvig_pipes; i++) {
		pipe = mdata->vig_pipes + i;
		total += scnprintf(buf + total, len - total,
			"VIG%d :   %08u\t", i, pipe->play_cnt);
	}
	total += scnprintf(buf + total, len - total, "\n");

	for (i = 0; i < mdata->nrgb_pipes; i++) {
		pipe = mdata->rgb_pipes + i;
		total += scnprintf(buf + total, len - total,
			"RGB%d :   %08u\t", i, pipe->play_cnt);
	}
	total += scnprintf(buf + total, len - total, "\n");

	for (i = 0; i < mdata->ndma_pipes; i++) {
		pipe = mdata->dma_pipes + i;
		total += scnprintf(buf + total, len - total,
			"DMA%d :   %08u\t", i, pipe->play_cnt);
	}
	return total;
}

static void mdss_debug_enable_clock(int on)
{
	if (on)
@@ -1125,7 +1070,6 @@ static int mdss_mdp_debug_init(struct mdss_data_type *mdata)
{
	int rc;

	mdata->debug_inf.debug_dump_stats = mdss_debug_dump_stats;
	mdata->debug_inf.debug_enable_clock = mdss_debug_enable_clock;

	rc = mdss_debugfs_init(mdata);
+52 −0
Original line number Diff line number Diff line
@@ -183,6 +183,56 @@ static int mdss_debugfs_dump_show(struct seq_file *s, void *v)
}
DEFINE_MDSS_DEBUGFS_SEQ_FOPS(mdss_debugfs_dump);

static void __stats_ctl_dump(struct mdss_mdp_ctl *ctl, struct seq_file *s)
{
	if (!ctl->ref_cnt)
		return;

	if (ctl->intf_num) {
		seq_printf(s, "intf%d: play: %08u \t",
				ctl->intf_num, ctl->play_cnt);
		seq_printf(s, "vsync: %08u \tunderrun: %08u\n",
				ctl->vsync_cnt, ctl->underrun_cnt);
	} else {
		seq_printf(s, "wb: \tmode=%x \tplay: %08u\n",
				ctl->opmode, ctl->play_cnt);
	}
}

static int mdss_debugfs_stats_show(struct seq_file *s, void *v)
{
	struct mdss_data_type *mdata = (struct mdss_data_type *)s->private;
	struct mdss_mdp_pipe *pipe;
	int i;

	seq_puts(s, "\nmdp:\n");

	for (i = 0; i < mdata->nctl; i++)
		__stats_ctl_dump(mdata->ctl_off + i, s);
	seq_puts(s, "\n");

	for (i = 0; i < mdata->nvig_pipes; i++) {
		pipe = mdata->vig_pipes + i;
		seq_printf(s, "VIG%d :   %08u\t", i, pipe->play_cnt);
	}
	seq_puts(s, "\n");

	for (i = 0; i < mdata->nrgb_pipes; i++) {
		pipe = mdata->rgb_pipes + i;
		seq_printf(s, "RGB%d :   %08u\t", i, pipe->play_cnt);
	}
	seq_puts(s, "\n");

	for (i = 0; i < mdata->ndma_pipes; i++) {
		pipe = mdata->dma_pipes + i;
		seq_printf(s, "DMA%d :   %08u\t", i, pipe->play_cnt);
	}
	seq_puts(s, "\n");

	return 0;
}
DEFINE_MDSS_DEBUGFS_SEQ_FOPS(mdss_debugfs_stats);

int mdss_mdp_debugfs_init(struct mdss_data_type *mdata)
{
	struct mdss_debug_data *mdd;
@@ -196,6 +246,8 @@ int mdss_mdp_debugfs_init(struct mdss_data_type *mdata)

	debugfs_create_file("dump", 0644, mdd->root, mdata,
			&mdss_debugfs_dump_fops);
	debugfs_create_file("stat", 0644, mdd->root, mdata,
			&mdss_debugfs_stats_fops);

	return 0;
}