Bug 469653

Summary: Primary monitor changes after resume from sleep when screens' DP cables are plugged into the NVIDIA GPU in a specific way
Product: [Plasma] KScreen Reporter: rtheren
Component: commonAssignee: kscreen-bugs-null <kscreen-bugs-null>
Status: REPORTED ---    
Severity: normal CC: nate
Priority: NOR Keywords: multiscreen, wayland
Version: 5.27.4   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=466342
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Monitor Layout
Monitor layout after resume from sleep
kscreen bug before putting computer to sleep
kscreen bug after resuming computer from sleep
kscreen-doctor bug for X session

Description rtheren 2023-05-12 06:55:59 UTC
Created attachment 158881 [details]
Monitor Layout

SUMMARY

After the update to KDE Plasma 5.27 on Nobara Linux (Fedora fork), the primary monitor setting is set on a second monitor (on the right) rather than the first one (widescreen monitor on the left).

Both monitors are connected via DisplayPort cables.

~)$ kscreen-doctor -o
Output: 1 DP-2 enabled connected priority 2 DisplayPort Modes: 0:2560x1440@60! 1:2560x1440@144* 2:1920x1200@60 3:1920x1080@60 4:1920x1080@60 5:1920x1080@50 6:1600x1200@60 7:1680x1050@60 8:1280x1024@75 9:1280x1024@60 10:1280x800@60 11:1152x864@75 12:1280x720@60 13:1280x720@60 14:1280x720@50 15:1024x768@75 16:1024x768@60 17:800x600@75 18:800x600@60 19:720x576@50 20:720x480@60 21:640x480@75 22:640x480@60 23:640x480@60 Geometry: 3440,0 1440x2560 Scale: 1 Rotation: 2 Overscan: 0 Vrr: Never RgbRange: unknown
Output: 2 DP-3 enabled connected priority 1 DisplayPort Modes: 0:3440x1440@60! 1:3440x1440@165 2:3440x1440@144* 3:3440x1440@120 4:3440x1440@100 5:3440x1440@75 6:2560x1440@120 7:1920x1200@60 8:1920x1080@120 9:1920x1080@100 10:1920x1080@60 11:1920x1080@60 12:1680x1050@60 13:1600x900@60 14:1280x1024@60 15:1440x900@60 16:1280x800@60 17:1280x720@60 18:1280x720@60 19:1024x768@60 20:800x600@60 21:720x480@60 22:640x480@60 23:640x480@60 Geometry: 0,641 3440x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: Never RgbRange: unknown


STEPS TO REPRODUCE
1.  Put computer to sleep overnight.
2.  Turn it on, and login.

OBSERVED RESULT

Plasma panel is moved to the right monitor, and primary setting is also changed to the second monitor (Dell).

EXPECTED RESULT

Primary monitor setting should be kept as it was setup by me.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma:  Nobara Linux 37 
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.9

ADDITIONAL INFORMATION

GPU: MSI RTX 3080 Ventus 3X PLUS 10G LHR

I can reliably replicate this issue with sleep overnight, but I had it happen once while I was switching between TTYs.
This happens on both Nobara Linux and Manjaro. Also tried this on fresh user account with no difference.

I've been using this command to switch primary monitor after waking up:
$ kscreen-doctor output.DP-3.primary
Comment 1 Nate Graham 2023-05-15 18:56:26 UTC
According to the screenshot, the HP monitor is the primary one. And the output of kscreen-doctor -o also shows that DP-3 (which appears to be the widescreen HP monitor by resolution inspection) is listed as priority 1, which is correct.

So from KScreen's perspective, everything is okay and it would seem that Plasma is at fault. Or did you take the screenshot and paste the kscreen-doctor -o output after you manually fixed things by running `kscreen-doctor output.DP-3.primary`?
Comment 2 rtheren 2023-05-15 19:03:27 UTC
Hi Nate,

Yes, the output I provided from both the screenshot and kscreen-doctor is how it's supposed to be. I will paste here the output of both when the screens are 'flipped' after resume.

Regards
Comment 3 rtheren 2023-05-16 21:58:20 UTC
Created attachment 159019 [details]
Monitor layout after resume from sleep
Comment 4 rtheren 2023-05-16 21:58:53 UTC
Managed to get it flipped after second resume from sleep.

Attaching also kscreen-doctor output


