Frog color management
The aim of this color management extension is to get HDR games working quickly, and have an easy way to test implementations in the wild before the upstream protocol is ready to be merged. For that purpose it's intentionally limited and cut down and does not serve all uses cases.
frog_color_management_factory_v1
The color management factory singleton creates color managed surface objects.
destroy()
get_color_managed_surface(surface: object<wl_surface>, callback: new_id<frog_color_managed_surface>)
Argument | Type | Description |
|---|---|---|
| surface | object<wl_surface> | target surface |
| callback | new_id<frog_color_managed_surface> | new color managed surface object |
frog_color_managed_surface
Interface for changing surface color management and HDR state.
An implementation must: support every part of the version of the frog_color_managed_surface interface it exposes. Including all known enums associated with a given version.
destroy()
Destroying the color managed surface resets all known color state for the surface back to 'undefined' implementation-specific values.
set_known_transfer_function(transfer_function: uint<frog_color_managed_surface.transfer_function>)
Argument | Type | Description |
|---|---|---|
| transfer_function | uint<frog_color_managed_surface.transfer_function> | transfer function for the surface |
set_known_container_color_volume(primaries: uint<frog_color_managed_surface.primaries>)
Argument | Type | Description |
|---|---|---|
| primaries | uint<frog_color_managed_surface.primaries> | primaries for the surface |
set_render_intent(render_intent: uint<frog_color_managed_surface.render_intent>)
Argument | Type | Description |
|---|---|---|
| render_intent | uint<frog_color_managed_surface.render_intent> | render intent for the surface |
NOTE: On a surface with "perceptual" (default) render intent, handling of the container's color volume is implementation-specific, and may differ between different transfer functions it is paired with: ie. sRGB + 709 rendering may have it's primaries widened to more of the available display's gamut to be be more pleasing for the viewer. Compared to scRGB Linear + 709 being treated faithfully as 709 (including utilizing negatives out of the 709 gamut triangle)
set_hdr_metadata(mastering_display_primary_red_x: uint, mastering_display_primary_red_y: uint, mastering_display_primary_green_x: uint, mastering_display_primary_green_y: uint, mastering_display_primary_blue_x: uint, mastering_display_primary_blue_y: uint, mastering_white_point_x: uint, mastering_white_point_y: uint, max_display_mastering_luminance: uint, min_display_mastering_luminance: uint, max_cll: uint, max_fall: uint)
Argument | Type | Description |
|---|---|---|
| mastering_display_primary_red_x | uint | red primary x coordinate Mastering Red Color Primary X Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| mastering_display_primary_red_y | uint | red primary y coordinate Mastering Red Color Primary Y Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| mastering_display_primary_green_x | uint | green primary x coordinate Mastering Green Color Primary X Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| mastering_display_primary_green_y | uint | green primary y coordinate Mastering Green Color Primary Y Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| mastering_display_primary_blue_x | uint | blue primary x coordinate Mastering Blue Color Primary X Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| mastering_display_primary_blue_y | uint | blue primary y coordinate Mastering Blue Color Primary Y Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| mastering_white_point_x | uint | white point x coordinate Mastering White Point X Coordinate of the Data. These are coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| mastering_white_point_y | uint | white point y coordinate Mastering White Point Y Coordinate of the Data. These are coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| max_display_mastering_luminance | uint | max display mastering luminance Max Mastering Display Luminance. This value is coded as an unsigned 16-bit value in units of 1 cd/m2, where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. |
| min_display_mastering_luminance | uint | min display mastering luminance Min Mastering Display Luminance. This value is coded as an unsigned 16-bit value in units of 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF represents 6.5535 cd/m2. |
| max_cll | uint | max content light level Max Content Light Level. This value is coded as an unsigned 16-bit value in units of 1 cd/m2, where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. |
| max_fall | uint | max frame average light level Max Frame Average Light Level. This value is coded as an unsigned 16-bit value in units of 1 cd/m2, where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. |
Forwards HDR metadata from the client to the compositor.
HDR Metadata Infoframe as per CTA 861.G spec.
Usage of this HDR metadata is implementation specific and outside of the scope of this protocol.
preferred_metadata(transfer_function: uint<frog_color_managed_surface.transfer_function>, output_display_primary_red_x: uint, output_display_primary_red_y: uint, output_display_primary_green_x: uint, output_display_primary_green_y: uint, output_display_primary_blue_x: uint, output_display_primary_blue_y: uint, output_white_point_x: uint, output_white_point_y: uint, max_luminance: uint, min_luminance: uint, max_full_frame_luminance: uint)
Argument | Type | Description |
|---|---|---|
| transfer_function | uint<frog_color_managed_surface.transfer_function> | output's current transfer function Specifies a known transfer function that corresponds to the output the surface is targeting. |
| output_display_primary_red_x | uint | red primary x coordinate Output Red Color Primary X Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| output_display_primary_red_y | uint | red primary y coordinate Output Red Color Primary Y Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| output_display_primary_green_x | uint | green primary x coordinate Output Green Color Primary X Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| output_display_primary_green_y | uint | green primary y coordinate Output Green Color Primary Y Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| output_display_primary_blue_x | uint | blue primary x coordinate Output Blue Color Primary X Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| output_display_primary_blue_y | uint | blue primary y coordinate Output Blue Color Primary Y Coordinate of the Data. Coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| output_white_point_x | uint | white point x coordinate Output White Point X Coordinate of the Data. These are coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| output_white_point_y | uint | white point y coordinate Output White Point Y Coordinate of the Data. These are coded as unsigned 16-bit values in units of 0.00002, where 0x0000 represents zero and 0xC350 represents 1.0000. |
| max_luminance | uint | maximum luminance Max Output Luminance The max luminance in nits that the output is capable of rendering in small areas. Content should: not exceed this value to avoid clipping. This value is coded as an unsigned 16-bit value in units of 1 cd/m2, where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. |
| min_luminance | uint | minimum luminance Min Output Luminance The min luminance that the output is capable of rendering. Content should: not exceed this value to avoid clipping. This value is coded as an unsigned 16-bit value in units of 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF represents 6.5535 cd/m2. |
| max_full_frame_luminance | uint | maximum full frame luminance Max Full Frame Luminance The max luminance in nits that the output is capable of rendering for the full frame sustained. This value is coded as an unsigned 16-bit value in units of 1 cd/m2, where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. |
Current preferred metadata for a surface. The application should use this information to tone-map its buffers to this target before committing.
This metadata does not necessarily correspond to any physical output, but rather what the compositor thinks would be best for a given surface.
transfer_function { undefined, srgb, gamma_22, st2084_pq, scrgb_linear }
Argument | Value | Description |
|---|---|---|
| undefined | 0 | specifies undefined, implementation-specific handling of the surface's transfer function. |
| srgb | 1 | specifies the sRGB non-linear EOTF. An implementation may: display this as Gamma 2.2 for the purposes of being consistent with content rendering across displays, rendering_intent and user expectations. |
| gamma_22 | 2 | specifies gamma 2.2 power curve as the EOTF |
| st2084_pq | 3 | specifies the SMPTE ST2084 Perceptual Quantizer (PQ) EOTF |
| scrgb_linear | 4 | specifies the scRGB (extended sRGB) linear EOTF. Note: Primaries outside the gamut triangle specified can be expressed with negative values for this transfer function. |
Extended information on the transfer functions described here can be found in the Khronos Data Format specification:
https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html
Argument | Value | Description |
|---|---|---|
| undefined | 0 | specifies undefined, implementation-specific handling |
| rec709 | 1 | specifies Rec.709/sRGB primaries with D65 white point |
| rec2020 | 2 | specifies Rec.2020/HDR10 primaries with D65 white point |
render_intent { perceptual }
Argument | Value | Description |
|---|---|---|
| perceptual | 0 | perceptual |
Extended information on render intents described here can be found in ICC.1:2022:
https://www.color.org/specification/ICC.1-2022-05.pdf
Compositor Support
| frog_color_management_factory_v1 | ↓ | ||
| Compositors | |||
| Cage | 0.3.0 | x | |
| COSMIC | 1.11.0 | x | |
| flakewm | 3.0.5 | x | |
| GameScope | 3.17.0 | x | |
| Hyprland | 0.57.2 | x | |
| Jay | 1.14.0 | x | |
| KWin | 6.7 | 1 | |
| Labwc | 0.20.2 | x | |
| Louvre | 2.14.1 | x | |
| Mango | 0.16.3 | x | |
| Mir | 2.26 | x | |
| Muffin | 6.7.4 | x | |
| Mutter | 51 | x | |
| niri | 26.04 | x | |
| phoc | 0.55 | x | |
| Pila | 0.5.1 | x | |
| Qtile | 0.37.1 | x | |
| river | 0.5.0 | x | |
| Sway | 1.11 | x | |
| Treeland | 0.8.0 | x | |
| Wayfire | 0.9.0 | x | |
| Weston | 15.0.1 | x | |
Copyright
Copyright © 2023 Joshua Ashton for Valve Software Copyright © 2023 Xaver Hugl
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 (including the next paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.