From: Cho KyongHo Date: Sat, 17 Mar 2018 12:37:50 +0000 (+0900) Subject: g2d: add debugfs node about states of tasks X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=863f22b3f2e8ac1295f88aaae33ae2134c0e5c76;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git g2d: add debugfs node about states of tasks When G2D driver is not able to allocate a free task, we are curious about the states of each task. debugs/g2d/tasks shows details of all tasks including flags, state flags, priority and the time of starting job and the time of the completion of the job. Change-Id: I617f98169daaaca851bfd7c0dc52245ab96c624d Signed-off-by: Cho KyongHo --- diff --git a/drivers/gpu/exynos/g2d/g2d.h b/drivers/gpu/exynos/g2d/g2d.h index a764b1dbb6ee..4e5ad05c05b4 100644 --- a/drivers/gpu/exynos/g2d/g2d.h +++ b/drivers/gpu/exynos/g2d/g2d.h @@ -109,6 +109,7 @@ struct g2d_device { struct dentry *debug; struct dentry *debug_logs; struct dentry *debug_contexts; + struct dentry *debug_tasks; atomic_t prior_stats[G2D_PRIORITY_END]; diff --git a/drivers/gpu/exynos/g2d/g2d_debug.c b/drivers/gpu/exynos/g2d/g2d_debug.c index 8dd3e46e3c02..9c6184f23870 100644 --- a/drivers/gpu/exynos/g2d/g2d_debug.c +++ b/drivers/gpu/exynos/g2d/g2d_debug.c @@ -184,6 +184,34 @@ static const struct file_operations g2d_debug_contexts_fops = { .release = single_release, }; +static int g2d_debug_tasks_show(struct seq_file *s, void *unused) +{ + struct g2d_device *g2d_dev = s->private; + struct g2d_task *task; + + for (task = g2d_dev->tasks; task; task = task->next) { + seq_printf(s, "TASK[%d]: state %#lx flags %#x ", + task->job_id, task->state, task->flags); + seq_printf(s, "prio %d begin@%llu end@%llu nr_src %d\n", + task->priority, ktime_to_us(task->ktime_begin), + ktime_to_us(task->ktime_end), task->num_source); + } + + return 0; +} + +static int g2d_debug_tasks_open(struct inode *inode, struct file *file) +{ + return single_open(file, g2d_debug_tasks_show, inode->i_private); +} + +static const struct file_operations g2d_debug_tasks_fops = { + .open = g2d_debug_tasks_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + void g2d_init_debug(struct g2d_device *g2d_dev) { atomic_set(&g2d_stamp_id, -1); @@ -216,6 +244,15 @@ void g2d_init_debug(struct g2d_device *g2d_dev) "debugfs : failed to create debug contexts file\n"); return; } + + g2d_dev->debug_tasks= debugfs_create_file("tasks", + 0400, g2d_dev->debug_root, g2d_dev, + &g2d_debug_tasks_fops); + if (!g2d_dev->debug_logs) { + dev_err(g2d_dev->dev, + "debugfs : failed to create debug contexts file\n"); + return; + } } void g2d_destroy_debug(struct g2d_device *g2d_dev)