Skip to contentSkip to conversation

kmscon: treat platform display controllers as primary GPUs

PATCH Markus Volk 1 participant 1 message Sep 28 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

v2: I tested all the previous issues again on actual hardware. The RPi won't boot without the patch, but it does with it. The Intel ARC is behaving normally and is no longer flooding the journal.

Quoted 151 lines · Markus Volk via lists.openembedded.org

kmscon only counted a GPU as primary when its PCI parent had boot_vga set, so with gpus=primary it ignored vc4 on the Raspberry Pi 4 and never showed a terminal. Treat DRM devices on the platform bus as primary, except for the firmware framebuffer drivers. Tested on a Raspberry Pi 4 booting through EDK2.

AI-Generated: Uses Claude Code (Claude Opus 5.5)

Signed-off-by Markus Volk <[email protected] <mailto:[email protected]>>
---
 ...-display-controllers-as-primary-GPUs.patch | 84 
+++++++++++++++++++
 .../recipes-graphics/kmscon/kmscon_10.0.1.bb  |  5 +-
 2 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 

meta-oe/recipes-graphics/kmscon/kmscon/0002-uterm_monitor-treat-platform-display-controllers-as-primary-GPUs.patch

(quoted diff) +0 -0
new file mode 100644
index 0000000000..c85607783c

b/meta-oe/recipes-graphics/kmscon/kmscon/0002-uterm_monitor-treat-platform-display-controllers-as-primary-GPUs.patch

(quoted diff) +1 -0
@@ -0,0 +1,84 @@
+From d321a1572a12d760ddade294f4e7eabe57d555d1 Mon Sep 17 00:00:00 

2001

(quoted diff) +3 -0
+From: Markus Volk <[email protected] <mailto:[email protected]>>
+Date: Sat, 26 Sep 2026 10:00:57 +0200
+Subject: [PATCH] uterm_monitor: treat platform display controllers 

as primary
+ GPUs

(quoted diff) +26 -0
+
+A GPU only counted as primary when its PCI parent had boot_vga set.
+SoC display controllers such as vc4 on the Raspberry Pi are platform
+devices without a PCI parent, so with gpus=primary kmscon ignored the
+only display in the system and never showed a terminal.
+
+Treat DRM devices on the platform bus as primary, except for the
+simpledrm, efidrm, vesadrm and ofdrm firmware framebuffers that only
+stand in until the native driver has loaded.
+
+Upstream-Status: Pending
+
+AI-Generated: Uses Claude Code (Claude Opus 5.5)
+---
+ src/uterm_monitor.c | 29 ++++++++++++++++++++++++++---
+ 1 file changed, 26 insertions(+), 3 deletions(-)
+
+diff --git a/src/uterm_monitor.c b/src/uterm_monitor.c
+index d89bfa1..25ec91f 100644
+--- a/src/uterm_monitor.c
++++ b/src/uterm_monitor.c
+@@ -234,10 +234,15 @@ out_close:
+ 	return flags;
+ }
+
+-static bool is_drm_primary(struct uterm_monitor *mon, struct 

udev_device *dev, const char *node)
++static char *get_drm_name(int fd);
++
++static bool is_drm_primary(struct uterm_monitor *mon, struct udev_device *dev, const char *node,
++ int fd)
+ {

(quoted diff) +6 -0
+ 	struct udev_device *pci;
+ 	const char *id;
++	char *name;
++	bool res;
+
+ 	pci = udev_device_get_parent_with_subsystem_devtype(dev, "pci", 

NULL);

(quoted diff) +2 -0
+ 	if (pci) {
+@@ -246,9 +251,27 @@ static bool is_drm_primary(struct uterm_monitor 

*mon, struct udev_device *dev, c

(quoted diff) +10 -0
+ 			log_debug("DRM device %s is primary PCI GPU", node);
+ 			return true;
+ 		}
++		return false;
+ 	}
+
+-	return false;
++	/*
++	 * SoC display controllers are platform devices without a boot_vga
++	 * attribute. Treat them as primary, except for the generic 

firmware
++ * framebuffer drivers that only stand in until the real driver
loads.
++ */
++ if (!udev_device_get_parent_with_subsystem_devtype(dev,
"platform", NULL))
++ return false;
++
++ name = get_drm_name(fd);
++ if (!name)
++ return false;
++
++ res = strcmp(name, "simpledrm") && strcmp(name, "efidrm") &&
strcmp(name, "vesadrm") &&
++ strcmp(name, "ofdrm");
++ if (res)
++ log_debug("DRM device %s is primary platform GPU (%s)", node,
name);
++ free(name);
++ return res;
+ }
+
+ /*
+@@ -334,7 +357,7 @@ static unsigned int get_drm_flags(struct uterm_monitor *mon, struct udev_device

(quoted diff) +11 -0
+ 		return flags;
+ 	}
+
+-	if (is_drm_primary(mon, dev, node))
++	if (is_drm_primary(mon, dev, node, fd))
+ 		flags |= UTERM_MONITOR_PRIMARY;
+ 	if (is_drm_usb(mon, node, fd))
+ 		flags |= UTERM_MONITOR_AUX;
+--
+2.55.0
+
meta-oe/recipes-graphics/kmscon/kmscon_10.0.1.bb +0 -0
index c5cfd527d5..0336649551 100644
@@ -23,7 +23,10 @@ DEPENDS = "\
 SRC_URI = 

"git://github.com/kmscon/kmscon;protocol=https;branch=main;tag=v${PV}"
SRCREV = "c9d0e23336c6bb7645a1f5f48a4a82f1d5a589d9"

-SRC_URI +=
"file://0001-terminal-open-the-pty-only-once-a-display-is-attached.patch" <file://0001-terminal-open-the-pty-only-once-a-display-is-attached.patch/>

meta-oe/recipes-graphics/kmscon/kmscon_10.0.1.bb +2 -0
+SRC_URI += " \
+    

file://0001-terminal-open-the-pty-only-once-a-display-is-attached.patch <file://0001-terminal-open-the-pty-only-once-a-display-is-attached.patch/> \
+
file://0002-uterm_monitor-treat-platform-display-controllers-as-primary-GPUs.patch <file://0002-uterm_monitor-treat-platform-display-controllers-as-primary-gpus.patch/> \
+"

inherit meson pkgconfig systemd

--
2.55.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#130433): <https://lists.openembedded.org/g/openembedded-devel/message/130433>
Mute This Topic: <https://lists.openembedded.org/mt/121469845/3618223>
Group Owner: [email protected] <mailto:[email protected]>
Unsubscribe: <https://lists.openembedded.org/g/openembedded-devel/unsub> [[email protected] <mailto:[email protected]>]
-=-=-=-=-=-=-=-=-=-=-=-