Bug 437973

Summary: Meta + P Switch Monitor Shortcut Reverts Monitor(s) to Default Refresh Rate
Product: [Plasma] KScreen Reporter: Tim <dodgexander>
Component: commonAssignee: kscreen-bugs-null <kscreen-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: kde, nate
Priority: NOR    
Version: 5.26.2   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Tim 2021-06-01 22:40:23 UTC
SUMMARY
Using the Meta+P shortcut to change multiple monitor layouts sets monitor frequency to default instead metamode defined in xorg.conf, or if not, it should use the last used frequency.

STEPS TO REPRODUCE
1. Set a monitor refresh rate that is non-default, in my case 144hz of my external monitor.
2. Change screen layout using meta+p shortcut to extend too secondary screen.
3. View current refresh rate (reported by the display).

OBSERVED RESULT
The refresh rate always switches to the default as reported by xrandr, rather than the preferred mode set in xorg.conf, or the last used mode in nvidia-settings or display manager. For monitors that have correct refresh rate's set as default, its fine. For high refresh rate monitors that often report default 60hz when they can run at 144hz+ or higher, its not.

When using Meta+P you can view the xorg.log. Instead of following my defined metamode in the xorg.conf, meta+p overules and sets the resolution as an auto mode instead.

See xorg log when I enable my internal laptop monitor in addition to my primary here (extend right, meta+p):
[ 17023.529] (II) NVIDIA(0): Setting mode "DP-1: nvidia-auto-select @2560x1440 +1920+0 {ViewPortIn=2560x1440, ViewPortOut=2560x1440+0+0}, DP-0: nvidia-auto-select @1920x1080 +0+0 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}"

DP-1 which is my ext monitor is using nvidia-auto-select mode and not the metamode reported in my xorg.conf.

EXPECTED RESULT
The shortcut should read the preferred mode set in xorg.conf, or the last used mode rather than the default mode.

Correct Xorg.log would look like:
[ 17023.529] (II) NVIDIA(0): Setting mode "DP-1: 2560x1440_144 +1920+0 {ViewPortIn=2560x1440, ViewPortOut=2560x1440+0+0}, DP-0: 1920x1080_120 @1920x1080 +0+0 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}"

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: 
Operating System: Manjaro Linux
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2
Kernel Version: 5.10.41-1-MANJARO
OS Type: 64-bit
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-8750H CPU @ 2.20GHz
Memory: 7.7 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1060/PCIe/SSE2KDE Plasma Version: 

ADDITIONAL INFORMATION
Possibly related to this bug: https://bugs.kde.org/show_bug.cgi?id=417543
But instead of switching monitors using meta+p, they are physically switching them.

xrandr:

Screen 0: minimum 8 x 8, current 2560 x 1440, maximum 32767 x 32767HDMI-0 disconnected (normal left inverted right x axis y axis)DP-0 connected (normal left inverted right x axis y axis)  1920x1080    120.15 +  60.13   DP-1 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 697mm x 392mm  2560x1440     59.95*+ 144.00   120.00    99.95    84.98     1024x768      60.00     800x600       60.32     640x480       59.94  

inxi:

Graphics:Device-1: NVIDIA GP106BM [GeForce GTX 1060 Mobile 6GB] driver: nvidia  v: 460.73.01  Display: x11 server: X.Org 1.20.11 driver: loaded: nvidia  resolution: 2560x1440~60Hz  OpenGL: renderer: GeForce GTX 1060/PCIe/SSE2 v: 4.6.0 NVIDIA 460.73.01

Xorg.conf:
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 460.73.01

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "LG Electronics 32GK650G"
    HorizSync       88.0 - 222.0
    VertRefresh     30.0 - 144.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 1060"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-2"
    Option         "metamodes" "DP-1: 2560x1440_144 +1920+0, DP-0: 1920x1080_120 +0+360"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
Comment 1 Tim 2021-06-02 02:56:32 UTC
Some additional info. Found in the journalctl this is what seems to cause the issue:

6/1/21 10:53 PM	kscreen_backend_launcher	kscreen.xrandr: RRSetCrtcConfig (change output) 
 	Output: 449 ( "DP-1" ) 
 	CRTC: 441 
 	Pos: QPoint(0,0) 
 	Mode: 450 KScreen::Mode(Id: "450" , Size: QSize(2560, 1440) @ 59.9506 ) 
 	Rotation: KScreen::Output::None
Comment 2 Nate Graham 2022-11-07 21:14:23 UTC
Thank you for the bug report. Unfortunately we were not able to get to it yet. Can we ask you to please see if you can reproduce the issue with Plasma 5.25 or 5.26?

If you can, please change the status to CONFIRMED when replying. Thanks a lot!
Comment 3 Tim 2022-11-08 12:42:30 UTC
This still exists in 5.26.
Comment 4 Nate Graham 2022-11-08 23:08:28 UTC
(In reply to Tim from comment #1)
> Some additional info. Found in the journalctl this is what seems to cause
> the issue:
> 
> 6/1/21 10:53 PM	kscreen_backend_launcher	kscreen.xrandr: RRSetCrtcConfig
> (change output) 
>  	Output: 449 ( "DP-1" ) 
>  	CRTC: 441 
>  	Pos: QPoint(0,0) 
>  	Mode: 450 KScreen::Mode(Id: "450" , Size: QSize(2560, 1440) @ 59.9506 ) 
>  	Rotation: KScreen::Output::None

Looks like it grabbed the config for another screen. Marking as a duplicate of Bug 434604.

*** This bug has been marked as a duplicate of bug 434604 ***
Comment 5 Tim 2022-11-09 03:22:55 UTC
(In reply to Nate Graham from comment #4)
> (In reply to Tim from comment #1)
> > Some additional info. Found in the journalctl this is what seems to cause
> > the issue:
> > 
> > 6/1/21 10:53 PM	kscreen_backend_launcher	kscreen.xrandr: RRSetCrtcConfig
> > (change output) 
> >  	Output: 449 ( "DP-1" ) 
> >  	CRTC: 441 
> >  	Pos: QPoint(0,0) 
> >  	Mode: 450 KScreen::Mode(Id: "450" , Size: QSize(2560, 1440) @ 59.9506 ) 
> >  	Rotation: KScreen::Output::None
> 
> Looks like it grabbed the config for another screen. Marking as a duplicate
> of Bug 434604.
> 
> *** This bug has been marked as a duplicate of bug 434604 ***

I don't think this is a duplicate. The monitor I have connected is always the same. What it's doing is resetting to the default 60hz each time instead of what I've set (144hz).
This involves no disconnecting or reconnecting monitors and only uses the meta+p shortcut.
Comment 6 Nate Graham 2022-11-09 19:34:34 UTC
Hmm. Can you attach the output of `kscreen-doctor -o` before you trigger the bug (when it's working properly) and then immediately after you trigger the bug (when the refresh rate gets reset)?