Module Name:    src
Committed By:   ahoka
Date:           Mon Feb 22 05:55:10 UTC 2010

Modified Files:
        src/sys/dev/pci: files.pci
        src/sys/dev/splash: splash.c
        src/sys/dev/wsfb: genfb.c genfbvar.h

Log Message:
Restore splashscreen support with genfb.
genfb patch from Pierre Pronchery, other small changes to make it
compile by me.

Closes PR kern/42605.

XXX doesnt work in 8bit, probably a cmap issue


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/splash/splash.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/wsfb/genfb.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/wsfb/genfbvar.h

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

Modified files:

Index: src/sys/dev/pci/files.pci
diff -u src/sys/dev/pci/files.pci:1.324 src/sys/dev/pci/files.pci:1.325
--- src/sys/dev/pci/files.pci:1.324	Thu Jan  7 09:25:19 2010
+++ src/sys/dev/pci/files.pci	Mon Feb 22 05:55:10 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.324 2010/01/07 09:25:19 jdc Exp $
+#	$NetBSD: files.pci,v 1.325 2010/02/22 05:55:10 ahoka Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -924,7 +924,7 @@
 file	dev/pci/sdhc_pci.c		sdhc_pci
 
 # generic framebuffer console driver, PCI frontend
-attach genfb at pci with genfb_pci
+attach genfb at pci with genfb_pci : splash
 file	dev/pci/genfb_pci.c	genfb_pci
 
 # NVIDIA nForce2/3/4 SMBus controller

Index: src/sys/dev/splash/splash.c
diff -u src/sys/dev/splash/splash.c:1.7 src/sys/dev/splash/splash.c:1.8
--- src/sys/dev/splash/splash.c:1.7	Tue May 12 14:45:43 2009
+++ src/sys/dev/splash/splash.c	Mon Feb 22 05:55:10 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: splash.c,v 1.7 2009/05/12 14:45:43 cegger Exp $ */
+/* $NetBSD: splash.c,v 1.8 2010/02/22 05:55:10 ahoka Exp $ */
 
 /*-
  * Copyright (c) 2006 Jared D. McNeill <jmcne...@invisible.ca>
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: splash.c,v 1.7 2009/05/12 14:45:43 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: splash.c,v 1.8 2010/02/22 05:55:10 ahoka Exp $");
 
 #include "opt_splash.h"
 
@@ -44,6 +44,7 @@
 #define	NSPLASH32 1
 
 #include <sys/param.h>
+#include <sys/device.h>
 #include <sys/systm.h>
 #include <sys/types.h>
 #include <sys/kernel.h>

Index: src/sys/dev/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.28 src/sys/dev/wsfb/genfb.c:1.29
--- src/sys/dev/wsfb/genfb.c:1.28	Mon Aug 24 11:03:44 2009
+++ src/sys/dev/wsfb/genfb.c	Mon Feb 22 05:55:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.28 2009/08/24 11:03:44 jmcneill Exp $ */
+/*	$NetBSD: genfb.c,v 1.29 2010/02/22 05:55:10 ahoka Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.28 2009/08/24 11:03:44 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.29 2010/02/22 05:55:10 ahoka Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -49,6 +49,12 @@
 
 #include <dev/wsfb/genfbvar.h>
 
+#ifdef GENFB_DISABLE_TEXT
+#include <sys/reboot.h>
+#define DISABLESPLASH (boothowto & (RB_SINGLE | RB_USERCONF | RB_ASKNAME | \
+		AB_VERBOSE | AB_DEBUG) )
+#endif
+
 #include "opt_genfb.h"
 #include "opt_wsfb.h"
 
@@ -204,6 +210,15 @@
 	    &defattr);
 	sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
 
+#ifdef SPLASHSCREEN
+/*
+ * If system isn't going to go multiuser, or user has requested to see
+ * boot text, don't render splash screen immediately
+ */
+	if (DISABLESPLASH)
+#endif
+		vcons_redraw_screen(&sc->sc_console_screen);
+
 	sc->sc_defaultscreen_descr.textops = &ri->ri_ops;
 	sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
 	sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
@@ -217,16 +232,53 @@
 
 	j = 0;
 	for (i = 0; i < min(1 << sc->sc_depth, 256); i++) {
-
+#ifndef SPLASHSCREEN
 		sc->sc_cmap_red[i] = rasops_cmap[j];
 		sc->sc_cmap_green[i] = rasops_cmap[j + 1];
 		sc->sc_cmap_blue[i] = rasops_cmap[j + 2];
 		genfb_putpalreg(sc, i, rasops_cmap[j], rasops_cmap[j + 1],
 		    rasops_cmap[j + 2]);
 		j += 3;
+#else
+		if(i >= SPLASH_CMAP_OFFSET &&
+		    i < SPLASH_CMAP_OFFSET + SPLASH_CMAP_SIZE) {
+			sc->sc_cmap_red[i] = _splash_header_data_cmap[j][0];
+			sc->sc_cmap_green[i] = _splash_header_data_cmap[j][1];
+			sc->sc_cmap_blue[i] = _splash_header_data_cmap[j][2];
+		} else {
+			sc->sc_cmap_red[i] = rasops_cmap[j];
+			sc->sc_cmap_green[i] = rasops_cmap[j + 1];
+			sc->sc_cmap_blue[i] = rasops_cmap[j + 2];
+			genfb_putpalreg(sc, i, rasops_cmap[j],
+				rasops_cmap[j + 1],
+				rasops_cmap[j + 2]);
+		}
+		j += 3;
+#endif
 	}
 
