compositor, frontend: Allow to configure placeholder-color

This is a trivial change to allow passing a user-defined color to
specify the color for the placeholder.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2025-06-24 15:06:18 +03:00
parent 0a76b639fe
commit feb4fd1386
4 changed files with 20 additions and 3 deletions

View file

@ -1216,6 +1216,9 @@ weston_compositor_init_config(struct weston_compositor *ec,
weston_log("Output repaint window is %d ms maximum.\n",
ec->repaint_msec);
weston_config_section_get_uint(s, "placeholder-color",
&ec->placeholder_color, 0x660000);
weston_config_section_get_bool(s, "color-management",
&color_management, false);
if (color_management) {

View file

@ -1421,6 +1421,10 @@ struct weston_compositor {
/** fires with frame_counter_interval rate */
struct wl_event_source *frame_counter_timer;
} perf_surface_stats;
/* if set use this placeholder-color to use instead of the default
* grenadier one */
uint32_t placeholder_color;
};
struct weston_solid_buffer_values {

View file

@ -214,9 +214,13 @@ maybe_replace_paint_node(struct weston_paint_node *pnode)
(surface->desired_protection > WESTON_HDCP_DISABLE);
bool unprotected_censor =
(surface->desired_protection > output->current_protection);
struct weston_solid_buffer_values placeholder_color = {
0.40f, 0.0f, 0.0f, 1.0f
};
struct weston_solid_buffer_values placeholder_color;
uint32_t color_tmp = output->compositor->placeholder_color;
placeholder_color.r = ((color_tmp >> 16) & 0xff) / 255.0;
placeholder_color.g = ((color_tmp >> 8) & 0xff) / 255.0;
placeholder_color.b = ((color_tmp >> 0) & 0xff) / 255.0;
placeholder_color.a = 1.0;
pnode->draw_solid = false;
pnode->is_direct = false;

View file

@ -249,6 +249,12 @@ Boolean, defaults to
.BR false .
These decorations cannot normally be screenshot. This option is useful for
the Weston test suite only.
.TP 7
.BI "placeholder-color=" 0xRRGGBB
sets the color of the placeholder (unsigned integer). The hexadecimal digit
pairs are in order red, green, and blue. This placeholder is used for
content-protection or when we're not able to lift a surface/view in a HW plane,
but we require direct scan-out of buffers. Defaults to 0x660000 (red grenadier).
.\"---------------------------------------------------------------------
.SH "LIBINPUT SECTION"
The