xserver/test/ddc-tests.c
Tautvis 2d72f9e192
Some checks failed
Build X servers / ubuntu-fetch-pkg (push) Has been cancelled
Build X servers / xserver-build-ubuntu-no-gbm (push) Has been cancelled
Build X servers / xserver-build-ubuntu (push) Has been cancelled
Build X servers / abi-changes-check (push) Has been cancelled
Build X servers / xserver-build-ubuntu-debug (push) Has been cancelled
Build X servers / xserver-build-ubuntu-valgrind (push) Has been cancelled
Build X servers / ubuntu-deps-image (push) Has been cancelled
Build X servers / build-sdk-image (push) Has been cancelled
Build X servers / drivers-build-ubuntu (input-elographics:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (input-evdev:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (input-joystick:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (input-keyboard:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (input-libinput:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (input-mouse:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (input-synaptics:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (input-vmmouse:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (input-void:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (input-wacom:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-amdgpu:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-apm:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-ark:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-ast:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-ati:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-chips:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-cirrus:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-dummy:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-fbdev:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-freedreno:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-geode:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-i128:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-i740:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-intel:25.0.1) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-mach64:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-mga:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-neomagic:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-nested:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-nouveau:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-nv:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-omap:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-qxl:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-r128:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-rendition:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-s3virge:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-savage:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-siliconmotion:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sis:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sisusb:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg14:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg3:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suncg6:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sunffb:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-sunleo:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-suntcx:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-tdfx:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-trident:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-v4l:25.0.1) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vbox:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vesa:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-vmware:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-voodoo:25.0.0) (push) Has been cancelled
Build X servers / drivers-build-ubuntu (video-xgi:25.0.0) (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-macos (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-solaris (push) Has been cancelled
Build X servers / xserver-build-openbsd (push) Has been cancelled
Build X servers / xserver-build-hurd (push) Has been cancelled
Build X servers / xserver-build-alpine (push) Has been cancelled
Build X servers / gentoo-deps-image (push) Has been cancelled
Build X servers / xserver-build-gentoo (push) Has been cancelled
Build X servers / xserver-build-rhel (10) (push) Has been cancelled
Build X servers / xserver-build-rhel (9) (push) Has been cancelled
Build X servers / xserver-build-cygwin (push) Has been cancelled
Build X servers / xserver-build-arch (push) Has been cancelled
Build X servers / xserver-build-qemu-user (http://deb.debian.org/debian, armhf, qemu-arm-static, bookworm) (push) Has been cancelled
Build X servers / xserver-build-qemu-user (http://deb.debian.org/debian, mipsel, qemu-mipsel-static, bookworm) (push) Has been cancelled
Build X servers / xserver-build-qemu-user (http://deb.debian.org/debian, ppc64el, qemu-ppc64le-static, bookworm) (push) Has been cancelled
Build X servers / xserver-build-qemu-user (http://deb.debian.org/debian-ports, alpha, qemu-alpha-static, unstable) (push) Has been cancelled
Build X servers / xserver-build-qemu-user (http://deb.debian.org/debian-ports, sparc64, qemu-sparc64-static, unstable) (push) Has been cancelled
Build X servers / Check Signed-Off-By (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled
check PRs for merge conflicts / notify (push) Has been cancelled
xfree86: ddc: parse CTA-861-G HDR static metadata + colorimetry data blocks
Add xf86DoInterpretHDRMetadata(), which walks the EDID's CTA/CEA
extension data blocks and fills in a new struct monitor_hdr_data
(tail-appended field xf86Monitor::hdr) from the two blocks a display
uses to advertise HDR support:

 - the Colorimetry Data Block (tag 5): which extended gamuts/transfer
   spaces the display accepts (BT.2020 RGB/YCC/cYCC, opRGB, xvYCC,
   ICtCp, ...), exposed via is_CTA_CDB_*() bit-test macros.
 - the HDR Static Metadata Data Block (tag 6): supported EOTFs
   (traditional SDR/HDR gamma, SMPTE ST.2084/PQ, HLG) plus the
   desired content min/max/max-frame-average luminance, decoded with
   the CTA-861-G power-law formulas.

Covered by a new EDID unit test (test/ddc-tests.c) using real captured
EDIDs from four displays (Samsung Q800T, MSI MAG321CURV, HP 27 QD, and
a QEMU virtual display as the "no HDR block present" negative case),
asserting the parsed colorimetry/luminance values match known-good
figures for each.

This is a standalone prerequisite for HDR support, independent of any
particular rendering-pipeline design: cepelinas9000's HDR work
(https://github.com/cepelinas9000/xserver/tree/wip/x11hdrV2) needs to
know a display's HDR/colorimetry capabilities before doing anything
else, and this is useful on its own for any HDR/wide-gamut detection
regardless of how the rest of the pipeline ends up looking.

Extracted (with typo/whitespace cleanup, no logic changes) from
cepelinas9000's wip/x11hdrV2 branch, commit 159a6f484a, for standalone
review ahead of the larger HDR effort.

Note for review: struct monitor_hdr_data is added as a new field at
the tail of the public xf86Monitor struct (include/edid.h) - additive
only, no existing field shifts.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-08-24 13:50:42 +02:00

289 lines
11 KiB
C

/* Mostly these tests about HDR edid data parsing */
#undef NDEBUG
#include <dix-config.h>
#include <assert.h>
#include <stdio.h>
#include "include/edid.h"
#include "include/xf86DDC.h"
#include "tests-common.h"
/* https://gitlab.freedesktop.org/emersion/libdisplay-info/-/commit/f7bd5275574e2f6918de48d466233285a1189394 */
static unsigned char samsung_q800t_hdmi2_0_edid[] = {
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x4c, 0x2d, 0x3e, 0x70,
0x00, 0x0e, 0x00, 0x01, 0x01, 0x1e, 0x01, 0x03, 0x80, 0xa5, 0x5d, 0x78,
0x0a, 0xa8, 0x33, 0xab, 0x50, 0x45, 0xa5, 0x27, 0x0d, 0x48, 0x48, 0xbd,
0xef, 0x80, 0x71, 0x4f, 0x81, 0xc0, 0x81, 0x00, 0x81, 0x80, 0x95, 0x00,
0xa9, 0xc0, 0xb3, 0x00, 0xd1, 0xc0, 0x04, 0x74, 0x00, 0x30, 0xf2, 0x70,
0x5a, 0x80, 0xb0, 0x58, 0x8a, 0x00, 0x50, 0x1d, 0x74, 0x00, 0x00, 0x1e,
0x56, 0x5e, 0x00, 0xa0, 0xa0, 0xa0, 0x29, 0x50, 0x30, 0x20, 0x35, 0x00,
0x50, 0x1d, 0x74, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18,
0x78, 0x0f, 0x87, 0x1e, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x00, 0x00, 0xfc, 0x00, 0x53, 0x41, 0x4d, 0x53, 0x55, 0x4e, 0x47,
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x62, 0x02, 0x03, 0x50, 0xf0,
0x54, 0x5f, 0x10, 0x1f, 0x04, 0x13, 0x05, 0x14, 0x20, 0x21, 0x22, 0x5d,
0x5e, 0x62, 0x64, 0x07, 0x16, 0x03, 0x12, 0x3f, 0x40, 0x2c, 0x09, 0x07,
0x07, 0x15, 0x07, 0x50, 0x57, 0x07, 0x00, 0x67, 0x54, 0x00, 0x83, 0x01,
0x00, 0x00, 0xe2, 0x00, 0x4f, 0xe3, 0x05, 0x03, 0x01, 0x6e, 0x03, 0x0c,
0x00, 0x40, 0x00, 0xb8, 0x3c, 0x20, 0x00, 0x80, 0x01, 0x02, 0x03, 0x04,
0xe3, 0x06, 0x0d, 0x01, 0xe5, 0x0e, 0x60, 0x61, 0x65, 0x66, 0xe5, 0x01,
0x8b, 0x84, 0x90, 0x01, 0x01, 0x1d, 0x80, 0xd0, 0x72, 0x1c, 0x16, 0x20,
0x10, 0x2c, 0x25, 0x80, 0x50, 0x1d, 0x74, 0x00, 0x00, 0x9e, 0x02, 0x3a,
0x80, 0x18, 0x71, 0x38, 0x2d, 0x40, 0x58, 0x2c, 0x45, 0x00, 0x50, 0x1d,
0x74, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10
};
/* static unsigned int samsung_q800t_hdmi2_0_edid_len = 256; */
/*
make: Samsung Electric Company
model: SAMSUNG
serial: 0x01000E00
HDR static metadata:
luminance 0.000000-0.000000, maxFALL 0.000000
metadata type1=yes
EOTF tSDR=yes, tHDR=no, PQ=yes, HLG=yes
default color primaries:
red: 0.670, 0.314
green: 0.271, 0.645
blue: 0.152, 0.054
default white: 0.281, 0.284
default gamma: 2.20
signal colorimetry:
*/
/* **** */
static unsigned char msi_mag321curv_dp_edid[] = {
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x36, 0x69, 0xa2, 0x3d,
0x01, 0x01, 0x01, 0x01, 0x24, 0x1d, 0x01, 0x04, 0xb5, 0x46, 0x27, 0x78,
0xff, 0xf8, 0xc5, 0xa5, 0x56, 0x50, 0x9e, 0x26, 0x11, 0x50, 0x54, 0xbf,
0xef, 0x80, 0x71, 0x4f, 0x81, 0xc0, 0x81, 0x00, 0x81, 0x40, 0x81, 0x80,
0x95, 0x00, 0xb3, 0x00, 0xd1, 0xc0, 0x4d, 0xd0, 0x00, 0xa0, 0xf0, 0x70,
0x3e, 0x80, 0x30, 0x20, 0x35, 0x00, 0xbc, 0x86, 0x21, 0x00, 0x00, 0x1a,
0x00, 0x00, 0x00, 0xfd, 0x00, 0x28, 0x3c, 0x87, 0x87, 0x3c, 0x02, 0x00,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x4d,
0x41, 0x47, 0x33, 0x32, 0x31, 0x43, 0x55, 0x52, 0x56, 0x0a, 0x20, 0x20,
0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x41, 0x32, 0x41, 0x30, 0x31, 0x39,
0x33, 0x36, 0x30, 0x30, 0x34, 0x31, 0x01, 0xde, 0x02, 0x03, 0x44, 0xf1,
0x51, 0x01, 0x02, 0x03, 0x04, 0x05, 0x10, 0x11, 0x12, 0x13, 0x14, 0x1f,
0x20, 0x21, 0x22, 0x5f, 0x61, 0x60, 0x23, 0x09, 0x17, 0x07, 0x83, 0x01,
0x00, 0x00, 0x6d, 0x03, 0x0c, 0x00, 0x10, 0x00, 0x38, 0x3c, 0x20, 0x00,
0x60, 0x01, 0x02, 0x03, 0x67, 0xd8, 0x5d, 0xc4, 0x01, 0x78, 0x80, 0x03,
0xe3, 0x05, 0xe3, 0x01, 0xe4, 0x0f, 0x00, 0x80, 0x01, 0xe6, 0x06, 0x07,
0x01, 0x5c, 0x5c, 0x00, 0x56, 0x5e, 0x00, 0xa0, 0xa0, 0xa0, 0x29, 0x50,
0x30, 0x20, 0x35, 0x00, 0xbc, 0x86, 0x21, 0x00, 0x00, 0x1e, 0x66, 0x21,
0x56, 0xaa, 0x51, 0x00, 0x1e, 0x30, 0x46, 0x8f, 0x33, 0x00, 0xbc, 0x86,
0x21, 0x00, 0x00, 0x1e, 0x0e, 0x1f, 0x00, 0x80, 0x51, 0x00, 0x1e, 0x30,
0x40, 0x80, 0x37, 0x00, 0xbc, 0x86, 0x21, 0x00, 0x00, 0x1c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x4a
};
/*static unsigned int msi_mag321curv_dp_edid_len = 256;*/
/*
model: MAG321CURV
serial: DA2A019360041
HDR static metadata:
luminance 0.000000-366.801605, maxFALL 366.801605
metadata type1=yes
EOTF tSDR=yes, tHDR=yes, PQ=yes, HLG=no
default color primaries:
red: 0.640, 0.330
green: 0.300, 0.600
blue: 0.150, 0.060
default white: 0.313, 0.329
default gamma: 2.20
signal colorimetry: BT2020_cYCC BT2020_YCC BT2020_RGB
*/
/* *** */
static unsigned char qemu_edid[] = {
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x49, 0x14, 0x34, 0x12,
0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x01, 0x04, 0xa5, 0x20, 0x14, 0x78,
0x06, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, 0x0f, 0x50, 0x54, 0x21,
0x08, 0x00, 0xe1, 0xc0, 0xd1, 0xc0, 0xd1, 0x00, 0xa9, 0x40, 0xb3, 0x00,
0x95, 0x00, 0x81, 0x80, 0x81, 0x40, 0xea, 0x29, 0x00, 0xc0, 0x51, 0x20,
0x1c, 0x30, 0x40, 0x26, 0x44, 0x40, 0x45, 0xcb, 0x10, 0x00, 0x00, 0x18,
0x00, 0x00, 0x00, 0xf7, 0x00, 0x0a, 0x00, 0x40, 0x82, 0x00, 0x28, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x32,
0x7d, 0x1e, 0xa0, 0xff, 0x01, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x00, 0x00, 0x00, 0xfc, 0x00, 0x51, 0x45, 0x4d, 0x55, 0x20, 0x4d, 0x6f,
0x6e, 0x69, 0x74, 0x6f, 0x72, 0x0a, 0x01, 0x3a, 0x02, 0x03, 0x0b, 0x00,
0x46, 0x7d, 0x65, 0x60, 0x59, 0x1f, 0x61, 0x00, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x2f
};
/*static unsigned int qemu_edid_len = 256;*/
/* nothing hdr in qumu edid - it for sanity check */
/* *** */
static unsigned char hp_5dq99aa_hdmi_edid[] = {
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x22, 0x0e, 0x17, 0x36,
0x01, 0x01, 0x01, 0x01, 0x0c, 0x1d, 0x01, 0x03, 0x80, 0x3c, 0x22, 0x78,
0x2a, 0x63, 0x45, 0xaa, 0x53, 0x4a, 0xa4, 0x26, 0x0d, 0x50, 0x54, 0xa1,
0x08, 0x00, 0xd1, 0xc0, 0xa9, 0xc0, 0x81, 0xc0, 0xd1, 0x00, 0xb3, 0x00,
0x95, 0x00, 0xa9, 0x40, 0x81, 0x80, 0x56, 0x5e, 0x00, 0xa0, 0xa0, 0xa0,
0x29, 0x50, 0x30, 0x20, 0x35, 0x00, 0x55, 0x53, 0x21, 0x00, 0x00, 0x1a,
0x00, 0x00, 0x00, 0xfd, 0x00, 0x2e, 0x4b, 0x1e, 0x70, 0x1f, 0x00, 0x0a,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x48,
0x50, 0x20, 0x32, 0x37, 0x20, 0x51, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x20,
0x00, 0x00, 0x00, 0xff, 0x00, 0x43, 0x4e, 0x34, 0x39, 0x31, 0x32, 0x30,
0x4a, 0x36, 0x4e, 0x0a, 0x20, 0x20, 0x01, 0x20, 0x02, 0x03, 0x2d, 0xb1,
0x49, 0x10, 0x04, 0x03, 0x02, 0x1f, 0x13, 0x12, 0x11, 0x01, 0x67, 0x03,
0x0c, 0x00, 0x10, 0x00, 0x38, 0x3e, 0xe2, 0x00, 0x2b, 0x68, 0x1a, 0x00,
0x00, 0x01, 0x01, 0x2e, 0x4b, 0xed, 0xe3, 0x05, 0xe0, 0x00, 0xe6, 0x06,
0x07, 0x01, 0x73, 0x5a, 0x01, 0x02, 0x3a, 0x80, 0x18, 0x71, 0x38, 0x2d,
0x40, 0x58, 0x2c, 0x45, 0x00, 0x55, 0x53, 0x21, 0x00, 0x00, 0x1e, 0x02,
0x3a, 0x80, 0xd0, 0x72, 0x38, 0x2d, 0x40, 0x10, 0x2c, 0x45, 0x80, 0x55,
0x53, 0x21, 0x00, 0x00, 0x1e, 0xd9, 0x76, 0x00, 0xa0, 0xa0, 0xa0, 0x34,
0x50, 0x30, 0x20, 0x35, 0x00, 0x55, 0x53, 0x21, 0x00, 0x00, 0x1a, 0x2a,
0x44, 0x80, 0xa0, 0x70, 0x38, 0x27, 0x40, 0x30, 0x20, 0x35, 0x00, 0x55,
0x53, 0x21, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xa3
};
/*static unsigned int hp_5dq99aa_hdmi_edid_len = 256;*/
/*
make: HP Inc.
model: HP 27 QD
serial: CN49120J6N
HDR static metadata:
luminance 0.000093-603.665771, maxFALL 351.250427
metadata type1=yes
EOTF tSDR=yes, tHDR=yes, PQ=yes, HLG=no
default color primaries:
red: 0.665, 0.326
green: 0.289, 0.644
blue: 0.149, 0.051
default white: 0.313, 0.329
default gamma: 2.20
signal colorimetry: BT2020_cYCC BT2020_YCC BT2020_RGB
*/
static void
parse_simple(void)
{
xf86MonPtr mon = xf86InterpretEDID(0, samsung_q800t_hdmi2_0_edid);
mon->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
xf86DoInterpretHDRMetadata(mon);
assert(mon->hdr.colorimetry_profiles);
assert(mon->hdr.hdr_valid);
assert(mon->hdr.tf_4 == 0);
assert(mon->hdr.tf_5 == 0);
assert(mon->hdr.tf_traditional_sdr == 1);
assert(mon->hdr.tf_traditional_hdr == 0);
assert(mon->hdr.tf_pq == 1);
assert(mon->hdr.tf_hlg == 1);
assert(mon->hdr.desired_content_max_frame_avg_luminance == 0);
assert(mon->hdr.desired_content_max_luminance == 0);
assert(mon->hdr.desired_content_min_luminance == 0);
assert(mon->hdr.colorimetry_profiles == 0x0301);
assert(is_CTA_CDB_xvYCC601(mon->hdr.colorimetry_profiles));
assert(is_CTA_CDB_xvYCC709(mon->hdr.colorimetry_profiles));
free(mon);
// msi_mag321curv_dp_edid
mon = xf86InterpretEDID(0, msi_mag321curv_dp_edid);
mon->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
xf86DoInterpretHDRMetadata(mon);
assert(mon->hdr.colorimetry_profiles);
assert(mon->hdr.hdr_valid);
assert(mon->hdr.tf_4 == 0);
assert(mon->hdr.tf_5 == 0);
assert(mon->hdr.tf_traditional_sdr == 1);
assert(mon->hdr.tf_traditional_hdr == 1);
assert(mon->hdr.tf_pq == 1);
assert(mon->hdr.tf_hlg == 0);
assert(mon->hdr.desired_content_max_frame_avg_luminance == 366.801605f);
assert(mon->hdr.desired_content_max_luminance == 366.801605f);
assert(mon->hdr.desired_content_min_luminance == 0);
assert(is_CTA_CDB_xvYCC601(mon->hdr.colorimetry_profiles));
assert(is_CTA_CDB_xvYCC709(mon->hdr.colorimetry_profiles));
assert(is_CTA_CDB_BT2020_cYCC(mon->hdr.colorimetry_profiles));
assert(is_CTA_CDB_BT2020_YCC(mon->hdr.colorimetry_profiles));
assert(is_CTA_CDB_BT2020_RGB(mon->hdr.colorimetry_profiles));
assert(mon->hdr.colorimetry_profiles == 0xe301);
free(mon);
mon = xf86InterpretEDID(0, qemu_edid);
mon->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
assert(xf86DoInterpretHDRMetadata(mon) == false);
free(mon);
// hp_5dq99aa_hdmi_edid
mon = xf86InterpretEDID(0, hp_5dq99aa_hdmi_edid);
mon->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
xf86DoInterpretHDRMetadata(mon);
assert(mon->hdr.colorimetry_profiles);
assert(mon->hdr.hdr_valid);
assert(mon->hdr.tf_4 == 0);
assert(mon->hdr.tf_5 == 0);
assert(mon->hdr.tf_traditional_sdr == 1);
assert(mon->hdr.tf_traditional_hdr == 1);
assert(mon->hdr.tf_pq == 1);
assert(mon->hdr.tf_hlg == 0);
assert(mon->hdr.desired_content_max_frame_avg_luminance == 351.250427f);
assert(mon->hdr.desired_content_max_luminance == 603.665771f);
assert(mon->hdr.desired_content_min_luminance == 9.28359659e-05f);
assert(mon->hdr.colorimetry_profiles == 0xe000);
assert(is_CTA_CDB_xvYCC601(mon->hdr.colorimetry_profiles) == 0);
assert(is_CTA_CDB_xvYCC709(mon->hdr.colorimetry_profiles) == 0);
assert(is_CTA_CDB_BT2020_cYCC(mon->hdr.colorimetry_profiles));
assert(is_CTA_CDB_BT2020_YCC(mon->hdr.colorimetry_profiles));
assert(is_CTA_CDB_BT2020_RGB(mon->hdr.colorimetry_profiles));
free(mon);
}
const testfunc_t*
ddc_tests(void)
{
static const testfunc_t testfuncs[] = {
parse_simple,
NULL,
};
return testfuncs;
}