[PATCH i-g-t v2 11/11] lib/kms: convert igt_crtc_for_pipe() into a proper function

Jani Nikula
2026-03-20T10:40:44Z

The usage of igt_crtc_for_pipe() has been reduced so much that having it
as static inline is no longer justified for performance reasons. Prefer
hiding the implementation details instead by turning it into a proper
function.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
lib/igt_kms.c | 8 ++++++++
lib/igt_kms.h | 8 +-------
2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 197ed15d1380..ab120c807151 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -8065,6 +8065,14 @@ igt_crtc_t *igt_crtc_for_crtc_index(igt_display_t *display, int crtc_index)
return NULL;
}

+igt_crtc_t *igt_crtc_for_pipe(igt_display_t *display, enum pipe pipe)
+{
+ if (pipe == PIPE_NONE)
+ return NULL;
+
+ return &display->crtcs[pipe];
+}
+
/*
* igt_first_crtc:
* @display: pointer to igt_display_t
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 71ed4604e7e0..887099a7084d 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -575,15 +575,9 @@ int igt_display_n_crtcs(igt_display_t *display);

const char *igt_crtc_name(igt_crtc_t *crtc);

-static inline igt_crtc_t *igt_crtc_for_pipe(igt_display_t *display, enum pipe pipe)
-{
- if (pipe == PIPE_NONE)
- return NULL;
-
- return &display->crtcs[pipe];
-}
igt_crtc_t *igt_crtc_for_crtc_id(igt_display_t *display, uint32_t crtc_id);
igt_crtc_t *igt_crtc_for_crtc_index(igt_display_t *display, int crtc_index);
+igt_crtc_t *igt_crtc_for_pipe(igt_display_t *display, enum pipe pipe);
igt_crtc_t *igt_first_crtc(igt_display_t *display);
igt_crtc_t *igt_first_crtc_with_single_output(igt_display_t *display, igt_output_t **ret_output);
igt_crtc_t *igt_next_crtc(igt_display_t *display, igt_crtc_t *crtc);
--
2.47.3