public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Jani Nikula <jani.nikula@intel.com>,
	Jing-Ping Jan <jingpingjan@google.com>,
	igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t v2] tests/kms: correct index validation logic
Date: Wed, 22 Apr 2026 20:23:12 +0300	[thread overview]
Message-ID: <aekEACGEcS2QGQgV@intel.com> (raw)
In-Reply-To: <20260422170557.434ohgvhvjzqmrws@kamilkon-DESK.igk.intel.com>

On Wed, Apr 22, 2026 at 07:05:57PM +0200, Kamil Konieczny wrote:
> Hi Jani,
> On 2026-04-21 at 15:02:01 +0300, Jani Nikula wrote:
> > On Tue, 21 Apr 2026, Jing-Ping Jan <jingpingjan@google.com> wrote:
> > > Based on the original implementation and the comment above the function,
> > > it appears the expected behavior is for the plane indices to remain
> > > consistent with those in crtc->planes. Therefore, after swapping the old
> > > and new primary planes, we must update the index in igt_plane_t to
> > > ensure it matches the corresponding index in crtc->planes.
> > >
> > > Therefore, we should expect the indices of the old and new primary
> > > planes to remain unchanged after swapping them.
> > >
> > > Fixes: ac37e1174cc4 ("lib/kms: Pimp the primary plane swapping")
> > 
> > With Fixes: it's customary to Cc the author and reviewer(s).
> > 
> > Cc: Jani Nikula <jani.nikula@intel.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > > Signed-off-by: Jing-Ping Jan <jingpingjan@google.com>
> > > ---
> > > v2:
> > >   - Add Fixes tag to the commit message.
> > >  lib/igt_kms.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> > > index bec96f267..405a04640 100644
> > > --- a/lib/igt_kms.c
> > > +++ b/lib/igt_kms.c
> > > @@ -2982,8 +2982,8 @@ void igt_display_reset_outputs(igt_display_t *display)
> > 
> 
> Lets have for simplicity simple struct { char name; int index; }
> and old -> { A, 0 }, new -> { F, 7 }
> 
> > The whole context here is:
> > 
> > 			if (new_primary->index != 0) {
> > 				igt_assert(old_primary != new_primary);
> > 
> > 				igt_assert_eq(old_primary->index, 0);
> > 				igt_assert_neq(new_primary->index, 0);
> > 
> > >  				igt_swap(*old_primary, *new_primary);
> 
> Now old -> { F, 7 }, new -> { A, 0 }
> 
> > >  				igt_swap(old_primary->index, new_primary->index);
> 
> Now old -> { F, 0 }, new -> { A, 7 }
> 
> Or do I miss something?

The problem is the pointers weren't swapped.

[0] = { 0, A } <- old
[1] = { 1, B } <- new

step1: full swap
[0] = { 1, B } <- old
[1] = { 0, A } <- new

step2: index swap
[0] = { 0, B } <- old
[1] = { 1, A } <- new

So after this I think the proper fix is to also swap the pointers.
Then the asserts after the swap start to make actual sense.

step3: pointer swap
[0] = { 0, B } <- new
[1] = { 1, A } <- old

> 
> > >  
> > > -				igt_assert_neq(old_primary->index, 0);
> > > -				igt_assert_eq(new_primary->index, 0);
> > > +				igt_assert_eq(old_primary->index, 0);
> > > +				igt_assert_neq(new_primary->index, 0);
> > 
> > Why do you expect these to remain the same as before the swapping?
> > That's why we are swapping.
> > 
> > >  			} else {
> > >  				igt_assert(old_primary == new_primary);
> > 
> > -- 
> > Jani Nikula, Intel

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-04-22 17:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20  7:49 [PATCH i-g-t] tests/kms: correct index validation logic Jing-Ping Jan
2026-04-20 18:16 ` Kamil Konieczny
2026-04-21  2:07   ` Jing-Ping Jan
2026-04-21  6:13     ` Karthik B S
2026-04-21  6:43       ` [PATCH i-g-t v2] " Jing-Ping Jan
2026-04-21  9:28         ` Karthik B S
2026-04-21 12:02         ` Jani Nikula
2026-04-22 17:05           ` Kamil Konieczny
2026-04-22 17:23             ` Ville Syrjälä [this message]
2026-04-23  9:21               ` Jing-Ping Jan
2026-04-23  9:28                 ` [PATCH i-g-t v3] " Jing-Ping Jan
2026-04-23 10:27                 ` [PATCH i-g-t v2] " Kamil Konieczny
2026-04-23 10:40                 ` Ville Syrjälä
2026-04-21 21:28 ` ✓ i915.CI.BAT: success for tests/kms: correct index validation logic (rev2) Patchwork
2026-04-21 22:20 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-22  2:36 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-22  5:16 ` ✓ i915.CI.Full: success " 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=aekEACGEcS2QGQgV@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=jingpingjan@google.com \
    --cc=kamil.konieczny@linux.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