(~)$ kscreen-doctor -o
Output: 1 DP-3 enabled connected priority 2 DisplayPort Modes: 0:3440x1440@60! 1:3440x1440@165 2:3440x1440@144* 3:3440x1440@120 4:3440x1440@100 5:3440x1440@75 6:2560x1440@120 7:1920x1200@60 8:1920x1080@120 9:1920x1080@100 10:1920x1080@60 11:1920x1080@60 12:1680x1050@60 13:1600x900@60 14:1280x1024@60 15:1440x900@60 16:1280x800@60 17:1280x720@60 18:1280x720@60 19:1024x768@60 20:800x600@60 21:720x480@60 22:640x480@60 23:640x480@60 Geometry: 0,641 3440x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: Never RgbRange: unknown
Output: 2 DP-2 enabled connected priority 1 DisplayPort Modes: 0:2560x1440@60! 1:2560x1440@144* 2:1920x1200@60 3:1920x1080@60 4:1920x1080@60 5:1920x1080@50 6:1600x1200@60 7:1680x1050@60 8:1280x1024@75 9:1280x1024@60 10:1280x800@60 11:1152x864@75 12:1280x720@60 13:1280x720@60 14:1280x720@50 15:1024x768@75 16:1024x768@60 17:800x600@75 18:800x600@60 19:720x576@50 20:720x480@60 21:640x480@75 22:640x480@60 23:640x480@60 Geometry: 3440,0 1440x2560 Scale: 1 Rotation: 2 Overscan: 0 Vrr: Never RgbRange: unknown
Comment 5 Nate Graham 2023-05-17 14:34:32 UTC
So it looks like which screen counts as output 1 and which counts as output 2 are getting switched around.

Can you also attach the output of `kscreen-console bug`?
Comment 6 rtheren 2023-05-17 17:55:47 UTC
Sure Nate, Here you go:

(~)$ kscreen-console bug

