Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/i915drm Take the console only from vga...



details:   https://anonhg.NetBSD.org/src/rev/bc226552693e
branches:  trunk
changeset: 328959:bc226552693e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Apr 25 19:02:51 2014 +0000

description:
Take the console only from vga or generic genfb.

Adapted from a patch by nonaka@ in PR 48705.

While here, attach i915 genfb earlier as in PR 48706.

diffstat:

 sys/external/bsd/drm2/i915drm/i915_pci.c |  56 +++++++++++++++++++++++++++++--
 1 files changed, 51 insertions(+), 5 deletions(-)

diffs (105 lines):

diff -r 08d05afb349a -r bc226552693e sys/external/bsd/drm2/i915drm/i915_pci.c
--- a/sys/external/bsd/drm2/i915drm/i915_pci.c  Fri Apr 25 18:38:54 2014 +0000
+++ b/sys/external/bsd/drm2/i915drm/i915_pci.c  Fri Apr 25 19:02:51 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_pci.c,v 1.7 2014/04/06 16:42:00 riastradh Exp $   */
+/*     $NetBSD: i915_pci.c,v 1.8 2014/04/25 19:02:51 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_pci.c,v 1.7 2014/04/06 16:42:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_pci.c,v 1.8 2014/04/25 19:02:51 riastradh Exp $");
+
+#ifdef _KERNEL_OPT
+#include "vga.h"
+#endif
 
 #include <sys/types.h>
 #ifndef _MODULE
@@ -46,6 +50,18 @@
 #include <dev/pci/wsdisplay_pci.h>
 #include <dev/wsfb/genfbvar.h>
 
+#if NVGA > 0
+/*
+ * XXX All we really need is vga_is_console from vgavar.h, but the
+ * header files are missing their own dependencies, so we need to
+ * explicitly drag in the other crap.
+ */
+#include <dev/ic/mc6845reg.h>
+#include <dev/ic/pcdisplayvar.h>
+#include <dev/ic/vgareg.h>
+#include <dev/ic/vgavar.h>
+#endif
+
 #include <drm/drmP.h>
 
 #include "i915_drv.h"
@@ -58,6 +74,7 @@
        bus_space_handle_t              sc_fb_bsh;
        struct genfb_softc              sc_genfb;
        struct list_head                sc_fb_list; /* XXX Kludge!  */
+       bool                            sc_console;
 };
 
 static int     i915drm_match(device_t, cfdata_t, void *);
@@ -168,6 +185,35 @@
                i915_drm_driver->driver_features &=~ DRIVER_USE_AGP;
        }
 
+       /*
+        * Figure out whether to grab the console.
+        *
+        * XXX This is much too hairy!  Can we simplify it and
+        * x86/consinit.c?
+        */
+#if NVGA > 0
+       if (vga_is_console(pa->pa_iot, -1) ||
+           vga_is_console(pa->pa_memt, -1)) {
+               sc->sc_console = true;
+               /*
+                * There is a window from here until genfb attaches in
+                * which kernel messages will go into a black hole,
+                * until genfb replays the console.  Whattakludge.
+                *
+                * wsdisplay_cndetach must come first, to clear cn_tab,
+                * so that nothing will use it; then vga_cndetach
+                * unmaps the bus space that it would have used.
+                */
+               wsdisplay_cndetach();
+               vga_cndetach();
+       } else
+#endif
+       if (genfb_is_console() && genfb_is_enabled()) {
+               sc->sc_console = true;
+       } else {
+               sc->sc_console = false;
+       }
+
        /* Initialize the drm pci driver state.  */
        sc->sc_drm_dev.driver = i915_drm_driver;
        drm_pci_attach(self, pa, &sc->sc_pci_dev, &sc->sc_drm_dev);
@@ -180,8 +226,8 @@
                return;
        }
 
-       /* Attach a framebuffer, but not until interrupts work.  */
-       config_interrupts(self, &i915drm_attach_framebuffer);
+       /* Attach a framebuffer.  */
+       i915drm_attach_framebuffer(self);
 }
 
 static int
@@ -412,7 +458,7 @@
                goto fail3;
        }
 
-       prop_dictionary_set_bool(dict, "is_console", 1); /* XXX */
+       prop_dictionary_set_bool(dict, "is_console", sc->sc_console);
        prop_dictionary_set_uint32(dict, "width", mode_cmd.width);
        prop_dictionary_set_uint32(dict, "height", mode_cmd.height);
        prop_dictionary_set_uint8(dict, "depth", sizes->surface_bpp);



Home | Main Index | Thread Index | Old Index