g2d: add debugfs node about states of tasks
authorCho KyongHo <pullip.cho@samsung.com>
Sat, 17 Mar 2018 12:37:50 +0000 (21:37 +0900)
committerSeungchul Kim <sc377.kim@samsung.com>
Mon, 28 May 2018 05:28:09 +0000 (14:28 +0900)
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 <pullip.cho@samsung.com>
drivers/gpu/exynos/g2d/g2d.h
drivers/gpu/exynos/g2d/g2d_debug.c

index a764b1dbb6ee40f650aeff57fca02987f0296aee..4e5ad05c05b4b552f746f8aa59abbd3840c12c0a 100644 (file)
@@ -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];
 
index 8dd3e46e3c0202fd5690f0f44d355f5e08df3e28..9c6184f2387083d6ecec91e8c437bbe6439ae3c4 100644 (file)
@@ -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)