========================xrandr --verbose==========================
Screen 0: minimum 16 x 16, current 4880 x 2560, maximum 32767 x 32767
XWAYLAND1 connected 3440x1440+0+641 (0x41) normal (normal left inverted right x axis y axis) 800mm x 340mm
        Identifier: 0x23
        Timestamp:  87292
        Subpixel:   unknown
        Gamma:      1.0:1.0:1.0
        Brightness: 0.0
        Clones:    
        CRTC:       1
        CRTCs:      1
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                   filter: 
        RANDR Emulation: 1 
        non-desktop: 0 
                supported: 0, 1
  3440x1440 (0x41) 1086.750MHz -HSync +VSync *current +preferred
        h: width  3440 start 3744 end 4128 total 4816 skew    0 clock 225.65KHz
        v: height 1440 start 1443 end 1453 total 1568           clock 143.91Hz
  1920x1440 (0x42) 606.500MHz -HSync +VSync
        h: width  1920 start 2096 end 2304 total 2688 skew    0 clock 225.63KHz
        v: height 1440 start 1443 end 1447 total 1568           clock 143.90Hz
  1600x1200 (0x43) 418.250MHz -HSync +VSync
        h: width  1600 start 1736 end 1912 total 2224 skew    0 clock 188.06KHz
        v: height 1200 start 1203 end 1207 total 1307           clock 143.89Hz
  1440x1080 (0x28) 338.500MHz -HSync +VSync
        h: width  1440 start 1568 end 1720 total 2000 skew    0 clock 169.25KHz
        v: height 1080 start 1083 end 1087 total 1177           clock 143.80Hz
  1400x1050 (0x44) 320.000MHz -HSync +VSync
        h: width  1400 start 1520 end 1672 total 1944 skew    0 clock 164.61KHz
        v: height 1050 start 1053 end 1057 total 1144           clock 143.89Hz
  1280x1024 (0x2a) 285.000MHz -HSync +VSync
        h: width  1280 start 1392 end 1528 total 1776 skew    0 clock 160.47KHz
        v: height 1024 start 1027 end 1034 total 1116           clock 143.79Hz
  1280x960 (0x2b) 267.250MHz -HSync +VSync
        h: width  1280 start 1392 end 1528 total 1776 skew    0 clock 150.48KHz
        v: height  960 start  963 end  967 total 1046           clock 143.86Hz
  1152x864 (0x45) 214.750MHz -HSync +VSync
        h: width  1152 start 1248 end 1368 total 1584 skew    0 clock 135.57KHz
        v: height  864 start  867 end  871 total  942           clock 143.92Hz
  1024x768 (0x46) 169.750MHz -HSync +VSync
        h: width  1024 start 1112 end 1216 total 1408 skew    0 clock 120.56KHz
        v: height  768 start  771 end  775 total  838           clock 143.87Hz
  800x600 (0x2e) 102.500MHz -HSync +VSync
        h: width   800 start  864 end  944 total 1088 skew    0 clock  94.21KHz
        v: height  600 start  603 end  607 total  655           clock 143.83Hz
  640x480 (0x47) 65.250MHz -HSync +VSync
        h: width   640 start  688 end  752 total  864 skew    0 clock  75.52KHz
        v: height  480 start  483 end  487 total  525           clock 143.85Hz
  320x240 (0x30) 15.000MHz -HSync +VSync
        h: width   320 start  336 end  360 total  400 skew    0 clock  37.50KHz
        v: height  240 start  243 end  247 total  264           clock 142.05Hz
  1920x1200 (0x48) 502.500MHz -HSync +VSync
        h: width  1920 start 2088 end 2296 total 2672 skew    0 clock 188.06KHz
        v: height 1200 start 1203 end 1209 total 1307           clock 143.89Hz
  1680x1050 (0x49) 384.500MHz -HSync +VSync
        h: width  1680 start 1824 end 2008 total 2336 skew    0 clock 164.60KHz
        v: height 1050 start 1053 end 1059 total 1144           clock 143.88Hz
  1440x900 (0x4a) 280.000MHz -HSync +VSync
        h: width  1440 start 1560 end 1712 total 1984 skew    0 clock 141.13KHz
        v: height  900 start  903 end  909 total  981           clock 143.86Hz
  1280x800 (0x4b) 221.000MHz -HSync +VSync
        h: width  1280 start 1384 end 1520 total 1760 skew    0 clock 125.57KHz
        v: height  800 start  803 end  809 total  873           clock 143.84Hz
  720x480 (0x4c) 72.500MHz -HSync +VSync
        h: width   720 start  768 end  840 total  960 skew    0 clock  75.52KHz
        v: height  480 start  483 end  493 total  525           clock 143.85Hz
  640x400 (0x36) 53.250MHz -HSync +VSync
        h: width   640 start  680 end  744 total  848 skew    0 clock  62.79KHz
        v: height  400 start  403 end  409 total  438           clock 143.37Hz
  320x200 (0x37) 12.500MHz -HSync +VSync
        h: width   320 start  336 end  360 total  400 skew    0 clock  31.25KHz
        v: height  200 start  203 end  209 total  221           clock 141.40Hz
  2560x1440 (0x4d) 808.750MHz -HSync +VSync
        h: width  2560 start 2792 end 3072 total 3584 skew    0 clock 225.66KHz
        v: height 1440 start 1443 end 1448 total 1568           clock 143.91Hz
  2048x1152 (0x4e) 514.250MHz -HSync +VSync
        h: width  2048 start 2224 end 2448 total 2848 skew    0 clock 180.57KHz
        v: height 1152 start 1155 end 1160 total 1255           clock 143.88Hz
  1920x1080 (0x4f) 452.500MHz -HSync +VSync
        h: width  1920 start 2088 end 2296 total 2672 skew    0 clock 169.35KHz
        v: height 1080 start 1083 end 1088 total 1177           clock 143.88Hz
  1600x900 (0x50) 311.750MHz -HSync +VSync
        h: width  1600 start 1736 end 1904 total 2208 skew    0 clock 141.19KHz
        v: height  900 start  903 end  908 total  981           clock 143.93Hz
  1368x768 (0x3b) 226.500MHz -HSync +VSync
        h: width  1368 start 1480 end 1624 total 1880 skew    0 clock 120.48KHz
        v: height  768 start  771 end  781 total  838           clock 143.77Hz
  1280x720 (0x3c) 198.750MHz -HSync +VSync
        h: width  1280 start 1384 end 1520 total 1760 skew    0 clock 112.93KHz
        v: height  720 start  723 end  728 total  786           clock 143.67Hz
  1024x576 (0x51) 126.000MHz -HSync +VSync
        h: width  1024 start 1104 end 1208 total 1392 skew    0 clock  90.52KHz
        v: height  576 start  579 end  584 total  629           clock 143.91Hz
  864x486 (0x3e) 89.250MHz -HSync +VSync
        h: width   864 start  928 end 1016 total 1168 skew    0 clock  76.41KHz
        v: height  486 start  489 end  494 total  532           clock 143.63Hz
  720x400 (0x52) 60.500MHz -HSync +VSync
        h: width   720 start  768 end  840 total  960 skew    0 clock  63.02KHz
        v: height  400 start  403 end  413 total  438           clock 143.88Hz
  640x350 (0x40) 46.750MHz -HSync +VSync
        h: width   640 start  680 end  744 total  848 skew    0 clock  55.13KHz
        v: height  350 start  353 end  363 total  384           clock 143.57Hz
