From f5574b4a644211fe7709234b1b9ed715099e02a7 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 4 May 2019 11:34:49 +0000 Subject: 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@ --- sys/dev/wscons/wsdisplay.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sys/dev/wscons/wsdisplay.c') 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); } -- cgit v1.2.3