Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Hung <alex.hung@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: <alex.hung@amd.com>, <Mark.Broadworth@amd.com>,
	<vitaly.prosyak@amd.com>,  <swati2.sharma@intel.com>,
	<kamil.konieczny@linux.intel.com>, <jani.nikula@intel.com>,
	Wayne Lin <wayne.lin@amd.com>
Subject: [PATCH][V4] tests/kms_hdr: Add interactive HDR verification to static-swap
Date: Tue, 12 May 2026 16:22:44 -0600	[thread overview]
Message-ID: <20260512222245.1767752-1-alex.hung@amd.com> (raw)

From: Wayne Lin <wayne.lin@amd.com>

Add smpte2084 and traditional-sdr with igt_debug_interactive_mode_check()
checks in test_static_swap(). These checks are CI-safe (no-op without
--interactive-debug) and provide a Y/n prompt when run interactively:

  kms_hdr --run-subtest static-swap --interactive-debug=smpte2084
  kms_hdr --run-subtest static-swap --interactive-debug=traditional-sdr

The HDR metadata probe in test_hdr() failed with EINVAL because it attempted
to commit metadata without a scanout buffer present. Fix the probe to create
a minimal framebuffer and use DRM_MODE_ATOMIC_TEST_ONLY to validate the
commit without modifying hardware state. The framebuffer is freed immediately
after and the display state is reset, so the actual subtest starts from the
same clean slate as before.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Assisted-by: Copilot:Claude-Sonnet-4.6
---
 tests/kms_hdr.c | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
index d50f87787..affd38887 100644
--- a/tests/kms_hdr.c
+++ b/tests/kms_hdr.c
@@ -454,6 +454,8 @@ static void test_static_swap(data_t *data, igt_crtc_t *crtc,
 	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 	igt_assert_output_bpc_equal(crtc,
 				    data->output, 10);
+	igt_debug_interactive_mode_check("smpte2084",
+					 "HDR pattern displayed with SMPTE ST 2084 metadata");

 	igt_pipe_crc_collect_crc(data->pipe_crc, &ref_crc);

@@ -483,6 +485,8 @@ static void test_static_swap(data_t *data, igt_crtc_t *crtc,
 		igt_display_commit_atomic(display, 0, NULL);
 	else
 		igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	igt_debug_interactive_mode_check("traditional-sdr",
+					 "SDR pattern displayed with traditional SDR metadata");

 	igt_pipe_crc_collect_crc(data->pipe_crc, &new_crc);

@@ -571,16 +575,33 @@ static void test_hdr(data_t *data, uint32_t flags)
 							      "non-internal panel.\n",
 							      igt_output_name(output));

-					/* Signal HDR requirement via metadata */
+					/* Signal HDR requirement via metadata.
+					 * A framebuffer must be present for the driver to accept
+					 * a metadata commit. Use TEST_ONLY so hardware state is
+					 * unchanged.
+					 */
+					igt_create_fb(data->fd,
+						      data->w, data->h,
+						      hdr_test_formats[i],
+						      DRM_FORMAT_MOD_LINEAR,
+						      &data->afb);
+					igt_plane_set_fb(data->primary, &data->afb);
+					igt_plane_set_size(data->primary, data->w, data->h);
+					igt_output_set_prop_value(data->output, IGT_CONNECTOR_MAX_BPC, 10);
 					igt_hdr_fill_st2084(&hdr);
 					igt_hdr_set_metadata(data->output, &hdr);
-					igt_require_f(!igt_display_try_commit2(display,
-									       display->is_atomic ?
-									       COMMIT_ATOMIC :
-									       COMMIT_LEGACY),
+					igt_require_f(!igt_display_try_commit_atomic(display,
+										     DRM_MODE_ATOMIC_TEST_ONLY |
+										     DRM_MODE_ATOMIC_ALLOW_MODESET,
+										     NULL),
 						      "%s: Couldn't set HDR metadata\n",
 						      igt_output_name(output));

+					/* Reset IGT display state; hardware was not changed. */
+					igt_hdr_set_metadata(data->output, NULL);
+					igt_plane_set_fb(data->primary, NULL);
+					igt_remove_fb(data->fd, &data->afb);
+
 					igt_require_f(!is_intel_device(data->fd) ||
 						      igt_max_bpc_constraint(display, crtc, output, 10),
 						      "%s: No suitable mode found to use 10 bpc.\n",
@@ -591,10 +612,6 @@ static void test_hdr(data_t *data, uint32_t flags)
 					else
 						flags &= ~TEST_NEEDS_DSC;

-					igt_hdr_set_metadata(data->output, NULL);
-					igt_display_commit2(display, display->is_atomic ?
-							    COMMIT_ATOMIC : COMMIT_LEGACY);
-
 					if (flags & (TEST_NONE | TEST_DPMS | TEST_SUSPEND |
 						     TEST_INVALID_HDR | TEST_BRIGHTNESS))
 						test_static_toggle(data,
--
2.43.0


             reply	other threads:[~2026-05-12 22:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 22:22 Alex Hung [this message]
2026-05-13  0:44 ` ✓ i915.CI.BAT: success for tests/kms_hdr: Add interactive HDR verification to static-swap Patchwork
2026-05-13  3:01 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-13 17:51 ` [PATCH][V4] " Sharma, Swati2
2026-05-13 21:28 ` ✗ Xe.CI.FULL: failure for " Patchwork
2026-05-14  1:36 ` ✗ 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=20260512222245.1767752-1-alex.hung@amd.com \
    --to=alex.hung@amd.com \
    --cc=Mark.Broadworth@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=swati2.sharma@intel.com \
    --cc=vitaly.prosyak@amd.com \
    --cc=wayne.lin@amd.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