XWAYLAND2 connected primary 1440x2560+3440+0 (0x25) left (normal left inverted right x axis y axis) 340mm x 600mm
        Identifier: 0x6a3
        Timestamp:  87292
        Subpixel:   unknown
        Gamma:      1.0:1.0:1.0
        Brightness: 0.0
        Clones:    
        CRTC:       0
        CRTCs:      0
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                   filter: 
        RANDR Emulation: 1 
        non-desktop: 0 
                supported: 0, 1
  2560x1440 (0x25) 808.000MHz -HSync +VSync *current +preferred
        h: width  2560 start 2792 end 3072 total 3584 skew    0 clock 225.45KHz
        v: height 1440 start 1443 end 1448 total 1568           clock 143.78Hz
  1920x1440 (0x26) 606.000MHz -HSync +VSync
        h: width  1920 start 2096 end 2304 total 2688 skew    0 clock 225.45KHz
        v: height 1440 start 1443 end 1447 total 1568           clock 143.78Hz
  1600x1200 (0x27) 418.000MHz -HSync +VSync
        h: width  1600 start 1736 end 1912 total 2224 skew    0 clock 187.95KHz
        v: height 1200 start 1203 end 1207 total 1307           clock 143.80Hz
  1440x1080 (0x28) 338.500MHz -HSync +VSync
        h: width  1440 start 1568 end 1720 total 2000 skew    0 clock 169.25KHz
        v: height 1080 start 1083 end 1087 total 1177           clock 143.80Hz
  1400x1050 (0x29) 319.750MHz -HSync +VSync
        h: width  1400 start 1520 end 1672 total 1944 skew    0 clock 164.48KHz
        v: height 1050 start 1053 end 1057 total 1144           clock 143.78Hz
  1280x1024 (0x2a) 285.000MHz -HSync +VSync
        h: width  1280 start 1392 end 1528 total 1776 skew    0 clock 160.47KHz
        v: height 1024 start 1027 end 1034 total 1116           clock 143.79Hz
  1280x960 (0x2b) 267.250MHz -HSync +VSync
        h: width  1280 start 1392 end 1528 total 1776 skew    0 clock 150.48KHz
        v: height  960 start  963 end  967 total 1046           clock 143.86Hz
  1152x864 (0x2c) 214.500MHz -HSync +VSync
        h: width  1152 start 1248 end 1368 total 1584 skew    0 clock 135.42KHz
        v: height  864 start  867 end  871 total  942           clock 143.75Hz
  1024x768 (0x2d) 169.500MHz -HSync +VSync
        h: width  1024 start 1112 end 1216 total 1408 skew    0 clock 120.38KHz
        v: height  768 start  771 end  775 total  838           clock 143.66Hz
  800x600 (0x2e) 102.500MHz -HSync +VSync
        h: width   800 start  864 end  944 total 1088 skew    0 clock  94.21KHz
        v: height  600 start  603 end  607 total  655           clock 143.83Hz
  640x480 (0x2f) 65.000MHz -HSync +VSync
        h: width   640 start  688 end  752 total  864 skew    0 clock  75.23KHz
        v: height  480 start  483 end  487 total  525           clock 143.30Hz
  320x240 (0x30) 15.000MHz -HSync +VSync
        h: width   320 start  336 end  360 total  400 skew    0 clock  37.50KHz
        v: height  240 start  243 end  247 total  264           clock 142.05Hz
  1920x1200 (0x31) 502.250MHz -HSync +VSync
        h: width  1920 start 2088 end 2296 total 2672 skew    0 clock 187.97KHz
        v: height 1200 start 1203 end 1209 total 1307           clock 143.82Hz
  1680x1050 (0x32) 384.250MHz -HSync +VSync
        h: width  1680 start 1824 end 2008 total 2336 skew    0 clock 164.49KHz
        v: height 1050 start 1053 end 1059 total 1144           clock 143.79Hz
  1440x900 (0x33) 279.750MHz -HSync +VSync
        h: width  1440 start 1560 end 1712 total 1984 skew    0 clock 141.00KHz
        v: height  900 start  903 end  909 total  981           clock 143.73Hz
  1280x800 (0x34) 220.750MHz -HSync +VSync
        h: width  1280 start 1384 end 1520 total 1760 skew    0 clock 125.43KHz
        v: height  800 start  803 end  809 total  873           clock 143.67Hz
  720x480 (0x35) 72.250MHz -HSync +VSync
        h: width   720 start  768 end  840 total  960 skew    0 clock  75.26KHz
        v: height  480 start  483 end  493 total  525           clock 143.35Hz
  640x400 (0x36) 53.250MHz -HSync +VSync
        h: width   640 start  680 end  744 total  848 skew    0 clock  62.79KHz
        v: height  400 start  403 end  409 total  438           clock 143.37Hz
  320x200 (0x37) 12.500MHz -HSync +VSync
        h: width   320 start  336 end  360 total  400 skew    0 clock  31.25KHz
        v: height  200 start  203 end  209 total  221           clock 141.40Hz
  2048x1152 (0x38) 514.000MHz -HSync +VSync
        h: width  2048 start 2224 end 2448 total 2848 skew    0 clock 180.48KHz
        v: height 1152 start 1155 end 1160 total 1255           clock 143.81Hz
  1920x1080 (0x39) 452.000MHz -HSync +VSync
        h: width  1920 start 2088 end 2296 total 2672 skew    0 clock 169.16KHz
        v: height 1080 start 1083 end 1088 total 1177           clock 143.72Hz
  1600x900 (0x3a) 311.500MHz -HSync +VSync
        h: width  1600 start 1736 end 1904 total 2208 skew    0 clock 141.08KHz
        v: height  900 start  903 end  908 total  981           clock 143.81Hz
  1368x768 (0x3b) 226.500MHz -HSync +VSync
        h: width  1368 start 1480 end 1624 total 1880 skew    0 clock 120.48KHz
        v: height  768 start  771 end  781 total  838           clock 143.77Hz
  1280x720 (0x3c) 198.750MHz -HSync +VSync
        h: width  1280 start 1384 end 1520 total 1760 skew    0 clock 112.93KHz
        v: height  720 start  723 end  728 total  786           clock 143.67Hz
  1024x576 (0x3d) 125.750MHz -HSync +VSync
        h: width  1024 start 1104 end 1208 total 1392 skew    0 clock  90.34KHz
        v: height  576 start  579 end  584 total  629           clock 143.62Hz
  864x486 (0x3e) 89.250MHz -HSync +VSync
        h: width   864 start  928 end 1016 total 1168 skew    0 clock  76.41KHz
        v: height  486 start  489 end  494 total  532           clock 143.63Hz
  720x400 (0x3f) 60.250MHz -HSync +VSync
        h: width   720 start  768 end  840 total  960 skew    0 clock  62.76KHz
        v: height  400 start  403 end  413 total  438           clock 143.29Hz
  640x350 (0x40) 46.750MHz -HSync +VSync
        h: width   640 start  680 end  744 total  848 skew    0 clock  55.13KHz
        v: height  350 start  353 end  363 total  384           clock 143.57Hz

