|
10 | 10 | #include <wlr/render/allocator.h> |
11 | 11 | #include <wlr/render/wlr_renderer.h> |
12 | 12 | #include <wlr/types/wlr_alpha_modifier_v1.h> |
| 13 | +#include <wlr/types/wlr_color_management_v1.h> |
13 | 14 | #include <wlr/types/wlr_compositor.h> |
14 | 15 | #include <wlr/types/wlr_content_type_v1.h> |
15 | 16 | #include <wlr/types/wlr_cursor_shape_v1.h> |
@@ -443,6 +444,33 @@ bool server_init(struct sway_server *server) { |
443 | 444 | server->request_set_cursor_shape.notify = handle_request_set_cursor_shape; |
444 | 445 | wl_signal_add(&cursor_shape_manager->events.request_set_shape, &server->request_set_cursor_shape); |
445 | 446 |
|
| 447 | + if (server->renderer->features.input_color_transform) { |
| 448 | + const enum wp_color_manager_v1_render_intent render_intents[] = { |
| 449 | + WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL, |
| 450 | + }; |
| 451 | + const enum wp_color_manager_v1_transfer_function transfer_functions[] = { |
| 452 | + WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, |
| 453 | + WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ, |
| 454 | + WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR, |
| 455 | + }; |
| 456 | + const enum wp_color_manager_v1_primaries primaries[] = { |
| 457 | + WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, |
| 458 | + WP_COLOR_MANAGER_V1_PRIMARIES_BT2020, |
| 459 | + }; |
| 460 | + wlr_color_manager_v1_create(server->wl_display, 1, &(struct wlr_color_manager_v1_options){ |
| 461 | + .features = { |
| 462 | + .parametric = true, |
| 463 | + .set_mastering_display_primaries = true, |
| 464 | + }, |
| 465 | + .render_intents = render_intents, |
| 466 | + .render_intents_len = sizeof(render_intents) / sizeof(render_intents[0]), |
| 467 | + .transfer_functions = transfer_functions, |
| 468 | + .transfer_functions_len = sizeof(transfer_functions) / sizeof(transfer_functions[0]), |
| 469 | + .primaries = primaries, |
| 470 | + .primaries_len = sizeof(primaries) / sizeof(primaries[0]), |
| 471 | + }); |
| 472 | + } |
| 473 | + |
446 | 474 | wl_list_init(&server->pending_launcher_ctxs); |
447 | 475 |
|
448 | 476 | // Avoid using "wayland-0" as display socket |
|
0 commit comments