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/igt_kms: Drop the ioctl fallback for CRTC id to pipe mapping
Date: Wed, 28 Jan 2026 17:11:57 +0200 [thread overview]
Message-ID: <aXonPYqtubeQ_sNa@intel.com> (raw)
In-Reply-To: <00f072a6eabf9d74ef80dc683e9d024344a3d399.1769514879.git.jani.nikula@intel.com>
On Tue, Jan 27, 2026 at 01:55:58PM +0200, Jani Nikula wrote:
> The kernel support for i915_pipe debugfs has been around for 2½ years in
> both i915 and xe. Drop the ioctl fallback for simplicity. Rename the
> function __intel_get_pipe_from_crtc_index() as it's now purely about
> CRTC index and not id.
I was actaully pondering about using the ioctl as a hint to the
kernel whether userspace is using MI_WAIT_SCANLINE, and if not
I could start using the scanline window wait stuff for the
vblank evasion in the driver (which might be nice for some pfit
shenanigans). I gave up on that after realizing that igt was also
using the ioctl. So getting rid of the ioctl use here migth
actually be a good thing for me, and it means we just have one
codepath to deal with for both kernel drivers.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> lib/igt_kms.c | 47 ++++++++++-------------------------------------
> 1 file changed, 10 insertions(+), 37 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index bd02148d1d3f..a236597ac152 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1316,51 +1316,27 @@ void kmstest_dump_mode(drmModeModeInfo *mode)
> }
>
> /*
> - * With non-contiguous pipes display, crtc mapping is not always same
> - * as pipe mapping, In i915 pipe is enum id of i915's crtc object.
> - * hence allocating upper bound igt_pipe array to support non-contiguos
> - * pipe display and reading pipe enum for a crtc using GET_PIPE_FROM_CRTC_ID
> - * ioctl for a pipe to do pipe ordering with respect to crtc list.
> + * The hardware pipe may be different from the CRTC index. Figure out the CRTC
> + * index to pipe mapping from the debugfs.
> */
> -static int __intel_get_pipe_from_crtc_id(int fd, int crtc_id, int crtc_idx)
> +static int __intel_get_pipe_from_crtc_index(int fd, int crtc_index)
> {
> char buf[2];
> int debugfs_fd, res = 0;
> + char pipe_char;
>
> - /*
> - * No GET_PIPE_FROM_CRTC_ID ioctl support for XE. Instead read
> - * from the debugfs "i915_pipe".
> - *
> - * This debugfs is applicable for both i915 & XE. For i915, still
> - * we can fallback to ioctl method to support older kernels.
> - */
> - debugfs_fd = igt_debugfs_pipe_dir(fd, crtc_idx, O_RDONLY);
> + debugfs_fd = igt_debugfs_pipe_dir(fd, crtc_index, O_RDONLY);
>
> if (debugfs_fd >= 0) {
> res = igt_debugfs_simple_read(debugfs_fd, "i915_pipe", buf, sizeof(buf));
> close(debugfs_fd);
> }
>
> - if (res <= 0) {
> - /* Fallback to older ioctl method. */
> - if (is_i915_device(fd)) {
> - struct drm_i915_get_pipe_from_crtc_id get_pipe;
> -
> - get_pipe.pipe = 0;
> - get_pipe.crtc_id = crtc_id;
> + igt_assert_f(res > 0, "Failed to read the debugfs i915_pipe.\n");
>
> - do_ioctl(fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID,
> - &get_pipe);
> + igt_assert_eq(sscanf(buf, "%c", &pipe_char), 1);
>
> - return get_pipe.pipe;
> - } else
> - igt_assert_f(false, "XE: Failed to read the debugfs i915_pipe.\n");
> - } else {
> - char pipe;
> -
> - igt_assert_eq(sscanf(buf, "%c", &pipe), 1);
> - return kmstest_pipe_to_index(pipe);
> - }
> + return kmstest_pipe_to_index(pipe_char);
> }
>
> /**
> @@ -1395,8 +1371,7 @@ int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id)
>
> drmModeFreeResources(res);
>
> - return is_intel_device(fd) ?
> - __intel_get_pipe_from_crtc_id(fd, crtc_id, i) : i;
> + return is_intel_device(fd) ? __intel_get_pipe_from_crtc_index(fd, i) : i;
> }
>
> /**
> @@ -3231,9 +3206,7 @@ void igt_display_require(igt_display_t *display, int drm_fd)
>
> for (i = 0; i < resources->count_crtcs; i++) {
> igt_crtc_t *crtc;
> - int pipe_enum = (is_intel_dev)?
> - __intel_get_pipe_from_crtc_id(drm_fd,
> - resources->crtcs[i], i) : i;
> + int pipe_enum = is_intel_dev ? __intel_get_pipe_from_crtc_index(drm_fd, i) : i;
>
> crtc = igt_crtc_for_pipe(display, pipe_enum);
> crtc->pipe = pipe_enum;
> --
> 2.47.3
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-01-28 15:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 11:55 [PATCH i-g-t 0/8] lib/igt_kms: pipe vs CRTC index cleanups Jani Nikula
2026-01-27 11:55 ` [PATCH i-g-t 1/8] lib/igt_kms: Drop the ioctl fallback for CRTC id to pipe mapping Jani Nikula
2026-01-28 15:11 ` Ville Syrjälä [this message]
2026-01-27 11:55 ` [PATCH i-g-t 2/8] lib/igt_kms: Remove kmstest_pipe_to_index() Jani Nikula
2026-01-27 11:56 ` [PATCH i-g-t 3/8] tests/kms_setmode: drop redundant drmModeGetCrtc() call Jani Nikula
2026-01-27 11:56 ` [PATCH i-g-t 4/8] tests/kms_setmode: use CRTC index instead of pipe for intel_drrs_disable() Jani Nikula
2026-01-27 11:56 ` [PATCH i-g-t 5/8] tests/kms_setmode: use __intel_get_pipe_from_crtc_index() directly Jani Nikula
2026-01-27 11:56 ` [PATCH i-g-t 6/8] lib/igt_kms: Always return CRTC index from kmstest_get_pipe_from_crtc_id() Jani Nikula
2026-01-27 11:56 ` [PATCH i-g-t 7/8] lib/igt_debugfs: rename igt_debugfs_pipe_dir() to igt_debugfs_crtc_dir() Jani Nikula
2026-01-27 11:56 ` [PATCH i-g-t 8/8] lib/i915/drrs: switch the interface from pipe to CRTC index Jani Nikula
2026-01-27 16:47 ` ✓ Xe.CI.BAT: success for lib/igt_kms: pipe vs CRTC index cleanups (rev2) Patchwork
2026-01-27 17:05 ` ✓ i915.CI.BAT: " Patchwork
2026-01-27 21:07 ` ✗ Xe.CI.Full: failure " Patchwork
2026-01-28 2:07 ` ✗ i915.CI.Full: " Patchwork
2026-01-28 15:14 ` [PATCH i-g-t 0/8] lib/igt_kms: pipe vs CRTC index cleanups Ville Syrjälä
2026-01-28 16:47 ` Jani Nikula
2026-01-28 16:52 ` Ville Syrjälä
2026-01-28 16:59 ` Jani Nikula
2026-01-28 17:16 ` Ville Syrjälä
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=aXonPYqtubeQ_sNa@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