From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 1/8] lib/kms: add and use igt_crtc_debugfs_dir()
Date: Fri, 13 Mar 2026 12:23:40 +0200 [thread overview]
Message-ID: <abPlrLjp0RjJk2I0@intel.com> (raw)
In-Reply-To: <30fc91b2a9d6ced1ec26bad26cecc90af81636d3.1773394225.git.jani.nikula@intel.com>
On Fri, Mar 13, 2026 at 11:31:53AM +0200, Jani Nikula wrote:
> Add igt_crtc_debugfs_dir() for getting the debugfs for a CRTC, and use
> it where applicable. As a side effect, this fixes several cases where
> pipe is used instead of CRTC index for the debugfs dir.
>
> Note: Looks like it's difficult to add any igt_crtc_t based interfaces
> in igt_debugfs.h due to header dependencies, so add it to igt_kms.h
> along with the rest of the crtc based helpers.
I think that's the better option. This keeps the
debugfs/etc low level and thus potentially reusable
even for tools/etc that should not suck in the whole
igt library. See eg
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/16
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> lib/i915/intel_fbc.c | 4 ++--
> lib/igt_kms.c | 7 ++++++-
> lib/igt_kms.h | 2 ++
> tests/intel/kms_frontbuffer_tracking.c | 4 +---
> tests/nouveau_crc.c | 4 +---
> 5 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/lib/i915/intel_fbc.c b/lib/i915/intel_fbc.c
> index 9ea5e3cf68fd..b418c95e66bd 100644
> --- a/lib/i915/intel_fbc.c
> +++ b/lib/i915/intel_fbc.c
> @@ -27,7 +27,7 @@ bool intel_fbc_supported(igt_crtc_t *crtc)
> char buf[FBC_STATUS_BUF_LEN];
> int dir;
>
> - dir = igt_debugfs_crtc_dir(crtc->display->drm_fd, crtc->crtc_index, O_DIRECTORY);
> + dir = igt_crtc_debugfs_dir(crtc, O_DIRECTORY);
> igt_require_fd(dir);
> igt_debugfs_simple_read(dir, "i915_fbc_status", buf, sizeof(buf));
> close(dir);
> @@ -44,7 +44,7 @@ static bool _intel_fbc_is_enabled(igt_crtc_t *crtc, int log_level, char *last_fb
> bool print = true;
> int dir;
>
> - dir = igt_debugfs_crtc_dir(crtc->display->drm_fd, crtc->crtc_index, O_DIRECTORY);
> + dir = igt_crtc_debugfs_dir(crtc, O_DIRECTORY);
> igt_require_fd(dir);
> igt_debugfs_simple_read(dir, "i915_fbc_status", buf, sizeof(buf));
> close(dir);
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 0b05ddd72977..6ccc9d0e6221 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -5254,6 +5254,11 @@ igt_pipe_crc_t *igt_crtc_crc_new_nonblock(igt_crtc_t *crtc, const char *source)
> return igt_pipe_crc_new_nonblock(crtc->display->drm_fd, crtc->crtc_index, source);
> }
>
> +int igt_crtc_debugfs_dir(igt_crtc_t *crtc, int mode)
> +{
> + return igt_debugfs_crtc_dir(crtc->display->drm_fd, crtc->crtc_index, mode);
> +}
> +
> const char *igt_crtc_name(igt_crtc_t *crtc)
> {
> if (crtc == NULL)
> @@ -6638,7 +6643,7 @@ unsigned int igt_get_crtc_current_bpc(igt_crtc_t *crtc)
> int fd, res;
> unsigned int current;
>
> - fd = igt_debugfs_crtc_dir(drmfd, crtc->pipe, O_RDONLY);
> + fd = igt_crtc_debugfs_dir(crtc, O_RDONLY);
Why do we even have these 'mode' arguments to igt_debugfs_*_dir()?
This guy forgets to set O_DIRECTORY (which would make the open
fail of the path is not a directory), and everyone else forgets
to set O_RDONLY (but O_RDONLY==0 so doesn't really matter I guess).
I think we should get rid of these 'mode' arguments and
just make the debugfs code do the right thing all by itself.
> igt_assert(fd >= 0);
>
> if (is_intel_device(drmfd))
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 081613a4b949..2492dac77e4f 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -595,6 +595,8 @@ typedef struct _igt_pipe_crc igt_pipe_crc_t;
> igt_pipe_crc_t *igt_crtc_crc_new(igt_crtc_t *crtc, const char *source);
> igt_pipe_crc_t *igt_crtc_crc_new_nonblock(igt_crtc_t *crtc, const char *source);
>
> +int igt_crtc_debugfs_dir(igt_crtc_t *crtc, int mode);
> +
> igt_crtc_t *igt_output_get_driving_crtc(igt_output_t *output);
> const char *igt_output_name(igt_output_t *output);
> bool kmstest_mode_is_valid(const drmModeModeInfo *mode);
> diff --git a/tests/intel/kms_frontbuffer_tracking.c b/tests/intel/kms_frontbuffer_tracking.c
> index 12f51047d286..e83465c0d478 100644
> --- a/tests/intel/kms_frontbuffer_tracking.c
> +++ b/tests/intel/kms_frontbuffer_tracking.c
> @@ -1534,10 +1534,8 @@ static void set_mode_for_params(struct modeset_params *params)
> static void __debugfs_read_crtc(const char *param, char *buf, int len)
> {
> int dir;
> - enum pipe pipe;
>
> - pipe = prim_mode_params.crtc->pipe;
> - dir = igt_debugfs_crtc_dir(drm.fd, pipe, O_DIRECTORY);
> + dir = igt_crtc_debugfs_dir(prim_mode_params.crtc, 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 c080ded3e621..29e2d84e76ac 100644
> --- a/tests/nouveau_crc.c
> +++ b/tests/nouveau_crc.c
> @@ -370,9 +370,7 @@ int igt_main()
> igt_plane_set_fb(data.primary, &data.default_fb);
> igt_display_commit(&data.display);
>
> - dir = igt_debugfs_crtc_dir(data.drm_fd,
> - data.crtc->pipe,
> - O_DIRECTORY);
> + dir = igt_crtc_debugfs_dir(data.crtc, O_DIRECTORY);
> igt_require_fd(dir);
> data.nv_crc_dir = openat(dir, "nv_crc", O_DIRECTORY);
> close(dir);
> --
> 2.47.3
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-03-13 10:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 9:31 [PATCH i-g-t 0/8] CRTC index vs. pipe fixes, drrs/fbc interface cleanups Jani Nikula
2026-03-13 9:31 ` [PATCH i-g-t 1/8] lib/kms: add and use igt_crtc_debugfs_dir() Jani Nikula
2026-03-13 10:23 ` Ville Syrjälä [this message]
2026-03-13 9:31 ` [PATCH i-g-t 2/8] lib/kms: add igt_crtc_for_crtc_index() Jani Nikula
2026-03-13 9:31 ` [PATCH i-g-t 3/8] lib/i915/drrs: convert the interface to igt_crtc_t Jani Nikula
2026-03-13 9:31 ` [PATCH i-g-t 4/8] Revert "lib/i915/intel_fbc: Add fbc supported check based on wa" Jani Nikula
2026-03-13 9:31 ` [PATCH i-g-t 5/8] lib/i915/fbc: make intel_fbc_max_plane_size() static Jani Nikula
2026-03-13 9:31 ` [PATCH i-g-t 6/8] lib/i915/fbc: pass display to intel_fbc_plane_size_supported() Jani Nikula
2026-03-13 9:31 ` [PATCH i-g-t 7/8] lib/i915/fbc: convert intel_fbc_{enable, disable}() into proper functions Jani Nikula
2026-03-13 9:32 ` [PATCH i-g-t 8/8] lib/i915/fbc: convert intel_fbc_supported_for_psr_mode() to igt_display_t* Jani Nikula
2026-03-13 10:28 ` [PATCH i-g-t 0/8] CRTC index vs. pipe fixes, drrs/fbc interface cleanups Ville Syrjälä
2026-03-13 11:28 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-03-13 11:46 ` ✓ i915.CI.BAT: " Patchwork
2026-03-14 11:29 ` ✓ i915.CI.Full: " Patchwork
2026-03-14 13:48 ` ✗ Xe.CI.FULL: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=abPlrLjp0RjJk2I0@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox