This commit is contained in:
Manu Linares 2026-01-08 23:08:47 -03:00 committed by GitHub
commit 9b924202a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 0 deletions

View file

@ -25,6 +25,7 @@ server_protocols = [
wl_protocol_dir / 'staging/ext-workspace/ext-workspace-v1.xml',
wl_protocol_dir / 'staging/ext-image-capture-source/ext-image-capture-source-v1.xml',
wl_protocol_dir / 'staging/ext-image-copy-capture/ext-image-copy-capture-v1.xml',
wl_protocol_dir / 'staging/color-management/color-management-v1.xml',
'cosmic-workspace-unstable-v1.xml',
'wlr-layer-shell-unstable-v1.xml',
'wlr-output-power-management-unstable-v1.xml',

View file

@ -8,6 +8,8 @@
#include <wlr/backend/multi.h>
#include <wlr/render/allocator.h>
#include <wlr/types/wlr_alpha_modifier_v1.h>
#include <wlr/types/wlr_color_management_v1.h>
#include <wlr/types/wlr_color_representation_v1.h>
#include <wlr/types/wlr_data_control_v1.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_drm.h>
@ -587,6 +589,45 @@ server_init(struct server *server)
* | output->layer_tree[0] | background layer surfaces (e.g. swaybg)
*/
if (server->renderer->features.input_color_transform) {
const enum wp_color_manager_v1_render_intent render_intents[] = {
WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL,
};
const enum wp_color_manager_v1_transfer_function transfer_functions[] = {
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB,
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ,
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR,
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22,
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_BT1886,
};
const enum wp_color_manager_v1_primaries primaries[] = {
WP_COLOR_MANAGER_V1_PRIMARIES_SRGB,
WP_COLOR_MANAGER_V1_PRIMARIES_BT2020,
};
struct wlr_color_manager_v1 *cm = wlr_color_manager_v1_create(
server->wl_display, 1, &(struct wlr_color_manager_v1_options){
.features = {
.parametric = true,
.set_mastering_display_primaries = true,
},
.render_intents = render_intents,
.render_intents_len = ARRAY_SIZE(render_intents),
.transfer_functions = transfer_functions,
.transfer_functions_len = ARRAY_SIZE(transfer_functions),
.primaries = primaries,
.primaries_len = ARRAY_SIZE(primaries),
});
if (cm) {
wlr_scene_set_color_manager_v1(server->scene, cm);
} else {
wlr_log(WLR_ERROR, "unable to create color manager");
}
wlr_color_representation_manager_v1_create_with_renderer(
server->wl_display, 1, server->renderer);
}
server->view_tree_always_on_bottom = wlr_scene_tree_create(&server->scene->tree);
server->view_tree = wlr_scene_tree_create(&server->scene->tree);
server->view_tree_always_on_top = wlr_scene_tree_create(&server->scene->tree);