Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Sharma, Swati2" <swati2.sharma@intel.com>
To: Alex Hung <alex.hung@amd.com>, <igt-dev@lists.freedesktop.org>
Cc: <Mark.Broadworth@amd.com>, <vitaly.prosyak@amd.com>,
	<kamil.konieczny@linux.intel.com>, <jani.nikula@intel.com>,
	Wayne Lin <wayne.lin@amd.com>
Subject: Re: [PATCH i-g-t][V2] tests/amdgpu: Add amd_hdr_visual for manual HDR verification
Date: Wed, 6 May 2026 17:13:39 +0530	[thread overview]
Message-ID: <17d2434d-90e6-4824-87b6-bf9a3644a275@intel.com> (raw)
In-Reply-To: <20260505205743.1839944-1-alex.hung@amd.com>

Hi Alex

Can't this be part of kms_hdr?

On 06-05-2026 02:27 am, Alex Hung wrote:
> From: Wayne Lin <wayne.lin@amd.com>
>
> Add a visual verification test for AMD HDR display output. This test
> displays HDR test patterns with different metadata types and waits for
> user confirmation, enabling manual inspection of HDR output quality.
>
> Subtests:
> - static-swap-smpte2084: Display with SMPTE ST2084 (PQ) HDR metadata
> - static-swap-traditional-sdr: Display with traditional SDR gamma metadata
>
> Co-developed-by: Alex Hung <alex.hung@amd.com>
> Signed-off-by: Alex Hung <alex.hung@amd.com>
> Signed-off-by: Wayne Lin <wayne.lin@amd.com>
> ---
>   tests/amdgpu/amd_hdr_visual.c | 176 ++++++++++++++++++++++++++++++++++
>   tests/amdgpu/meson.build      |   7 ++
>   2 files changed, 183 insertions(+)
>   create mode 100644 tests/amdgpu/amd_hdr_visual.c
>
> diff --git a/tests/amdgpu/amd_hdr_visual.c b/tests/amdgpu/amd_hdr_visual.c
> new file mode 100644
> index 000000000..63eed937c
> --- /dev/null
> +++ b/tests/amdgpu/amd_hdr_visual.c
> @@ -0,0 +1,176 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright 2026 Advanced Micro Devices, Inc.
> + */
> +
> +#include "igt.h"
> +#include "igt_hdr.h"
> +
> +/**
> + * TEST: AMD manual HDR visual tests
> + * Description: Test HDR metadata interfaces by showing visual HDR patterns
> + * Driver requirement: amdgpu
> + * Mega-feature: Display
> + * Sub-category: HDR
> + *
> + * SUBTEST: static-swap-smpte2084
> + * Description: Show a visual HDR pattern with SMPTE ST2084 metadata and
> + * require user confirmation.
> + *
> + * SUBTEST: static-swap-traditional-sdr
> + * Description: Show a visual HDR pattern with traditional SDR gamma metadata
> + * and require user confirmation.
> + */
> +IGT_TEST_DESCRIPTION("Test HDR output metadata visual verification");
> +
> +/* Common test data. */
> +typedef struct data {
> +	igt_display_t display;
> +	igt_plane_t *primary;
> +	igt_output_t *output;
> +	igt_crtc_t *crtc;
> +	drmModeModeInfo *mode;
> +	int fd;
> +	int w;
> +	int h;
> +} data_t;
> +
> +/* Fills the FB with a test HDR pattern. */
> +static void draw_hdr_pattern(igt_fb_t *fb)
> +{
> +	cairo_t *cr = igt_get_cairo_ctx(fb->fd, fb);
> +
> +	igt_paint_color(cr, 0, 0, fb->width, fb->height, 1.0, 1.0, 1.0);
> +	igt_paint_test_pattern(cr, fb->width, fb->height);
> +
> +	igt_put_cairo_ctx(cr);
> +}
> +
> +/* Prepare test data. */
> +static void prepare_test(data_t *data, igt_output_t *output, igt_crtc_t *crtc)
> +{
> +	igt_display_t *display = &data->display;
> +
> +	data->crtc = crtc;
> +	igt_assert(data->crtc);
> +
> +	igt_display_reset(display);
> +
> +	data->output = output;
> +	igt_assert(data->output);
> +
> +	data->mode = igt_output_get_mode(data->output);
> +	igt_assert(data->mode);
> +
> +	data->primary =
> +		igt_crtc_get_plane_type(data->crtc, DRM_PLANE_TYPE_PRIMARY);
> +
> +	igt_output_set_crtc(data->output, crtc);
> +
> +	data->w = data->mode->hdisplay;
> +	data->h = data->mode->vdisplay;
> +}
> +
> +/* Returns true if an output supports max bpc property. */
> +static bool has_max_bpc(igt_output_t *output)
> +{
> +	return igt_output_has_prop(output, IGT_CONNECTOR_MAX_BPC) &&
> +	       igt_output_get_prop(output, IGT_CONNECTOR_MAX_BPC);
> +}
> +
> +static void test_static_swap(data_t *data,
> +			     void (*fill_metadata)(struct hdr_output_metadata *),
> +			     const char *mode_name)
> +{
> +	igt_display_t *display = &data->display;
> +	igt_output_t *output;
> +	igt_crtc_t *crtc;
> +	igt_fb_t afb;
> +	int afb_id;
> +	bool found = false;
> +	struct hdr_output_metadata hdr;
> +
> +	for_each_connected_output(display, output) {
> +		if (!has_max_bpc(output) || !igt_output_supports_hdr(output)) {
> +			igt_info("%s connector not found with HDR metadata/max_bpc connector property\n", output->name);
> +			continue;
> +		}
> +
> +		if (!igt_is_panel_hdr(data->fd, output)) {
> +			igt_info("Panel attached via %s connector is non-HDR\n", output->name);
> +			continue;
> +		}
> +
> +		for_each_crtc(display, crtc) {
> +			if (!igt_crtc_connector_valid(crtc, output))
> +				continue;
> +
> +			prepare_test(data, output, crtc);
> +
> +			/* 10-bit formats are slow, so limit the size. */
> +			afb_id = igt_create_fb(data->fd, 512, 512,
> +					       DRM_FORMAT_XRGB2101010, 0, &afb);
> +			igt_assert(afb_id);
> +
> +			draw_hdr_pattern(&afb);
> +
> +			/* Start in the specified HDR mode. */
> +			igt_plane_set_fb(data->primary, &afb);
> +			igt_plane_set_size(data->primary, data->w, data->h);
> +			fill_metadata(&hdr);
> +			igt_hdr_set_metadata(data->output, &hdr);
> +			igt_output_set_prop_value(data->output,
> +						  IGT_CONNECTOR_MAX_BPC, 10);
> +			igt_display_commit_atomic(display,
> +						  DRM_MODE_ATOMIC_ALLOW_MODESET,
> +						  NULL);
> +
> +			igt_info("wait %s!\n", mode_name);
> +			igt_debug_wait_for_keypress(mode_name);
> +
> +			/* Exit HDR mode and enter 8bpc, cleanup. */
> +			igt_hdr_set_metadata(data->output, NULL);
> +			igt_output_set_prop_value(data->output,
> +						  IGT_CONNECTOR_MAX_BPC, 8);
> +			igt_display_commit_atomic(display,
> +						  DRM_MODE_ATOMIC_ALLOW_MODESET,
> +						  NULL);
> +
> +			igt_display_reset(display);
> +			igt_remove_fb(data->fd, &afb);
> +
> +			found = true;
> +			break;
> +		}
> +	}
> +
> +	igt_require_f(found, "No connector found with HDR metadata/max_bpc connector property (or) panel is non-HDR\n");
> +}
> +
> +int igt_main()
> +{
> +	data_t data = { 0 };
> +
> +	igt_fixture() {
> +		data.fd = drm_open_driver_master(DRIVER_AMDGPU);
> +
> +		kmstest_set_vt_graphics_mode();
> +
> +		igt_display_require(&data.display, data.fd);
> +		igt_require(data.display.is_atomic);
> +
> +		igt_display_require_output(&data.display);
> +	}
> +
> +	igt_describe("Tests swapping to SMPTE ST2084 HDR metadata");
> +	igt_subtest("static-swap-smpte2084")
> +		test_static_swap(&data, igt_hdr_fill_st2084, "smpte2084");
> +
> +	igt_describe("Tests swapping to traditional SDR gamma HDR metadata");
> +	igt_subtest("static-swap-traditional-sdr")
> +		test_static_swap(&data, igt_hdr_fill_sdr, "traditional-sdr");
> +
> +	igt_fixture() {
> +		igt_display_fini(&data.display);
> +	}
> +}
> diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
> index d5a4820e3..7db1e2d9e 100644
> --- a/tests/amdgpu/meson.build
> +++ b/tests/amdgpu/meson.build
> @@ -90,3 +90,10 @@ foreach prog : amdgpu_progs
>   				       install : true)
>   	test_list += join_paths('amdgpu', prog)
>   endforeach
> +
> +test_executables += executable('amd_hdr_visual', 'amd_hdr_visual.c',
> +			       dependencies : test_deps,
> +			       install_dir : amdgpudir,
> +			       install_rpath : amdgpudir_rpathdir,
> +			       install : true)
> +test_list += join_paths('amdgpu', 'amd_hdr_visual')
> --
> 2.43.0
>

  parent reply	other threads:[~2026-05-06 11:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05 20:57 [PATCH i-g-t][V2] tests/amdgpu: Add amd_hdr_visual for manual HDR verification Alex Hung
2026-05-05 22:10 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-05-05 22:11 ` ✗ i915.CI.BAT: failure " Patchwork
2026-05-06  4:48 ` ✗ Xe.CI.FULL: " Patchwork
2026-05-06 11:43 ` Sharma, Swati2 [this message]
2026-05-06 15:40   ` [PATCH i-g-t][V2] " Alex Hung
2026-05-06 19:23     ` Sharma, Swati2

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=17d2434d-90e6-4824-87b6-bf9a3644a275@intel.com \
    --to=swati2.sharma@intel.com \
    --cc=Mark.Broadworth@amd.com \
    --cc=alex.hung@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=kamil.konieczny@linux.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