From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Kunal Joshi <kunal1.joshi@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 01/35] lib/igt_pipe_crc: separate CRTC index from pipe
Date: Mon, 24 Nov 2025 21:15:45 +0200 [thread overview]
Message-ID: <aSSu4eSzuKMa4R2q@intel.com> (raw)
In-Reply-To: <20251123152412.599801-2-kunal1.joshi@intel.com>
On Sun, Nov 23, 2025 at 08:53:38PM +0530, Kunal Joshi wrote:
> The pipe CRC helpers have historically treated the logical pipe enum as if it
> were the CRTC index, and used that directly in the debugfs paths under
> crtc-<index>/crc/. This only works as long as crtc_index == pipe, which is no
> longer guaranteed once pipes are virtualized, fused off, or reordered.
>
> Introduce an explicit CRTC index in igt_pipe_crc and wire it through the
> debugfs control/data paths. Add new constructors that take either a raw CRTC
> index or an igt_display+pipe pair, and update kms_pipe_crc_basic to use the
> display-aware helper so it always uses display->pipes[pipe].crtc_offset.
>
> Keep the existing igt_pipe_crc_new(fd, pipe, ...) API as a thin wrapper that
> still assumes crtc_index == pipe for now so existing callers continue to work.
> This is a first incremental step towards fully decoupling CRTC indices from
> hardware pipes across the KMS tests.
> ---
> lib/igt_pipe_crc.c | 39 +++++++++++++++++++++++++++++++++++---
> lib/igt_pipe_crc.h | 6 ++++++
> tests/kms_pipe_crc_basic.c | 12 ++++++------
> 3 files changed, 48 insertions(+), 9 deletions(-)
>
> diff --git a/lib/igt_pipe_crc.c b/lib/igt_pipe_crc.c
> index 866bf2881..24aa72bcc 100644
> --- a/lib/igt_pipe_crc.c
> +++ b/lib/igt_pipe_crc.c
> @@ -190,6 +190,8 @@ struct _igt_pipe_crc {
> int flags;
>
> enum pipe pipe;
This whole pipe thing needs to go away.
> + /* CRTC index in drmModeRes.crtcs used for debugfs paths. */
> + unsigned int crtc_index;
> char *source;
> };
>
> @@ -215,7 +217,8 @@ void igt_require_pipe_crc(int fd)
> }
>
> static igt_pipe_crc_t *
> -pipe_crc_new(int fd, enum pipe pipe, const char *source, int flags)
> +pipe_crc_new_internal(int fd, enum pipe pipe, unsigned int crtc_index,
> + const char *source, int flags)
> {
> igt_pipe_crc_t *pipe_crc;
> char buf[128];
> @@ -235,7 +238,7 @@ pipe_crc_new(int fd, enum pipe pipe, const char *source, int flags)
> pipe_crc = calloc(1, sizeof(struct _igt_pipe_crc));
> igt_assert(pipe_crc);
>
> - sprintf(buf, "crtc-%d/crc/control", pipe);
> + sprintf(buf, "crtc-%u/crc/control", crtc_index);
> pipe_crc->ctl_fd = openat(debugfs, buf, O_WRONLY);
> igt_assert(pipe_crc->ctl_fd != -1);
>
> @@ -243,6 +246,7 @@ pipe_crc_new(int fd, enum pipe pipe, const char *source, int flags)
> pipe_crc->fd = fd;
> pipe_crc->dir = debugfs;
> pipe_crc->pipe = pipe;
> + pipe_crc->crtc_index = crtc_index;
> pipe_crc->source = strdup(env_source);
> igt_assert(pipe_crc->source);
> pipe_crc->flags = flags;
> @@ -250,6 +254,15 @@ pipe_crc_new(int fd, enum pipe pipe, const char *source, int flags)
> return pipe_crc;
> }
>
> +static igt_pipe_crc_t *
> +pipe_crc_new(int fd, enum pipe pipe, const char *source, int flags)
> +{
> + /* Existing callers pass a logical pipe; assume crtc_index == pipe
> + * until they are converted to use the new helpers.
> + */
> + return pipe_crc_new_internal(fd, pipe, pipe, source, flags);
> +}
> +
> /**
> * igt_pipe_crc_new:
> * @fd: fd of the device
> @@ -288,6 +301,26 @@ igt_pipe_crc_new_nonblock(int fd, enum pipe pipe, const char *source)
> return pipe_crc_new(fd, pipe, source, O_RDONLY | O_NONBLOCK);
> }
>
> +igt_pipe_crc_t *
> +igt_pipe_crc_new_for_crtc(int fd, unsigned int crtc_index,
> + const char *source)
> +{
> + return pipe_crc_new_internal(fd, PIPE_A, crtc_index, source, O_RDONLY);
> +}
> +
> +igt_pipe_crc_t *
> +igt_pipe_crc_new_for_display(struct igt_display *display, enum pipe pipe,
> + const char *source)
> +{
I think it's better to just pass in the whole igt_pipe_t.
In fact I already wrote the cocci for that, but I need to
get a bunch of refactroing done in before it can be done.
I already posted two small refactoring series, but more
will be needed.
> + igt_pipe_t *igt_pipe = &display->pipes[pipe];
> +
> + igt_assert(igt_pipe->valid);
> +
> + return pipe_crc_new_internal(display->drm_fd, pipe,
> + igt_pipe->crtc_offset, source,
> + O_RDONLY);
> +}
> +
> /**
> * igt_pipe_crc_free:
> * @pipe_crc: pipe CRC object
> @@ -380,7 +413,7 @@ void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc)
>
> igt_assert_eq(write(pipe_crc->ctl_fd, src, strlen(src)), strlen(src));
>
> - sprintf(buf, "crtc-%d/crc/data", pipe_crc->pipe);
> + sprintf(buf, "crtc-%u/crc/data", pipe_crc->crtc_index);
>
> igt_set_timeout(10, "Opening crc fd, and poll for first CRC.");
> pipe_crc->crc_fd = openat(pipe_crc->dir, buf, pipe_crc->flags);
> diff --git a/lib/igt_pipe_crc.h b/lib/igt_pipe_crc.h
> index 171f08230..142e39569 100644
> --- a/lib/igt_pipe_crc.h
> +++ b/lib/igt_pipe_crc.h
> @@ -51,6 +51,12 @@ igt_pipe_crc_t *
> igt_pipe_crc_new(int fd, enum pipe pipe, const char *source);
> igt_pipe_crc_t *
> igt_pipe_crc_new_nonblock(int fd, enum pipe pipe, const char *source);
> +igt_pipe_crc_t *
> +igt_pipe_crc_new_for_crtc(int fd, unsigned int crtc_index,
> + const char *source);
> +igt_pipe_crc_t *
> +igt_pipe_crc_new_for_display(struct igt_display *display, enum pipe pipe,
> + const char *source);
> void igt_pipe_crc_free(igt_pipe_crc_t *pipe_crc);
> void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc);
> void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc);
> diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
> index 9750d014c..135b82832 100644
> --- a/tests/kms_pipe_crc_basic.c
> +++ b/tests/kms_pipe_crc_basic.c
> @@ -183,8 +183,8 @@ static void test_read_crc(data_t *data, enum pipe pipe,
> } else {
> igt_pipe_crc_t *pipe_crc;
>
> - pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe,
> - IGT_PIPE_CRC_SOURCE_AUTO);
> + pipe_crc = igt_pipe_crc_new_for_display(&data->display, pipe,
> + IGT_PIPE_CRC_SOURCE_AUTO);
> igt_pipe_crc_start(pipe_crc);
>
> n_crcs = igt_pipe_crc_get_crcs(pipe_crc, N_CRCS, &crcs);
> @@ -268,8 +268,8 @@ static void test_compare_crc(data_t *data, enum pipe pipe, igt_output_t *output,
> igt_plane_set_fb(primary, &fb0);
> igt_display_commit(display);
>
> - pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe,
> - IGT_PIPE_CRC_SOURCE_AUTO);
> + pipe_crc = igt_pipe_crc_new_for_display(&data->display, pipe,
> + IGT_PIPE_CRC_SOURCE_AUTO);
> igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
>
> /* Flip FB1 with the primary plane & compare the CRC with ref CRC. */
> @@ -298,8 +298,8 @@ static void test_disable_crc_after_crtc(data_t *data, enum pipe pipe,
> igt_crc_t crc[2];
> igt_plane_t *primary;
>
> - pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe,
> - IGT_PIPE_CRC_SOURCE_AUTO);
> + pipe_crc = igt_pipe_crc_new_for_display(&data->display, pipe,
> + IGT_PIPE_CRC_SOURCE_AUTO);
>
> igt_display_reset(display);
> igt_output_set_pipe(output, pipe);
> --
> 2.25.1
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2025-11-24 19:15 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-23 15:23 [PATCH i-g-t 00/35] fix pipe-crtc conflict in crc helpers Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 01/35] lib/igt_pipe_crc: separate CRTC index from pipe Kunal Joshi
2025-11-24 19:15 ` Ville Syrjälä [this message]
2025-11-24 20:31 ` Jani Nikula
2025-11-24 20:55 ` Ville Syrjälä
2025-11-25 8:47 ` Joshi, Kunal1
2025-11-23 15:23 ` [PATCH i-g-t 02/35] tests/kms_atomic: use display-aware pipe CRC helper Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 03/35] tests/kms_color: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 04/35] tests/kms_cursor_crc: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 05/35] tests/kms_cursor_legacy: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 06/35] tests/kms_display_modes: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 07/35] tests/kms_hdr: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 08/35] tests/kms_multipipe_modeset: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 09/35] tests/kms_rotation_crc: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 10/35] tests/kms_plane_lowres: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 11/35] tests/kms_async_flips: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 12/35] tests/kms_atomic_transition: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 13/35] tests/kms_plane: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 14/35] tests/kms_plane_alpha_blend, cursor: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 15/35] tests/kms_plane_multiple: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 16/35] tests/kms_sharpness_filter: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 17/35] tests/kms_universal_plane: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 18/35] tests/kms_prime: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 19/35] tests/kms_bw: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 20/35] tests/kms_ccs: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 21/35] tests/kms_fbc_dirty_rect: " Kunal Joshi
2025-11-23 15:23 ` [PATCH i-g-t 22/35] tests/kms_pwrite_crc: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 23/35] tests/xe_pxp: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 24/35] tests/kms_frontbuffer_tracking: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 25/35] tests/kms_mmap_write_crc: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 26/35] tests/kms_dirtyfb: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 27/35] tests/kms_big_fb: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 28/35] tests/xe_pat: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 29/35] tests/kms_draw_crc: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 30/35] tests/kms_fbcon_fbt: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 31/35] tests/tests/intel/kms_flip_scaled_crc: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 32/35] tests/intel/kms_flip_tiling: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 33/35] tests/intel/kms_pipe_stress: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 34/35] tests/intel/kms_fb_coherency: " Kunal Joshi
2025-11-23 15:24 ` [PATCH i-g-t 35/35] tests/intel/gem_pxp: " Kunal Joshi
2025-11-25 5:58 ` ✓ Xe.CI.BAT: success for fix pipe-crtc conflict in crc helpers Patchwork
2025-11-25 6:13 ` ✓ i915.CI.BAT: " Patchwork
2025-11-25 9:14 ` ✗ Xe.CI.Full: failure " Patchwork
2025-11-25 13:03 ` ✗ i915.CI.Full: " 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=aSSu4eSzuKMa4R2q@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kunal1.joshi@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