Re: [PATCH 2/3] tools: Add amd_hdr_visual for manual HDR verification

Jani Nikula
2026-03-19T08:54:47Z

On Tue, 17 Mar 2026, Alex Hung <alex.hung@amd.com> wrote:
> From: Wayne Lin <wayne.lin@amd.com>
>
> Add a visual verification tool for AMD HDR display output. This tool
> 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>
> ---
> tools/amd_hdr_visual.c | 372 +++++++++++++++++++++++++++++++++++++++++
> tools/meson.build | 5 +
> 2 files changed, 377 insertions(+)
> create mode 100644 tools/amd_hdr_visual.c
>
> diff --git a/tools/amd_hdr_visual.c b/tools/amd_hdr_visual.c
> new file mode 100644
> index 000000000..58decb356
> --- /dev/null
> +++ b/tools/amd_hdr_visual.c
> @@ -0,0 +1,372 @@
> +/*
> + * Copyright 2026 Advanced Micro Devices, Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + */
> +
> +#include "igt.h"
> +#include <fcntl.h>
> +#include <termios.h>
> +#include <unistd.h>
> +#include "igt_edid.h"
> +#include "igt_hdr.h"
> +
> +IGT_TEST_DESCRIPTION("Test HDR metadata interfaces and bpc switch");
> +
> +/* Test flags. */
> +enum {
> + TEST_NONE = 1 << 0,
> + TEST_DPMS = 1 << 1,
> + TEST_SUSPEND = 1 << 2,
> + TEST_SWAP = 1 << 3,
> +};
> +
> +/* BPC connector state. */
> +typedef struct output_bpc {
> + unsigned int current;
> + unsigned int maximum;
> +} output_bpc_t;
> +
> +/* Common test data. */
> +typedef struct data {
> + igt_display_t display;
> + igt_plane_t *primary;
> + igt_output_t *output;
> + igt_crtc_t *pipe;
> + igt_pipe_crc_t *pipe_crc;
> + drmModeModeInfo *mode;
> + enum pipe pipe_id;

Please avoid using enum pipe and crtc->pipe for anything unless you
actually really *really* need to know the (Intel) hardware pipe.

Further details at [1].

BR,
Jani.

[1] https://lore.kernel.org/r/356099f0d5b2c882460e344869720b92c0da538d@intel.com

> + int fd;
> + int w;
> + int h;
> +} data_t;

--
Jani Nikula, Intel