wsi/display: Accept 0 nits for HDR light level properties for "undefined"

CTA-861-G section 6.9.1 Static Metadata Type 1 declares that zero values
for different groups of HDR Metadata properties are allowed, including
zero nits values for max display mastering luminance, max content light
level, max frame-average light level and min display mastering luminance.

A zero value is meant to be treated by the video sink as "undefined" /
"unknown", and handled accordingly. This is common for dynamically
generated visual content.

Therefore don't assert on some minimum nits level > 0, but only check for
a non-negative level.

Fixes: b4176393a0 ("wsi/display: Implement VK_EXT_hdr_metadata on KHR_display swapchain")
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Autumn Ashton <misyl@froggi.es>
(cherry picked from commit 19dc09aded)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38432>
This commit is contained in:
Mario Kleiner 2025-10-15 00:42:47 +01:00 committed by Dylan Baker
parent f3268818d5
commit c4e0f4d917
2 changed files with 3 additions and 3 deletions

View file

@ -224,7 +224,7 @@
"description": "wsi/display: Accept 0 nits for HDR light level properties for \"undefined\"",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "b4176393a0aa5af547aa3f0ddfd03817e99a2588",
"notes": null

View file

@ -2582,7 +2582,7 @@ color_xy_to_u16(float v)
static inline uint16_t
nits_to_u16(float nits)
{
assert(nits >= 1.0f);
assert(nits >= 0.0f);
assert(nits <= 65535.0f);
/*
* CTA-861-G
@ -2596,7 +2596,7 @@ nits_to_u16(float nits)
static inline uint16_t
nits_to_u16_dark(float nits)
{
assert(nits >= 0.0001f);
assert(nits >= 0.0000f);
assert(nits <= 6.5535f);
/*
* CTA-861-G