compositor: add eotf-mode weston.ini option

This per-output option allows to choose one of the HDR video modes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 3 years ago committed by Pekka Paalanen
parent 5151f9fe9e
commit 33d553f833
  1. 76
      compositor/main.c
  2. 19
      man/weston.ini.man

@ -1316,6 +1316,73 @@ wet_output_set_color_profile(struct weston_output *output,
return ok ? 0 : -1;
}
static int
wet_output_set_eotf_mode(struct weston_output *output,
struct weston_config_section *section)
{
static const struct {
const char *name;
enum weston_eotf_mode eotf_mode;
} modes[] = {
{ "sdr", WESTON_EOTF_MODE_SDR },
{ "hdr-gamma", WESTON_EOTF_MODE_TRADITIONAL_HDR },
{ "st2084", WESTON_EOTF_MODE_ST2084 },
{ "hlg", WESTON_EOTF_MODE_HLG },
};
struct wet_compositor *compositor;
enum weston_eotf_mode eotf_mode = WESTON_EOTF_MODE_SDR;
char *str = NULL;
unsigned i;
compositor = to_wet_compositor(output->compositor);
if (section) {
weston_config_section_get_string(section, "eotf-mode",
&str, NULL);
}
if (!str) {
/* The default SDR mode is always supported. */
assert(weston_output_get_supported_eotf_modes(output) & eotf_mode);
weston_output_set_eotf_mode(output, eotf_mode);
return 0;
}
for (i = 0; i < ARRAY_LENGTH(modes); i++)
if (strcmp(str, modes[i].name) == 0)
break;
if (i == ARRAY_LENGTH(modes)) {
weston_log("Error in config for output '%s': '%s' is not a valid EOTF mode. Try one of:",
output->name, str);
for (i = 0; i < ARRAY_LENGTH(modes); i++)
weston_log_continue(" %s", modes[i].name);
weston_log_continue("\n");
return -1;
}
eotf_mode = modes[i].eotf_mode;
if ((weston_output_get_supported_eotf_modes(output) & eotf_mode) == 0) {
weston_log("Error: output '%s' does not support EOTF mode %s.\n",
output->name, str);
free(str);
return -1;
}
if (eotf_mode != WESTON_EOTF_MODE_SDR &&
!compositor->use_color_manager) {
weston_log("Error: EOTF mode %s on output '%s' requires color-management=true in weston.ini\n",
str, output->name);
free(str);
return -1;
}
weston_output_set_eotf_mode(output, eotf_mode);
free(str);
return 0;
}
static void
allow_content_protection(struct weston_output *output,
struct weston_config_section *section)
@ -1839,6 +1906,9 @@ drm_backend_output_configure(struct weston_output *output,
allow_content_protection(output, section);
if (wet_output_set_eotf_mode(output, section) < 0)
return -1;
return 0;
}
@ -2655,6 +2725,12 @@ headless_backend_output_configure(struct weston_output *output)
.scale = 1,
.transform = WL_OUTPUT_TRANSFORM_NORMAL
};
struct weston_config *wc = wet_get_config(output->compositor);
struct weston_config_section *section;
section = weston_config_get_section(wc, "output", "name", output->name);
if (wet_output_set_eotf_mode(output, section) < 0)
return -1;
return wet_configure_windowed_output_from_config(output, &defaults);
}

@ -548,6 +548,25 @@ of content-protection protocol. Currently, HDCP is supported by drm-backend.
A comma separated list of the IDs of applications to place on this output.
These IDs should match the application IDs as set with the xdg_shell.set_app_id
request. Currently, this option is supported by kiosk-shell.
.TP 7
.BI "eotf-mode=" sdr
Sets the EOTF mode on the output. This is used for choosing between standard
dynamic range (SDR) mode and the various high dynamic range (HDR) modes. The
display driver, the graphics card, and the video sink (monitor) need to support
the chosen mode, otherwise the result is undefined.
The mode can be one of the following strings:
.PP
.RS 10
.nf
.BR "sdr " "traditional gamma, SDR"
.BR "hdr-gamma " "traditional gamma, HDR"
.BR "st2084 " "SMPTE ST 2084, a.k.a Perceptual Quantizer"
.BR "hlg " "Hybrid Log-Gamma (ITU-R BT.2100)"
.fi
.RE
.IP
Defaults to
.BR sdr ". Non-SDR modes require " "color-management=true" .
.\"---------------------------------------------------------------------
.SH "INPUT-METHOD SECTION"
.TP 7

Loading…
Cancel
Save