summaryrefslogtreecommitdiff
path: root/lib/igt_debugfs.c
diff options
context:
space:
mode:
authorLyude Paul <lyude@redhat.com>2020-09-30 13:31:48 -0400
committerLyude Paul <lyude@redhat.com>2020-09-30 15:02:33 -0400
commit30032a72d441651b36cf73b751fed9b2e3165e8f (patch)
treea39bbc58251864a771923b78fe1916244133e27c /lib/igt_debugfs.c
parentc6dd50bf193864120bb13cdd8830c4f6cf7f9818 (diff)
lib/igt_debugfs: Add igt_debugfs_pipe_dir()
Like igt_debugfs_connector_dir(), but for pipes instead. Changes since v4: * Make igt_debugfs_pipe_dir() much smaller - jcline * Fixup docs - jcline Reviewed-by: Jeremy Cline <jcline@redhat.com> Signed-off-by: Lyude Paul <lyude@redhat.com>
Diffstat (limited to 'lib/igt_debugfs.c')
-rw-r--r--lib/igt_debugfs.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 05067078..c4dab392 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -261,6 +261,27 @@ int igt_debugfs_connector_dir(int device, char *conn_name, int mode)
}
/**
+ * igt_debugfs_pipe_dir:
+ * @device: fd of the device
+ * @pipe: index of pipe
+ * @mode: mode bits as used by open()
+ *
+ * This opens the debugfs directory corresponding to the pipe index on the
+ * device for use with igt_sysfs_get() and related functions. This is just
+ * syntax sugar for igt_debugfs_open().
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_debugfs_pipe_dir(int device, int pipe, int mode)
+{
+ char buf[128];
+
+ snprintf(buf, sizeof(buf), "crtc-%d", pipe);
+ return igt_debugfs_open(device, buf, mode);
+}
+
+/**
* igt_debugfs_open:
* @filename: name of the debugfs node to open
* @mode: mode bits as used by open()