color_management_v1
- external
The aim of the color management extension is to allow clients to know the color properties of outputs, and to tell the compositor about the color properties of their content on surfaces. Doing this enables a compositor to perform automatic color management of content for different outputs according to how content is intended to look like.
The color properties are represented as an image description object which is immutable after it has been created. A wl_output always has an associated image description that clients can observe. A wl_surface always has an associated preferred image description as a hint chosen by the compositor that clients can also observe. Clients can set an image description on a wl_surface to denote the color characteristics of the surface contents.
An image description includes SDR and HDR colorimetry and encoding, HDR metadata, and viewing environment parameters. An image description does not include the properties set through color-representation extension. It is expected that the color-representation extension is used in conjunction with the color management extension when necessary, particularly with the YUV family of pixel formats.
Recommendation ITU-T H.273 "Coding-independent code points for video signal type identification" shall be referred to as simply H.273 here.
The color-and-hdr repository (https://gitlab.freedesktop.org/pq/color-and-hdr) contains background information on the protocol design and legacy color management. It also contains a glossary, learning resources for digital color, tools, samples and more.
The terminology used in this protocol is based on common color science and color encoding terminology where possible. The glossary in the color-and-hdr repository shall be the authority on the definition of terms in this protocol.
Warning! The protocol described in this file is currently in the testing phase. Backward compatible changes may be added together with the corresponding interface version bump. Backward incompatible changes can only be done by creating a new major version of the extension.
wp_color_manager_v1
A singleton global interface used for getting color management extensions for wl_surface and wl_output objects, and for creating client defined image description objects. The extension interfaces allow getting the image description of outputs and setting the image description of surfaces.
Compositors should never remove this global.
destroy()
Destroy the wp_color_manager_v1 object. This does not affect any other objects in any way.
get_output(id: new_id<wp_color_management_output_v1>, output: object<wl_output>)
Argument | Type | Description |
---|---|---|
id | new_id<wp_color_management_output_v1> | |
output | object<wl_output> |
This creates a new wp_color_management_output_v1 object for the given wl_output.
See the wp_color_management_output_v1 interface for more details.
get_surface(id: new_id<wp_color_management_surface_v1>, surface: object<wl_surface>)
Argument | Type | Description |
---|---|---|
id | new_id<wp_color_management_surface_v1> | |
surface | object<wl_surface> |
If a wp_color_management_surface_v1 object already exists for the given wl_surface, the protocol error surface_exists is raised.
This creates a new color wp_color_management_surface_v1 object for the given wl_surface.
See the wp_color_management_surface_v1 interface for more details.
get_surface_feedback(id: new_id<wp_color_management_surface_feedback_v1>, surface: object<wl_surface>)
Argument | Type | Description |
---|---|---|
id | new_id<wp_color_management_surface_feedback_v1> | |
surface | object<wl_surface> |
This creates a new color wp_color_management_surface_feedback_v1 object for the given wl_surface.
See the wp_color_management_surface_feedback_v1 interface for more details.
create_icc_creator(obj: new_id<wp_image_description_creator_icc_v1>)
Argument | Type | Description |
---|---|---|
obj | new_id<wp_image_description_creator_icc_v1> | the new creator object |
Makes a new ICC-based image description creator object with all properties initially unset. The client can then use the object's interface to define all the required properties for an image description and finally create a wp_image_description_v1 object.
This request can be used when the compositor advertises wp_color_manager_v1.feature.icc_v2_v4. Otherwise this request raises the protocol error unsupported_feature.
create_parametric_creator(obj: new_id<wp_image_description_creator_params_v1>)
Argument | Type | Description |
---|---|---|
obj | new_id<wp_image_description_creator_params_v1> | the new creator object |
Makes a new parametric image description creator object with all properties initially unset. The client can then use the object's interface to define all the required properties for an image description and finally create a wp_image_description_v1 object.
This request can be used when the compositor advertises wp_color_manager_v1.feature.parametric. Otherwise this request raises the protocol error unsupported_feature.
create_windows_scrgb(image_description: new_id<wp_image_description_v1>)
Argument | Type | Description |
---|---|---|
image_description | new_id<wp_image_description_v1> |
This creates a pre-defined image description for the so-called Windows-scRGB stimulus encoding. This comes from the Windows 10 handling of its own definition of an scRGB color space for an HDR screen driven in BT.2100/PQ signalling mode.
Windows-scRGB uses sRGB (BT.709) color primaries and white point. The transfer characteristic is extended linear.
The nominal color channel value range is extended, meaning it includes negative and greater than 1.0 values. Negative values are used to escape the sRGB color gamut boundaries. To make use of the extended range, the client needs to use a pixel format that can represent those values, e.g. floating-point 16 bits per channel.
Nominal color value R=G=B=0.0 corresponds to BT.2100/PQ system 0 cd/m², and R=G=B=1.0 corresponds to BT.2100/PQ system 80 cd/m². The maximum is R=G=B=125.0 corresponding to 10k cd/m².
Windows-scRGB is displayed by Windows 10 by converting it to BT.2100/PQ, maintaining the CIE 1931 chromaticity and mapping the luminance as above. No adjustment is made to the signal to account for the viewing conditions.
The reference white level of Windows-scRGB is unknown. If a reference white level must be assumed for compositor processing, it should be R=G=B=2.5375 corresponding to 203 cd/m² of Report ITU-R BT.2408-7.
The target color volume of Windows-scRGB is unknown. The color gamut may be anything between sRGB and BT.2100.
Note: EGL_EXT_gl_colorspace_scrgb_linear definition differs from Windows-scRGB by using R=G=B=1.0 as the reference white level, while Windows-scRGB reference white level is unknown or varies. However, it seems probable that Windows implements both EGL_EXT_gl_colorspace_scrgb_linear and Vulkan VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT as Windows-scRGB.
This request can be used when the compositor advertises wp_color_manager_v1.feature.windows_scrgb. Otherwise this request raises the protocol error unsupported_feature.
The resulting image description object does not allow get_information request. The wp_image_description_v1.ready event shall be sent.
get_image_description(image_description: new_id<wp_image_description_v1>, reference: object<wp_image_description_reference_v1>)
Argument | Type | Description |
---|---|---|
image_description | new_id<wp_image_description_v1> | |
reference | object<wp_image_description_reference_v1> |
This request retrieves the image description backing a reference.
The get_information request can be used if and only if the request that creates the reference allows it.
supported_intent(render_intent: uint<wp_color_manager_v1.render_intent>)
Argument | Type | Description |
---|---|---|
render_intent | uint<wp_color_manager_v1.render_intent> | rendering intent |
When this object is created, it shall immediately send this event once for each rendering intent the compositor supports.
supported_feature(feature: uint<wp_color_manager_v1.feature>)
Argument | Type | Description |
---|---|---|
feature | uint<wp_color_manager_v1.feature> | supported feature |
When this object is created, it shall immediately send this event once for each compositor supported feature listed in the enumeration.
supported_tf_named(tf: uint<wp_color_manager_v1.transfer_function>)
Argument | Type | Description |
---|---|---|
tf | uint<wp_color_manager_v1.transfer_function> | Named transfer function |
When this object is created, it shall immediately send this event once for each named transfer function the compositor supports with the parametric image description creator.
supported_primaries_named(primaries: uint<wp_color_manager_v1.primaries>)
Argument | Type | Description |
---|---|---|
primaries | uint<wp_color_manager_v1.primaries> | Named color primaries |
When this object is created, it shall immediately send this event once for each named set of primaries the compositor supports with the parametric image description creator.
done()
This event is sent when all supported rendering intents, features, transfer functions and named primaries have been sent.
error { unsupported_feature, surface_exists }
Argument | Value | Description |
---|---|---|
unsupported_feature | 0 | request not supported |
surface_exists | 1 | color management surface exists already |
render_intent { perceptual, relative, saturation, absolute, relative_bpc }
Argument | Value | Description |
---|---|---|
perceptual | 0 | perceptual |
relative | 1 | media-relative colorimetric |
saturation | 2 | saturation |
absolute | 3 | ICC-absolute colorimetric |
relative_bpc | 4 | media-relative colorimetric + black point compensation |
See the ICC.1:2022 specification from the International Color Consortium for more details about rendering intents.
The principles of ICC defined rendering intents apply with all types of image descriptions, not only those with ICC file profiles.
Compositors must support the perceptual rendering intent. Other rendering intents are optional.
feature { icc_v2_v4, parametric, set_primaries, set_tf_power, set_luminances, set_mastering_display_primaries, extended_target_volume, windows_scrgb }
Argument | Value | Description |
---|---|---|
icc_v2_v4 | 0 | create_icc_creator request |
parametric | 1 | create_parametric_creator request |
set_primaries | 2 | parametric set_primaries request |
set_tf_power | 3 | parametric set_tf_power request |
set_luminances | 4 | parametric set_luminances request |
set_mastering_display_primaries | 5 | parametric set_mastering_display_primaries request The compositor supports set_mastering_display_primaries request with a target color volume fully contained inside the primary color volume. |
extended_target_volume | 6 | parametric target exceeds primary color volume The compositor additionally supports target color volumes that extend outside of the primary color volume. This can only be advertised if feature set_mastering_display_primaries is supported as well. |
windows_scrgb | 7 | create_windows_scrgb request |
primaries { srgb, pal_m, pal, ntsc, generic_film, bt2020, cie1931_xyz, dci_p3, display_p3, adobe_rgb }
Argument | Value | Description |
---|---|---|
srgb | 1 | Color primaries for the sRGB color space as defined by the BT.709 standard Color primaries as defined by |
pal_m | 2 | Color primaries for PAL-M as defined by the BT.470 standard Color primaries as defined by |
pal | 3 | Color primaries for PAL as defined by the BT.601 standard Color primaries as defined by |
ntsc | 4 | Color primaries for NTSC as defined by the BT.601 standard Color primaries as defined by |
generic_film | 5 | Generic film with colour filters using Illuminant C Color primaries as defined by H.273 for generic film. Equivalent to H.273 ColourPrimaries code point 8. |
bt2020 | 6 | Color primaries as defined by the BT.2020 and BT.2100 standard Color primaries as defined by |
cie1931_xyz | 7 | Color primaries of the full CIE 1931 XYZ color space Color primaries as defined as the maximum of the CIE 1931 XYZ color space by |
dci_p3 | 8 | Color primaries of the DCI P3 color space as defined by the SMPTE RP 431 standard Color primaries as defined by Digital Cinema System and published in SMPTE RP 431-2 (2011). Equivalent to H.273 ColourPrimaries code point 11. |
display_p3 | 9 | Color primaries of Display P3 variant of the DCI-P3 color space as defined by the SMPTE EG 432 standard Color primaries as defined by Digital Cinema System and published in SMPTE EG 432-1 (2010). Equivalent to H.273 ColourPrimaries code point 12. |
adobe_rgb | 10 | Color primaries of the Adobe RGB color space as defined by the ISO 12640 standard Color primaries as defined by Adobe as "Adobe RGB" and later published by ISO 12640-4 (2011). |
Named color primaries used to encode well-known sets of primaries. H.273 is the authority, when it comes to the exact values of primaries and authoritative specifications, where an equivalent code point exists.
A value of 0 is invalid and will never be present in the list of enums.
Descriptions do list the specifications for convenience.
transfer_function { bt1886, gamma22, gamma28, st240, ext_linear, log_100, log_316, xvycc, srgb, ext_srgb, st2084_pq, st428, hlg }
Argument | Value | Description |
---|---|---|
bt1886 | 1 | BT.1886 display transfer characteristic Rec. ITU-R BT.1886 is the display transfer characteristic assumed by
This TF implies these default luminances from Rec. ITU-R BT.2035: |
gamma22 | 2 | Assumed display gamma 2.2 transfer function Transfer characteristics as defined by
Note: an sRGB display (IEC 61966-2-1) uses this transfer function. |
gamma28 | 3 | Assumed display gamma 2.8 transfer function Transfer characteristics as defined by |
st240 | 4 | SMPTE ST 240 transfer function Transfer characteristics as defined by |
ext_linear | 5 | extended linear transfer function Linear transfer function defined over all real numbers. Normalised electrical values are equal the normalised optical values. The differences to H.273 TransferCharacteristics code point 8 are the definition over all real numbers. |
log_100 | 6 | logarithmic 100:1 transfer function Logarithmic transfer characteristic (100:1 range). Equivalent to H.273 TransferCharacteristics code point 9. |
log_316 | 7 | logarithmic (100*Sqrt(10) : 1) transfer function Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range). Equivalent to H.273 TransferCharacteristics code point 10. |
xvycc | 8 | IEC 61966-2-4 transfer function Transfer characteristics as defined by |
srgb | 9 | sRGB piece-wise transfer function Transfer characteristics as defined by
Note: This is not appropriate for describing sRGB material. sRGB material is intended to be viewed on an sRGB display, and that is described by gamma22. |
ext_srgb | 10 | Extended sRGB piece-wise transfer function Transfer characteristics as defined by |
st2084_pq | 11 | perceptual quantizer transfer function Transfer characteristics as defined by
This TF implies these default luminances
The difference between the primary color volume minimum and maximum must be approximately 10000 cd/m² as that is the swing of the EOTF defined by ST 2084 and BT.2100. The default value for the reference white is a protocol addition: it is suggested by Report ITU-R BT.2408-7 and is not part of ST 2084 or BT.2100. |
st428 | 12 | SMPTE ST 428 transfer function Transfer characteristics as defined by |
hlg | 13 | hybrid log-gamma transfer function Transfer characteristics as defined by
This TF implies these default luminances
HLG is a relative display-referred signal with a specified non-linear mapping to the display peak luminance (the HLG OOTF). All absolute luminance values used here for HLG assume a 1000 cd/m² peak display. The default value for the reference white is a protocol addition: it is suggested by Report ITU-R BT.2408-7 and is not part of ARIB STD-B67 or BT.2100. |
Named transfer functions used to represent well-known transfer characteristics. H.273 is the authority, when it comes to the exact formulas and authoritative specifications, where an equivalent code point exists.
A value of 0 is invalid and will never be present in the list of enums.
Descriptions do list the specifications for convenience.
wp_color_management_output_v1
A wp_color_management_output_v1 describes the color properties of an output.
The wp_color_management_output_v1 is associated with the wl_output global underlying the wl_output object. Therefore the client destroying the wl_output object has no impact, but the compositor removing the output global makes the wp_color_management_output_v1 object inert.
destroy()
Destroy the color wp_color_management_output_v1 object. This does not affect any remaining protocol objects.
get_image_description(image_description: new_id<wp_image_description_v1>)
Argument | Type | Description |
---|---|---|
image_description | new_id<wp_image_description_v1> |
This creates a new wp_image_description_v1 object for the current image description of the output. There always is exactly one image description active for an output so the client should destroy the image description created by earlier invocations of this request. This request is usually sent as a reaction to the image_description_changed event or when creating a wp_color_management_output_v1 object.
The image description of an output represents the color encoding the output expects. There might be performance and power advantages, as well as improved color reproduction, if a content update matches the image description of the output it is being shown on. If a content update is shown on any other output than the one it matches the image description of, then the color reproduction on those outputs might be considerably worse.
The created wp_image_description_v1 object preserves the image description of the output from the time the object was created.
The resulting image description object allows get_information request.
If this protocol object is inert, the resulting image description object shall immediately deliver the wp_image_description_v1.failed event with the no_output cause.
If the interface version is inadequate for the output's image description, meaning that the client does not support all the events needed to deliver the crucial information, the resulting image description object shall immediately deliver the wp_image_description_v1.failed event with the low_version cause.
Otherwise the object shall immediately deliver the ready event.
image_description_changed()
This event is sent whenever the image description of the output changed, followed by one wl_output.done event common to output events across all extensions.
If the client wants to use the updated image description, it needs to do get_image_description again, because image description objects are immutable.
wp_color_management_surface_v1
A wp_color_management_surface_v1 allows the client to set the color space and HDR properties of a surface.
If the wl_surface associated with the wp_color_management_surface_v1 is destroyed, the wp_color_management_surface_v1 object becomes inert.
destroy()
Destroy the wp_color_management_surface_v1 object and do the same as unset_image_description.
set_image_description(image_description: object<wp_image_description_v1>, render_intent: uint<wp_color_manager_v1.render_intent>)
Argument | Type | Description |
---|---|---|
image_description | object<wp_image_description_v1> | |
render_intent | uint<wp_color_manager_v1.render_intent> | rendering intent |
If this protocol object is inert, the protocol error inert is raised.
Set the image description of the underlying surface. The image description and rendering intent are double-buffered state, see wl_surface.commit.
It is the client's responsibility to understand the image description it sets on a surface, and to provide content that matches that image description. Compositors might convert images to match their own or any other image descriptions.
Image descriptions which are not ready (see wp_image_description_v1) are forbidden in this request, and in such case the protocol error image_description is raised.
All image descriptions which are ready (see wp_image_description_v1) are allowed and must always be accepted by the compositor.
A rendering intent provides the client's preference on how content colors should be mapped to each output. The render_intent value must be one advertised by the compositor with wp_color_manager_v1.render_intent event, otherwise the protocol error render_intent is raised.
When an image description is set on a surface, the Transfer Characteristics of the image description defines the valid range of the nominal (real-valued) color channel values. The processing of out-of-range color channel values is undefined, but compositors are recommended to clamp the values to the valid range when possible.
By default, a surface does not have an associated image description nor a rendering intent. The handling of color on such surfaces is compositor implementation defined. Compositors should handle such surfaces as sRGB, but may handle them differently if they have specific requirements.
Setting the image description has copy semantics; after this request, the image description can be immediately destroyed without affecting the pending state of the surface.
unset_image_description()
If this protocol object is inert, the protocol error inert is raised.
This request removes any image description from the surface. See set_image_description for how a compositor handles a surface without an image description. This is double-buffered state, see wl_surface.commit.
error { render_intent, image_description, inert }
Argument | Value | Description |
---|---|---|
render_intent | 0 | unsupported rendering intent |
image_description | 1 | invalid image description |
inert | 2 | forbidden request on inert object |
A wp_color_management_surface_feedback_v1 allows the client to get the preferred image description of a surface.
If the wl_surface associated with this object is destroyed, the wp_color_management_surface_feedback_v1 object becomes inert.
destroy()
Destroy the wp_color_management_surface_feedback_v1 object.
get_preferred(image_description: new_id<wp_image_description_v1>)
Argument | Type | Description |
---|---|---|
image_description | new_id<wp_image_description_v1> |
If this protocol object is inert, the protocol error inert is raised.
The preferred image description represents the compositor's preferred color encoding for this wl_surface at the current time. There might be performance and power advantages, as well as improved color reproduction, if the image description of a content update matches the preferred image description.
This creates a new wp_image_description_v1 object for the currently preferred image description for the wl_surface. The client should stop using and destroy the image descriptions created by earlier invocations of this request for the associated wl_surface. This request is usually sent as a reaction to the preferred_changed event or when creating a wp_color_management_surface_feedback_v1 object if the client is capable of adapting to image descriptions.
The created wp_image_description_v1 object preserves the preferred image description of the wl_surface from the time the object was created.
The resulting image description object allows get_information request.
If the image description is parametric, the client should set it on its wl_surface only if the image description is an exact match with the client content. Particularly if everything else matches, but the target color volume is greater than what the client needs, the client should create its own parameric image description with its exact parameters.
If the interface version is inadequate for the preferred image description, meaning that the client does not support all the events needed to deliver the crucial information, the resulting image description object shall immediately deliver the wp_image_description_v1.failed event with the low_version cause, otherwise the object shall immediately deliver the ready event.
get_preferred_parametric(image_description: new_id<wp_image_description_v1>)
Argument | Type | Description |
---|---|---|
image_description | new_id<wp_image_description_v1> |
The same description as for get_preferred applies, except the returned image description is guaranteed to be parametric. This is meant for clients that can only deal with parametric image descriptions.
If the compositor doesn't support parametric image descriptions, the unsupported_feature error is emitted.
preferred_changed(identity: uint)
Argument | Type | Description |
---|---|---|
identity | uint | image description id number |
The preferred image description is the one which likely has the most performance and/or quality benefits for the compositor if used by the client for its wl_surface contents. This event is sent whenever the compositor changes the wl_surface's preferred image description.
This event sends the identity of the new preferred state as the argument, so clients who are aware of the image description already can reuse it. Otherwise, if the client client wants to know what the preferred image description is, it shall use the get_preferred request.
The preferred image description is not automatically used for anything. It is only a hint, and clients may set any valid image description with set_image_description, but there might be performance and color accuracy improvements by providing the wl_surface contents in the preferred image description. Therefore clients that can, should render according to the preferred image description
error { inert, unsupported_feature }
Argument | Value | Description |
---|---|---|
inert | 0 | forbidden request on inert object |
unsupported_feature | 1 | attempted to use an unsupported feature |
wp_image_description_creator_icc_v1
This type of object is used for collecting all the information required to create a wp_image_description_v1 object from an ICC file. A complete set of required parameters consists of these properties:
- ICC file
Each required property must be set exactly once if the client is to create an image description. The set requests verify that a property was not already set. The create request verifies that all required properties are set. There may be several alternative requests for setting each property, and in that case the client must choose one of them.
Once all properties have been set, the create request must be used to create the image description object, destroying the creator in the process.
create(image_description: new_id<wp_image_description_v1>)
Argument | Type | Description |
---|---|---|
image_description | new_id<wp_image_description_v1> |
Create an image description object based on the ICC information previously set on this object. A compositor must parse the ICC data in some undefined but finite amount of time.
The completeness of the parameter set is verified. If the set is not complete, the protocol error incomplete_set is raised. For the definition of a complete set, see the description of this interface.
If the particular combination of the information is not supported by the compositor, the resulting image description object shall immediately deliver the wp_image_description_v1.failed event with the 'unsupported' cause. If a valid image description was created from the information, the wp_image_description_v1.ready event will eventually be sent instead.
This request destroys the wp_image_description_creator_icc_v1 object.
The resulting image description object does not allow get_information request.
set_icc_file(icc_profile: fd, offset: uint, length: uint)
Argument | Type | Description |
---|---|---|
icc_profile | fd | ICC profile |
offset | uint | byte offset in fd to start of ICC data |
length | uint | length of ICC data in bytes |
Sets the ICC profile file to be used as the basis of the image description.
The data shall be found through the given fd at the given offset, having the given length. The fd must be seekable and readable. Violating these requirements raises the bad_fd protocol error.
If reading the data fails due to an error independent of the client, the compositor shall send the wp_image_description_v1.failed event on the created wp_image_description_v1 with the 'operating_system' cause.
The maximum size of the ICC profile is 32 MB. If length is greater than that or zero, the protocol error bad_size is raised. If offset + length exceeds the file size, the protocol error out_of_file is raised.
A compositor may read the file at any time starting from this request and only until whichever happens first:
- If create request was issued, the wp_image_description_v1 object delivers either failed or ready event; or
- if create request was not issued, this wp_image_description_creator_icc_v1 object is destroyed.
A compositor shall not modify the contents of the file, and the fd may be sealed for writes and size changes. The client must ensure to its best ability that the data does not change while the compositor is reading it.
The data 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 Display or ColorSpace. Violating these requirements will not result in a protocol error, but will eventually send the wp_image_description_v1.failed event on the created wp_image_description_v1 with the 'unsupported' cause.
See the International Color Consortium specification ICC.1:2022 for more details about ICC profiles.
If ICC file has already been set on this object, the protocol error already_set is raised.
error { incomplete_set, already_set, bad_fd, bad_size, out_of_file }
Argument | Value | Description |
---|---|---|
incomplete_set | 0 | incomplete parameter set |
already_set | 1 | property already set |
bad_fd | 2 | fd not seekable and readable |
bad_size | 3 | no or too much data |
out_of_file | 4 | offset + length exceeds file size |
This type of object is used for collecting all the parameters required to create a wp_image_description_v1 object. A complete set of required parameters consists of these properties:
- transfer characteristic function (tf)
- chromaticities of primaries and white point (primary color volume)
The following properties are optional and have a well-defined default if not explicitly set:
- primary color volume luminance range
- reference white luminance level
- mastering display primaries and white point (target color volume)
- mastering luminance range
The following properties are optional and will be ignored if not explicitly set:
- maximum content light level
- maximum frame-average light level
Each required property must be set exactly once if the client is to create an image description. The set requests verify that a property was not already set. The create request verifies that all required properties are set. There may be several alternative requests for setting each property, and in that case the client must choose one of them.
Once all properties have been set, the create request must be used to create the image description object, destroying the creator in the process.
create(image_description: new_id<wp_image_description_v1>)
Argument | Type | Description |
---|---|---|
image_description | new_id<wp_image_description_v1> |
Create an image description object based on the parameters previously set on this object.
The completeness of the parameter set is verified. If the set is not complete, the protocol error incomplete_set is raised. For the definition of a complete set, see the description of this interface.
The protocol error invalid_luminance is raised if any of the following requirements is not met:
- When max_cll is set, it must be greater than min L and less or equal to max L of the mastering luminance range.
- When max_fall is set, it must be greater than min L and less or equal to max L of the mastering luminance range.
- When both max_cll and max_fall are set, max_fall must be less or equal to max_cll.
If the particular combination of the parameter set is not supported by the compositor, the resulting image description object shall immediately deliver the wp_image_description_v1.failed event with the 'unsupported' cause. If a valid image description was created from the parameter set, the wp_image_description_v1.ready event will eventually be sent instead.
This request destroys the wp_image_description_creator_params_v1 object.
The resulting image description object does not allow get_information request.
set_tf_named(tf: uint<wp_color_manager_v1.transfer_function>)
Argument | Type | Description |
---|---|---|
tf | uint<wp_color_manager_v1.transfer_function> | named transfer function |
Sets the transfer characteristic using explicitly enumerated named functions.
When the resulting image description is attached to an image, the content should be decoded according to the industry standard practices for the transfer characteristic.
Only names advertised with wp_color_manager_v1 event supported_tf_named are allowed. Other values shall raise the protocol error invalid_tf.
If transfer characteristic has already been set on this object, the protocol error already_set is raised.
set_tf_power(eexp: uint)
Argument | Type | Description |
---|---|---|
eexp | uint | the exponent * 10000 |
Sets the color component transfer characteristic to a power curve with the given exponent. Negative values are handled by mirroring the positive half of the curve through the origin. The valid domain and range of the curve are all finite real numbers. This curve represents the conversion from electrical to optical color channel values.
The curve exponent shall be multiplied by 10000 to get the argument eexp value to carry the precision of 4 decimals.
The curve exponent must be at least 1.0 and at most 10.0. Otherwise the protocol error invalid_tf is raised.
If transfer characteristic has already been set on this object, the protocol error already_set is raised.
This request can be used when the compositor advertises wp_color_manager_v1.feature.set_tf_power. Otherwise this request raises the protocol error unsupported_feature.
set_primaries_named(primaries: uint<wp_color_manager_v1.primaries>)
Argument | Type | Description |
---|---|---|
primaries | uint<wp_color_manager_v1.primaries> | named primaries |
Sets the color primaries and white point using explicitly named sets. This describes the primary color volume which is the basis for color value encoding.
Only names advertised with wp_color_manager_v1 event supported_primaries_named are allowed. Other values shall raise the protocol error invalid_primaries_named.
If primaries have already been set on this object, the protocol error already_set is raised.
Argument | Type | Description |
---|---|---|
r_x | int | Red x * 1M |
r_y | int | Red y * 1M |
g_x | int | Green x * 1M |
g_y | int | Green y * 1M |
b_x | int | Blue x * 1M |
b_y | int | Blue y * 1M |
w_x | int | White x * 1M |
w_y | int | White y * 1M |
Sets the color primaries and white point using CIE 1931 xy chromaticity coordinates. This describes the primary color volume which is the basis for color value encoding.
Each coordinate value is multiplied by 1 million to get the argument value to carry precision of 6 decimals.
If primaries have already been set on this object, the protocol error already_set is raised.
This request can be used if the compositor advertises wp_color_manager_v1.feature.set_primaries. Otherwise this request raises the protocol error unsupported_feature.
set_luminances(min_lum: uint, max_lum: uint, reference_lum: uint)
Argument | Type | Description |
---|---|---|
min_lum | uint | minimum luminance (cd/m²) * 10000 |
max_lum | uint | maximum luminance (cd/m²) |
reference_lum | uint | reference white luminance (cd/m²) |
Sets the primary color volume luminance range and the reference white luminance level. These values include the minimum display emission and ambient flare luminances, assumed to be optically additive and have the chromaticity of the primary color volume white point.
The default luminances from https://www.color.org/chardata/rgb/srgb.xalter are
- primary color volume minimum: 0.2 cd/m²
- primary color volume maximum: 80 cd/m²
- reference white: 80 cd/m²
Setting a named transfer characteristic can imply other default luminances.
The default luminances get overwritten when this request is used. With transfer_function.st2084_pq the given 'max_lum' value is ignored, and 'max_lum' is taken as 'min_lum' + 10000 cd/m².
'min_lum' and 'max_lum' specify the minimum and maximum luminances of the primary color volume as reproduced by the targeted display.
'reference_lum' specifies the luminance of the reference white as reproduced by the targeted display, and reflects the targeted viewing environment.
Compositors should make sure that all content is anchored, meaning that an input signal level of 'reference_lum' on one image description and another input signal level of 'reference_lum' on another image description should produce the same output level, even though the 'reference_lum' on both image representations can be different.
'reference_lum' may be higher than 'max_lum'. In that case reaching the reference white output level in image content requires the 'extended_target_volume' feature support.
If 'max_lum' or 'reference_lum' are less than or equal to 'min_lum', the protocol error invalid_luminance is raised.
The minimum luminance is multiplied by 10000 to get the argument 'min_lum' value and carries precision of 4 decimals. The maximum luminance and reference white luminance values are unscaled.
If the primary color volume luminance range and the reference white luminance level have already been set on this object, the protocol error already_set is raised.
This request can be used if the compositor advertises wp_color_manager_v1.feature.set_luminances. Otherwise this request raises the protocol error unsupported_feature.
set_mastering_display_primaries(r_x: int, r_y: int, g_x: int, g_y: int, b_x: int, b_y: int, w_x: int, w_y: int)
Argument | Type | Description |
---|---|---|
r_x | int | Red x * 1M |
r_y | int | Red y * 1M |
g_x | int | Green x * 1M |
g_y | int | Green y * 1M |
b_x | int | Blue x * 1M |
b_y | int | Blue y * 1M |
w_x | int | White x * 1M |
w_y | int | White y * 1M |
Provides the color primaries and white point of the mastering display using CIE 1931 xy chromaticity coordinates. This is compatible with the SMPTE ST 2086 definition of HDR static metadata.
The mastering display primaries and mastering display luminances define the target color volume.
If mastering display primaries are not explicitly set, the target color volume is assumed to have the same primaries as the primary color volume.
The target color volume is defined by all tristimulus values between 0.0 and 1.0 (inclusive) of the color space defined by the given mastering display primaries and white point. The colorimetry is identical between the container color space and the mastering display color space, including that no chromatic adaptation is applied even if the white points differ.
The target color volume can exceed the primary color volume to allow for a greater color volume with an existing color space definition (for example scRGB). It can be smaller than the primary color volume to minimize gamut and tone mapping distances for big color spaces (HDR metadata).
To make use of the entire target color volume a suitable pixel format has to be chosen (e.g. floating point to exceed the primary color volume, or abusing limited quantization range as with xvYCC).
Each coordinate value is multiplied by 1 million to get the argument value to carry precision of 6 decimals.
If mastering display primaries have already been set on this object, the protocol error already_set is raised.
This request can be used if the compositor advertises wp_color_manager_v1.feature.set_mastering_display_primaries. Otherwise this request raises the protocol error unsupported_feature. The advertisement implies support only for target color volumes fully contained within the primary color volume.
If a compositor additionally supports target color volume exceeding the primary color volume, it must advertise wp_color_manager_v1.feature.extended_target_volume. If a client uses target color volume exceeding the primary color volume and the compositor does not support it, the result is implementation defined. Compositors are recommended to detect this case and fail the image description gracefully, but it may as well result in color artifacts.
Sets the luminance range that was used during the content mastering process as the minimum and maximum absolute luminance L. These values include the minimum display emission and ambient flare luminances, assumed to be optically additive and have the chromaticity of the primary color volume white point. This should be compatible with the SMPTE ST 2086 definition of HDR static metadata.
The mastering display primaries and mastering display luminances define the target color volume.
If mastering luminances are not explicitly set, the target color volume is assumed to have the same min and max luminances as the primary color volume.
If max L is less than or equal to min L, the protocol error invalid_luminance is raised.
Min L value is multiplied by 10000 to get the argument min_lum value and carry precision of 4 decimals. Max L value is unscaled for max_lum.
This request can be used if the compositor advertises wp_color_manager_v1.feature.set_mastering_display_primaries. Otherwise this request raises the protocol error unsupported_feature. The advertisement implies support only for target color volumes fully contained within the primary color volume.
If a compositor additionally supports target color volume exceeding the primary color volume, it must advertise wp_color_manager_v1.feature.extended_target_volume. If a client uses target color volume exceeding the primary color volume and the compositor does not support it, the result is implementation defined. Compositors are recommended to detect this case and fail the image description gracefully, but it may as well result in color artifacts.
set_max_cll(max_cll: uint)
Argument | Type | Description |
---|---|---|
max_cll | uint | Maximum content light level (cd/m²) |
Sets the maximum content light level (max_cll) as defined by CTA-861-H.
max_cll is undefined by default.
set_max_fall(max_fall: uint)
Argument | Type | Description |
---|---|---|
max_fall | uint | Maximum frame-average light level (cd/m²) |
Sets the maximum frame-average light level (max_fall) as defined by CTA-861-H.
max_fall is undefined by default.
error { incomplete_set, already_set, unsupported_feature, invalid_tf, invalid_primaries_named, invalid_luminance }
Argument | Value | Description |
---|---|---|
incomplete_set | 0 | incomplete parameter set |
already_set | 1 | property already set |
unsupported_feature | 2 | request not supported |
invalid_tf | 3 | invalid transfer characteristic |
invalid_primaries_named | 4 | invalid primaries named |
invalid_luminance | 5 | invalid luminance value or range |
wp_image_description_v1
An image description carries information about the color encoding used on a surface when attached to a wl_surface via wp_color_management_surface_v1.set_image_description. A compositor can use this information to decode pixel values into colorimetrically meaningful quantities.
Note, that the wp_image_description_v1 object is not ready to be used immediately after creation. The object eventually delivers either the 'ready' or the 'failed' event, specified in all requests creating it. The object is deemed "ready" after receiving the 'ready' event.
An object which is not ready is illegal to use, it can only be destroyed. Any other request in this interface shall result in the 'not_ready' protocol error. Attempts to use an object which is not ready through other interfaces shall raise protocol errors defined there.
Once created and regardless of how it was created, a wp_image_description_v1 object always refers to one fixed image description. It cannot change after creation.
destroy()
Destroy this object. It is safe to destroy an object which is not ready.
Destroying a wp_image_description_v1 object has no side-effects, not even if a wp_color_management_surface_v1.set_image_description has not yet been followed by a wl_surface.commit.
get_information(information: new_id<wp_image_description_info_v1>)
Argument | Type | Description |
---|---|---|
information | new_id<wp_image_description_info_v1> |
Creates a wp_image_description_info_v1 object which delivers the information that makes up the image description.
Not all image description protocol objects allow get_information request. Whether it is allowed or not is defined by the request that created the object. If get_information is not allowed, the protocol error no_information is raised.
failed(cause: uint<wp_image_description_v1.cause>, msg: string)
Argument | Type | Description |
---|---|---|
cause | uint<wp_image_description_v1.cause> | generic reason |
msg | string | ad hoc human-readable explanation |
If creating a wp_image_description_v1 object fails for a reason that is not defined as a protocol error, this event is sent.
The requests that create image description objects define whether and when this can occur. Only such creation requests can trigger this event. This event cannot be triggered after the image description was successfully formed.
Once this event has been sent, the wp_image_description_v1 object will never become ready and it can only be destroyed.
ready(identity: uint)
Argument | Type | Description |
---|---|---|
identity | uint | image description id number |
Once this event has been sent, the wp_image_description_v1 object is deemed "ready". Ready objects can be used to send requests and can be used through other interfaces.
Every ready wp_image_description_v1 protocol object refers to an underlying image description record in the compositor. Multiple protocol objects may end up referring to the same record. Clients may identify these "copies" by comparing their id numbers: if the numbers from two protocol objects are identical, the protocol objects refer to the same image description record. Two different image description records cannot have the same id number simultaneously. The id number does not change during the lifetime of the image description record.
The id number is valid only as long as the protocol object is alive. If all protocol objects referring to the same image description record are destroyed, the id number may be recycled for a different image description record.
Image description id number is not a protocol object id. Zero is reserved as an invalid id number. It shall not be possible for a client to refer to an image description by its id number in protocol. The id numbers might not be portable between Wayland connections. A compositor shall not send an invalid id number.
This identity allows clients to de-duplicate image description records and avoid get_information request if they already have the image description information.
error { not_ready, no_information }
Argument | Value | Description |
---|---|---|
not_ready | 0 | attempted to use an object which is not ready |
no_information | 1 | get_information not allowed |
cause { low_version, unsupported, operating_system, no_output }
Argument | Value | Description |
---|---|---|
low_version | 0 | interface version too low |
unsupported | 1 | unsupported image description data |
operating_system | 2 | error independent of the client |
no_output | 3 | the relevant output no longer exists |
wp_image_description_info_v1
Sends all matching events describing an image description object exactly once and finally sends the 'done' event.
This means
- if the image description is parametric, it must send
- primaries
- named_primaries, if applicable
- at least one of tf_power and tf_named, as applicable
- luminances
- target_primaries
- target_luminance
- if the image description is parametric, it may send, if applicable,
- target_max_cll
- target_max_fall
- if the image description contains an ICC profile, it must send the icc_file event
Once a wp_image_description_info_v1 object has delivered a 'done' event it is automatically destroyed.
Every wp_image_description_info_v1 created from the same wp_image_description_v1 shall always return the exact same data.
done()
Signals the end of information events and destroys the object.
The icc argument provides a file descriptor to the client which may be memory-mapped to provide the ICC profile matching the image description. The fd is read-only, and if mapped then it must be mapped with MAP_PRIVATE by the client.
The ICC profile version and other details are determined by the compositor. There is no provision for a client to ask for a specific kind of a profile.
Argument | Type | Description |
---|---|---|
r_x | int | Red x * 1M |
r_y | int | Red y * 1M |
g_x | int | Green x * 1M |
g_y | int | Green y * 1M |
b_x | int | Blue x * 1M |
b_y | int | Blue y * 1M |
w_x | int | White x * 1M |
w_y | int | White y * 1M |
Delivers the primary color volume primaries and white point using CIE 1931 xy chromaticity coordinates.
Each coordinate value is multiplied by 1 million to get the argument value to carry precision of 6 decimals.
primaries_named(primaries: uint<wp_color_manager_v1.primaries>)
Argument | Type | Description |
---|---|---|
primaries | uint<wp_color_manager_v1.primaries> | named primaries |
Delivers the primary color volume primaries and white point using an explicitly enumerated named set.
tf_power(eexp: uint)
Argument | Type | Description |
---|---|---|
eexp | uint | the exponent * 10000 |
The color component transfer characteristic of this image description is a pure power curve. This event provides the exponent of the power function. This curve represents the conversion from electrical to optical pixel or color values.
The curve exponent has been multiplied by 10000 to get the argument eexp value to carry the precision of 4 decimals.
tf_named(tf: uint<wp_color_manager_v1.transfer_function>)
Argument | Type | Description |
---|---|---|
tf | uint<wp_color_manager_v1.transfer_function> | named transfer function |
Delivers the transfer characteristic using an explicitly enumerated named function.
luminances(min_lum: uint, max_lum: uint, reference_lum: uint)
Argument | Type | Description |
---|---|---|
min_lum | uint | minimum luminance (cd/m²) * 10000 |
max_lum | uint | maximum luminance (cd/m²) |
reference_lum | uint | reference white luminance (cd/m²) |
Delivers the primary color volume luminance range and the reference white luminance level. These values include the minimum display emission and ambient flare luminances, assumed to be optically additive and have the chromaticity of the primary color volume white point.
The minimum luminance is multiplied by 10000 to get the argument 'min_lum' value and carries precision of 4 decimals. The maximum luminance and reference white luminance values are unscaled.
Argument | Type | Description |
---|---|---|
r_x | int | Red x * 1M |
r_y | int | Red y * 1M |
g_x | int | Green x * 1M |
g_y | int | Green y * 1M |
b_x | int | Blue x * 1M |
b_y | int | Blue y * 1M |
w_x | int | White x * 1M |
w_y | int | White y * 1M |
Provides the color primaries and white point of the target color volume using CIE 1931 xy chromaticity coordinates. This is compatible with the SMPTE ST 2086 definition of HDR static metadata for mastering displays.
While primary color volume is about how color is encoded, the target color volume is the actually displayable color volume. If target color volume is equal to the primary color volume, then this event is not sent.
Each coordinate value is multiplied by 1 million to get the argument value to carry precision of 6 decimals.
Provides the luminance range that the image description is targeting as the minimum and maximum absolute luminance L. These values include the minimum display emission and ambient flare luminances, assumed to be optically additive and have the chromaticity of the primary color volume white point. This should be compatible with the SMPTE ST 2086 definition of HDR static metadata.
This luminance range is only theoretical and may not correspond to the luminance of light emitted on an actual display.
Min L value is multiplied by 10000 to get the argument min_lum value and carry precision of 4 decimals. Max L value is unscaled for max_lum.
target_max_cll(max_cll: uint)
Argument | Type | Description |
---|---|---|
max_cll | uint | Maximum content light-level (cd/m²) |
Provides the targeted max_cll of the image description. max_cll is defined by CTA-861-H.
This luminance is only theoretical and may not correspond to the luminance of light emitted on an actual display.
target_max_fall(max_fall: uint)
Argument | Type | Description |
---|---|---|
max_fall | uint | Maximum frame-average light level (cd/m²) |
Provides the targeted max_fall of the image description. max_fall is defined by CTA-861-H.
This luminance is only theoretical and may not correspond to the luminance of light emitted on an actual display.
wp_image_description_reference_v1
This object is a reference to an image description. This interface is frozen at version 1 to allow other protocols to create wp_image_description_v1 objects.
The wp_color_manager_v1.get_image_description request can be used to retrieve the underlying image description.
destroy()
Destroy this object. This has no effect on the referenced image description.
Compositor Support
Mutter | KWin | Sway | COSMIC | Hyprland | niri | Weston | Labwc | Cage | Wayfire | GameScope | Jay | Mir | Treeland | Louvre | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wp_color_manager_v1 | 1 | 1 | x | x | 1 | x | x | x | x | x | x | 1 | x | x | x |
Copyright
Copyright 2019 Sebastian Wick Copyright 2019 Erwin Burema Copyright 2020 AMD Copyright 2020-2024 Collabora, Ltd. Copyright 2024 Xaver Hugl Copyright 2022-2025 Red Hat, Inc.
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.
ext_image_capture_color_management_v1
- external
This protocol provides extensions to the ext-image-capture-source-v1 and ext-image-copy-capture-v1 protocols to allow clients to capture frames in color spaces other than srgb/gamma22.
ext_image_capture_color_manager_v1
This global allows clients to retrieve information about the preferred image description of a capture source and to define the image description of a capture frame.
destroy()
Destroys the object. This request can be sent at any time by the client.
get_capture_source_colors(colors: new_id<ext_image_capture_source_colors_v1>, source: object<ext_image_capture_source_v1>)
Argument | Type | Description |
---|---|---|
colors | new_id<ext_image_capture_source_colors_v1> | |
source | object<ext_image_capture_source_v1> |
This creates a new ext_image_capture_source_colors_v1 for a given ext_image_capture_source_v1.
See ext_image_capture_source_colors_v1 for more details.
set_frame_image_description(frame: object<ext_image_copy_capture_frame_v1>, image_description: object<wp_image_description_v1>)
Argument | Type | Description |
---|---|---|
frame | object<ext_image_copy_capture_frame_v1> | |
image_description | object<wp_image_description_v1> |
If the frame is successfully captured, it will be encoded according to this image description.
This request must not be used if the image description is not ready. Otherwise the image_description_not_ready error is emitted.
This request must not be used if the frame has already been captured. Otherwise the already_captured error is emitted.
error { image_description_not_ready, already_captured }
Argument | Value | Description |
---|---|---|
image_description_not_ready | 1 | the image description is not ready |
already_captured | 2 | capture request has been sent |
ext_image_capture_source_colors_v1
This object describes the color properties of a capture source.
The ext_image_capture_source_colors_v1 is associated with the compositor object backing the source. Therefore the client destroying the ext_image_capture_source_v1 object has no impact. The object becomes inert when the compositor object backing the source is destroyed. How the client can detects this depends on the source.
destroy()
Destroys this object.
get_preferred(id: new_id<wp_image_description_reference_v1>)
Argument | Type | Description |
---|---|---|
id | new_id<wp_image_description_reference_v1> | the preferred description |
The preferred image description represents the compositor's preferred color encoding for this capture source at the current time. There might be performance and power advantages, as well as improved color reproduction, if the image description of a capture frame matches the preferred image description.
This creates a new wp_image_description_reference_v1 object for the currently preferred image description for the capture source. The client should stop using and destroy the image descriptions created by earlier invocations of this request for the associated capture source. This request is usually sent as a reaction to the preferred_changed event or when creating a ext_image_capture_source_colors_v1 object if the client is capable of adapting to image descriptions.
The created wp_image_description_reference_v1 object preserves the preferred image description of the capture source from the time the object was created.
The resulting image description object allows get_information request.
preferred_changed(identity_hi: uint, identity_lo: uint)
Argument | Type | Description |
---|---|---|
identity_hi | uint | image description id number (high 32 bits) |
identity_lo | uint | image description id number (low 32 bits) |
The preferred image description is the one which likely has the most performance and/or quality benefits for the compositor if used by the client for its capture frames. This event is sent whenever the compositor changes the capture source's preferred image description.
This event sends the identity of the new preferred state as the argument, so clients who are aware of the image description already can reuse it. Otherwise, if the client client wants to know what the preferred image description is, it shall use the get_preferred request.
The preferred image description is not automatically used for anything. It is only a hint, and clients may set any valid image description with set_frame_image_description, but there might be performance and color accuracy improvements by providing the capture frame's contents in the preferred image description. Therefore clients that can, should capture frames in the preferred image description
Compositor Support
Copyright
Copyright © 2025 Julian Orth
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.
ext_image_copy_capture_v1
- external
This protocol allows clients to ask the compositor to capture image sources such as outputs and toplevels into user submitted buffers.
Warning! The protocol described in this file is currently in the testing phase. Backward compatible changes may be added together with the corresponding interface version bump. Backward incompatible changes can only be done by creating a new major version of the extension.
ext_image_copy_capture_manager_v1
This object is a manager which offers requests to start capturing from a source.
create_session(session: new_id<ext_image_copy_capture_session_v1>, source: object<ext_image_capture_source_v1>, options: uint<ext_image_copy_capture_manager_v1.options>)
Argument | Type | Description |
---|---|---|
session | new_id<ext_image_copy_capture_session_v1> | |
source | object<ext_image_capture_source_v1> | |
options | uint<ext_image_copy_capture_manager_v1.options> |
Create a capturing session for an image capture source.
If the paint_cursors option is set, cursors shall be composited onto the captured frame. The cursor must not be composited onto the frame if this flag is not set.
If the options bitfield is invalid, the invalid_option protocol error is sent.
create_pointer_cursor_session(session: new_id<ext_image_copy_capture_cursor_session_v1>, source: object<ext_image_capture_source_v1>, pointer: object<wl_pointer>)
Argument | Type | Description |
---|---|---|
session | new_id<ext_image_copy_capture_cursor_session_v1> | |
source | object<ext_image_capture_source_v1> | |
pointer | object<wl_pointer> |
Create a cursor capturing session for the pointer of an image capture source.
destroy()
Destroy the manager object.
Other objects created via this interface are unaffected.
error { invalid_option }
Argument | Value | Description |
---|---|---|
invalid_option | 1 | invalid option flag |
options { paint_cursors }
Argument | Value | Description |
---|---|---|
paint_cursors | 1 | paint cursors onto captured frames |
ext_image_copy_capture_session_v1
This object represents an active image copy capture session.
After a capture session is created, buffer constraint events will be emitted from the compositor to tell the client which buffer types and formats are supported for reading from the session. The compositor may re-send buffer constraint events whenever they change.
To advertise buffer constraints, the compositor must send in no particular order: zero or more shm_format and dmabuf_format events, zero or one dmabuf_device event, and exactly one buffer_size event. Then the compositor must send a done event.
When the client has received all the buffer constraints, it can create a buffer accordingly, attach it to the capture session using the attach_buffer request, set the buffer damage using the damage_buffer request and then send the capture request.
create_frame(frame: new_id<ext_image_copy_capture_frame_v1>)
Argument | Type | Description |
---|---|---|
frame | new_id<ext_image_copy_capture_frame_v1> |
Create a capture frame for this session.
At most one frame object can exist for a given session at any time. If a client sends a create_frame request before a previous frame object has been destroyed, the duplicate_frame protocol error is raised.
destroy()
Destroys the session. This request can be sent at any time by the client.
This request doesn't affect ext_image_copy_capture_frame_v1 objects created by this object.
Provides the dimensions of the source image in buffer pixel coordinates.
The client must attach buffers that match this size.
shm_format(format: uint<wl_shm.format>)
Argument | Type | Description |
---|---|---|
format | uint<wl_shm.format> | shm format |
Provides the format that must be used for shared-memory buffers.
This event may be emitted multiple times, in which case the client may choose any given format.
dmabuf_device(device: array)
Argument | Type | Description |
---|---|---|
device | array | device dev_t value |
This event advertises the device buffers must be allocated on for dma-buf buffers.
In general the device is a DRM node. The DRM node type (primary vs. render) is unspecified. Clients must not rely on the compositor sending a particular node type. Clients cannot check two devices for equality by comparing the dev_t value.
Provides the format that must be used for dma-buf buffers.
The client may choose any of the modifiers advertised in the array of 64-bit unsigned integers.
This event may be emitted multiple times, in which case the client may choose any given format.
done()
This event is sent once when all buffer constraint events have been sent.
The compositor must always end a batch of buffer constraint events with this event, regardless of whether it sends the initial constraints or an update.
stopped()
This event indicates that the capture session has stopped and is no longer available. This can happen in a number of cases, e.g. when the underlying source is destroyed, if the user decides to end the image capture, or if an unrecoverable runtime error has occurred.
The client should destroy the session after receiving this event.
error { duplicate_frame }
Argument | Value | Description |
---|---|---|
duplicate_frame | 1 | create_frame sent before destroying previous frame |
ext_image_copy_capture_frame_v1
This object represents an image capture frame.
The client should attach a buffer, damage the buffer, and then send a capture request.
If the capture is successful, the compositor must send the frame metadata (transform, damage, presentation_time in any order) followed by the ready event.
If the capture fails, the compositor must send the failed event.
destroy()
Destroys the frame. This request can be sent at any time by the client.
Attach a buffer to the session.
The wl_buffer.release request is unused.
The new buffer replaces any previously attached buffer.
This request must not be sent after capture, or else the already_captured protocol error is raised.
Argument | Type | Description |
---|---|---|
x | int | region x coordinate |
y | int | region y coordinate |
width | int | region width |
height | int | region height |
Apply damage to the buffer which is to be captured next. This request may be sent multiple times to describe a region.
The client indicates the accumulated damage since this wl_buffer was last captured. During capture, the compositor will update the buffer with at least the union of the region passed by the client and the region advertised by ext_image_copy_capture_frame_v1.damage.
When a wl_buffer is captured for the first time, or when the client doesn't track damage, the client must damage the whole buffer.
This is for optimisation purposes. The compositor may use this information to reduce copying.
These coordinates originate from the upper left corner of the buffer.
If x or y are strictly negative, or if width or height are negative or zero, the invalid_buffer_damage protocol error is raised.
This request must not be sent after capture, or else the already_captured protocol error is raised.
capture()
Capture a frame.
Unless this is the first successful captured frame performed in this session, the compositor may wait an indefinite amount of time for the source content to change before performing the copy.
This request may only be sent once, or else the already_captured protocol error is raised. A buffer must be attached before this request is sent, or else the no_buffer protocol error is raised.
transform(transform: uint<wl_output.transform>)
Argument | Type | Description |
---|---|---|
transform | uint<wl_output.transform> |
This event is sent before the ready event and holds the transform that the compositor has applied to the buffer contents.
Argument | Type | Description |
---|---|---|
x | int | damage x coordinate |
y | int | damage y coordinate |
width | int | damage width |
height | int | damage height |
This event is sent before the ready event. It may be generated multiple times to describe a region.
The first captured frame in a session will always carry full damage. Subsequent frames' damaged regions describe which parts of the buffer have changed since the last ready event.
These coordinates originate in the upper left corner of the buffer.
Argument | Type | Description |
---|---|---|
tv_sec_hi | uint | high 32 bits of the seconds part of the timestamp |
tv_sec_lo | uint | low 32 bits of the seconds part of the timestamp |
tv_nsec | uint | nanoseconds part of the timestamp |
This event indicates the time at which the frame is presented to the output in system monotonic time. This event is sent before the ready event.
The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples, each component being an unsigned 32-bit value. Whole seconds are in tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo, and the additional fractional part in tv_nsec as nanoseconds. Hence, for valid timestamps tv_nsec must be in [0, 999999999].
ready()
Called as soon as the frame is copied, indicating it is available for reading.
The buffer may be re-used by the client after this event.
After receiving this event, the client must destroy the object.
failed(reason: uint<ext_image_copy_capture_frame_v1.failure_reason>)
Argument | Type | Description |
---|---|---|
reason | uint<ext_image_copy_capture_frame_v1.failure_reason> |
This event indicates that the attempted frame copy has failed.
After receiving this event, the client must destroy the object.
error { no_buffer, invalid_buffer_damage, already_captured }
Argument | Value | Description |
---|---|---|
no_buffer | 1 | capture sent without attach_buffer |
invalid_buffer_damage | 2 | invalid buffer damage |
already_captured | 3 | capture request has been sent |
failure_reason { unknown, buffer_constraints, stopped, unsupported_image_description }
Argument | Value | Description |
---|---|---|
unknown | 0 | unknown runtime error An unspecified runtime error has occurred. The client may retry. |
buffer_constraints | 1 | buffer constraints mismatch The buffer submitted by the client doesn't match the latest session constraints. The client should re-allocate its buffers and retry. |
stopped | 2 | session is no longer available The session has stopped. See ext_image_copy_capture_session_v1.stopped. |
unsupported_image_descriptionsince 2 | 3 | image description could not be used The image description could not be used to capture a frame. The client may retry without an image description or with another image description. |
This object represents a cursor capture session. It extends the base capture session with cursor-specific metadata.
destroy()
Destroys the session. This request can be sent at any time by the client.
This request doesn't affect ext_image_copy_capture_frame_v1 objects created by this object.
get_capture_session(session: new_id<ext_image_copy_capture_session_v1>)
Argument | Type | Description |
---|---|---|
session | new_id<ext_image_copy_capture_session_v1> |
Gets the image copy capture session for this cursor session.
The session will produce frames of the cursor image. The compositor may pause the session when the cursor leaves the captured area.
This request must not be sent more than once, or else the duplicate_session protocol error is raised.
enter()
Sent when a cursor enters the captured area. It shall be generated before the "position" and "hotspot" events when and only when a cursor enters the area.
The cursor enters the captured area when the cursor image intersects with the captured area. Note, this is different from e.g. wl_pointer.enter.
leave()
Sent when a cursor leaves the captured area. No "position" or "hotspot" event is generated for the cursor until the cursor enters the captured area again.
Cursors outside the image capture source do not get captured and no event will be generated for them.
The given position is the position of the cursor's hotspot and it is relative to the main buffer's top left corner in transformed buffer pixel coordinates. The coordinates may be negative or greater than the main buffer size.
The hotspot describes the offset between the cursor image and the position of the input device.
The given coordinates are the hotspot's offset from the origin in buffer coordinates.
Clients should not apply the hotspot immediately: the hotspot becomes effective when the next ext_image_copy_capture_frame_v1.ready event is received.
Compositors may delay this event until the client captures a new frame.
error { duplicate_session }
Argument | Value | Description |
---|---|---|
duplicate_session | 1 | get_capture_session sent twice |
Compositor Support
Mutter | KWin | Sway | COSMIC | Hyprland | niri | Weston | Labwc | Cage | Wayfire | GameScope | Jay | Mir | Treeland | Louvre | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ext_image_copy_capture_manager_v1 | x | x | 1 | 1 | x | x | x | x | x | x | x | 1 | x | 1 | x |
Copyright
Copyright © 2021-2023 Andri Yngvason Copyright © 2024 Simon Ser
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.