Bug 110806 - Display not recognized if initially disconnected
Summary: Display not recognized if initially disconnected
Status: RESOLVED NOTOURBUG
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/AMDgpu (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: xf86-video-ati maintainers
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-01 11:23 UTC by farmboy0+freedesktop
Modified: 2019-06-03 13:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description farmboy0+freedesktop 2019-06-01 11:23:52 UTC
Driver version: 19.0.1
Xorg: 1.20.4
Kernel: 5.1.5

If my monitor cable is disconnected when starting the computer and launching X, connecting it will not display anything.
I need to switch to a text terminal and restart the X login to have any effect.

OTOH if I disconnect and then reconnect my monitor if it had already been used the monitor will show my DE again after reconnecting.
Comment 1 Ropid 2019-06-01 13:30:37 UTC
Are you using LightDM as display manager?

I see the same behavior here with LightDM, but I'm thinking this is a problem in LightDM and is not a problem in xf86-video-amdgpu.

What I noticed is that if I log in blind by typing my password, then my XFCE desktop will later work fine after I plug in the monitor cable. The desktop will start using the monitor.
Comment 2 farmboy0+freedesktop 2019-06-01 15:33:34 UTC
I am using SDDM. Havent tried logging in blind, I usually restart X.
Comment 3 Michel Dänzer 2019-06-03 09:20:32 UTC
Not a driver or X server bug. Xorg doesn't automatically enable hot-plugged displays, this has to be done by a client.
Comment 4 Ropid 2019-06-03 13:05:38 UTC
I got this to work right with LightDM. Looking at "man sddm.conf", it seems the same method could also work with SDDM.

I created the following three scripts inside "/etc/lightdm/":

------------------------------------------------------------
$ tail -n+1 display-setup session-setup xrandr-auto.sh 
==> display-setup <==
#!/bin/bash
/etc/lightdm/xrandr-auto.sh &

==> session-setup <==
#!/bin/bash
pkill -x xrandr-auto.sh

==> xrandr-auto.sh <==
#!/bin/bash
trap 'kill -- $(jobs -p)' EXIT
LC_ALL=C xev -root -event randr |
while read -r line; do
    # trigger only on certain lines
    if [[ $line == "RRScreenChangeNotify event"* ]]; then
        echo "$(date +%H:%M:%S.%N): screen change event"
        # in background, sleep a bit and run xrandr --auto
        # and don't start multiple background jobs
        if [[ ! $(jobs) ]]; then
            {
                sleep 1;
                echo "$(date +%H:%M:%S.%N): run xrandr"
                xrandr --auto
            } &
        fi
    fi
done
------------------------------------------------------------

And then in "/etc/lightdm/lightdm.conf", I configured the following:

[Seat:*]
display-setup-script=/etc/lightdm/display-setup
session-setup-script=/etc/lightdm/session-setup


The interesting part is inside "xrandr-auto.sh". That script uses 'xev' to capture screen change events and it runs "xrandr --auto" when those events happen. This seems to solve the problem here for me. I can now boot without a monitor being connected, and when I connect the monitor the login screen will show up correctly.


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.