Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Allow the DEBE layer and output sizes to be set ind...
details: https://anonhg.NetBSD.org/src/rev/89785ec81452
branches: trunk
changeset: 333709:89785ec81452
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Nov 14 19:47:36 2014 +0000
description:
Allow the DEBE layer and output sizes to be set independently. Now you can
pass fb.margin=<n> in bootargs to add a border to the framebuffer, in case
your display doesn't let you turn off overscan and you really want to see
the whole screen.
diffstat:
sys/arch/arm/allwinner/awin_debe.c | 34 ++++++++++++++++++++++++++--------
sys/arch/arm/allwinner/awin_fb.c | 13 +++----------
sys/arch/arm/allwinner/awin_var.h | 4 ++--
sys/arch/evbarm/awin/awin_machdep.c | 12 ++++++++++--
4 files changed, 41 insertions(+), 22 deletions(-)
diffs (195 lines):
diff -r 6c4aedc2b179 -r 89785ec81452 sys/arch/arm/allwinner/awin_debe.c
--- a/sys/arch/arm/allwinner/awin_debe.c Fri Nov 14 17:34:23 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_debe.c Fri Nov 14 19:47:36 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_debe.c,v 1.6 2014/11/14 00:31:54 jmcneill Exp $ */
+/* $NetBSD: awin_debe.c,v 1.7 2014/11/14 19:47:36 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -34,7 +34,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.6 2014/11/14 00:31:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.7 2014/11/14 19:47:36 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -63,6 +63,8 @@
bus_size_t sc_dmasize;
bus_dmamap_t sc_dmamap;
void *sc_dmap;
+
+ uint16_t sc_margin;
};
#define DEBE_READ(sc, reg) \
@@ -98,6 +100,7 @@
struct awin_debe_softc *sc = device_private(self);
struct awinio_attach_args * const aio = aux;
const struct awin_locators * const loc = &aio->aio_loc;
+ prop_dictionary_t cfg = device_properties(self);
int error;
sc->sc_dev = self;
@@ -112,6 +115,8 @@
aprint_naive("\n");
aprint_normal(": Display Engine Backend (BE%d)\n", loc->loc_port);
+ prop_dictionary_get_uint16(cfg, "margin", &sc->sc_margin);
+
if (awin_chip_id() == AWIN_CHIP_ID_A31) {
awin_reg_set_clear(aio->aio_core_bst, aio->aio_ccm_bsh,
AWIN_A31_AHB_RESET1_REG,
@@ -202,6 +207,8 @@
if (error)
goto destroy;
+ memset(sc->sc_dmap, 0, sc->sc_dmasize);
+
return 0;
destroy:
@@ -220,12 +227,19 @@
static void
awin_debe_setup_fbdev(struct awin_debe_softc *sc, const struct videomode *mode)
{
+ if (mode == NULL)
+ return;
+
+ const u_int interlace_p = !!(mode->flags & VID_INTERLACE);
+ const u_int fb_width = mode->hdisplay - (sc->sc_margin * 2);
+ const u_int fb_height = (mode->vdisplay << interlace_p) -
+ (sc->sc_margin * 2);
+
if (mode && sc->sc_fbdev == NULL) {
- const u_int interlace_p = !!(mode->flags & VID_INTERLACE);
struct awinfb_attach_args afb = {
.afb_fb = sc->sc_dmap,
- .afb_width = mode->hdisplay,
- .afb_height = (mode->vdisplay << interlace_p),
+ .afb_width = fb_width,
+ .afb_height = fb_height,
.afb_dmat = sc->sc_dmat,
.afb_dmasegs = sc->sc_dmasegs,
.afb_ndmasegs = 1
@@ -235,7 +249,7 @@
}
#if NGENFB > 0
else if (sc->sc_fbdev != NULL) {
- awin_fb_set_videomode(sc->sc_fbdev, mode);
+ awin_fb_set_videomode(sc->sc_fbdev, fb_width, fb_height);
}
#endif
}
@@ -287,6 +301,8 @@
const u_int interlace_p = !!(mode->flags & VID_INTERLACE);
const u_int width = mode->hdisplay;
const u_int height = (mode->vdisplay << interlace_p);
+ const u_int fb_width = width - (sc->sc_margin * 2);
+ const u_int fb_height = height - (sc->sc_margin * 2);
uint32_t vmem = width * height * 4;
if (vmem > sc->sc_dmasize) {
@@ -310,8 +326,10 @@
DEBE_WRITE(sc, AWIN_DEBE_DISSIZE_REG,
((height - 1) << 16) | (width - 1));
DEBE_WRITE(sc, AWIN_DEBE_LAYSIZE_REG,
- ((height - 1) << 16) | (width - 1));
- DEBE_WRITE(sc, AWIN_DEBE_LAYLINEWIDTH_REG, (width << 5));
+ ((fb_height - 1) << 16) | (fb_width - 1));
+ DEBE_WRITE(sc, AWIN_DEBE_LAYCOOR_REG,
+ (sc->sc_margin << 16) | sc->sc_margin);
+ DEBE_WRITE(sc, AWIN_DEBE_LAYLINEWIDTH_REG, (fb_width << 5));
DEBE_WRITE(sc, AWIN_DEBE_LAYFB_L32ADD_REG, pa << 3);
DEBE_WRITE(sc, AWIN_DEBE_LAYFB_H4ADD_REG, pa >> 29);
diff -r 6c4aedc2b179 -r 89785ec81452 sys/arch/arm/allwinner/awin_fb.c
--- a/sys/arch/arm/allwinner/awin_fb.c Fri Nov 14 17:34:23 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_fb.c Fri Nov 14 19:47:36 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_fb.c,v 1.4 2014/11/14 00:31:54 jmcneill Exp $ */
+/* $NetBSD: awin_fb.c,v 1.5 2014/11/14 19:47:36 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_fb.c,v 1.4 2014/11/14 00:31:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_fb.c,v 1.5 2014/11/14 19:47:36 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -182,17 +182,10 @@
}
void
-awin_fb_set_videomode(device_t dev, const struct videomode *mode)
+awin_fb_set_videomode(device_t dev, u_int width, u_int height)
{
struct awin_fb_softc *sc = device_private(dev);
- if (mode == NULL)
- return;
-
- const u_int interlace_p = !!(mode->flags & VID_INTERLACE);
- const u_int width = mode->hdisplay;
- const u_int height = (mode->vdisplay << interlace_p);
-
if (sc->sc_gen.sc_width != width || sc->sc_gen.sc_height != height) {
device_printf(sc->sc_gen.sc_dev,
"mode switching not yet supported\n");
diff -r 6c4aedc2b179 -r 89785ec81452 sys/arch/arm/allwinner/awin_var.h
--- a/sys/arch/arm/allwinner/awin_var.h Fri Nov 14 17:34:23 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_var.h Fri Nov 14 19:47:36 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_var.h,v 1.22 2014/11/10 17:55:25 jmcneill Exp $ */
+/* $NetBSD: awin_var.h,v 1.23 2014/11/14 19:47:36 jmcneill Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -131,7 +131,7 @@
void awin_tcon_enable(bool);
void awin_debe_set_videomode(const struct videomode *);
void awin_debe_enable(bool);
-void awin_fb_set_videomode(device_t, const struct videomode *);
+void awin_fb_set_videomode(device_t, u_int, u_int);
void awin_fb_ddb_trap_callback(int);
void awin_wdog_reset(void);
diff -r 6c4aedc2b179 -r 89785ec81452 sys/arch/evbarm/awin/awin_machdep.c
--- a/sys/arch/evbarm/awin/awin_machdep.c Fri Nov 14 17:34:23 2014 +0000
+++ b/sys/arch/evbarm/awin/awin_machdep.c Fri Nov 14 19:47:36 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_machdep.c,v 1.27 2014/11/10 20:36:12 jmcneill Exp $ */
+/* $NetBSD: awin_machdep.c,v 1.28 2014/11/14 19:47:36 jmcneill Exp $ */
/*
* Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.27 2014/11/10 20:36:12 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.28 2014/11/14 19:47:36 jmcneill Exp $");
#include "opt_machdep.h"
#include "opt_ddb.h"
@@ -761,6 +761,14 @@
return;
}
+ if (device_is_a(self, "awindebe")) {
+ int margin;
+ if (get_bootconf_option(boot_args, "fb.margin",
+ BOOTOPT_TYPE_INT, &margin) && margin > 0) {
+ prop_dictionary_set_uint16(dict, "margin", margin);
+ }
+ }
+
#if NGENFB > 0
if (device_is_a(self, "genfb")) {
#ifdef DDB
Home |
Main Index |
Thread Index |
Old Index