mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 08:10:10 +01:00
frontend: Enable VRR from the config file
Allow weston.ini to enable game VRR. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
8e26bf1ce9
commit
c7cf87fe85
2 changed files with 66 additions and 0 deletions
|
|
@ -1361,6 +1361,56 @@ wet_output_set_transform(struct weston_output *output,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
wet_output_set_vrr_mode(struct weston_output *output,
|
||||||
|
struct weston_config_section *section)
|
||||||
|
{
|
||||||
|
static const struct {
|
||||||
|
const char *name;
|
||||||
|
enum weston_vrr_mode vrr_mode;
|
||||||
|
} vrr_modes[] = {
|
||||||
|
{ "none", WESTON_VRR_MODE_NONE },
|
||||||
|
{ "game", WESTON_VRR_MODE_GAME },
|
||||||
|
};
|
||||||
|
enum weston_vrr_mode vrr_mode = WESTON_VRR_MODE_NONE;
|
||||||
|
char *vrr_str = NULL;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
weston_config_section_get_string(section, "vrr-mode", &vrr_str, NULL);
|
||||||
|
if (!vrr_str)
|
||||||
|
return vrr_mode;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(vrr_modes); i++)
|
||||||
|
if (strcmp(vrr_str, vrr_modes[i].name) == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i == ARRAY_LENGTH(vrr_modes)) {
|
||||||
|
weston_log("Error in config for output '%s': '%s' is not a valid vrr mode. Try one of:",
|
||||||
|
output->name, vrr_str);
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(vrr_modes); i++)
|
||||||
|
weston_log_continue(" %s", vrr_modes[i].name);
|
||||||
|
weston_log_continue("\n");
|
||||||
|
free(vrr_str);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
vrr_mode = vrr_modes[i].vrr_mode;
|
||||||
|
|
||||||
|
if (vrr_mode && (weston_output_get_supported_vrr_modes(output) & vrr_mode) == 0) {
|
||||||
|
weston_log("Error: output '%s' does not support output format %s.\n",
|
||||||
|
output->name, vrr_str);
|
||||||
|
free(vrr_str);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(vrr_str);
|
||||||
|
|
||||||
|
if (weston_output_set_vrr_mode(output, vrr_mode) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
wet_output_set_color_profile(struct weston_output *output,
|
wet_output_set_color_profile(struct weston_output *output,
|
||||||
struct weston_config_section *section,
|
struct weston_config_section *section,
|
||||||
|
|
@ -2423,6 +2473,9 @@ drm_backend_output_configure(struct weston_output *output,
|
||||||
wet->config, section) < 0)
|
wet->config, section) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (wet_output_set_vrr_mode(output, section) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -669,6 +669,19 @@ only for remote outputs.
|
||||||
NOTE: The native outputs created by the DRM backend using the 'clone-of'
|
NOTE: The native outputs created by the DRM backend using the 'clone-of'
|
||||||
are for cloning the outputs, and not sharing or mirroring. See also
|
are for cloning the outputs, and not sharing or mirroring. See also
|
||||||
.BR weston-drm(7).
|
.BR weston-drm(7).
|
||||||
|
.TP 7
|
||||||
|
.BI "vrr-mode=" mode
|
||||||
|
Sets the variable refresh rate mode of the display.
|
||||||
|
The mode can be one of the following strings:
|
||||||
|
.PP
|
||||||
|
.RS 10
|
||||||
|
.nf
|
||||||
|
.BR "none " "variable refresh rate is disabled"
|
||||||
|
.BR "game " "game variable refresh rate"
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
.IP
|
||||||
|
Defaults to "none".
|
||||||
.\"---------------------------------------------------------------------
|
.\"---------------------------------------------------------------------
|
||||||
.SH "INPUT-METHOD SECTION"
|
.SH "INPUT-METHOD SECTION"
|
||||||
.TP 7
|
.TP 7
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue