[PATCH i-g-t 2/3] lib/igt_kms: Fix assert in igt_display_reset_outputs()

Kamil Konieczny
2026-04-24T15:14:55Z

There is an error manifesting by assert, when primary plane was
not a first one:

sudo ./kms_getfb
INFO: IGT-Version: IGT_VERSION-GIT (arm64) (Linux:
6.6.118-android15-8-g34da635f9b82-ab14801981-4k aarch64)
...
CRITICAL: Test assertion failure function igt_display_reset_outputs,
file external/igt-gpu-tools/lib/igt_kms.c:2985:
CRITICAL: Failed assertion: old_primary->index != 0
CRITICAL: error: 0 == 0

It turns out that after swapping data and index, it should also
swap pointers itself so asserts will be correct checks.

Cc: Jani Nikula <jani.nikula@intel.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reported-by: Jing-Ping Jan <jingpingjan@google.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
lib/igt_kms.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 2d758b63c..33092fc85 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2980,6 +2980,7 @@ void igt_display_reset_outputs(igt_display_t *display)

igt_swap(*old_primary, *new_primary);
igt_swap(old_primary->index, new_primary->index);
+ igt_swap(old_primary, new_primary);

igt_assert_neq(old_primary->index, 0);
igt_assert_eq(new_primary->index, 0);
--
2.54.0