+#ifdef SPLASHSCREEN
+	sc->sc_splash.si_depth = sc->sc_depth;
+	sc->sc_splash.si_bits = sc->sc_console_screen.scr_ri.ri_bits;
+	sc->sc_splash.si_hwbits = sc->sc_fbaddr;
+	sc->sc_splash.si_width = sc->sc_width;
+	sc->sc_splash.si_height = sc->sc_height;
+	sc->sc_splash.si_stride = sc->sc_stride;
+	sc->sc_splash.si_fillrect = NULL;
+	if (!DISABLESPLASH)
+		splash_render(&sc->sc_splash, SPLASH_F_CENTER|SPLASH_F_FILL);
+#ifdef SPLASHSCREEN_PROGRESS
+	sc->sc_progress.sp_top = (sc->sc_height / 8) * 7;
+	sc->sc_progress.sp_width = (sc->sc_width / 4) * 3;
+	sc->sc_progress.sp_left = (sc->sc_width / 8) * 7;
+	sc->sc_progress.sp_height = 20;
+	sc->sc_progress.sp_state = -1;
+	sc->sc_progress.sp_si = &sc->sc_splash;
+	splash_progress_init(&sc->sc_progress);
+#endif
+#else
 	vcons_replay_msgbuf(&sc->sc_console_screen);
+#endif
 
 	if (genfb_softc == NULL)
 		genfb_softc = sc;
@@ -236,6 +288,11 @@
 	aa.accessops = &genfb_accessops;
 	aa.accesscookie = &sc->vd;
 
+#ifdef GENFB_DISABLE_TEXT
+	if (!DISABLESPLASH)
+		SCREEN_DISABLE_DRAWING(&sc->sc_console_screen);
+#endif
+
 	config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint);
 
 	return 0;
@@ -293,6 +350,36 @@
 				}
 			}
 			return 0;
+		case WSDISPLAYIO_SSPLASH:
+#if defined(SPLASHSCREEN)
+			if(*(int *)data == 1) {
+				SCREEN_DISABLE_DRAWING(&sc->sc_console_screen);
+				splash_render(&sc->sc_splash,
+						SPLASH_F_CENTER|SPLASH_F_FILL);
+#if defined(SPLASHSCREEN_PROGRESS)
+				sc->sc_progress.sp_running = 1;
+#endif
+			} else {
+				SCREEN_ENABLE_DRAWING(&sc->sc_console_screen);
+#if defined(SPLASHSCREEN_PROGRESS)
+				sc->sc_progress.sp_running = 0;
+#endif
+			}
+			vcons_redraw_screen(ms);
+			return 0;
+#else
+			return ENODEV;
+#endif
+		case WSDISPLAYIO_SPROGRESS:
+#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS)
+			sc->sc_progress.sp_force = 1;
+			splash_progress_update(&sc->sc_progress);
+			sc->sc_progress.sp_force = 0;
+			vcons_redraw_screen(ms);
+			return 0;
+#else
+			return ENODEV;
+#endif
 		default:
 			if (sc->sc_ops.genfb_ioctl)
 				return sc->sc_ops.genfb_ioctl(sc, vs, cmd,
@@ -347,6 +434,11 @@
 
 	/* TODO: actually center output */
 	ri->ri_hw = scr;
+
+#ifdef GENFB_DISABLE_TEXT
+	if (scr == &sc->sc_console_screen && !DISABLESPLASH)
+		SCREEN_DISABLE_DRAWING(&sc->sc_console_screen);
+#endif
 }
 
 static int

Index: src/sys/dev/wsfb/genfbvar.h
diff -u src/sys/dev/wsfb/genfbvar.h:1.12 src/sys/dev/wsfb/genfbvar.h:1.13
--- src/sys/dev/wsfb/genfbvar.h:1.12	Fri Jan  8 19:51:11 2010
+++ src/sys/dev/wsfb/genfbvar.h	Mon Feb 22 05:55:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfbvar.h,v 1.12 2010/01/08 19:51:11 dyoung Exp $ */
+/*	$NetBSD: genfbvar.h,v 1.13 2010/02/22 05:55:10 ahoka Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,11 +27,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.12 2010/01/08 19:51:11 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.13 2010/02/22 05:55:10 ahoka Exp $");
 
 #ifndef GENFBVAR_H
 #define GENFBVAR_H
 
+#include "opt_splash.h"
+
 #include <sys/param.h>
 #include <sys/buf.h>
 #include <sys/conf.h>
@@ -45,6 +47,13 @@
 
 #include <dev/wscons/wsdisplay_vconsvar.h>
 
+#ifdef SPLASHSCREEN
+#define GENFB_DISABLE_TEXT
+#include <dev/splash/splash.h>
+/* XXX */
+extern const char _splash_header_data_cmap[64+32][3];
+#endif
+
 struct genfb_ops {
 	int (*genfb_ioctl)(void *, void *, u_long, void *, int, struct lwp *);
 	paddr_t	(*genfb_mmap)(void *, void *, off_t, int);
@@ -81,6 +90,12 @@
 	u_char sc_cmap_green[256];
 	u_char sc_cmap_blue[256];
 	bool sc_want_clear;
+#ifdef SPLASHSCREEN
+	struct splash_info sc_splash;
+#ifdef SPLASHSCREEN_PROGRESS
+	struct splash_progress sc_progress;
+#endif
+#endif
 };
 
 void	genfb_cnattach(void);

Reply via email to