========================Outputs===================================

========================Configurations============================
Comment 7 rtheren 2023-05-17 17:58:00 UTC
Just for completeness sake, here's the output of doctor before and I after change primary once the screens got flipped from resume:

(~)$ kscreen-doctor -o
Output: 1 DP-3 enabled connected priority 2 DisplayPort Modes: 0:3440x1440@60! 1:3440x1440@165 2:3440x1440@144* 3:3440x1440@120 4:3440x1440@100 5:3440x1440@75 6:2560x1440@120 7:1920x1200@60 8:1920x1080@120 9:1920x1080@100 10:1920x1080@60 11:1920x1080@60 12:1680x1050@60 13:1600x900@60 14:1280x1024@60 15:1440x900@60 16:1280x800@60 17:1280x720@60 18:1280x720@60 19:1024x768@60 20:800x600@60 21:720x480@60 22:640x480@60 23:640x480@60 Geometry: 0,641 3440x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: Never RgbRange: unknown
Output: 2 DP-2 enabled connected priority 1 DisplayPort Modes: 0:2560x1440@60! 1:2560x1440@144* 2:1920x1200@60 3:1920x1080@60 4:1920x1080@60 5:1920x1080@50 6:1600x1200@60 7:1680x1050@60 8:1280x1024@75 9:1280x1024@60 10:1280x800@60 11:1152x864@75 12:1280x720@60 13:1280x720@60 14:1280x720@50 15:1024x768@75 16:1024x768@60 17:800x600@75 18:800x600@60 19:720x576@50 20:720x480@60 21:640x480@75 22:640x480@60 23:640x480@60 Geometry: 3440,0 1440x2560 Scale: 1 Rotation: 2 Overscan: 0 Vrr: Never RgbRange: unknown

