Bug 29929

Summary: Failure to switch external monitors: xrandr --auto should free unused crtcs
Product: xorg Reporter: tim.holy
Component: App/xrandrAssignee: Keith Packard <keithp>
Status: RESOLVED MOVED QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: medium CC: bugzilla, byron, gezuru, j_suni, spacepluk, vovik-wfa
Version: 7.5 (2009.10)   
Hardware: All   
OS: All   
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:

Description tim.holy 2010-09-01 02:29:27 UTC
If your laptop video card has only 2 crtcs (one of which is devoted to the laptop LVDS display), then switching between two different external monitors often fails if one of them is connected with a digital (DVI) connector and the other uses a VGA connector, unless one explicitly turns off the first output, e.g.,
xrandr --output VGA-0 --off

xrandr's command line output does not clearly convey the problem or the solution; moreover, the behavior of "xrandr --auto" clearly does not live up to the second promise it makes in the man page:

--auto: For connected but disabled outputs, this will enable them using their preferred mode (or, something close to 96dpi if they have no preferred mode). For disconnected but enabled outputs, this will disable them.

The "disabling disconnected outputs" part must be incomplete because the crtc remains held by the first output even though it is disconnected, resulting in errors like:
xrandr: cannot find crtc for output DVI-0

For more information, see the discussion here:
https://bugs.freedesktop.org/show_bug.cgi?id=29852

Suggested fixes:
1. xrandr --auto should first turn off any disconnected outputs before enabling new outputs
2. The output of xrandr -q should more clearly distinguish disconnected but not disabled outputs.
Comment 1 Jeremy Huddleston Sequoia 2011-10-08 19:32:26 UTC
*** Bug 37586 has been marked as a duplicate of this bug. ***
Comment 2 bugzilla 2012-10-24 01:53:13 UTC
This problem persists as of xrandr 1.3.5 / Xorg 1.13.0
Comment 3 gezuru 2012-12-14 15:57:06 UTC
Yes please. This is needed when switching from a "1 internal screen" to a "2 external screens" setup or back. Otherwise xrandr cannot enable some configurations that are completely valid.
Comment 4 Chris Bainbridge 2014-04-28 13:01:48 UTC
Bug still present in Debian Testing / xrandr 1.4.1
This is a Macbook 13 with passive cables, so displays present are: eDP1 HDMI1 HDMI2 HDMI3

To reproduce: 
$ xrandr --output eDP1 --off --output HDMI1 --auto --output HDMI2 --auto --output HDMI3 --auto
xrandr: cannot find crtc for output HDMI3

or while triplehead is active:
$ xrandr --output HDMI1 --off --output HDMI2 --off --output HDMI3 --off --output eDP1 --auto
xrandr: cannot find crtc for output eDP1

There is (/would be) a crtc available since the three external monitors are being turned off.

Workaround turning external monitors on:

xrandr --output eDP1 --off --output HDMI1 --auto --output HDMI2 --auto --right-of HDMI1
xrandr --output HDMI3 --auto --right-of HDMI2

Workaround turning external monitors off:

xrandr --output HDMI3 --off
xrandr --output HDMI1 --off --output HDMI2 --off --output eDP1 --auto

ie. turning eDP1 or HDMI3 off first releases the crtc. But afaics it shouldn't be necessary to split the xrandr calls like this? xrandr should calculate that there will be a free crtc from the --off operation.
Comment 5 GitLab Migration User 2018-08-10 20:33:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/app/xrandr/issues/10.

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.