make use of a shadow framebuffer optional, use VCONS_DONT_READ by default

This commit is contained in:
macallan 2010-08-31 02:49:17 +00:00
parent 4e9aaafe62
commit b8dd6fd56b
3 changed files with 18 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.wsfb,v 1.6 2009/08/06 16:26:51 macallan Exp $
# $NetBSD: files.wsfb,v 1.7 2010/08/31 02:49:17 macallan Exp $
#
# wsdisplay framebuffer drivers
@ -9,6 +9,6 @@ defflag opt_wsfb.h WSFB_FAKE_VGA_FB # allow mmap(0xa0000)
defflag opt_wsfb.h WSFB_ALLOW_OTHERS # allow to mmap() foreign ranges
# a generic framebuffer console
device genfb: wsemuldisplaydev, rasops1, rasops8, rasops15, rasops16, rasops24, rasops32, vcons, drm
device genfb: wsemuldisplaydev, rasops1, rasops2, rasops8, rasops15, rasops16, rasops24, rasops32, vcons, drm
file dev/wsfb/genfb.c genfb needs-flag
defflag opt_genfb.h GENFB_DEBUG
defflag opt_genfb.h GENFB_DEBUG GENFB_SHADOWFB

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfb.c,v 1.29 2010/02/22 05:55:10 ahoka Exp $ */
/* $NetBSD: genfb.c,v 1.30 2010/08/31 02:49:17 macallan Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.29 2010/02/22 05:55:10 ahoka Exp $");
__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.30 2010/08/31 02:49:17 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -193,9 +193,11 @@ genfb_attach(struct genfb_softc *sc, struct genfb_ops *ops)
memcpy(&sc->sc_ops, ops, sizeof(struct genfb_ops));
sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
#ifdef GENFB_SHADOWFB
sc->sc_shadowfb = kmem_alloc(sc->sc_fbsize, KM_SLEEP);
if (sc->sc_want_clear == false && sc->sc_shadowfb != NULL)
memcpy(sc->sc_shadowfb, sc->sc_fbaddr, sc->sc_fbsize);
#endif
vcons_init(&sc->vd, sc, &sc->sc_defaultscreen_descr,
&genfb_accessops);
@ -415,12 +417,17 @@ genfb_init_screen(void *cookie, struct vcons_screen *scr,
if (sc->sc_want_clear)
ri->ri_flg |= RI_FULLCLEAR;
#ifdef GENFB_SHADOWFB
if (sc->sc_shadowfb != NULL) {
ri->ri_hwbits = (char *)sc->sc_fbaddr;
ri->ri_bits = (char *)sc->sc_shadowfb;
} else
#endif
{
ri->ri_bits = (char *)sc->sc_fbaddr;
scr->scr_flags |= VCONS_DONT_READ;
}
if (existing && sc->sc_want_clear) {
ri->ri_flg |= RI_CLEAR;

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfbvar.h,v 1.14 2010/02/24 22:38:09 dyoung Exp $ */
/* $NetBSD: genfbvar.h,v 1.15 2010/08/31 02:49:17 macallan Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.14 2010/02/24 22:38:09 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.15 2010/08/31 02:49:17 macallan Exp $");
#ifndef GENFBVAR_H
#define GENFBVAR_H
@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.14 2010/02/24 22:38:09 dyoung Exp $")
#include <dev/rasops/rasops.h>
#include <dev/wscons/wsdisplay_vconsvar.h>
#include "opt_genfb.h"
#ifdef SPLASHSCREEN
#define GENFB_DISABLE_TEXT
@ -81,7 +82,9 @@ struct genfb_softc {
struct genfb_colormap_callback *sc_cmcb;
struct genfb_pmf_callback *sc_pmfcb;
void *sc_fbaddr; /* kva */
void *sc_shadowfb;
#ifdef GENFB_SHADOWFB
void *sc_shadowfb;
#endif
bus_addr_t sc_fboffset; /* bus address */
int sc_width, sc_height, sc_stride, sc_depth;
size_t sc_fbsize;