I experienced some weird dual screen issue after git pull yesterday, when I added a external monitor to the left of my laptop screen, using either xrandr command or the KDE tool, the right (laptop) screen was complete blank (black), mouse could move on it but the plasma desktop did not extend to it. The display on the left (external) screen wass also strange, the images and windows were stretched as if they are showing on a bigger screen but only partial are visible. After I reverted d6b3f6983efebc42abd6028ece9c3ec7facea2d0 everything is normal again. Reproducible: Always Steps to Reproduce: 1. Plugin an external monitor 2. Add it to the left of the main monitor using xrandr 3. Actual Results: The main monitor become blank, and the windows on the the external monitor are stretched and only partially visiable. Expected Results: The normal behavior Not sure if it is relevant, I am using libxcb 1.9, with some gentoo patches, libxcb-1.9-r1 to be specific.
Suspend the compositor before adding the screen (shift+alt+f12) Does it then act as expected? (While i actually doubt so from the description) In case please attach the output of qdbus org.kde.kwin /KWin supportInformation Otherwise please post the output of "xrandr -q" before and after adding the screen.
Disable the compositor improved the situation a litle bit, now I can see the wall paper on the main monitor and use the plasma desktop on it, once I enable composite, the main monitor black out again, and even with the compositor disabled, I cannot move window from the external monitor to the main monitor, the other way around somehow works fine. And restart kwin fixes everything. xrandr -q look normal: Before adding the monitor: Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 8192 x 8192 VGA-0 disconnected primary (normal left inverted right x axis y axis) LVDS-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm 1920x1080 60.0*+ 50.0 DP-0 disconnected (normal left inverted right x axis y axis) DP-1 disconnected (normal left inverted right x axis y axis) DP-2 disconnected (normal left inverted right x axis y axis) DP-3 disconnected (normal left inverted right x axis y axis) DP-4 disconnected (normal left inverted right x axis y axis) DP-5 disconnected (normal left inverted right x axis y axis) After adding a new monitor: Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 8192 x 8192 VGA-0 disconnected primary (normal left inverted right x axis y axis) LVDS-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm 1920x1080 60.0*+ 50.0 DP-0 disconnected (normal left inverted right x axis y axis) DP-1 disconnected (normal left inverted right x axis y axis) DP-2 disconnected (normal left inverted right x axis y axis) DP-3 connected (normal left inverted right x axis y axis) 1920x1080 60.0 + 1280x1024 75.0 60.0 1152x864 75.0 1024x768 75.0 60.0 800x600 75.0 60.3 640x480 75.0 59.9 DP-4 disconnected (normal left inverted right x axis y axis) DP-5 disconnected (normal left inverted right x axis y axis) The output of qdbus org.kde.kwin /KWin supportInformation can be find in the attachment
Created attachment 77701 [details] qdbus org.kde.kwin /KWin supportInformation output
----- Snip ---------- Before adding the monitor: Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 8192 x 8192 After adding a new monitor: Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 8192 x 8192 DP-3 connected (normal left inverted right x axis y axis) 1920x1080 60.0 + ----- /Snip ---------- DP-3 is connected, but not used. Does the output change with restarting kwin?
That output is just after I connected the monitor, before enable it using xrandr, after issuing xrandr --output DP-3 --auto --left-of LVDS-0 --output LVDS-0 --auto --primary the output is: Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 8192 x 8192 VGA-0 disconnected (normal left inverted right x axis y axis) LVDS-0 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 344mm x 193mm 1920x1080 60.0*+ 50.0 DP-0 disconnected (normal left inverted right x axis y axis) DP-1 disconnected (normal left inverted right x axis y axis) DP-2 disconnected (normal left inverted right x axis y axis) DP-3 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm 1920x1080 60.0*+ 1280x1024 75.0 60.0 1152x864 75.0 1024x768 75.0 60.0 800x600 75.0 60.3 640x480 75.0 59.9 DP-4 disconnected (normal left inverted right x axis y axis) DP-5 disconnected (normal left inverted right x axis y axis) Also if I disable the external monitor after I fixed the dual screen display by restarting kwin, the resulting desktop is squeezed to like 2/3 of the main screen, the rest 1/3 is just black band.
The issue is likely the screen caching. If you want, you can try moving local static xcb_screen_t *s_screen = NULL; to a global static static xcb_screen_t *gs_screen = NULL; and add some inline void invalidateScreen() { gs_screen = NULL; } To call eg at events.cpp if (e->type == Extensions::randrNotifyEvent() && Extensions::randrAvailable()) { XRRUpdateConfiguration(e); invalidateScreen(); ... } or in workspace.cpp void Workspace::desktopResized() { invalidateScreen(); ... }
Hi Thomas, sorry for the late reply, I tried the changes you suggested but no improvement, the diff look like this: diff --git a/kwin/geometry.cpp b/kwin/geometry.cpp index 03085db..3f99c01 100644 --- a/kwin/geometry.cpp +++ b/kwin/geometry.cpp @@ -67,6 +67,7 @@ extern bool is_multihead; */ void Workspace::desktopResized() { + invalidateScreen(); QRect geom; for (int i = 0; i < QApplication::desktop()->screenCount(); i++) { //do NOT use - QApplication::desktop()->screenGeometry(i) there could be a virtual geometry diff --git a/kwin/libkwineffects/kwinglobals.h b/kwin/libkwineffects/kwinglobals.h index aa2681c..13276f5 100644 --- a/kwin/libkwineffects/kwinglobals.h +++ b/kwin/libkwineffects/kwinglobals.h @@ -158,10 +158,10 @@ KWIN_EXPORT xcb_timestamp_t xTime() return QX11Info::appTime(); } +static xcb_screen_t *s_screen = NULL; inline KWIN_EXPORT xcb_screen_t *defaultScreen() { - static xcb_screen_t *s_screen = NULL; if (s_screen) { return s_screen; } @@ -190,6 +190,10 @@ KWIN_EXPORT int displayHeight() return screen ? screen->height_in_pixels : 0; } +inline void invalidateScreen() { + s_screen = NULL; +} + /** @internal */ // TODO: QT5: remove I also tried to change event.cpp (but not tried both together), the result is the same. I only restarted kwin by run kwin --replace in konsole without a full logout/login.
try after XRRUpdateConfiguration(e); in events.cpp as well. If it's not screen caching i frankly don't know what could cause any issues here ... except getting the geometry update, and calling displayWidth/Height before the structure behind the defaultScreen() pointer has updated. Brute force: add "XSync(display(), false);" on top of the defaultScreen() function.
Git commit c61081ffed38a2f124631d41cede6e2b839026c9 by Martin Gräßlin. Committed on 11/03/2013 at 15:14. Pushed by graesslin into branch 'master'. Temporarily revert to XDisplayWidth/Height We don't like broken master. Proper fix coming later on. M +8 -0 kwin/libkwineffects/kwinglobals.h http://commits.kde.org/kde-workspace/c61081ffed38a2f124631d41cede6e2b839026c9