Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/omap switch to 32bit colour for X, keep the con...
details: https://anonhg.NetBSD.org/src/rev/e5fdf1da86a7
branches: trunk
changeset: 784190:e5fdf1da86a7
user: macallan <macallan%NetBSD.org@localhost>
date: Mon Jan 21 16:08:30 2013 +0000
description:
switch to 32bit colour for X, keep the console in 16bit for some extra speed
( yay, first commit from my BeagleBoard )
diffstat:
sys/arch/arm/omap/omapfb.c | 61 ++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 54 insertions(+), 7 deletions(-)
diffs (112 lines):
diff -r ed6d9bb49a56 -r e5fdf1da86a7 sys/arch/arm/omap/omapfb.c
--- a/sys/arch/arm/omap/omapfb.c Mon Jan 21 15:21:30 2013 +0000
+++ b/sys/arch/arm/omap/omapfb.c Mon Jan 21 16:08:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: omapfb.c,v 1.14 2013/01/21 14:17:39 macallan Exp $ */
+/* $NetBSD: omapfb.c,v 1.15 2013/01/21 16:08:30 macallan Exp $ */
/*
* Copyright (c) 2010 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.14 2013/01/21 14:17:39 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.15 2013/01/21 16:08:30 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -107,6 +107,8 @@
static void omapfb_putpalreg(struct omapfb_softc *, int, uint8_t,
uint8_t, uint8_t);
+static int omapfb_set_depth(struct omapfb_softc *, int);
+
#if NOMAPDMA > 0
static void omapfb_init(struct omapfb_softc *);
static void omapfb_wait_idle(struct omapfb_softc *);
@@ -453,7 +455,7 @@
wdf = (void *)data;
wdf->height = ms->scr_ri.ri_height;
wdf->width = ms->scr_ri.ri_width;
- wdf->depth = ms->scr_ri.ri_depth;
+ wdf->depth = 32;
wdf->cmsize = 256;
return 0;
@@ -466,19 +468,21 @@
(struct wsdisplay_cmap *)data);
case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = sc->sc_stride;
+ *(u_int *)data = sc->sc_width * 4;
return 0;
case WSDISPLAYIO_SMODE:
{
int new_mode = *(int*)data;
- /* notify the bus backend */
if (new_mode != sc->sc_mode) {
sc->sc_mode = new_mode;
- if(new_mode == WSDISPLAYIO_MODE_EMUL) {
+ if (new_mode == WSDISPLAYIO_MODE_EMUL) {
+ omapfb_set_depth(sc, 16);
vcons_redraw_screen(ms);
- }
+ } else {
+ omapfb_set_depth(sc, 32);
+ }
}
}
return 0;
@@ -630,6 +634,49 @@
}
+static int
+omapfb_set_depth(struct omapfb_softc *sc, int d)
+{
+ uint32_t reg;
+
+ reg = OMAP_DISPC_ATTR_ENABLE |
+ OMAP_DISPC_ATTR_BURST_16x32 |
+ OMAP_DISPC_ATTR_REPLICATION;
+ switch (d) {
+ case 16:
+ reg |= OMAP_DISPC_ATTR_RGB16;
+ break;
+ case 32:
+ reg |= OMAP_DISPC_ATTR_RGB24;
+ break;
+ default:
+ aprint_error_dev(sc->sc_dev, "unsupported depth (%d)\n", d);
+ return EINVAL;
+ }
+
+ bus_space_write_4(sc->sc_iot, sc->sc_regh,
+ OMAPFB_DISPC_GFX_ATTRIBUTES, reg);
+
+ /*
+ * now tell the video controller that we're done mucking around and
+ * actually update its settings
+ */
+ reg = bus_space_read_4(sc->sc_iot, sc->sc_regh, OMAPFB_DISPC_CONTROL);
+ bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPFB_DISPC_CONTROL,
+ reg | OMAP_DISPC_CTRL_GO_LCD | OMAP_DISPC_CTRL_GO_DIGITAL);
+
+ sc->sc_depth = d;
+ sc->sc_stride = sc->sc_width * (sc->sc_depth >> 3);
+
+ /* clear the screen here */
+#if NOMAPDMA > 0
+ omapfb_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height, 0);
+#else
+ memset(sc->sc_fbaddr, 0, sc->sc_stride * sc->sc_height);
+#endif
+ return 0;
+}
+
#if NOMAPDMA > 0
static void
omapfb_init(struct omapfb_softc *sc)
Home |
Main Index |
Thread Index |
Old Index