ext_image_capture_source_v1: render hidden sRGB for ICC correct

screencopy

When a compositor uses color transforms (ICC profiles), the output's
post-render buffer is in the display's color space, not sRGB.  A
screenshot client like grim receives this buffer and saves it as an
untagged PNG, which then appears over-saturated in non-color-managed
viewers.

To avoid this, the output capture source now creates a hidden headless
output that re-renders the same scene graph with an identity color
transform (sRGB).  The hidden output is driven entirely within the
capture source and does not affect the real output or cause any visual
flicker.
This commit is contained in:
Furkan Sahin 2026-05-07 16:15:46 -04:00
parent bd99e8c2bd
commit f56e1f6a52
2 changed files with 149 additions and 25 deletions

View file

@ -12,6 +12,7 @@
#include <pixman.h>
#include <wayland-server-core.h>
#include <wlr/render/drm_format_set.h>
#include <wlr/backend.h>
struct wlr_scene_node;
struct wlr_allocator;
@ -79,12 +80,19 @@ struct wlr_ext_image_capture_source_v1_cursor {
*/
struct wlr_ext_output_image_capture_source_manager_v1 {
struct wl_global *global;
struct wl_display *display;
struct wlr_scene *scene;
struct {
struct wl_listener display_destroy;
} WLR_PRIVATE;
struct wlr_backend *headless_backend;
};
void wlr_ext_output_image_capture_source_manager_v1_set_scene(
struct wlr_ext_output_image_capture_source_manager_v1 *manager,
struct wlr_scene *scene);
/**
* Interface exposing one screen capture source per foreign toplevel.
*/