compositor-drm: allow mode frequency selection
As an option, allow to specify a mode (from the configuration file) by its refresh rate. Example of valid syntax: - "mode=1920x1080" Select a 1920x1080 mode, refresh rate undefined. - "mode=1920x1080@60" Select the (or one of the) 1920x1080 60 Hz mode. Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
82681571cf
commit
2d66a7d883
|
@ -2210,9 +2210,12 @@ drm_output_choose_initial_mode(struct drm_backend *backend,
|
|||
drmModeModeInfo drm_modeline;
|
||||
int32_t width = 0;
|
||||
int32_t height = 0;
|
||||
uint32_t refresh = 0;
|
||||
int n;
|
||||
|
||||
if (mode == WESTON_DRM_BACKEND_OUTPUT_PREFERRED && modeline) {
|
||||
if (sscanf(modeline, "%dx%d", &width, &height) != 2) {
|
||||
n = sscanf(modeline, "%dx%d@%d", &width, &height, &refresh);
|
||||
if (n != 2 && n != 3) {
|
||||
width = -1;
|
||||
|
||||
if (parse_modeline(modeline, &drm_modeline) == 0) {
|
||||
|
@ -2228,7 +2231,8 @@ drm_output_choose_initial_mode(struct drm_backend *backend,
|
|||
|
||||
wl_list_for_each_reverse(drm_mode, &output->base.mode_list, base.link) {
|
||||
if (width == drm_mode->base.width &&
|
||||
height == drm_mode->base.height)
|
||||
height == drm_mode->base.height &&
|
||||
(refresh == 0 || refresh == drm_mode->mode_info.vrefresh))
|
||||
configured = drm_mode;
|
||||
|
||||
if (memcmp(current_mode, &drm_mode->mode_info,
|
||||
|
|
|
@ -55,7 +55,7 @@ path=@libexecdir@/weston-keyboard
|
|||
|
||||
#[output]
|
||||
#name=X1
|
||||
#mode=1024x768
|
||||
#mode=1024x768@60
|
||||
#transform=flipped-90
|
||||
|
||||
#[libinput]
|
||||
|
|
Loading…
Reference in New Issue