Bug 37545

Summary: Cannot disable LVDS after login
Product: xorg Reporter: Orion Poplawski <orion>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED INVALID QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Xorg log after xrandr run
none
dmesg
none
xrandr ouput
none
possible fix
none
dmesg with drm.debug=4 none

Description Orion Poplawski 2011-05-24 08:42:12 UTC
Running Fedora 15 with:

xorg-x11-drv-ati-6.14.1-1.20110504gita6d2dba6.fc15.i686
xorg-x11-server-Xorg-1.10.1-14.fc15.i686

01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M6 LY

kernel 2.6.38.6-27.fc15.i686

System is in a docking station with the lid closed but the system activates it anyways.  So after login I want to disable the LVDS output with:

xrandr --output LVDS --off

But at this point the external monitor goes into power save and Xorg.0.log shows:

[ 58797.212] (II) RADEON(0): Allocate new frame buffer 1600x1200 stride 1600
[ 58797.215] (EE) RADEON(0): failed to set mode: Invalid argument(II) RADEON(0): VRAM usage limit set to 6008K
Comment 1 Alex Deucher 2011-05-24 08:49:56 UTC
Please attach your xorg log, xrandr output, and dmesg output.
Comment 2 Orion Poplawski 2011-05-24 09:54:18 UTC
Created attachment 47103 [details]
Xorg log after xrandr run
Comment 3 Orion Poplawski 2011-05-24 09:54:48 UTC
Created attachment 47104 [details]
dmesg
Comment 4 Orion Poplawski 2011-05-24 09:58:13 UTC
Created attachment 47105 [details]
xrandr ouput
Comment 5 Alex Deucher 2011-05-24 10:35:37 UTC
The problem in this case is vram fragmentation.  When you start X, the driver allocates a buffer large enough for both dualhead (1024x768 + 1600x1200).  When you turn off the LVDS port, the driver tried to allocate a new 1600x1200 buffer for just the VGA monitor before freeing the previous dualhead allocation.  since there isn't enough VRAM available for both the dualhead allocation and the VGA only allocation, the modeset fails.

Does it work if you start X without tha VGA monitor connected?  Then connect it after you've started X, something like:
xrandr --output VGA-0 --off
xrandr --output VGA-0 --auto --pos 0x0
xrandr --output LVDS --off
Comment 6 Orion Poplawski 2011-05-24 11:18:17 UTC
That does succeed, although not really a workable solution.
Comment 7 Orion Poplawski 2011-05-26 15:15:18 UTC
Is there any way to tell X to not enable the LVDS output on startup?
Comment 8 Alex Deucher 2011-05-26 15:38:50 UTC
Section "Monitor"
        Identifier "LVDS"
        Option "Disable" "TRUE"
EndSection
Comment 9 Orion Poplawski 2011-05-26 15:41:39 UTC
Yeah, but I'm assuming that would still deactivate the LVDS output even if it was the only output available.  I need to conditionally deactivate it if the lid is closed.
Comment 10 Alex Deucher 2011-05-26 16:04:38 UTC
Created attachment 47201 [details] [review]
possible fix

Does this patch fix the issue?
Comment 11 Orion Poplawski 2011-05-27 09:01:55 UTC
No that doesn't help.  It appears that info->front_bo is non-null at that point, so your new code doesn't run.

Breakpoint 2, drmmode_xf86crtc_resize (scrn=0xa09a880, width=1600, height=1200)
    at drmmode_display.c:1288
1288            if (!info->front_bo) {
(gdb) print info->front_bo
$2 = (struct radeon_bo *) 0xa0a68d0

At this point the log has:
[   516.548] (II) RADEON(0): Allocate new frame buffer 1600x1200 stride 1600

The invalid argument error comes later.
Comment 12 Orion Poplawski 2011-05-27 09:11:00 UTC
The invalid argument error comes in this code:

1337            for (i = 0; i < xf86_config->num_crtc; i++) {
(gdb) 
1343                    drmmode_set_mode_major(crtc, &crtc->mode,

Interesting that at this point there is no fail handling - which must be why the VGA output dies and goes into power save.
Comment 13 Orion Poplawski 2011-05-31 10:06:22 UTC
Created attachment 47403 [details]
dmesg with drm.debug=4
Comment 14 Adam Jackson 2018-06-12 19:06:27 UTC
Mass closure: This bug has been untouched for more than six years, and is not
obviously still valid. Please reopen this bug or file a new report if you continue to experience issues with current releases.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.