randomher0
Posts: 24
Joined: Wed Apr 21, 2021 9:54 pm

Configure full-KMS for headless X11 access

Fri May 07, 2021 8:22 am

How can full-KMS/X11 be configured to start up with 1080p (or any other resolution than 720x480) in a headless configuration.
Setting hdmi_force_hotplug=1 in /boot/config.txt does not work - I've read the /boot/config.txt parameters do not
work for full-KMS. It is not possible to reconfigure with xrandr, the resolution change is not accepted - probably because
hdmi signals disconnected state.

Is there another way to make full-KMS think a hdmi device is connected?
Goal is to remote access desktop to X11 without an HDMI device connected.

Code: Select all

[    12.326] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[    12.327] (**) modesetting(0): Depth 24, (--) framebuffer bpp 32
[    12.327] (==) modesetting(0): RGB weight 888
[    12.327] (==) modesetting(0): Default visual is TrueColor
[    12.327] (II) modesetting(0): ShadowFB: preferred NO, enabled NO
[    12.327] (II) modesetting(0): Output HDMI-0 using monitor section HDMI-1
[    12.327] (**) modesetting(0): Option "Primary" "true"
[    12.328] (II) modesetting(0): Output Composite-0 has no monitor section
[    12.328] (II) modesetting(0): EDID for output HDMI-0
[    12.328] (II) modesetting(0): EDID for output Composite-0
[    12.328] (II) modesetting(0): Printing probed modes for output Composite-0
[    12.328] (II) modesetting(0): Modeline "720x480"x31.3   13.50  720 734 798 858  480 483 486 502 interlace (15.7 kHz e)
[    12.328] (II) modesetting(0): Output HDMI-0 disconnected
[    12.328] (II) modesetting(0): Output Composite-0 disconnected
[    12.328] (WW) modesetting(0): No outputs definitely connected, trying again...
[    12.328] (II) modesetting(0): Output HDMI-0 disconnected
[    12.328] (II) modesetting(0): Output Composite-0 connected
[    12.329] (II) modesetting(0): Using sloppy heuristic for initial modes
[    12.329] (II) modesetting(0): Output Composite-0 using initial mode 720x480 +0+0
[    12.329] (==) modesetting(0): Using gamma correction (1.0, 1.0, 1.0)
[    12.329] (==) modesetting(0): DPI set to (96, 96)

cleverca22
Posts: 3792
Joined: Sat Aug 18, 2012 2:33 pm

Re: Configure full-KMS for headless X11 access

Fri May 07, 2021 9:51 am

i think hdmi_force_hotplug=1 only applies when the firmware is in control (fkms for example)

the real kms stack has a different option for that, but i'm not sure what it is

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5748
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Configure full-KMS for headless X11 access

Fri May 07, 2021 9:55 am

When using kms, firmware settings for controlling hdmi will have no effect (firmware is not in control of hdmi).
I think you can do this with cmdline.txt settings. e.g.
capture your edid when monitor is connected and booted with kms:

Code: Select all

sudo cp /sys/devices/platform/gpu/drm/card0/card0-HDMI-A-1/edid /lib/firmware/edid/myedid.dat
Then add to start of cmdline.txt:

Code: Select all

video=HDMI-A-1:1920x1080@60 drm.edid_firmware=edid/myedid.dat
You should then have the edid available on future boots without needing HDMI to be connected.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11247
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Configure full-KMS for headless X11 access

Fri May 07, 2021 10:39 am

Full KMS abides by the hotplug signal, so I suspect even with the overrides that dom has given it will still see HPD as disconnected and therefore not activate the HDMI interface.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5748
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Configure full-KMS for headless X11 access

Fri May 07, 2021 11:18 am

That's annoying. I was under the impression that a being able to read the edid overrode the lack of hotpug.
And I hoped a custom edid would count.

But you are right, it doesn't work as hoped. Any idea how to override hotplug?

randomher0
Posts: 24
Joined: Wed Apr 21, 2021 9:54 pm

Re: Configure full-KMS for headless X11 access

Fri May 07, 2021 11:29 am

Thanks for your replies.

tried suggestion by @dom - unfortunately without success:
On raspberry pi 3+ sys/devices/gpu/... - is not there? - following command outputs a myedid.dat file (it contains some binary info and spotted the name of the screen "BenqXY", so this probably worked.)

Code: Select all

/opt/vc/bin/tvservice -d edid.dat
kern.log says the following.

Code: Select all

May  7 13:06:30 raspberrypi kernel: [    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=HDMI-A-1:1920x1080M@60 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=ttyS0,115200 console=tty1 root=PARTUUID=3cbe32eb-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles video=HDMI-A-1:1920x1080@60 drm.edid_firmware=edid/myedid.dat
Substituting video=HDMI-0:1920x1080@60 drm.edid_firmware=edid/myedid.dat didn't work neither.

Maybe there is another way to fake the hotplug signal - preferably in user space? Do you have any suggestions where to look?

HiassofT
Posts: 330
Joined: Fri Jun 30, 2017 10:07 pm
Location: Salzburg, Austria
Contact: Website

Re: Configure full-KMS for headless X11 access

Fri May 07, 2021 11:32 am

You can override hotplug by adding "D" at the end of the video option, see https://www.kernel.org/doc/Documentation/fb/modedb.txt

eg video=HDMI-A-1:1920x1080@60D (this will work without edid) or video=HDMI-A-1:D if you have an edid override in place.

so long,

Hias

randomher0
Posts: 24
Joined: Wed Apr 21, 2021 9:54 pm

Re: Configure full-KMS for headless X11 access

Fri May 07, 2021 11:41 am

HiassofT wrote:
Fri May 07, 2021 11:32 am
eg video=HDMI-A-1:1920x1080@60D (this will work without edid) or video=HDMI-A-1:D if you have an edid override in place.
Thanks for that suggestion @HiassofT - can you tell if HDMI-A-1 is correct for RPi3 since it has only a single HDMI portCan this mode be triggered at some other place - through user command?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5748
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Configure full-KMS for headless X11 access

Fri May 07, 2021 12:12 pm

Yes, I can confirm it works on Pi3. It still uses HDMI-A-1:
Added:

Code: Select all

drm.edid_firmware=edid/myedid.dat video=HDMI-A-1:1920x1080@60D
with no hdmi connected and

Code: Select all

sudo cat /sys/kernel/debug/dri/0/state
...
	mode: "1920x1080": 60 148500 1920 2008 2052 2200 1080 1084 1089 1125 0x60 0x5
...

randomher0
Posts: 24
Joined: Wed Apr 21, 2021 9:54 pm

Re: Configure full-KMS for headless X11 access

Fri May 07, 2021 2:31 pm

Thank you very much, this worked.


It didn't work without the edid.dat file for me - maybe the modes checked by X11 were all out of range for the "default monitor" - the most I could get was 1280x1024 - there were some messages "hsync out of range" or "vrefresh out of range".

(If anybody knows of a way to set this up without passing arguments to the kernel at bootup and creating an edid.dat please let me know.)

Return to “Graphics programming”