Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color management getters/events #4131

Open
Ralith opened this issue Feb 20, 2025 · 3 comments
Open

Color management getters/events #4131

Ralith opened this issue Feb 20, 2025 · 3 comments
Labels
S - enhancement Wouldn't this be the coolest?

Comments

@Ralith
Copy link
Contributor

Ralith commented Feb 20, 2025

Description

Applications (e.g. games, image viewers, video players) capable of native HDR output may be able to provide better visuals by querying the compositor and/or display's color reproduction capabilities and state. Useful information includes, but is not limited to, the minimum and maximum luminance and the reference white level. For example, this can help a game ensure its UI is displayed at the same brightness as the user's desktop GUI elements, and help minimize clipping/distortion of out-of-range luminance.

On Wayland, this is available via the recently merged color-management-v1 extension, in particular wp_color_management_output_v1::get_image_description and wp_color_management_output_v1::image_description_changed. On Windows, the reference white level is available via QueryDisplayConfig with DISPLAYCONFIG_SDR_WHITE_LEVEL, and other data is available in DXGI_OUTPUT_DESC1, though I'm not sure if DXGI APIs are usable from winit.

Additional research is needed to determine the full scope of metadata that should be exposed (e.g. are primary chromaticities useful?) to avoid future churn. The Wayland protocol has had a lot of thought put into it and may be a good model, and also cites relevant standards also used in image/video formats.

Graphics APIs already expose mechanisms to declare the properties of HDR content that an application actually generates, independent of the display, e.g. VK_EXT_hdr_metadata, so perhaps no special support from winit is required there although e.g. Wayland does seem to also have similar functionality. It's not immediately obvious how the two different mechanisms for applications to advertise this info interact.

Relevant platforms

Windows, Wayland

@Ralith Ralith added the S - enhancement Wouldn't this be the coolest? label Feb 20, 2025
@kchibisov
Copy link
Member

I think it's a matter of a WSI you're using and not winit in particular, like the wayland color management protocol will be implemented in mesa, and thus will be available to you by its means.

@kchibisov
Copy link
Member

The hdr vulkan extension will work via the new wayland protocol on wayland. You can browse mesa PRs to see how it's done.

@Ralith
Copy link
Contributor Author

Ralith commented Feb 20, 2025

I think it's a matter of a WSI you're using and not winit in particular

I think winit has to be where the getters/event forwarding live. Graphics API WSIs don't expose properties of the display environment, only tools for declaring the properties of your own content.

The hdr vulkan extension will work via the new wayland protocol on wayland

Ahah, that makes sense, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S - enhancement Wouldn't this be the coolest?
Development

No branches or pull requests

2 participants