alex-courtis / way-displays

way-displays: Auto Manage Your Wayland Displays
MIT License
246 stars 12 forks source link

Resolution #19

Closed peter-si closed 2 years ago

peter-si commented 2 years ago

Hi, probably a noob question, but I see

MAX_PREFERRED_REFRESH For the specified displays, use the maximum avalable refresh rate for resolution of the preferred mode. e.g. when preferred mode is 1920x1080@60Hz, use 1920x1080@165Hz

in documentation. How do I set preferred mode? (on sway specifically)

I have these modes

I [14:58:34.510] HDMI-A-1 Arrived:
I [14:58:34.510]   info:
I [14:58:34.510]     name:     'HDMI-A-1'
I [14:58:34.510]     desc:     'Samsung Electric Company U28E590 H4ZM901003 (HDMI-A-1)'
I [14:58:34.510]     width:    610mm
I [14:58:34.510]     height:   350mm
I [14:58:34.510]     dpi:      158.32 @ 3840x2160
D [14:58:34.510]     mode:     3840x2160@30Hz (preferred)
D [14:58:34.510]     mode:     3840x2160@30Hz
D [14:58:34.510]     mode:     3840x2160@30Hz
D [14:58:34.510]     mode:     3840x2160@25Hz
D [14:58:34.510]     mode:     3840x2160@24Hz
D [14:58:34.510]     mode:     3840x2160@24Hz
D [14:58:34.510]     mode:     2560x1440@60Hz
D [14:58:34.510]     mode:     1920x1080@60Hz
D [14:58:34.510]     mode:     1920x1080@60Hz

with 3840x2160@30Hz (preferred). However I would like to use 2560x1440@60Hz (I don't really care if it is preferred or no). Setting output HDMI-A-1 res 2560x1440@60Hz (or with mode) doesn't seem to work, since way-displays will override it. Can you please help setting my resolution? Thanks

alex-courtis commented 2 years ago

Duplicate of #13, closing that as it has less detail.

alex-courtis commented 2 years ago

Preferred mode is defined by the monitor. It is usually the highest resolution that it can display with the attached cable, however it is often not the highest refresh. Sometimes it is a low "most compatible" mode, especially on TVs.

TODO: document this in README

alex-courtis commented 2 years ago

We cannot change preferred mode, however it is possible to use a different mode. way-displays currently always uses the preferred mode's resolution, overriding the setting from sway.

Something like this is possible:

MODES:
    - NAME_DESC: Samsung Electric Company U28E590 H4ZM901003
      WIDTH: 2560
      HEIGHT: 1440
      REFRESH_MILLIHZ: 599531

Perhaps REFRESH_HZ: 60 and try modes close to 60 until we find one that works.

There may be problems, as monitors sometimes won't display some modes (black screen, power down) despite their being reported. A fallback to preferred may need to be implemented.

I will consider this and see if any other issues or solutions arise.

raxetul commented 2 years ago

I have two monitors:

alex-courtis commented 2 years ago

@raxetul MAX_PREFERRED_ REFRESH will resolve your VG27AQ case, however we need something more specific for the other panel.

Specifying the highest might be a solution that suits most cases, with the specific mode being the last resort.

Perhaps:

MODES:
    - NAME_DESC: Unknown Display Controller
      HIGHEST: TRUE
    - NAME_DESC: Samsung Electric Company U28E590 H4ZM901003
      WIDTH: 2560
      HEIGHT: 1440
      REFRESH_MILLIHZ: 599531
alex-courtis commented 2 years ago

22 should be resolved before attempting this one. The final head state after the inevitable failures may not be correct.

alex-courtis commented 2 years ago

Needs #27

raxetul commented 2 years ago

I agree, specific cases(in my case it is not a specific one, it is an extreme one) should be handled after the end. I just write it to make you know.

alex-courtis commented 2 years ago

should be handled after the end

The MAX_PREFERRED_REFRESH case? That will be deprecated, however will still be done after the user mode setting, but before the preferred mode. The effect will be the same as using a MODE with the width/height set to the preferred mode's.

alex-courtis commented 2 years ago

Changes merged to master. 1.5.0 release incoming.

User may select mode for each monitor via CLI or cfg.yaml via:

Mode fallback:

  1. Each mode that satisfies the selection, in descending order, until a successful mode is found
  2. Preferred
  3. Maximum Available

Refresh in mHz is printed, however the selection is in Hz. Selection in mHz may be added if needed.

alex-courtis commented 2 years ago

1.5.0 has been released.

Please see README and man way-displays for all the details.

I would be most grateful for any feedback and results.

Note that refresh selection is via Hz. If there are problems selecting the mode that closest matches that value, mHz selection could be added.

alex-courtis commented 2 years ago

Implemented. Please reopen if you have any issues or questions.