From: Lyude Paul <lyude@xxxxxxxxxx> Like igt_debugfs_connector_dir(), but for pipes instead. Changes since v4: * Make igt_debugfs_pipe_dir() much smaller - jcline * Fixup docs - jcline Signed-off-by: Lyude Paul <lyude@xxxxxxxxxx> --- lib/igt_debugfs.c | 21 +++++++++++++++++++++ lib/igt_debugfs.h | 1 + 2 files changed, 22 insertions(+) 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 @@ -260,6 +260,27 @@ int igt_debugfs_connector_dir(int device, char *conn_name, int mode) return ret; } +/** + * 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 diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h index 722c5cc3..d43ba6c6 100644 --- a/lib/igt_debugfs.h +++ b/lib/igt_debugfs.h @@ -36,6 +36,7 @@ char *igt_debugfs_path(int device, char *path, int pathlen); int igt_debugfs_dir(int device); int igt_debugfs_connector_dir(int device, char *conn_name, int mode); +int igt_debugfs_pipe_dir(int device, int pipe, int mode); int igt_debugfs_open(int fd, const char *filename, int mode); void __igt_debugfs_read(int fd, const char *filename, char *buf, int size); -- 2.26.2 _______________________________________________ Nouveau mailing list Nouveau@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/nouveau