[PATCH i-g-t 8/8] lib/i915/drrs: switch the interface from pipe to CRTC index

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

All of the DRRS functionality assumes CRTC index, even though the
functions have enum pipe as parameter. Switch to CRTC index to reflect
what the functions expect in reality.

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

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
lib/i915/intel_drrs.c | 36 ++++++++++++++++++------------------
lib/i915/intel_drrs.h | 8 ++++----
2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/lib/i915/intel_drrs.c b/lib/i915/intel_drrs.c
index 5257a6a6a7ca..ab32f2b4734f 100644
--- a/lib/i915/intel_drrs.c
+++ b/lib/i915/intel_drrs.c
@@ -13,19 +13,19 @@
/**
* intel_is_drrs_supported:
* @device: fd of the device
- * @pipe: Display pipe
+ * @crtc_index: CRTC index
*
- * Check if DRRS is supported on given pipe.
+ * Check if DRRS is supported on given CRTC index.
*
* Returns:
* true if DRRS is supported and false otherwise.
*/
-bool intel_is_drrs_supported(int device, enum pipe pipe)
+bool intel_is_drrs_supported(int device, int crtc_index)
{
char buf[256];
int dir;

- dir = igt_debugfs_crtc_dir(device, pipe, O_DIRECTORY);
+ dir = igt_debugfs_crtc_dir(device, crtc_index, O_DIRECTORY);
igt_require_fd(dir);
igt_debugfs_simple_read(dir, "i915_drrs_status", buf, sizeof(buf));
close(dir);
@@ -56,7 +56,7 @@ bool intel_output_has_drrs(int device, igt_output_t *output)
return strstr(buf, "seamless");
}

-static void drrs_set(int device, enum pipe pipe, unsigned int val)
+static void drrs_set(int device, int crtc_index, unsigned int val)
{
char buf[2];
int dir, ret;
@@ -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_crtc_dir(device, pipe, O_DIRECTORY);
+ dir = igt_debugfs_crtc_dir(device, crtc_index, O_DIRECTORY);
igt_require_fd(dir);
ret = igt_sysfs_write(dir, "i915_drrs_ctl", buf, sizeof(buf) - 1);
close(dir);
@@ -81,49 +81,49 @@ static void drrs_set(int device, enum pipe pipe, unsigned int val)
/**
* intel_drrs_enable:
* @device: fd of the device
- * @pipe: Display pipe
+ * @crtc_index: CRTC index
*
- * Enable DRRS on given pipe
+ * Enable DRRS on given CRTC index.
*
* Returns:
* none
*/
-void intel_drrs_enable(int device, enum pipe pipe)
+void intel_drrs_enable(int device, int crtc_index)
{
- drrs_set(device, pipe, 1);
+ drrs_set(device, crtc_index, 1);
}

/**
* intel_drrs_disable:
* @device: fd of the device
- * @pipe: Display pipe
+ * @crtc_index: CRTC index
*
- * Disable DRRS on given pipe
+ * Disable DRRS on given CRTC index.
*
* Returns:
* none
*/
-void intel_drrs_disable(int device, enum pipe pipe)
+void intel_drrs_disable(int device, int crtc_index)
{
- drrs_set(device, pipe, 0);
+ drrs_set(device, crtc_index, 0);
}

/**
* intel_is_drrs_inactive:
* @device: fd of the device
- * @pipe: Display pipe
+ * @crtc_index: CRTC index
*
- * Check if drrs is inactive on given pipe
+ * Check if drrs is inactive on given CRTC index.
*
* Returns:
* true if inactive and false otherwise
*/
-bool intel_is_drrs_inactive(int device, enum pipe pipe)
+bool intel_is_drrs_inactive(int device, int crtc_index)
{
char buf[256];
int dir;

- dir = igt_debugfs_crtc_dir(device, pipe, O_DIRECTORY);
+ dir = igt_debugfs_crtc_dir(device, crtc_index, 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_drrs.h b/lib/i915/intel_drrs.h
index d4d27a5f9991..1a612d16f6b6 100644
--- a/lib/i915/intel_drrs.h
+++ b/lib/i915/intel_drrs.h
@@ -8,10 +8,10 @@

#include "igt.h"

-bool intel_is_drrs_supported(int device, enum pipe pipe);
+bool intel_is_drrs_supported(int device, int crtc_index);
bool intel_output_has_drrs(int device, igt_output_t *output);
-void intel_drrs_enable(int device, enum pipe pipe);
-void intel_drrs_disable(int device, enum pipe pipe);
-bool intel_is_drrs_inactive(int device, enum pipe pipe);
+void intel_drrs_enable(int device, int crtc_index);
+void intel_drrs_disable(int device, int crtc_index);
+bool intel_is_drrs_inactive(int device, int crtc_index);

#endif
--
2.47.3