(~)$ kscreen-doctor output.DP-3.primary

(~)$ kscreen-doctor -o
Output: 1 DP-3 enabled connected priority 1 DisplayPort Modes: 0:3440x1440@60! 1:3440x1440@165 2:3440x1440@144* 3:3440x1440@120 4:3440x1440@100 5:3440x1440@75 6:2560x1440@120 7:1920x1200@60 8:1920x1080@120 9:1920x1080@100 10:1920x1080@60 11:1920x1080@60 12:1680x1050@60 13:1600x900@60 14:1280x1024@60 15:1440x900@60 16:1280x800@60 17:1280x720@60 18:1280x720@60 19:1024x768@60 20:800x600@60 21:720x480@60 22:640x480@60 23:640x480@60 Geometry: 0,641 3440x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: Never RgbRange: unknown
Output: 2 DP-2 enabled connected priority 2 DisplayPort Modes: 0:2560x1440@60! 1:2560x1440@144* 2:1920x1200@60 3:1920x1080@60 4:1920x1080@60 5:1920x1080@50 6:1600x1200@60 7:1680x1050@60 8:1280x1024@75 9:1280x1024@60 10:1280x800@60 11:1152x864@75 12:1280x720@60 13:1280x720@60 14:1280x720@50 15:1024x768@75 16:1024x768@60 17:800x600@75 18:800x600@60 19:720x576@50 20:720x480@60 21:640x480@75 22:640x480@60 23:640x480@60 Geometry: 3440,0 1440x2560 Scale: 1 Rotation: 2 Overscan: 0 Vrr: Never RgbRange: unknown
Comment 8 Nate Graham 2023-05-18 15:55:28 UTC
Thanks. Nothing looks crazy to me in there.

