All of lore.kernel.org
 help / color / mirror / Atom feed
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 2/2] lib/igt_kms: Drop the ioctl fallback for CRTC id to pipe mapping
Date: Thu, 20 Nov 2025 16:05:28 +0200	[thread overview]
Message-ID: <aR8gKIbyRdW-sDLU@intel.com> (raw)
In-Reply-To: <4ee248cad827f7c6ccb2b35544a6571822abe87d.1763634045.git.jani.nikula@intel.com>

On Thu, Nov 20, 2025 at 12:23:14PM +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.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  lib/igt_kms.c | 42 ++++++++----------------------------------
>  1 file changed, 8 insertions(+), 34 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 0ff56653a4a7..714b851e8037 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1193,24 +1193,15 @@ 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_idx)
>  {
>  	char buf[2];
>  	int debugfs_fd, res = 0;
> +	char pipe;
>  
> -	/*
> -	 * 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);
>  
>  	if (debugfs_fd >= 0) {
> @@ -1218,26 +1209,11 @@ static int __intel_get_pipe_from_crtc_id(int fd, int crtc_id, int crtc_idx)
>  		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), 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);
>  }
>  
>  /**
> @@ -2985,9 +2961,7 @@ void igt_display_require(igt_display_t *display, int drm_fd)
>  
>  	for (i = 0; i < resources->count_crtcs; i++) {
>  		igt_pipe_t *pipe;
> -		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;
>  
>  		pipe = &display->pipes[pipe_enum];
>  		pipe->pipe = pipe_enum;

It looked to me like this thing also get directly fed into bunch of
places that expect a crtc index. So I suspect you need to change
this to be the index as well.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2025-11-20 14:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20 10:23 [PATCH i-g-t 0/2] fix CRTC index to pipe conversion, cleanup Jani Nikula
2025-11-20 10:23 ` [PATCH i-g-t 1/2] lib/igt_kms: Always return CRTC index from kmstest_get_pipe_from_crtc_id() Jani Nikula
2025-11-20 10:23 ` [PATCH i-g-t 2/2] lib/igt_kms: Drop the ioctl fallback for CRTC id to pipe mapping Jani Nikula
2025-11-20 14:05   ` Ville Syrjälä [this message]
2025-11-20 14:58     ` Jani Nikula
2025-11-20 11:35 ` ✗ i915.CI.BAT: failure for fix CRTC index to pipe conversion, cleanup Patchwork
2025-11-20 12:46   ` Jani Nikula
2025-11-25  7:02     ` Ravali, JupallyX
2025-11-20 12:09 ` ✓ Xe.CI.BAT: success " Patchwork
2025-11-20 14:39 ` ✓ Xe.CI.Full: " Patchwork
2025-11-25  6:33 ` ✓ i915.CI.BAT: " Patchwork
2025-11-25 14:00 ` ✗ i915.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=aR8gKIbyRdW-sDLU@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.