Copyright
Copyright 2019 Sebastian Wick
Copyright 2019 Erwin Burema
Copyright 2020 AMD
Copyright 2020 Collabora, Ltd.
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.
color management protocol
This protocol specifies a way for a client to set the color space and
HDR metadata of a surface and to get information about the color spaces
and HDR capabilities of outputs.
This protocol is based on a proposed upstream protocol, which we will migrate
to once it is approved. It may diverge from the proposed upstream protocol
over the course of our development.
Version 6
color manager singleton
A global interface used for getting color management surface and color
management output objects as well as creating color space objects from
ICC profiles, parameters, or enumerated names.
zcr_color_manager_v1
enum eotf_names {
unknown = 0,
linear = 1,
srgb = 2,
bt2087 = 3,
adobergb = 4,
pq = 5,
hlg = 6,
bt709 = 7,
extendedsrgb10 = 8,
smpte170m = 9,
smpte240m = 10,
smptest428_1 = 11,
log = 12,
log_sqrt = 13,
iec61966_2_4 = 14,
bt1361_ecg = 15,
bt2020_10 = 16,
bt2020_12 = 17,
scrgb_linear_80_nits = 18,
gamma18 = 19,
gamma28 = 20,
srgb_hdr = 21,
}- unknown — unknown EOTF
- linear — Linear transfer function
- srgb — sRGB transfer function
- bt2087 — BT.2087 transfer function
- adobergb — AdobeRGB transfer function
- pq — Perceptual quantizer / SMPTEST2084
- hlg — hybrid log gamma
Available since version 2
- bt709 — gamma for rec709 encoded videos
Available since version 2
- extendedsrgb10 — sRGB transfer function with headroom for HDR
Available since version 2
- smpte170m — SMPTE240M transfer function
Available since version 5
- smpte240m — SMPTE240M transfer function
Available since version 5
- smptest428_1 — SMPTEST428_1 transfer function
Available since version 5
- log — LOG transfer function
Available since version 5
- log_sqrt — LOG Sqrt transfer function
Available since version 5
- iec61966_2_4 — IEC61966_2_4 transfer function
Available since version 5
- bt1361_ecg — BT1361_ECG transfer function
Available since version 5
- bt2020_10 — BT2020_10 transfer function
Available since version 5
- bt2020_12 — BT2020_12 transfer function
Available since version 5
- scrgb_linear_80_nits — SCRGB Linear transfer function
Available since version 5
- gamma18 — GAMMA18 transfer function
Available since version 5
- gamma28 — GAMMA28 transfer function
Available since version 5
- srgb_hdr — sRGB transfer function
Available since version 6
well-known EOTF names
Names that describe a well-known EOTF.
A compositor must support all of these based on the protocol interface
version.
zcr_color_manager_v1
enum chromaticity_names {
unknown = 0,
bt601_525_line = 1,
bt601_625_line = 2,
smpte170m = 3,
bt709 = 4,
bt2020 = 5,
srgb = 6,
displayp3 = 7,
adobergb = 8,
wide_gamut_color_spin = 9,
bt470m = 10,
smpte240m = 11,
xyz_d50 = 12,
smptest428_1 = 13,
smptest431_2 = 14,
film = 15,
}- unknown — unknown chromaticity
- bt601_525_line — ITU-R BT.601 http://www.itu.int/rec/R-REC-BT.601/en
- bt601_625_line — ITU-R BT.601 http://www.itu.int/rec/R-REC-BT.601/en
- smpte170m — SMPTE 170M-1999 https://www.itu.int/rec/R-REC-BT.1700/en
- bt709 — ITU-R BT.709 https://www.itu.int/rec/R-REC-BT.709/en
- bt2020 — ITU-R BT.2020 http://www.itu.int/rec/R-REC-BT.2020/en
- srgb — IEC/4WD 61966-2-1: sRGB https://webstore.iec.ch/publication/6169
- displayp3 — Display P3 https://developer.apple.com/reference/coregraphics/cgcolorspace/1408916-displayp3
- adobergb — Adobe RGB https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
- wide_gamut_color_spin —
Available since version 5
- bt470m —
Available since version 5
- smpte240m —
Available since version 5
- xyz_d50 —
Available since version 5
- smptest428_1 —
Available since version 5
- smptest431_2 —
Available since version 5
- film —
Available since version 5
well-known chromaticity names
Names that describe well-known chromaticities.
A compositor must support all of these based on the protocol interface
version.
zcr_color_manager_v1
enum whitepoint_names {
unknown = 0,
dci = 1,
d50 = 2,
d65 = 3,
}- unknown — unknown whitepoint
- dci — DCI whitepoint
- d50 — D50 whitepoint
- d65 — D65 whitepoint
well-known whitepoint names
Names that describe well-known whitepoints.
A compositor must support all of these based on the protocol interface
version.
zcr_color_manager_v1
enum error {
icc_fd = 0,
bad_enum = 1,
bad_param = 2,
}- icc_fd — given ICC fd has bad properties
- bad_enum — bad value given as a well-known name
- bad_param — bad parameter value
zcr_color_manager_v1
request create_color_space_from_icc(
id: new_id<zcr_color_space_creator_v1>,
icc: fd,
)create a color space object from ICC profiles
Create a color space object from an ICC profile. This request returns
a zcr_color_space_creator_v1 object which either returns an error
or the successfully created zcr_color_space_v1 object.
The description of the color space to create is sent in the form of an
ICC profile as a file descriptor in the argument icc.
The fd must be seekable and the maximum size of the ICC profile is 4 MB.
Violating these requirements will raise an icc_fd protocol error. A
compositor must not modify the contents of the file, and the fd may be
sealed for writes and size changes.
The file contents must represent a valid ICC profile.
The ICC profile version must be 2 or 4, it must be a 3 channel profile
and the class must be 'input', 'output', 'abstract' or 'display'.
Violating these requirements will not result in a protocol error but
raise the zcr_color_space_creator_v1.error event.
See the zcr_color_space_v1 and zcr_color_space_creator_v1 interface for
more details about the created object.
See the specification from International Color Consortium for more
details about ICC profiles, also known as ISO 15076-1:2010.
zcr_color_manager_v1
request create_color_space_from_params(
id: new_id<zcr_color_space_creator_v1>,
eotf: uint<eotf_names>,
primary_r_x: uint,
primary_r_y: uint,
primary_g_x: uint,
primary_g_y: uint,
primary_b_x: uint,
primary_b_y: uint,
white_point_x: uint,
white_point_y: uint,
)- eotf — EOTF
- primary_r_x — red primary X * 10000
- primary_r_y — red primary Y * 10000
- primary_g_x — green primary X * 10000
- primary_g_y — green primary Y * 10000
- primary_b_x — blue primary X * 10000
- primary_b_y — blue primary Y * 10000
- white_point_x — white point X * 10000
- white_point_y — white point Y * 10000
create a color space object from parameters
[Deprecated] Create a color space object from parameters. This request returns
a zcr_color_space_creator_v1 object which either returns an error
or the successfully created zcr_color_space_v1 object.
EOTF must not be unknown. Otherwise, or if a given EOTF is not listed
in the enumeration, the protocol error bad_enum is raised.
The white point must be inside the triangle created by the red, green
and blue primaries. Otherwise the bad_param protocol error is raised.
All the chromaticity values are multiplied by 10000 to produce the
integers carried by the protocol.
See the zcr_color_space_v1 and zcr_color_space_creator_v1 interface for
more details about the created object. Use create_color_space_from_complete_params
instead.
zcr_color_manager_v1
enum matrix_names {
unknown = 0,
rgb = 1,
bt709 = 2,
bt2020_ncl = 3,
bt2020_cl = 4,
fcc = 5,
smpte170m = 6,
smpte240m = 7,
ydzdx = 8,
bt470bg = 9,
gbr = 10,
ycocg = 11,
}- unknown — Unknown range
- rgb — RGB matrix
- bt709 — BT709 matrix
- bt2020_ncl — BT2020_NCL matrix
- bt2020_cl — BT2020_CL matrix
- fcc — FCC matrix
- smpte170m — SMPTE170M matrix
- smpte240m — SMPTE240M matrix
- ydzdx — YDZDX matrix
Available since version 5
- bt470bg — BT470BG matrix
Available since version 5
- gbr — GBR matrix
Available since version 5
- ycocg — YCOCG matrix
Available since version 5
For specifying color matrices
Names that describe typical ColorSpace Matrix IDs
zcr_color_manager_v1
enum range_names {
unknown = 0,
limited = 1,
full = 2,
derived = 3,
}- unknown — Unknown range
- limited — Limited RGB color range (values from 16-235 for 8-bit)
- full — Full RGB color range (values from 0 to 255 for 8-bit)
- derived — Range is defined by EOTF/MatrixID
For specifying RGB ranges
Names that describe typical RGB value ranges.
zcr_color_manager_v1
request create_color_space_from_complete_params(
id: new_id<zcr_color_space_creator_v1>,
eotf: uint<eotf_names>,
matrix: uint<matrix_names>,
range: uint<range_names>,
primary_r_x: uint,
primary_r_y: uint,
primary_g_x: uint,
primary_g_y: uint,
primary_b_x: uint,
primary_b_y: uint,
white_point_x: uint,
white_point_y: uint,
)Available since version 3
- eotf — EOTF
- matrix — Color matrix
- range — Color range
- primary_r_x — red primary X * 10000
- primary_r_y — red primary Y * 10000
- primary_g_x — green primary X * 10000
- primary_g_y — green primary Y * 10000
- primary_b_x — blue primary X * 10000
- primary_b_y — blue primary Y * 10000
- white_point_x — white point X * 10000
- white_point_y — white point Y * 10000
create a color space object from parameters
Create a color space object from parameters. This request returns
a zcr_color_space_creator_v1 object which either returns an error
or the successfully created zcr_color_space_v1 object.
EOTF must not be unknown. Otherwise, or if a given EOTF is not listed
in the enumeration, the protocol error bad_enum is raised.
The white point must be inside the triangle created by the red, green
and blue primaries. Otherwise the bad_param protocol error is raised.
All the chromaticity values are multiplied by 10000 to produce the
integers carried by the protocol.
This request additionally includes matrix and range information.
See the zcr_color_space_v1 and zcr_color_space_creator_v1 interface for
more details about the created object.
Version 4
zcr_color_management_output_v1
event extended_dynamic_range(
value: uint,
)output extended dynamic range
This is both an initial event and sent whenever the value changed.
When the value changed, this event is followed by one wl_output.done
event common to output events across all extensions.
The extended dynamic range value describes how much dynamic range is
available relative to the SDR maximum white. EDR value is proportional
to luminance, and the luminance of black is used as the zero level.
A value of 1.0 means that the the display can not display
anything brighter than SDR maximum white. A value of 3.0 means that the
SDR maximum white is at one third of the highest luminance the display
can produce.
The absolute luminance of the SDR maximum white depends on the monitor
capabilities, the viewing conditions and the viewer personal
preferences. A such, it cannot be given a single value in cd/m².
Compositors using HDR video modes should allow users to control the the
SDR maximum white level which the output EDR value is calculated from.
The SDR maximum white is a relative reference luminance that allows
to tone-map content from different dynamic ranges into a single common
dynamic range for display.
The EDR value is multiplied by 1000 to produce the integer value
carried by the protocol.
Version 4
zcr_color_management_surface_v1
enum render_intent {
perceptual = 0,
relative = 1,
saturation = 2,
absolute = 3,
relative_bpc = 4,
}- perceptual — perceptual
- relative — media-relative colorimetric
- saturation — saturation
- absolute — ICC-absolute colorimetric
- relative_bpc — media-relative colorimetric + black point compensation
render intent
Rendering intent allow the client to hint at how to perform color space
transformations.
See the ICC specification for more details about rendering intent.
zcr_color_management_surface_v1
enum alpha_mode {
straight = 0,
premultiplied = 1,
}- straight — alpha is independent from color channels
- premultiplied — alpha is pre-multiplied into color channels
alpha mode
Specifies whether alpha is pre-multiplied into color channels or not.
If pre-multiplied, the linear alpha value is already multiplied with the
(non-linear) color channel code values in the color channels.
zcr_color_management_surface_v1
request set_alpha_mode(
alpha_mode: uint<alpha_mode>,
)set the surface alpha mode
Assuming an alpha channel exists, it is always linear. The alpha mode
determines whether the color channels include alpha pre-multiplied or
not. Using straight alpha might have performance benefits.
Alpha mode is double buffered, and will be applied at the time
wl_surface.commit of the corresponding wl_surface is called.
By default, a surface is assumed to have pre-multiplied alpha.
zcr_color_management_surface_v1
request set_extended_dynamic_range(
value: uint,
)set the content extended dynamic range
Set the extended dynamic range (EDR) value for the underlying surface.
The EDR value is double buffered, and will be applied at the time
wl_surface.commit of the corresponding wl_surface is called.
The EDR value describes how much dynamic range is encoded relative to
the SDR maximum white. EDR value is proportional to luminance, using
the luminance of black as the zero level. A value of 1.0 means that the
SDR maximum white is the highest possible luminance of the surface. A
value of 3.0 means that the SDR maximum white is one third of the
highest possible luminance of the surface.
The color space attached to the surface can make the code values in the
buffer non-linear in regards to the luminance. The code value to produce
a third of the luminance of the biggest code value therefore might not
be one third of the biggest code value.
For the definition of the SDR maximum white on an output, see
zcr_color_management_output_v1.extended_dynamic_range. Content
producers are free to choose their SDR maximum white level. How it
shall be displayed depends on the monitor capabilities and the output
EDR value.
By default the EDR value is 1.0. The compositor will tone map the image
to match the EDR of each output the surface is shown on. The aim for
the EDR-EDR mapping is to produce a relative luminance mapping that
looks equally good regardless of the viewing conditions and the monitor
capabilities, assuming the output EDR value was tuned to the output
capabilities and the viewing environment. There might be performance
and image quality benefits from providing content readily tone mapped to
the EDR value of the output the surface is shown on.
The EDR value is multiplied by 1000 to produce the integer value
carried by the protocol.
zcr_color_management_surface_v1
request set_color_space(
color_space: object<zcr_color_space_v1>,
render_intent: uint<render_intent>,
)- render_intent — render intent
set the surface color space
Set the color space of the underlying surface. The color space and
render intent are double buffered, and will be applied
at the time wl_surface.commit of the corresponding wl_surface is called.
The render intent gives the compositor a hint what to optimize for in
color space transformations.
By default, a surface is assumed to have the sRGB color space and an
arbitrary render intent.
If the color space of the surface matches the color space of an output
it is shown on the performance and color accuracy might improve. To find
those color spaces the client can listen to the preferred_color_space or
the wl_surface.enter/leave events. This improvement may require using
the color space object created by
zcr_color_management_output_v1.get_color_space.
Version 4
zcr_color_space_creator_v1
enum creation_error {
malformed_icc = 0x1,
bad_icc = 0x2,
bad_primaries = 0x4,
bad_whitepoint = 0x8,
}This is a bitfield
- malformed_icc — malformed ICC profile
- bad_icc — ICC profile does not meet requirements
- bad_primaries — bad primaries
- bad_whitepoint — bad whitepoint
color space creation error
Bitmask of errors which occured while trying to create a color space
Version 4
- error
- get_information — get information about the color space
- icc_file — ICC profile describing the color space
- names — well-known names of a color space
- params — RGB primaries along with whitepoint defining color space
- done — end of color space information
- destroy — destroy the color space
- complete_names — well-known names of a color space
- complete_params — RGB primaries along with whitepoint defining color space
zcr_color_space_v1
request get_information()
get information about the color space
As a reply to this request, the compositor will send all available
information events describing this color space object and finally
the 'done' event. Other extensions may define more events to be sent
before 'done'.
This request is allowed only on zcr_color_space_v1 objects where the
message that created the object specifies that get_information is
allowed. Otherwise protocol error no_information is raised.
Every get_information request on the same object will always return the
exact same data.
See zcr_color_management_output_v1.get_color_space and
zcr_color_space_creator_v1.created.
zcr_color_space_v1
event icc_file(
icc: fd,
icc_size: uint,
)- icc — ICC profile file descriptor
- icc_size — ICC profile size, in bytes
ICC profile describing the color space
This event may be sent only as a response to
zcr_color_space_v1.get_information.
The icc argument provides a file descriptor to the client which can be
memory-mapped to provide the ICC profile describing the color space.
The fd must be mapped with MAP_PRIVATE and read-only by the client.
Compositors should send this event always when information is requested.
ICC profiles provide the common foundation which all color managed
clients may rely on.
zcr_color_space_v1
event params(
eotf: uint<zcr_color_manager_v1.eotf_names>,
primary_r_x: uint,
primary_r_y: uint,
primary_g_x: uint,
primary_g_y: uint,
primary_b_x: uint,
primary_b_y: uint,
white_point_x: uint,
white_point_y: uint,
)- eotf — EOTF
- primary_r_x — red primary X * 10000
- primary_r_y — red primary Y * 10000
- primary_g_x — green primary X * 10000
- primary_g_y — green primary Y * 10000
- primary_b_x — blue primary X * 10000
- primary_b_y — blue primary Y * 10000
- white_point_x — white point X * 10000
- white_point_y — white point Y * 10000
RGB primaries along with whitepoint defining color space
[Deprecated] This event may be sent only as a response to
zcr_color_space_v1.get_information.
The RGB primary value arguments along with the whitepoint value arguments
and eotf can be used to define an arbitrary or custom color space.
The eotf enum contains well known names of that property, but the compositor
should not assume that all clients will understand those names. Use
complete_params instead.
zcr_color_space_v1
event complete_names(
eotf: uint<zcr_color_manager_v1.eotf_names>,
chromaticity: uint<zcr_color_manager_v1.chromaticity_names>,
whitepoint: uint<zcr_color_manager_v1.whitepoint_names>,
matrix: uint<zcr_color_manager_v1.matrix_names>,
range: uint<zcr_color_manager_v1.range_names>,
)Available since version 3
- eotf — EOTF
- chromaticity — chromaticity
- whitepoint — whitepoint
- matrix — Color matrix
- range — Color range
well-known names of a color space
This event may be sent only as a response to
zcr_color_space_v1.get_information.
EOTF, chromaticity, matrix, range and whitepoint contain well-known names of those
properties if available and unknown otherwise.
Compositors should not assume that all clients can understand these
names. The names are provided for client convenience. If a client
understands the name triplet, it may ignore other information about
the color space, the ICC profile for example.
zcr_color_space_v1
event complete_params(
eotf: uint<zcr_color_manager_v1.eotf_names>,
matrix: uint<zcr_color_manager_v1.matrix_names>,
range: uint<zcr_color_manager_v1.range_names>,
primary_r_x: uint,
primary_r_y: uint,
primary_g_x: uint,
primary_g_y: uint,
primary_b_x: uint,
primary_b_y: uint,
white_point_x: uint,
white_point_y: uint,
)Available since version 3
- eotf — EOTF
- matrix — Color matrix
- range — Color range
- primary_r_x — red primary X * 10000
- primary_r_y — red primary Y * 10000
- primary_g_x — green primary X * 10000
- primary_g_y — green primary Y * 10000
- primary_b_x — blue primary X * 10000
- primary_b_y — blue primary Y * 10000
- white_point_x — white point X * 10000
- white_point_y — white point Y * 10000
RGB primaries along with whitepoint defining color space
This event may be sent only as a response to
zcr_color_space_v1.get_information.
The RGB primary value arguments along with the whitepoint value arguments
and eotf can be used to define an arbitrary or custom color space.
The eotf enum contains well known names of that property, but the compositor
should not assume that all clients will understand those names.