Module Name:    src
Committed By:   riastradh
Date:           Thu Sep  1 12:01:36 UTC 2022

Modified Files:
        src/sys/external/bsd/drm2/drm: drmfb.c

Log Message:
drmfb: Take is_console property from parent, not from self.

The parent is the pci or platform device that firmware knows about.
The `drmfb' device is more of a fictitious invention of the drm stack
that exists for the convenience of the genfb abstraction which needs
device_private to be a struct genfb_softc.

Let's see if this does any better than the last attempt to rework the
logic here.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/drm/drmfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/drm/drmfb.c
diff -u src/sys/external/bsd/drm2/drm/drmfb.c:1.14 src/sys/external/bsd/drm2/drm/drmfb.c:1.15
--- src/sys/external/bsd/drm2/drm/drmfb.c:1.14	Fri Feb 18 18:31:18 2022
+++ src/sys/external/bsd/drm2/drm/drmfb.c	Thu Sep  1 12:01:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: drmfb.c,v 1.14 2022/02/18 18:31:18 wiz Exp $	*/
+/*	$NetBSD: drmfb.c,v 1.15 2022/09/01 12:01:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drmfb.c,v 1.14 2022/02/18 18:31:18 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drmfb.c,v 1.15 2022/09/01 12:01:36 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "vga.h"
@@ -87,6 +87,8 @@ drmfb_attach(struct drmfb_softc *sc, con
 	struct drm_connector_list_iter conn_iter;
 	struct drm_connector *connector;
 	const prop_dictionary_t dict = device_properties(da->da_dev);
+	const device_t parent = device_parent(da->da_dev);
+	const prop_dictionary_t pdict = device_properties(parent);
 #if NVGA > 0
 	struct drm_device *const dev = da->da_fb_helper->dev;
 #endif
@@ -114,7 +116,10 @@ drmfb_attach(struct drmfb_softc *sc, con
 	prop_dictionary_set_uint64(dict, "mode_callback",
 	    (uint64_t)(uintptr_t)&drmfb_genfb_mode_callback);
 
-	if (!prop_dictionary_get_bool(dict, "is_console", &is_console)) {
+	if (prop_dictionary_get_bool(pdict, "is_console", &is_console)) {
+		what_was_cons = CONS_NONE;
+		prop_dictionary_set_bool(dict, "is_console", is_console);
+	} else {
 		/* XXX Whattakludge!  */
 #if NVGA > 0
 		if ((da->da_params->dp_is_vga_console != NULL) &&
@@ -133,8 +138,6 @@ drmfb_attach(struct drmfb_softc *sc, con
 			what_was_cons = CONS_NONE;
 			prop_dictionary_set_bool(dict, "is_console", false);
 		}
-	} else {
-		what_was_cons = CONS_NONE;
 	}
 
 	/* Make the first EDID we find available to wsfb */

Reply via email to