[PATCH i-g-t 7/8] lib/igt_debugfs: rename igt_debugfs_pipe_dir() to igt_debugfs_crtc_dir()

Jani Nikula
2026-01-27T11:56:46Z

Rename the function to reflect what it does. It opens the debugfs
directory based on the CRTC index, not the pipe.

There's no functional change here. If there's code that passes the
hardware pipe to igt_debugfs_crtc_dir(), it needs to be fixed.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
lib/i915/intel_drrs.c | 6 +++---
lib/i915/intel_fbc.c | 4 ++--
lib/igt_debugfs.c | 10 +++++-----
lib/igt_debugfs.h | 4 +---
lib/igt_kms.c | 4 ++--
tests/intel/kms_frontbuffer_tracking.c | 2 +-
tests/nouveau_crc.c | 2 +-
7 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/lib/i915/intel_drrs.c b/lib/i915/intel_drrs.c
index ac8dd5e61d21..5257a6a6a7ca 100644
--- a/lib/i915/intel_drrs.c
+++ b/lib/i915/intel_drrs.c
@@ -25,7 +25,7 @@ bool intel_is_drrs_supported(int device, enum pipe pipe)
char buf[256];
int dir;

- dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+ dir = igt_debugfs_crtc_dir(device, pipe, O_DIRECTORY);
igt_require_fd(dir);
igt_debugfs_simple_read(dir, "i915_drrs_status", buf, sizeof(buf));
close(dir);
@@ -64,7 +64,7 @@ static void drrs_set(int device, enum pipe pipe, unsigned int val)
igt_debug("Manually %sabling DRRS. %u\n", val ? "en" : "dis", val);
snprintf(buf, sizeof(buf), "%d", val);

- dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+ dir = igt_debugfs_crtc_dir(device, pipe, O_DIRECTORY);
igt_require_fd(dir);
ret = igt_sysfs_write(dir, "i915_drrs_ctl", buf, sizeof(buf) - 1);
close(dir);
@@ -123,7 +123,7 @@ bool intel_is_drrs_inactive(int device, enum pipe pipe)
char buf[256];
int dir;

- dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+ dir = igt_debugfs_crtc_dir(device, pipe, O_DIRECTORY);
igt_require_fd(dir);
igt_debugfs_simple_read(dir, "i915_drrs_status", buf, sizeof(buf));
close(dir);
diff --git a/lib/i915/intel_fbc.c b/lib/i915/intel_fbc.c
index a1a6de90e3f3..84c66929dabc 100644
--- a/lib/i915/intel_fbc.c
+++ b/lib/i915/intel_fbc.c
@@ -28,7 +28,7 @@ bool intel_fbc_supported_on_chipset(int device, enum pipe pipe)
char buf[FBC_STATUS_BUF_LEN];
int dir;

- dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+ dir = igt_debugfs_crtc_dir(device, pipe, O_DIRECTORY);
igt_require_fd(dir);
igt_debugfs_simple_read(dir, "i915_fbc_status", buf, sizeof(buf));
close(dir);
@@ -45,7 +45,7 @@ static bool _intel_fbc_is_enabled(int device, enum pipe pipe, int log_level, cha
bool print = true;
int dir;

- dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+ dir = igt_debugfs_crtc_dir(device, pipe, O_DIRECTORY);
igt_require_fd(dir);
igt_debugfs_simple_read(dir, "i915_fbc_status", buf, sizeof(buf));
close(dir);
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 40b719545e9b..11f5ee9984ee 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -285,23 +285,23 @@ int igt_debugfs_connector_dir(int device, char *conn_name, int mode)
}

/**
- * igt_debugfs_pipe_dir:
+ * igt_debugfs_crtc_dir:
* @device: fd of the device
- * @pipe: index of pipe
+ * @crtc_index: CRTC index
* @mode: mode bits as used by open()
*
- * This opens the debugfs directory corresponding to the pipe index on the
+ * This opens the debugfs directory corresponding to the CRTC 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)
+int igt_debugfs_crtc_dir(int device, int crtc_index, int mode)
{
char buf[128];

- snprintf(buf, sizeof(buf), "crtc-%d", pipe);
+ snprintf(buf, sizeof(buf), "crtc-%d", crtc_index);
return igt_debugfs_open(device, buf, mode);
}

diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 76dbff3e8e7f..2c546f299a43 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -29,14 +29,12 @@
#include <stdint.h>
#include <stdio.h>

-enum pipe;
-
const char *igt_debugfs_mount(void);
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_crtc_dir(int device, int crtc_index, int mode);

int igt_debugfs_open(int fd, const char *filename, int mode);
bool igt_debugfs_is_dir(int drm_fd, const char *name, int gt_id);
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 6508400fd686..a94c4820bd87 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1309,7 +1309,7 @@ int __intel_get_pipe_from_crtc_index(int fd, int crtc_index)
int debugfs_fd, pipe, res = 0;
char pipe_char;

- debugfs_fd = igt_debugfs_pipe_dir(fd, crtc_index, O_RDONLY);
+ debugfs_fd = igt_debugfs_crtc_dir(fd, crtc_index, O_RDONLY);

if (debugfs_fd >= 0) {
res = igt_debugfs_simple_read(debugfs_fd, "i915_pipe", buf, sizeof(buf));
@@ -6649,7 +6649,7 @@ unsigned int igt_get_pipe_current_bpc(int drmfd, enum pipe pipe)
int fd, res;
unsigned int current;

- fd = igt_debugfs_pipe_dir(drmfd, pipe, O_RDONLY);
+ fd = igt_debugfs_crtc_dir(drmfd, pipe, O_RDONLY);
igt_assert(fd >= 0);

if (is_intel_device(drmfd))
diff --git a/tests/intel/kms_frontbuffer_tracking.c b/tests/intel/kms_frontbuffer_tracking.c
index 7dd52f982d96..cd80ba444cf5 100644
--- a/tests/intel/kms_frontbuffer_tracking.c
+++ b/tests/intel/kms_frontbuffer_tracking.c
@@ -1538,7 +1538,7 @@ static void __debugfs_read_crtc(const char *param, char *buf, int len)
enum pipe pipe;

pipe = prim_mode_params.pipe;
- dir = igt_debugfs_pipe_dir(drm.fd, pipe, O_DIRECTORY);
+ dir = igt_debugfs_crtc_dir(drm.fd, pipe, O_DIRECTORY);
igt_require_fd(dir);
igt_debugfs_simple_read(dir, param, buf, len);
close(dir);
diff --git a/tests/nouveau_crc.c b/tests/nouveau_crc.c
index 6d61df006095..b30dbb1be592 100644
--- a/tests/nouveau_crc.c
+++ b/tests/nouveau_crc.c
@@ -369,7 +369,7 @@ int igt_main()
igt_plane_set_fb(data.primary, &data.default_fb);
igt_display_commit(&data.display);

- dir = igt_debugfs_pipe_dir(data.drm_fd, pipe, O_DIRECTORY);
+ dir = igt_debugfs_crtc_dir(data.drm_fd, pipe, O_DIRECTORY);
igt_require_fd(dir);
data.nv_crc_dir = openat(dir, "nv_crc", O_DIRECTORY);
close(dir);
--
2.47.3