phillipberndt / autorandr

Auto-detect the connected display hardware and load the appropriate X11 setup using xrandr
2.48k stars 122 forks source link

Switching between profiles failing: "cannot find crtc for output LVDS-1" #149

Open matedealer opened 5 years ago

matedealer commented 5 years ago

If I switch from docked config to mobile config autorandr failed with following error

$ autorandr -c
mobile (detected)
docked
xrandr: specified screen 1600x900 not large enough for output VGA-1 (1920x1080+1920+0)
xrandr: specified screen 1600x900 not large enough for output HDMI-3 (1920x1080+0+0)
xrandr: cannot find crtc for output LVDS-1
Failed to apply profile 'mobile' (line 762):
  Command failed: xrandr --fb 1600x900 --output LVDS-1 --gamma 1.0:1.0:1.0 --mode 1600x900 --pos 0x0 --primary --rate 60.01 --reflect normal --rotate normal (line 762)

My mobile config looks as followed:

output VGA-1
off
output HDMI-1
off
output DP-1
off
output HDMI-2
off
output HDMI-3
off
output DP-2
off
output DP-3
off
output LVDS-1
mode 1600x900
pos 0x0
primary
rate 60.01

My docked config:

output HDMI-1
off
output DP-1
off
output HDMI-2
off
output DP-2
off
output DP-3
off
output LVDS-1
off
output HDMI-3
mode 1920x1080
pos 0x0
rate 60.00
output VGA-1
mode 1920x1080
pos 1920x0
rate 60.00

Autorandr is installed from the Arch Repo.

phillipberndt commented 5 years ago

Could you run autorandr in --dry-run mode after detaching and before running it without? I want to know whether it correctly tries to disable the other outputs (--output VGA-1 --off etc.). In the case you quoted it might either be that it did run these, and there was no failure, or that it didn't try to run them. The output of xrandr --verbose after disconnecting / before running autorandr would help, too. Thanks!

matedealer commented 5 years ago

xrandr --verbose in docking station xrandr --verbose (undocked but autorandr did not activate laptop screen LVDS-1)

Running in docking station

$ autorandr --dry-run   
mobile
docked (detected) (current)

after undocking

$ autorandr --dry-run
mobile
docked

if I enable LVDS-1 and disable VGA-1 & HDMI-3 beforehand and undock then

$ autorandr --dry-run
mobile (detected) (current)
docked
phillipberndt commented 5 years ago

You'll need both --dry-run and -c, sorry

matedealer commented 5 years ago

no problem.

Running in docking station

$autorandr --dry-run -c
mobile
docked (detected) (current)
Config already loaded

after undocking

$ autorandr --dry-run -c
mobile
docked
travs commented 4 years ago

@phillipberndt I also get this error.

Error:

$ autorandr --load docked 
xrandr: Configure crtc 1 failed
Failed to apply profile 'docked' (line 762):
  Command failed: xrandr --fb 3840x1080 --output eDP-1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --pos 0x0 --primary --rate 59.93 --reflect normal --rotate normal --output DP-1-1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --pos 1920x0 --rate 60.00 --reflect normal --rotate normal (line 762)

Config:

$ cat ~/.config/autorandr/docked/config
output DP-1
off
output HDMI-1
off
output DP-2
off
output HDMI-2
off
output DP-1-2
off
output DP-1-3
off
output eDP-1
mode 1920x1080
pos 0x0
primary
rate 59.93
output DP-1-1
mode 1920x1080
pos 1920x0
rate 60.00

xrandr --verbose outputs: undocked, and docked.

Commands:

# while docked
$ autorandr --load docked --dry-run    

xrandr --fb 3840x1080 --output eDP-1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --pos 0x0 --primary --rate 59.93 --reflect normal --rotate normal --output DP-1-1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --pos 1920x0 --rate 60.00 --reflect normal --rotate normal

# while undocked

xrandr --fb 3840x1080 --output eDP-1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --pos 0x0 --primary --rate 59.93 --reflect normal --rotate normal --output DP-1-1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --pos 1920x0 --rate 60.00 --reflect normal --rotate normal

So

It looks like the other outputs are not being disabled. I tried adding to the command to disable them manually, and this happened:

$ xrandr --fb 3840x1080 --output eDP-1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --pos 0x0 --primary --rate 59.93 --reflect normal --rotate normal --output DP-1-1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --pos 1920x0 --rate 60.00 --reflect normal --rotate normal --output DP-1-2 --off --output DP-1-3 --off --output DP-2 --off --output HDMI-2 --off --output HDMI-1 --off --output DP-1 --off
xrandr: Configure crtc 1 failed
madduck commented 4 years ago

For the record: I always get this crtc error at my workplace, and I found that running xrandr --auto and then retrying makes it work in 100% of times I tried this now.

madduck commented 4 years ago

As suggested by @phillipberndt over in #178, I now created a .config/autorandr/myprofile/preswitch file that calls xrandr --auto in this context, and that fixes the problem for me, without requiring code changes.

NorfairKing commented 4 years ago

I'm having the same problem, xrandr --auto in a preswitch hook doesn't solve it, and just running the xrandr commands myself does work.

madduck commented 4 years ago

I am now calling

exec xrandr --output DP2-1 --crtc 2 --auto --output DP2-2 --crtc 1 --auto --output eDP1 --crtc 0 --auto

in the profile's preswitch hook. Try something similar?

NorfairKing commented 4 years ago

@madduck At that point I can just use xrandr myself, but thanks for the suggestion!