Seems similar to the issue reported in Bug 466342.
Comment 9 rtheren 2023-05-18 16:01:35 UTC
(In reply to Nate Graham from comment #8)
> Thanks. Nothing looks crazy to me in there.
> 
> Seems similar to the issue reported in Bug 466342.

Yup, the report seems to be the same as my case, except with sleep instead of hibernation. In both cases, it started t after upgrade to Plasma 5.27.
Comment 10 rtheren 2023-05-26 09:27:01 UTC
Alright, an interesting development has occured. I've changed the layout of the monitors, because I replaced the monitor arm so my monitors are one above another. This seem to have fixed the issue with swapping primary monitor somehow.

I've had it like this since last Saturday, and the plasma taskbar stays where it's supposed to. So..... to anyone reading this: changing monitor layout or swapping DP cables seem to have helped.

This is what the kscreen-doctor output looks like
Output: 1 DP-2 enabled connected priority 1 DisplayPort Modes: 0:3440x1440@60! 1:3440x1440@165 2:3440x1440@144* 3:3440x1440@120 4:3440x1440@100 5:3440x1440@75 6:2560x1440@120 7:1920x1200@60 8:1920x1080@120 9:1920x1080@100 10:1920x1080@60 11:1920x1080@60 12:1680x1050@60 13:1600x900@60 14:1280x1024@60 15:1440x900@60 16:1280x800@60 17:1280x720@60 18:1280x720@60 19:1024x768@60 20:800x600@60 21:720x480@60 22:640x480@60 23:640x480@60 Geometry: 0,1440 3440x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: Never RgbRange: unknown
Output: 2 DP-3 enabled connected priority 2 DisplayPort Modes: 0:2560x1440@60! 1:2560x1440@144* 2:1920x1200@60 3:1920x1080@60 4:1920x1080@60 5:1920x1080@50 6:1600x1200@60 7:1680x1050@60 8:1280x1024@75 9:1280x1024@60 10:1280x800@60 11:1152x864@75 12:1280x720@60 13:1280x720@60 14:1280x720@50 15:1024x768@75 16:1024x768@60 17:800x600@75 18:800x600@60 19:720x576@50 20:720x480@60 21:640x480@75 22:640x480@60 23:640x480@60 Geometry: 480,0 2560x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: Never RgbRange: unknown
Comment 11 Nate Graham 2023-05-28 03:46:29 UTC
If you bring back the old cable, does the issue come back? If so, it might truly be a hardware issue, similar to another bug report I saw recently that was ultimately solved with a new HDMI cable.
Comment 12 rtheren 2023-05-30 18:05:40 UTC
Hi Nate,

Sorry it took me so long, but I have some news. I swapped the DP cables between Dell and HP monitors, and after resume.... the primary monitor was set to the other one!

kscreen-doctor after swapping cables:
Output: 1 DP-2 enabled connected priority 2 DisplayPort Modes: 0:2560x1440@60! 1:2560x1440@144* 2:1920x1200@60 3:1920x1080@60 4:1920x1080@60 5:1920x1080@50 6:1600x1200@60 7:1680x1050@60 8:1280x1024@75 9:1280x1024@60 10:1280x800@60 11:1152x864@75 12:1280x720@60 13:1280x720@60 14:1280x720@50 15:1024x768@75 16:1024x768@60 17:800x600@75 18:800x600@60 19:720x576@50 20:720x480@60 21:640x480@75 22:640x480@60 23:640x480@60 Geometry: 480,0 2560x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: Never RgbRange: unknown
Output: 2 DP-3 enabled connected priority 1 DisplayPort Modes: 0:3440x1440@60! 1:3440x1440@165 2:3440x1440@144* 3:3440x1440@120 4:3440x1440@100 5:3440x1440@75 6:2560x1440@120 7:1920x1200@60 8:1920x1080@120 9:1920x1080@100 10:1920x1080@60 11:1920x1080@60 12:1680x1050@60 13:1600x900@60 14:1280x1024@60 15:1440x900@60 16:1280x800@60 17:1280x720@60 18:1280x720@60 19:1024x768@60 20:800x600@60 21:720x480@60 22:640x480@60 23:640x480@60 Geometry: 0,1440 3440x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: Never RgbRange: unknown


After resume from sleep:
Output: 1 DP-2 enabled connected priority 1 DisplayPort Modes: 0:2560x1440@60! 1:2560x1440@144* 2:1920x1200@60 3:1920x1080@60 4:1920x1080@60 5:1920x1080@50 6:1600x1200@60 7:1680x1050@60 8:1280x1024@75 9:1280x1024@60 10:1280x800@60 11:1152x864@75 12:1280x720@60 13:1280x720@60 14:1280x720@50 15:1024x768@75 16:1024x768@60 17:800x600@75 18:800x600@60 19:720x576@50 20:720x480@60 21:640x480@75 22:640x480@60 23:640x480@60 Geometry: 480,0 2560x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: Never RgbRange: unknown
Output: 2 DP-3 enabled connected priority 2 DisplayPort Modes: 0:3440x1440@60! 1:3440x1440@165 2:3440x1440@144* 3:3440x1440@120 4:3440x1440@100 5:3440x1440@75 6:2560x1440@120 7:1920x1200@60 8:1920x1080@120 9:1920x1080@100 10:1920x1080@60 11:1920x1080@60 12:1680x1050@60 13:1600x900@60 14:1280x1024@60 15:1440x900@60 16:1280x800@60 17:1280x720@60 18:1280x720@60 19:1024x768@60 20:800x600@60 21:720x480@60 22:640x480@60 23:640x480@60 Geometry: 0,1440 3440x1440 Scale: 1 Rotation: 1 Overscan: 0 Vrr: Never RgbRange: unknown

It seems like the priority swaps between those two.
Comment 13 Nate Graham 2023-06-02 19:02:44 UTC
So with the old cable, it's still broken in the same way, or still broken but in a different way, or it's fixed now?
Comment 14 rtheren 2023-06-02 19:09:40 UTC
(In reply to Nate Graham from comment #13)
> So with the old cable, it's still broken in the same way, or still broken
> but in a different way, or it's fixed now?

I didn't change cables, I just swapped where they connect on GPU ( Dell cable where the HP usually is and vice-versa). And the way I have it set now seem to have fixed it.
Comment 15 Nate Graham 2023-06-02 19:38:04 UTC
Amazing. I'm not sure how to proceed from here, so I'll keep the bug report open. Glad you found a setup that works now, though!
Comment 16 rtheren 2023-06-03 10:59:26 UTC
It's a confuzzling issue that's for sure. I suppose it can be closed, unless there will be someone else that will face the same issue.
Comment 17 Nate Graham 2023-06-06 16:05:21 UTC
Can you return the cables to their previous positions that triggered the bug? Then reboot, and set up everything the way it's supposed to be, run `kscreen-console bug`, and copy the contents of the EDID: section for each screen into a text file somewhere.

Then reproduce the bug and do it again. Have any of the screens' EDID values changed?
Comment 18 rtheren 2023-06-12 17:33:57 UTC
Created attachment 159616 [details]
kscreen bug before putting computer to sleep
Comment 19 rtheren 2023-06-12 17:34:18 UTC
Created attachment 159617 [details]
kscreen bug after resuming computer from sleep
Comment 20 rtheren 2023-06-12 17:35:06 UTC
Hi Nate,

Sorry I took so long. I've attached output from kscreen-doctor bug before and after resume. There's no EDID values in either one of them.
Comment 21 Nate Graham 2023-06-14 18:31:34 UTC
Oh, I think because you're on Wayland and IIRC the EDIDs only show up on X11 right now. Does the issue reproduce on X11? If it does, can you get the EDIDs there to see if they change in the way we're suspecting?
Comment 22 rtheren 2023-06-14 18:36:44 UTC
I will change the session to X11 before putting it to sleep tonight. Will post the .txt files with output for both states when I get them.
Comment 23 rtheren 2023-06-21 18:23:00 UTC
So..... it seems that I cannot reproduce it under X session no matter what I do. 
kscreen-doctor bug does give me EDID at least.
Comment 24 rtheren 2023-06-21 18:23:21 UTC
Created attachment 159822 [details]
kscreen-doctor bug for X session
Comment 25 Zamundaaa 2023-10-05 19:41:59 UTC
Git commit ae84480fbfdc684b8ee4b0207d3ce679f6fb4cd7 by Xaver Hugl.
Committed on 05/10/2023 at 20:29.
Pushed by zamundaaa into branch 'master'.

outputconfigurationstore: add new config system

Instead of an external service (like KScreen) storing and restoring output configurations,
with this commit KWin takes over that responsibility. This allows it to, among other things,
generate appropriate configs for new sets of outputs immediately, and take KWin-internal information
about outputs into account when generating them.
Related: bug 466208, bug 455082, bug 457430, bug 474021, bug 466342, bug 470863, bug 466556

M  +1    -0    CMakeLists.txt
M  +1    -0    autotests/integration/kwin_wayland_test.cpp
M  +1    -0    src/CMakeLists.txt
M  +5    -0    src/backends/drm/drm_output.cpp
M  +9    -0    src/core/output.cpp
M  +11   -0    src/core/output.h
M  +1    -0    src/core/outputconfiguration.h
M  +7    -0    src/main.cpp
M  +1    -0    src/main.h
M  +0    -4    src/main_wayland.cpp
M  +709  -20   src/outputconfigurationstore.cpp
M  +68   -4    src/outputconfigurationstore.h
M  +1    -0    src/utils/CMakeLists.txt
M  +8    -0    src/utils/edid.cpp
M  +8    -0    src/utils/edid.h
A  +54   -0    src/utils/orientationsensor.cpp     [License: GPL(v2.0+)]
A  +38   -0    src/utils/orientationsensor.h     [License: GPL(v2.0+)]
M  +34   -1    src/wayland/outputdevice_v2.cpp
M  +1    -0    src/wayland/outputdevice_v2.h
M  +12   -1    src/wayland/outputmanagement_v2.cpp
M  +49   -6    src/workspace.cpp
M  +2    -0    src/workspace.h

https://invent.kde.org/plasma/kwin/-/commit/ae84480fbfdc684b8ee4b0207d3ce679f6fb4cd7