From: Jani Nikula <jani.nikula@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 09/11] lib/kms: Pimp the priamry plane swapping
Date: Fri, 19 Dec 2025 14:00:18 +0200 [thread overview]
Message-ID: <cd18fda8f7ff8c322899d9d8b7eda049c635fb8d@intel.com> (raw)
In-Reply-To: <20251217153758.9369-10-ville.syrjala@linux.intel.com>
On Wed, 17 Dec 2025, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Do the primary plane swap a bit more cleanly with a pair of
> igt_swap()s. And while at it sprinkle some asserts around
> to make sure we didn't screw anything up.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Subject, *primary
> ---
> lib/igt_kms.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index ef3215332e29..69a430f01e21 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -3025,7 +3025,6 @@ void igt_display_reset_outputs(igt_display_t *display)
> igt_plane_t *old_primary = &pipe->planes[0];
> igt_plane_t *new_primary =
> igt_get_assigned_primary(output, pipe);
> - int new_primary_index = new_primary->index;
>
> /*
> * If the driver-assigned primary plane isn't at
> @@ -3034,12 +3033,21 @@ void igt_display_reset_outputs(igt_display_t *display)
> *
> * This way, the primary plane is always at index 0.
> */
> - if (new_primary_index != 0) {
> - new_primary->index = 0;
> - old_primary->index = new_primary_index;
> + if (new_primary->index != 0) {
> + igt_assert(old_primary != new_primary);
>
> - igt_swap(pipe->planes[new_primary_index],
> - pipe->planes[0]);
> + igt_assert_eq(old_primary->index, 0);
> + igt_assert_neq(new_primary->index, 0);
Nitpick, this is redundant as we're in new_primary->index != 0 branch,
but then again it's symmetric with the post-swap checks. *shrug*.
Anyway I'm glad the asserts are there, because the swaps on *&foo are a
bit hard for the reader.
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> +
> + igt_swap(*old_primary, *new_primary);
> + igt_swap(old_primary->index, new_primary->index);
> +
> + igt_assert_neq(old_primary->index, 0);
> + igt_assert_eq(new_primary->index, 0);
> + } else {
> + igt_assert(old_primary == new_primary);
> +
> + igt_assert_eq(old_primary->index, 0);
> }
> }
> }
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-12-19 12:00 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 15:37 [PATCH i-g-t 00/11] lib/kms: Carve up igt_display_require() Ville Syrjala
2025-12-17 15:37 ` [PATCH i-g-t 01/11] lib/kms: Extract igt_crtc_init() Ville Syrjala
2025-12-17 19:04 ` Jani Nikula
2025-12-17 15:37 ` [PATCH i-g-t 02/11] lib/kms: Nuke 'n_planes' from igt_crtc_init() Ville Syrjala
2025-12-17 19:11 ` Jani Nikula
2025-12-17 15:37 ` [PATCH i-g-t 03/11] lib/kms: Nuke 'last_plane' " Ville Syrjala
2025-12-17 19:12 ` Jani Nikula
2025-12-17 15:37 ` [PATCH i-g-t 04/11] lib/kms: Get rid of the 'p' plane index variable Ville Syrjala
2025-12-17 19:17 ` Jani Nikula
2025-12-18 11:33 ` Jani Nikula
2025-12-18 15:47 ` [PATCH i-g-t v2 " Ville Syrjala
2025-12-19 10:55 ` Jani Nikula
2025-12-17 15:37 ` [PATCH i-g-t 05/11] lib/kms: Extract igt_crtc_plane_init() Ville Syrjala
2025-12-17 19:18 ` Jani Nikula
2025-12-18 15:48 ` [PATCH i-g-t v2 " Ville Syrjala
2025-12-17 15:37 ` [PATCH i-g-t 06/11] lib/kms: Nuke pipe->plane_primary Ville Syrjala
2025-12-18 11:37 ` Jani Nikula
2025-12-17 15:37 ` [PATCH i-g-t 07/11] lib/kms: Nuke pipe->plane_cursor Ville Syrjala
2025-12-18 11:39 ` Jani Nikula
2025-12-17 15:37 ` [PATCH i-g-t 08/11] lib/kms: Use '{old, new}_primary' variable names in plane swapping Ville Syrjala
2025-12-17 19:20 ` Jani Nikula
2025-12-17 15:37 ` [PATCH i-g-t 09/11] lib/kms: Pimp the priamry " Ville Syrjala
2025-12-19 12:00 ` Jani Nikula [this message]
2025-12-17 15:37 ` [PATCH i-g-t 10/11] lib/kms: Extract plane_type_index() Ville Syrjala
2025-12-19 12:08 ` Jani Nikula
2025-12-17 15:37 ` [PATCH i-g-t 11/11] lib/kms: Streamline plane index handling further Ville Syrjala
2025-12-19 12:10 ` Jani Nikula
2025-12-17 20:36 ` ✗ Xe.CI.BAT: failure for lib/kms: Carve up igt_display_require() Patchwork
2025-12-17 21:00 ` ✗ i915.CI.BAT: " Patchwork
2025-12-18 20:21 ` ✗ Xe.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=cd18fda8f7ff8c322899d9d8b7eda049c635fb8d@intel.com \
--to=jani.nikula@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=ville.syrjala@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 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.