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
This commit is contained in:
ahoka 2010-02-22 05:55:10 +00:00
parent f34bafd81b
commit 0f279dbbae
4 changed files with 117 additions and 9 deletions

View File

@ -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 @@ attach sdhc at pci with sdhc_pci
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

View File

@ -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 <jmcneill@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 @@ __KERNEL_RCSID(0, "$NetBSD: splash.c,v 1.7 2009/05/12 14:45:43 cegger Exp $");
#define NSPLASH32 1
#include <sys/param.h>
#include <sys/device.h>
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/kernel.h>

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.28 2009/08/24 11:03:44 jmcneill Exp $");
#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 @@ genfb_attach(struct genfb_softc *sc, struct genfb_ops *ops)
&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 @@ genfb_attach(struct genfb_softc *sc, struct genfb_ops *ops)
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 @@ genfb_attach(struct genfb_softc *sc, struct genfb_ops *ops)
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 @@ genfb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
}
}
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 @@ genfb_init_screen(void *cookie, struct vcons_screen *scr,
/* 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

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.12 2010/01/08 19:51:11 dyoung Exp $")
#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 @@ struct genfb_softc {
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);