diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-01-06 23:47:23 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-01-06 23:47:23 +0000 |
commit | 8695dddce839575891df8af09429829f6c9c7d02 (patch) | |
tree | 70c211da0312effac20911a7ee2c6069ff617a7c /sys/arch/arm | |
parent | 7301da5fe6bbcc7295ba852addf8b052bcb17444 (diff) |
Lazy man's display console on Zaurus: allow the display to be attached as a
console when it is probed. Earlier boot messages are still being sent to the
serial port for now.
While there, swap blue and red in 16bpp mode to get the expected display
colours.
Tested and ok drahn@
Diffstat (limited to 'sys/arch/arm')
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_lcd.c | 77 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_lcd.h | 28 |
2 files changed, 69 insertions, 36 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_lcd.c b/sys/arch/arm/xscale/pxa2x0_lcd.c index b236d205602..1d1f0e8d43c 100644 --- a/sys/arch/arm/xscale/pxa2x0_lcd.c +++ b/sys/arch/arm/xscale/pxa2x0_lcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0_lcd.c,v 1.8 2005/01/06 16:50:44 miod Exp $ */ +/* $OpenBSD: pxa2x0_lcd.c,v 1.9 2005/01/06 23:47:20 miod Exp $ */ /* $NetBSD: pxa2x0_lcd.c,v 1.8 2003/10/03 07:24:05 bsh Exp $ */ /* @@ -453,7 +453,7 @@ pxa2x0_lcd_new_screen(struct pxa2x0_lcd_softc *sc, LIST_INSERT_HEAD(&(sc->screens), scr, link); sc->n_screens++; - + return scr; bad: @@ -480,9 +480,10 @@ pxa2x0_lcd_setup_wsscreen(struct pxa2x0_lcd_softc *sc, int width = geom->panel_width; int height = geom->panel_height; int cookie = -1; - struct rasops_info rinfo; + struct rasops_info *rinfo; - memset(&rinfo, 0, sizeof rinfo); + rinfo = &sc->sc_ro; + memset(rinfo, 0, sizeof(struct rasops_info)); #ifdef notyet if (fontname) { @@ -498,31 +499,52 @@ pxa2x0_lcd_setup_wsscreen(struct pxa2x0_lcd_softc *sc, #endif /* let rasops_init calculate # of cols and rows in character */ - rinfo.ri_flg = 0; - rinfo.ri_depth = descr->depth; - rinfo.ri_bits = NULL; - rinfo.ri_width = width; - rinfo.ri_height = height; - rinfo.ri_stride = width * rinfo.ri_depth / 8; - rinfo.ri_wsfcookie = cookie; + rinfo->ri_flg = 0; + rinfo->ri_depth = descr->depth; + rinfo->ri_bits = NULL; + rinfo->ri_width = width; + rinfo->ri_height = height; + rinfo->ri_stride = width * rinfo->ri_depth / 8; + rinfo->ri_wsfcookie = cookie; + + if (descr->depth == 16) { + rinfo->ri_rnum = 5; + rinfo->ri_rpos = 11; + rinfo->ri_gnum = 6; + rinfo->ri_gpos = 5; + rinfo->ri_bnum = 5; + rinfo->ri_bpos = 0; + } - rasops_init(&rinfo, 100, 100); + rasops_init(rinfo, 100, 100); - /* - * Since we will use a rasops structure per screen, we need to - * keep a copy of the emulops (which will always be the same) - * in the softc, so as not to require an extra indirection layer. - */ - sc->emulops = rinfo.ri_ops; - descr->c.nrows = rinfo.ri_rows; - descr->c.ncols = rinfo.ri_cols; - descr->c.capabilities = rinfo.ri_caps; - descr->c.textops = &sc->emulops; + descr->c.nrows = rinfo->ri_rows; + descr->c.ncols = rinfo->ri_cols; + descr->c.capabilities = rinfo->ri_caps; + descr->c.textops = &rinfo->ri_ops; return cookie; } int +pxa2x0_lcd_setup_console(struct pxa2x0_lcd_softc *sc, + const struct pxa2x0_wsscreen_descr *descr) +{ + struct pxa2x0_lcd_screen *scr; + + scr = pxa2x0_lcd_new_screen(sc, descr->depth); + if (scr == NULL) + return (ENOMEM); + + sc->sc_ro.ri_hw = (void *)scr; + sc->sc_ro.ri_bits = scr->buf_va; + bcopy(&sc->sc_ro, &scr->rinfo, sizeof(struct rasops_info)); + + pxa2x0_lcd_show_screen(sc, &sc->sc_ro, 0, NULL, NULL); + return (0); +} + +int pxa2x0_lcd_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int), void *cbarg) { @@ -555,7 +577,7 @@ pxa2x0_lcd_alloc_screen(void *v, const struct wsscreen_descr *_type, scr = pxa2x0_lcd_new_screen(sc, type->depth); if (scr == NULL) return (ENOMEM); - + /* * initialize raster operation for this screen. */ @@ -571,6 +593,15 @@ pxa2x0_lcd_alloc_screen(void *v, const struct wsscreen_descr *_type, ri->ri_wsfcookie = -1; /* XXX */ #endif + if (type->depth == 16) { + ri->ri_rnum = 5; + ri->ri_rpos = 11; + ri->ri_gnum = 6; + ri->ri_gpos = 5; + ri->ri_bnum = 5; + ri->ri_bpos = 0; + } + rasops_init(ri, type->c.nrows, type->c.ncols); ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp); diff --git a/sys/arch/arm/xscale/pxa2x0_lcd.h b/sys/arch/arm/xscale/pxa2x0_lcd.h index 94f7c38a840..5695e295ffd 100644 --- a/sys/arch/arm/xscale/pxa2x0_lcd.h +++ b/sys/arch/arm/xscale/pxa2x0_lcd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0_lcd.h,v 1.5 2005/01/06 16:50:44 miod Exp $ */ +/* $OpenBSD: pxa2x0_lcd.h,v 1.6 2005/01/06 23:47:20 miod Exp $ */ /* $NetBSD: pxa2x0_lcd.h,v 1.2 2003/06/17 09:43:14 bsh Exp $ */ /* * Copyright (c) 2002 Genetec Corporation. All rights reserved. @@ -85,7 +85,7 @@ struct pxa2x0_lcd_softc { int n_screens; LIST_HEAD(, pxa2x0_lcd_screen) screens; struct pxa2x0_lcd_screen *active; - struct wsdisplay_emulops emulops; /* master emulops copy */ + struct rasops_info sc_ro; /* main (console) rasops */ void *ih; /* interrupt handler */ }; @@ -124,8 +124,8 @@ struct lcd_panel_geometry { short end_frame_wait; /* end of frame wait (EFW) */ }; -void pxa2x0_lcd_geometry(struct pxa2x0_lcd_softc *, - const struct lcd_panel_geometry *); +void pxa2x0_lcd_geometry(struct pxa2x0_lcd_softc *, + const struct lcd_panel_geometry *); struct pxa2x0_lcd_screen *pxa2x0_lcd_new_screen(struct pxa2x0_lcd_softc *, int); /* @@ -136,16 +136,18 @@ struct pxa2x0_wsscreen_descr { int depth; /* bits per pixel */ }; -int pxa2x0_lcd_setup_wsscreen(struct pxa2x0_lcd_softc *, - struct pxa2x0_wsscreen_descr *, const struct lcd_panel_geometry *, - const char * ); +int pxa2x0_lcd_setup_console(struct pxa2x0_lcd_softc *, + const struct pxa2x0_wsscreen_descr *); +int pxa2x0_lcd_setup_wsscreen(struct pxa2x0_lcd_softc *, + struct pxa2x0_wsscreen_descr *, const struct lcd_panel_geometry *, + const char * ); -int pxa2x0_lcd_show_screen(void *, void *, int, void (*)(void *, int, int), - void *); -int pxa2x0_lcd_ioctl(void *, u_long, caddr_t, int, struct proc *); +int pxa2x0_lcd_alloc_screen(void *, const struct wsscreen_descr *, + void **, int *, int *, long *); +void pxa2x0_lcd_free_screen(void *, void *); +int pxa2x0_lcd_ioctl(void *, u_long, caddr_t, int, struct proc *); paddr_t pxa2x0_lcd_mmap(void *, off_t, int); -int pxa2x0_lcd_alloc_screen(void *, const struct wsscreen_descr *, - void **, int *, int *, long *); -void pxa2x0_lcd_free_screen(void *, void *); +int pxa2x0_lcd_show_screen(void *, void *, int, void (*)(void *, int, int), + void *); #endif /* _ARM_XSCALE_PXA2X0_LCD_H */ |