igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/kms_hdr: add FP16 format coverage
@ 2025-09-11 19:00 Swati Sharma
  2025-09-11 23:55 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Swati Sharma @ 2025-09-11 19:00 UTC (permalink / raw)
  To: igt-dev; +Cc: uma.shankar, Swati Sharma

Extend kms_hdr to exercise FP16 framebuffers in addition to
10bpc formats. All HDR metadata, toggle, swap and bpc-switch tests
now run with both XRGB2101010 and XRGB16161616F. This ensures
HDR handling paths are validated with half-float surfaces as
well as packed 10bpc.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 tests/kms_hdr.c | 143 ++++++++++++++++++++++++++----------------------
 1 file changed, 79 insertions(+), 64 deletions(-)

diff --git a/tests/kms_hdr.c b/tests/kms_hdr.c
index efa5964cf..37da709c1 100644
--- a/tests/kms_hdr.c
+++ b/tests/kms_hdr.c
@@ -88,6 +88,12 @@ enum hdmi_eotf {
 	HDMI_EOTF_SMPTE_ST2084,
 };
 
+/* HDR test formats: 10bpc + FP16 */
+static const uint32_t hdr_test_formats[] = {
+	DRM_FORMAT_XRGB2101010,
+	DRM_FORMAT_XRGB16161616F,
+};
+
 /* Test flags. */
 enum {
 	TEST_NONE = 1 << 0,
@@ -239,6 +245,7 @@ static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)
 
 static void test_bpc_switch_on_output(data_t *data, enum pipe pipe,
 				      igt_output_t *output,
+				      uint32_t format,
 				      uint32_t flags)
 {
 	igt_display_t *display = &data->display;
@@ -248,7 +255,7 @@ static void test_bpc_switch_on_output(data_t *data, enum pipe pipe,
 
 	/* 10-bit formats are slow, so limit the size. */
 	afb_id = igt_create_fb(data->fd, 512, 512,
-			       DRM_FORMAT_XRGB2101010, DRM_FORMAT_MOD_LINEAR, &afb);
+			       format, DRM_FORMAT_MOD_LINEAR, &afb);
 	igt_assert(afb_id);
 
 	draw_hdr_pattern(&afb);
@@ -335,24 +342,28 @@ static void test_bpc_switch(data_t *data, uint32_t flags)
 				continue;
 			}
 
-			prepare_test(data, output, pipe);
+			for (int i = 0; i < ARRAY_SIZE(hdr_test_formats); i++) {
+				prepare_test(data, output, pipe);
 
-			if (is_intel_device(data->fd) &&
-			    !igt_max_bpc_constraint(display, pipe, output, 10)) {
-				igt_info("%s: No suitable mode found to use 10 bpc.\n",
-					 igt_output_name(output));
+				if (is_intel_device(data->fd) &&
+				    !igt_max_bpc_constraint(display, pipe, output, 10)) {
+					igt_info("%s: No suitable mode found to use 10 bpc.\n",
+						  igt_output_name(output));
 
-				test_fini(data);
-				break;
-			}
+					test_fini(data);
+					break;
+				}
 
-			data->mode = igt_output_get_mode(output);
-			data->w = data->mode->hdisplay;
-			data->h = data->mode->vdisplay;
+				data->mode = igt_output_get_mode(output);
+				data->w = data->mode->hdisplay;
+				data->h = data->mode->vdisplay;
 
-			igt_dynamic_f("pipe-%s-%s",
-				      kmstest_pipe_name(pipe), output->name)
-				test_bpc_switch_on_output(data, pipe, output, flags);
+				igt_dynamic_f("pipe-%s-%s-%s",
+					      kmstest_pipe_name(pipe), output->name,
+					      igt_format_str(hdr_test_formats[i]))
+					      test_bpc_switch_on_output(data, pipe, output,
+					      hdr_test_formats[i], flags);
+			}
 
 			/* One pipe is enough */
 			break;
@@ -470,7 +481,7 @@ static void adjust_brightness(data_t *data, uint32_t flags)
 
 static void test_static_toggle(data_t *data, enum pipe pipe,
 			       igt_output_t *output,
-			       uint32_t flags)
+			       uint32_t format, uint32_t flags)
 {
 	igt_display_t *display = &data->display;
 	struct hdr_output_metadata hdr;
@@ -480,7 +491,7 @@ static void test_static_toggle(data_t *data, enum pipe pipe,
 
 	/* 10-bit formats are slow, so limit the size. */
 	afb_id = igt_create_fb(data->fd, 512, 512,
-			       DRM_FORMAT_XRGB2101010, DRM_FORMAT_MOD_LINEAR, &afb);
+			       format, DRM_FORMAT_MOD_LINEAR, &afb);
 	igt_assert(afb_id);
 
 	draw_hdr_pattern(&afb);
@@ -581,7 +592,8 @@ static void fill_hdr_output_metadata_sdr(struct hdr_output_metadata *meta)
 	meta->hdmi_metadata_type1.max_cll = 0;
 }
 
