summaryrefslogtreecommitdiff
path: root/sys/dev/wscons/wsdisplay.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2019-05-04 11:34:49 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2019-05-04 11:34:49 +0000
commitf5574b4a644211fe7709234b1b9ed715099e02a7 (patch)
tree01d4f0baa026101a4c304df9a928193d69293bdd /sys/dev/wscons/wsdisplay.c
parent4ed7a9910f2e75595c48e6cff73d3964a8de4c77 (diff)
Improve the interaction between efifb(4), inteldrm(4) and radeondrm(4)
when we have a serial console by introducing the notion of a "primary" graphics device. The primary graphics device is the one set up and used by firmware (BIOS, UEFI). The goal is to make sure that wsdisplay0 and drm0 reliably attach to the primary graphics device such that X works out of the box even if you have multiple cards or if you are using a serial console. This also fixes the situation where inteldrm(4) or radeondrm(4) would take over the console on UEFI systems even if the kernel was booted with a serial console. ok jsg@
Diffstat (limited to 'sys/dev/wscons/wsdisplay.c')
-rw-r--r--sys/dev/wscons/wsdisplay.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index b713695a916..e8da462bed3 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.131 2018/02/19 08:59:52 mpi Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.132 2019/05/04 11:34:48 kettenis Exp $ */
/* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -529,7 +529,18 @@ wsdisplay_emul_match(struct device *parent, void *match, void *aux)
return (0);
}
- /* If console-ness unspecified, it wins. */
+ if (cf->wsemuldisplaydevcf_primary != WSEMULDISPLAYDEVCF_PRIMARY_UNK) {
+ /*
+ * If primary-ness of device specified, either match
+ * exactly (at high priority), or fail.
+ */
+ if (cf->wsemuldisplaydevcf_primary != 0 && ap->primary != 0)
+ return (10);
+ else
+ return (0);
+ }
+
+ /* If console-ness and primary-ness unspecified, it wins. */
return (1);
}