Bug 131197

Summary: KDM starts with two screens, logging in disables one screen and loses window settings
Product: krandr Reporter: Niek Beernink <n.beernink>
Component: generalAssignee: Gustavo Pichorim Boiko <gustavo.boiko>
Severity: normal CC: apaku, danielstefanmader+kde, jonas.vejlin, l.lunak, myriam, wstephenson
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: kwin backtrace
kcmrandrrc file
Screencap of SystemSettings -> Display
Screencap of KControl->Peripherals->Display

Description Niek Beernink 2006-07-22 12:23:07 UTC
Version:           3.0 (using KDE KDE 3.5.3)
Installed from:    Ubuntu Packages

When I start KDM, both screens are enabled. When I proceed to log in, the right screen is disabled and my resolution is scaled down to 800x600.

If I then enable both screens by using the command "xrandr -s 0" and I try to maximize a window, it isn't confined to just one screen, but spans both. In order to fix it, I have to disable the option "Allow moving and resizing of maximized windows" and then enable it again. (hitting apply both times). Both my taskbars show exactly the same applications, eventhough the option for it ("Show windows from all screens") is disabled. In order to fix that, I have to enable the option, click apply, disable the option and click apply.

I created a new user to see if the same problem would occur, and it didn't. There it worked fine.
It must be a file that got corrupted, except I have no idea which one. This whole problem started happening after I updated kdelibs (and possibly kwin, but I think that's part of kdelibs?) from the kubuntu edgy repositories (which will be patched with Seli's Xinerama improvements. http://ktown.kde.org/~seli/xinerama/)

Here are the relevant sections of my xorg.conf file:
Section "Device"
        Identifier      "6600GT"
        BoardName       "GeForce 6600GT"
        Driver          "nvidia"
        BusID           "PCI:1:0:0"
        Option          "NvAGP"                         "2"
        Option          "TwinView"                      "on"
        Option          "Metamodes"     "1280x1024,1280x1024; 1024x768,1024x768; 800x600,800x600; 1280x1024,NULL; 1024x768,NULL; 800x600,NULL"
        Option          "TwinViewOrientation"           "RightOf"
        Option          "SecondMonitorHorizSync"        "UseEdidFreqs"
        Option          "SecondMonitorVertRefresh"      "UseEdidFreqs"
        Option          "ConnectedMonitor"              "crt, crt"
        Option          "NoLogo"                        "True"
        Option          "NoPowerConnectorCheck"         "True"

Section "Monitor"
        Identifier      "930BF"
        VendorName      "SamSung"
        ModelName       "930BF"
        Option          "DPMS"
        Option          "UseEdidFreqs"
        Gamma 0.8

Section "Screen"
        Identifier      "Default Screen"
        Device          "6600GT"
        Monitor         "930BF"
        DefaultDepth    24

        SubSection "Display"
                Depth           1
                Modes "800x600@75" "800x600@60" "1024x768@75" "1024x768@60" "1280x1024@75" "1280x1024@60"
                Viewport 0 0
        SubSection "Display"
                Depth           4
                Modes "800x600@75" "800x600@60" "1024x768@75" "1024x768@60" "1280x1024@75" "1280x1024@60"
                Viewport 0 0
        SubSection "Display"
                Depth           8
                Modes "800x600@75" "800x600@60" "1024x768@75" "1024x768@60" "1280x1024@75" "1280x1024@60"
                Viewport 0 0
        SubSection "Display"
                Depth           15
                Modes "800x600@75" "800x600@60" "1024x768@75" "1024x768@60" "1280x1024@75" "1280x1024@60"
                Viewport 0 0
        SubSection "Display"
                Depth           16
                Modes "800x600@75" "800x600@60" "1024x768@75" "1024x768@60" "1280x1024@75" "1280x1024@60"
                Viewport 0 0
        SubSection "Display"
                Depth           24
                Modes "800x600@75" "800x600@60" "1024x768@75" "1024x768@60" "1280x1024@75" "1280x1024@60"
                Viewport 0 0


$ xrandr
 SZ:    Pixels          Physical       Refresh
*0   2560 x 1024   ( 765mm x 302mm )  *50
 1   2048 x 768    ( 765mm x 302mm )   51
 2   1600 x 600    ( 765mm x 302mm )   52
 3   1280 x 1024   ( 765mm x 302mm )   75
 4   1024 x 768    ( 765mm x 302mm )   75
 5    800 x 600    ( 765mm x 302mm )   75
Current rotation - normal
Current reflection - none
Rotations possible - normal
Reflections possible - none
Comment 1 Niek Beernink 2006-07-25 11:47:53 UTC
Created attachment 17124 [details]
kwin backtrace

When I log out, all my applications, including kwin, crash. I attached the
backtrace for this. Perhaps it's of some use.
Comment 2 Niek Beernink 2006-07-31 18:14:09 UTC
This issue is caused by kguidance (http://www.simonzone.com/software/guidance/) writing a file called displayconfigrc in ~/.kde/share/config and me re-sizing back to two screens using xrandr -s 0. 

Kguidance as of this date doesn't support dual monitor layouts with twinview, my experience with it has been rather disastrous. While it does enable me to use two screens you would with nvidia's twinview, it soon becomes apparent that the desktop size is too large and you would have to scroll the desktops if you reached the sides of the monitor. Quite unpleasant and I didn't know how to solve it so I made my xorg.conf file by hand. However, I'm pretty sure that at the moment the tool is fine for people who have one monitor.

In any case, I'm not sure if kwin should detect changes made via xrandr, kguidance should detect these changes or that xrandr should notify the concerned programs. 
Comment 3 Andrew Ash 2006-08-19 16:37:27 UTC
I'm also having this bug!  I originally thought the problem was in Twinview, and posted a support request in their forums at http://www.nvnews.net/vbulletin/showthread.php?t=74292  Unfortunately, it didn't get any replies.

I looked for the file ~/.kde/share/config/displayconfigrc but it doesn't exist on my system.  I'm also using kubuntu dapper, and KDE 3.5.4  If it's not there, would that mean that the problem isn't with kguidance?  I'm not sure exactly what kguidance is, but the display button in systemsettings says the module could not be loaded.  I'll be filing a bug later.

I think toggling the "Allow moving and resizing of maximized windows" re-enables correct window maximizing because it updates xorg on the screen split in the middle of the double-wide screen.

I'm not sure if I interpretted your 2nd comment correctly: did you ever end up getting KDM to not switch to single-screen mode?
Comment 4 Niek Beernink 2006-08-19 17:00:20 UTC
Yes, I deleted displayconfigrc after which the problem stopped occuring.

Note that KDM itself was fine, but when logging in, KDE switched off one monitor. You seem to be having a problem with KDM switching off a monitor.
Comment 5 Andrew Ash 2006-08-19 17:23:38 UTC
That's correct.  At the login screen, both monitors are active.  Once I've logged in, the kde splash screen only appears on one monitor.  The other goes into powersaving mode.

The only way I can get it to not drop one screen is to remove that metamode from xorg.conf  I can't do this, though, because then UT2004 does weird things with the dual monitor setup.  My optimal situation would be if I have the single monitor line in as a metamode, which UT2004 would switch to when it gets run, but normal KDE usage would work in both screens, with the monitor split appearing in the middle of the screen so windows would maximize onto only one monitor.

Hopefully someone can figure out what's making KDE revert to only one monitor after the login screen uses both, that'd solve this whole problem.
Comment 6 Gabriel Ambuehl 2006-09-06 14:01:42 UTC
For me, removing the displayconfigrc fixed this bug. However, the screen spanning issue upon resolution switches semss to remain.
Comment 7 Hamish Rodda 2006-09-06 17:53:27 UTC
Ok, there are a few bugs in one here.  I'll try to take care of the screen disappearing bug.

Could those people who are experiencing one screen disappearing after kdm login please check for a file "kcmrandrrc" in $KDEHOME/share/config/, where $KDEHOME is usually ~/.kde/ or ~/.kde3/ - please post if it is present, and attach it if it is.

Then, please post the output of the "xrandr" command.

Comment 8 Andrew Ash 2006-09-06 22:19:09 UTC
I've got the bug, and the kcmrandrrc file.  Here's kcmrandrrc and xrandr:

$ cat ~/.kde/share/config/kcmrandrrc


$ xrandr
 SZ:    Pixels          Physical       Refresh
 0   2560 x 1024   ( 765mm x 313mm )   75
*1   1280 x 1024   ( 765mm x 313mm )  *75
Current rotation - normal
Current reflection - none
Rotations possible - normal
Reflections possible - none
Comment 9 Andrew Ash 2006-09-06 22:20:16 UTC
Created attachment 17653 [details]
kcmrandrrc file
Comment 10 emcee randello 2006-09-07 04:45:43 UTC
Am having the same problem. The guys in the freenode xorg channel reccomended I go into the kde display settings and check the "apply on startup" option, which seemed to work fine until I rebooted. Afterward it goes back to the same behavior (losing one screen after logging in). My xorg.conf worked perfectly with slackware using xorg 6.9 and kde 3.5.4 but loses a screen with kubuntu dapper with x.org 7 and kde 3.5.4.

mcrandello@user-laptop:~$ cat ~/.kde/share/config/kcmrandrrc


(currently I'm only using single head mode at work hence the *0)
mcrandello@user-laptop:~$ xrandr
 SZ:    Pixels          Physical       Refresh
*0   1024 x 768    ( 302mm x 232mm )  *60
 1    848 x 480    ( 302mm x 232mm )   60
 2    800 x 600    ( 302mm x 232mm )   60
 3    720 x 576    ( 302mm x 232mm )   60
 4    720 x 480    ( 302mm x 232mm )   60
 5    640 x 480    ( 302mm x 232mm )   60
 6    640 x 400    ( 302mm x 232mm )   60
 7    640 x 350    ( 302mm x 232mm )   60
 8    512 x 384    ( 302mm x 232mm )   60
 9    400 x 300    ( 302mm x 232mm )   60
 10   320 x 240    ( 302mm x 232mm )   60
 11   320 x 200    ( 302mm x 232mm )   60
Current rotation - normal
Current reflection - none
Rotations possible - normal
Reflections possible - none
Comment 11 emcee randello 2006-09-07 04:48:06 UTC
I should mention that when second monitor is attached it does show a mode 12 in xrandr, of 2048x768@60 and I've pretty much got a desktop shortcut to 'xrandr -s 12' to get both heads back.
Comment 12 Hamish Rodda 2006-09-07 09:26:45 UTC
Andrew, your config is set to change your screen to the lower of the two resolutions, which I am assuming is with one screen disabled.  Did you choose this?  Anyway, if you run "kcmshell display", you should be able to either disable apply at startup, or to choose the larger of the two resolutions - either should fix your problem.

Emcee: seems that you have the same problem; your config is requesting a change to the lower resolution.  Perhaps you ran the configuration at a time that the second monitor was not attached? Anyway, if you do the same when the second monitor is attached, it should fix your problem too.

Anyone else?
Comment 13 Andrew Ash 2006-09-08 01:56:42 UTC
Created attachment 17665 [details]
Screencap of SystemSettings -> Display

Running `kcmshell display` gives me a blank window and this console output:

$ kcmshell display
kio (KSycoca): Trying to open ksycoca from /var/tmp/kdecache-andrew/ksycoca
kutils (KCMultiDialog): KCMultiDialog::addModule Display
kutils (KCMultiDialog): [void KCMultiDialog::dialogClosed()]

From SystemSettings -> Display, I get the attached screenshot.	It seems that
this module is not installed or configured properly.

But by manually changing my kcmrandrrc to my double-wide screen (actually two
screens), the settings work great now, and TwinView switches resolutions to
accomodate fullscreen SDL apps (UT2004)!  Now I'm just bitten by the dualscreen
SDL bug.  I'm just curious as to why the display isn't working correctly
Comment 14 Hamish Rodda 2006-09-08 10:45:36 UTC
Andrew, try going to peripherals -> display in kcontrol instead.  What is the SDL bug?
Comment 15 Andrew Ash 2006-09-08 23:10:24 UTC
Kcontrol -> peripherals -> display seems to be functioning, though I'm not sure exactly what I'm supposed to be seeing.  I get four tabs: "size, orientation, & positioning", "color & gamma", "hardware", and "power saving".  

The first tab doesn't let me change screen size (resolution) or refresh rate.  Hardware says my graphics card is "VESA driver (generic)", but I have installed and am using the "nvidia" driver in my xorg.conf.  It detects my monitor as "Plug 'n' Play" though it's a Dell 1905FP and a Dell 1704FPV.  

Nowhere do I see any "apply settings at bootup" option, though.

The SDL bug is that if there are 2 monitors, it assumes the second monitor is to the right of the first one.  http://www.ubuntuforums.org/showthread.php?t=201268 and http://www.ubuntuforums.org/showthread.php?t=115273 both have this issue, and I think I remember seeing it described this way once before.  SDL centers the output on the right edge of monitor 1 (the right monitor), so only half the program's output is visible.

I wish I had a bug tracker link that discussed the issue, but I don't.  I'm currently using the suggestion in the first link, but UT is slow to close so Twinview doesn't switch back to dualscreen mode for about 15 seconds after UT closes its window.

Back the bug this thread was started from, though.  Now that a workaround has been found (manually edit kcmrandrrc), will that help developers to keep this bug from occurring on fresh installs?  And is this all related to kcmshell display not working correctly?
Comment 16 Hamish Rodda 2006-09-09 10:29:25 UTC
The display panel, specificly size + orientation, should allow you to select the size, orientation, and refresh rate of your display, and have a check box as to whether the settings are applied on startup.  What do you actually see?

The krandrrc file is created by this applet, so at some point in the past you would have had to configure this panel to create that file with the apply on startup set to true. (There is also a tray applet, krandrtray, which allows you to chose the resolution but not apply on restart, by default).

The SDL issue needs to be discussed with either the SDL developers or the app developers.
Comment 17 Andrew Ash 2006-09-09 16:42:02 UTC
Created attachment 17683 [details]
Screencap of KControl->Peripherals->Display

I don't see any apply on startup checkbox.  I'm using KDE Control Center 3.5.4
w/ KDE 3.5.4 on Kubuntu Dapper.

I also don't see a krandr applet when I R-click the panel -> Add Applet to
Panel.	Where can I find that?	aptitude install krandr returns no package
Comment 18 Hamish Rodda 2006-09-10 09:48:14 UTC
Oh, someone has changed the dialog on me.  Anyway, selecting the larger resolution should do the trick for you... does that work? If so, I'll close this bug...
Comment 19 emcee randello 2006-09-16 04:49:07 UTC
Running the setup while having the second monitor attached _does_ work, until I log out or restart or take the laptop somewhere there isn't a second monitor to hook up to. I'm not sure how else to describe my problem here. KDM gets it, when there's one monitor attached it only displays one screen, when there are two it displays on both. It doesn't do that after I log in. I can temporarily make it work, but it always screws up and goes back to one screen on login. 
Comment 20 Andrew Ash 2006-09-16 06:19:01 UTC
The slider for resolution is nonfunctional for me.  I resolved the bug by changing the file manually.  If no one else has the problem, I would consider it solved.
Comment 21 Jonas Vejlin 2009-05-24 16:30:13 UTC
So does any body else have the problem or is it sloved?
Comment 22 Lubos Lunak 2010-08-31 15:31:49 UTC
No response, and I assume this has been solved by using xrandr1.2.
Comment 23 Lubos Lunak 2010-08-31 15:32:32 UTC
*** Bug 151791 has been marked as a duplicate of this bug. ***