Bug 346455

Summary: KScreen doesn't change resolution immediately when plugin screen
Product: [Plasma] KScreen Reporter: Weng Xuetian <wengxt>
Component: commonAssignee: Daniel Vrátil <dvratil>
Status: RESOLVED UPSTREAM    
Severity: normal CC: loic.yhuel, matthias
Priority: NOR    
Version: 5.2.95   
Target Milestone: ---   
Platform: Chakra   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Weng Xuetian 2015-04-22 04:00:28 UTC
I'm using micro hdmi port for another screen. When I plugin the extra screen, screen resolution is not changed. When I try to start the kcm in systemsettings, the resolution is changed immediately.

Reproducible: Sometimes

Steps to Reproduce:
Plugin screen

Actual Results:  
The screen resolution is not changed, but after start kcm (just start it is enough, no need to change anything in it) resolution is changed automatically.

Expected Results:  
resolution changes automatically.
Comment 1 Matthias Blaicher 2015-08-20 19:14:36 UTC
I have something identical:

On i915, if I connect a VGA monitor, nothing happens. Once i run either kscreen kcm *or* xrandr, it triggers the monitor change.

This is really annoying when *removing* VGA and the laptop screen is still disabled. Running xrandr blindly in konsole makes the screen work again.  

This is on Arch Linux testing i.e. Qt 5.5.0 with the multimonitor patches applied in addition:
 https://codereview.qt-project.org/#/c/114796/ https://codereview.qt-project.org/#/c/120700/

That's probably as close to upstream as you can reasonably get on a production system...
Comment 2 Loïc Yhuel 2015-09-09 02:57:53 UTC
Same issue, a VT switch or "xrandr" (without arguments !) triggers the monitor change.

Here is what kscreen_backend_launcher gets on plug :
kscreen.xcb.helper: RRotify_OutputChange
kscreen.xcb.helper:     Output:  69
kscreen.xcb.helper:     CRTC:  0
kscreen.xcb.helper:     Mode:  0
kscreen.xcb.helper:     Rotation:  "Rotate_0"
kscreen.xcb.helper:     Connection:  "Disconnected"
kscreen.xcb.helper:     Subpixel Order:  0

And then when running "xrandr" just after :
kscreen.xcb.helper: RRotify_OutputChange
kscreen.xcb.helper:     Output:  69
kscreen.xcb.helper:     CRTC:  0
kscreen.xcb.helper:     Mode:  0
kscreen.xcb.helper:     Rotation:  "Rotate_0"
kscreen.xcb.helper:     Connection:  "Connected"
kscreen.xcb.helper:     Subpixel Order:  0

If "xev -event randr" is running, the bug disappears (at least on plug), xev and kscreen see both events :
RRNotify event, serial 25, synthetic NO, window 0x800001,
    subtype XRROutputChangeNotifyEvent
    output HDMI1, crtc None, mode None
    rotation RR_Rotate_0
    connection RR_Disconnected, subpixel_order SubPixelUnknown
...
RRNotify event, serial 29, synthetic NO, window 0x800001,
    subtype XRROutputChangeNotifyEvent
    output HDMI1, crtc None, mode None
    rotation RR_Rotate_0
    connection RR_Connected, subpixel_order SubPixelUnknown


It seems to be XRRGetScreenResources in xev which avoids the issue.
For "xrandr", it's probably the same, or XRRGetScreenInfo.
In Xorg server, these functions call RRGetInfo ("Poll the driver for changed information"), then RRTellChanged which will dispatch events.
So it looks like a bug in the Intel driver.
Comment 3 Loïc Yhuel 2015-09-09 20:45:34 UTC
Fixed by https://bugs.freedesktop.org/show_bug.cgi?id=91929 for me.
I don't know if the original reporter uses Intel DDX or not.

But now kscreen receives more events, so it crashes more often.
I often get https://bugs.kde.org/show_bug.cgi?id=352488 or https://bugs.kde.org/show_bug.cgi?id=344813.
Comment 4 Matthias Blaicher 2015-09-14 15:02:39 UTC
(In reply to Loïc Yhuel from comment #3)
> Fixed by https://bugs.freedesktop.org/show_bug.cgi?id=91929 for me.
> I don't know if the original reporter uses Intel DDX or not.
> 
> But now kscreen receives more events, so it crashes more often.
> I often get https://bugs.kde.org/show_bug.cgi?id=352488 or
> https://bugs.kde.org/show_bug.cgi?id=344813.

Thanks. Yes, at least I am indeed on Intel DDX.
Comment 5 Weng Xuetian 2015-09-14 18:48:19 UTC
Yes, I'm also on intel ddx. So I guess this should be marked as upstream.