Module Name:    src
Committed By:   nonaka
Date:           Sat Feb 25 01:13:50 UTC 2017

Modified Files:
        src/sys/arch/x86/pci: pci_machdep.c
        src/sys/arch/x86/x86: genfb_machdep.c

Log Message:
EFI console is drawing faster by shadowfb.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/x86/pci/pci_machdep.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/x86/genfb_machdep.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/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.77 src/sys/arch/x86/pci/pci_machdep.c:1.78
--- src/sys/arch/x86/pci/pci_machdep.c:1.77	Thu Feb  9 03:38:01 2017
+++ src/sys/arch/x86/pci/pci_machdep.c	Sat Feb 25 01:13:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.77 2017/02/09 03:38:01 msaitoh Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.78 2017/02/25 01:13:50 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.77 2017/02/09 03:38:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.78 2017/02/25 01:13:50 nonaka Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1095,6 +1095,8 @@ device_pci_register(device_t dev, void *
 				if (ri->ri_bits != NULL) {
 					prop_dictionary_set_uint64(dict,
 					    "virtual_address",
+					    ri->ri_hwbits != NULL ?
+					    (vaddr_t)ri->ri_hworigbits :
 					    (vaddr_t)ri->ri_origbits);
 				}
 #endif
@@ -1121,6 +1123,11 @@ device_pci_register(device_t dev, void *
 
 #if NWSDISPLAY > 0 && NGENFB > 0
 				if (device_is_a(dev, "genfb")) {
+					prop_dictionary_set_bool(dict,
+					    "enable_shadowfb",
+					    ri->ri_hwbits != NULL ?
+					      true : false);
+
 					x86_genfb_set_console_dev(dev);
 #ifdef DDB
 					db_trap_callback =

Index: src/sys/arch/x86/x86/genfb_machdep.c
diff -u src/sys/arch/x86/x86/genfb_machdep.c:1.11 src/sys/arch/x86/x86/genfb_machdep.c:1.12
--- src/sys/arch/x86/x86/genfb_machdep.c:1.11	Thu Jul 25 15:09:27 2013
+++ src/sys/arch/x86/x86/genfb_machdep.c	Sat Feb 25 01:13:50 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.c,v 1.11 2013/07/25 15:09:27 macallan Exp $ */
+/* $NetBSD: genfb_machdep.c,v 1.12 2017/02/25 01:13:50 nonaka Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill <jmcne...@invisible.ca>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.11 2013/07/25 15:09:27 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.12 2017/02/25 01:13:50 nonaka Exp $");
 
 #include "opt_mtrr.h"
 
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: genfb_machde
 #include <sys/device.h>
 #include <sys/ioctl.h>
 #include <sys/kernel.h>
+#include <sys/kmem.h>
 #include <sys/lwp.h>
 
 #include <sys/bus.h>
@@ -61,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: genfb_machde
 
 #if NWSDISPLAY > 0 && NGENFB > 0
 struct vcons_screen x86_genfb_console_screen;
+bool x86_genfb_use_shadowfb = true;
 
 #if NACPICA > 0
 extern int acpi_md_vesa_modenum;
@@ -182,7 +184,17 @@ x86_genfb_cnattach(void)
 	ri->ri_height = fbinfo->height;
 	ri->ri_depth = fbinfo->depth;
 	ri->ri_stride = fbinfo->stride;
-	ri->ri_bits = bits;
+	if (x86_genfb_use_shadowfb && lookup_bootinfo(BTINFO_EFI) != NULL) {
+		/* XXX The allocated memory is never released... */
+		ri->ri_bits = kmem_alloc(ri->ri_stride * ri->ri_height,
+		    KM_NOSLEEP);
+		if (ri->ri_bits == NULL) {
+			aprint_error("%s: couldn't alloc shadowfb\n", __func__);
+			ri->ri_bits = bits;
+		} else
+			ri->ri_hwbits = bits;
+	} else
+		ri->ri_bits = bits;
 	ri->ri_flg = RI_CENTER | RI_FULLCLEAR | RI_CLEAR;
 	rasops_init(ri, ri->ri_width / 8, ri->ri_height / 8);
 	ri->ri_caps = WSSCREEN_WSCOLORS;

Reply via email to