-static void test_static_swap(data_t *data, enum pipe pipe, igt_output_t *output, uint32_t flags)
+static void test_static_swap(data_t *data, enum pipe pipe, igt_output_t *output,
+			     uint32_t format, uint32_t flags)
 {
 	igt_display_t *display = &data->display;
 	igt_crc_t ref_crc, new_crc;
@@ -591,7 +603,7 @@ static void test_static_swap(data_t *data, enum pipe pipe, igt_output_t *output,
 
 	/* 10-bit formats are slow, so limit the size. */
 	afb_id = igt_create_fb(data->fd, 512, 512,
-			       DRM_FORMAT_XRGB2101010, DRM_FORMAT_MOD_LINEAR, &afb);
+			       format, DRM_FORMAT_MOD_LINEAR, &afb);
 	igt_assert(afb_id);
 
 	draw_hdr_pattern(&afb);
@@ -743,54 +755,57 @@ static void test_hdr(data_t *data, uint32_t flags)
 				continue;
 			}
 
-			prepare_test(data, output, pipe);
-
-			/* Signal HDR requirement via metadata */
-			fill_hdr_output_metadata_st2048(&hdr);
-			set_hdr_output_metadata(data, &hdr);
-			if (igt_display_try_commit2(display, display->is_atomic ?
-						    COMMIT_ATOMIC : COMMIT_LEGACY)) {
-				igt_info("%s: Couldn't set HDR metadata\n",
-					 igt_output_name(output));
-				test_fini(data);
-				break;
-			}
-
-			if (is_intel_device(data->fd) &&
-			    !igt_max_bpc_constraint(display, pipe, output, 10)) {
-				igt_info("%s: No suitable mode found to use 10 bpc.\n",
-					 igt_output_name(output));
+			for (int i = 0; i < ARRAY_SIZE(hdr_test_formats); i++) {
+				prepare_test(data, output, pipe);
+
+				/* Signal HDR requirement via metadata */
+				fill_hdr_output_metadata_st2048(&hdr);
+				set_hdr_output_metadata(data, &hdr);
+				if (igt_display_try_commit2(display, display->is_atomic ?
+							    COMMIT_ATOMIC : COMMIT_LEGACY)) {
+					igt_info("%s: Couldn't set HDR metadata\n",
+						  igt_output_name(output));
+					test_fini(data);
+					break;
+				}
 
-				test_fini(data);
-				break;
-			}
+				if (is_intel_device(data->fd) &&
+				    !igt_max_bpc_constraint(display, pipe, output, 10)) {
+					igt_info("%s: No suitable mode found to use 10 bpc.\n",
+						  igt_output_name(output));
 
-			if (igt_is_dsc_enabled(data->fd, output->name))
-				flags |= TEST_NEEDS_DSC;
-			else
-				flags &= ~TEST_NEEDS_DSC;
-
-			set_hdr_output_metadata(data, NULL);
-			igt_display_commit2(display, display->is_atomic ?
-					    COMMIT_ATOMIC : COMMIT_LEGACY);
-
-			data->mode = igt_output_get_mode(output);
-			data->w = data->mode->hdisplay;
-			data->h = data->mode->vdisplay;
-
-			igt_dynamic_f("pipe-%s-%s",
-				      kmstest_pipe_name(pipe), output->name) {
-				if (flags & (TEST_NONE | TEST_DPMS | TEST_SUSPEND |
-					     TEST_INVALID_HDR | TEST_BRIGHTNESS))
-					test_static_toggle(data, pipe, output, flags);
-				if (flags & TEST_SWAP)
-					test_static_swap(data, pipe, output, flags);
-				if (flags & TEST_INVALID_METADATA_SIZES)
-					test_invalid_metadata_sizes(data, output);
+					test_fini(data);
+					break;
+				}
+
+				if (igt_is_dsc_enabled(data->fd, output->name))
+					flags |= TEST_NEEDS_DSC;
+				else
+					flags &= ~TEST_NEEDS_DSC;
+
+				set_hdr_output_metadata(data, NULL);
+				igt_display_commit2(display, display->is_atomic ?
+						    COMMIT_ATOMIC : COMMIT_LEGACY);
+
+				data->mode = igt_output_get_mode(output);
+				data->w = data->mode->hdisplay;
+				data->h = data->mode->vdisplay;
+
+				igt_dynamic_f("pipe-%s-%s-%s",
+					       kmstest_pipe_name(pipe), output->name,
+					       igt_format_str(hdr_test_formats[i])) {
+					if (flags & (TEST_NONE | TEST_DPMS | TEST_SUSPEND |
+						     TEST_INVALID_HDR | TEST_BRIGHTNESS))
+						test_static_toggle(data, pipe, output, hdr_test_formats[i], flags);
+					if (flags & TEST_SWAP)
+						test_static_swap(data, pipe, output, hdr_test_formats[i], flags);
+					if (flags & TEST_INVALID_METADATA_SIZES)
+						test_invalid_metadata_sizes(data, output);
+				}
+
+				/* One pipe is enough */
+					break;
 			}
-
-			/* One pipe is enough */
-			break;
 		}
 	}
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-30 11:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-11 19:00 [PATCH i-g-t] tests/kms_hdr: add FP16 format coverage Swati Sharma
2025-09-11 23:55 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-09-12  0:09 ` ✓ i915.CI.BAT: " Patchwork
2025-09-12  6:23 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-12 23:48 ` ✓ i915.CI.Full: success " Patchwork
2025-11-30 11:28 ` [PATCH i-g-t] " Borah, Chaitanya Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).