diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-01-06 16:50:46 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-01-06 16:50:46 +0000 |
commit | c511518e27387a5a81b39ef175d43ebbc5255cf1 (patch) | |
tree | 53fd39a1ea98f2f2d2f99a8c84180f9a9abaf7e3 | |
parent | e0f2d9a633adc92193f1166a99b31046e250dde9 (diff) |
Bring back the code simplifications after debug and testing by drahn@
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_lcd.c | 121 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_lcd.h | 11 | ||||
-rw-r--r-- | sys/arch/zaurus/zaurus/zaurus_lcd.c | 21 |
3 files changed, 42 insertions, 111 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_lcd.c b/sys/arch/arm/xscale/pxa2x0_lcd.c index 77284933022..b236d205602 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.7 2005/01/05 23:04:23 miod Exp $ */ +/* $OpenBSD: pxa2x0_lcd.c,v 1.8 2005/01/06 16:50:44 miod Exp $ */ /* $NetBSD: pxa2x0_lcd.c,v 1.8 2003/10/03 07:24:05 bsh Exp $ */ /* @@ -472,7 +472,8 @@ pxa2x0_lcd_new_screen(struct pxa2x0_lcd_softc *sc, * raster operation subsystem. */ int -pxa2x0_lcd_setup_wsscreen(struct pxa2x0_wsscreen_descr *descr, +pxa2x0_lcd_setup_wsscreen(struct pxa2x0_lcd_softc *sc, + struct pxa2x0_wsscreen_descr *descr, const struct lcd_panel_geometry *geom, const char *fontname) { @@ -507,9 +508,16 @@ pxa2x0_lcd_setup_wsscreen(struct pxa2x0_wsscreen_descr *descr, 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; return cookie; } @@ -519,7 +527,8 @@ pxa2x0_lcd_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int), void *cbarg) { struct pxa2x0_lcd_softc *sc = v; - struct pxa2x0_lcd_screen *scr = cookie, *old; + struct rasops_info *ri = cookie; + struct pxa2x0_lcd_screen *scr = ri->ri_hw, *old; old = sc->active; if (old == scr) @@ -540,6 +549,7 @@ pxa2x0_lcd_alloc_screen(void *v, const struct wsscreen_descr *_type, { struct pxa2x0_lcd_softc *sc = v; struct pxa2x0_lcd_screen *scr; + struct rasops_info *ri; struct pxa2x0_wsscreen_descr *type = (struct pxa2x0_wsscreen_descr *)_type; scr = pxa2x0_lcd_new_screen(sc, type->depth); @@ -549,21 +559,23 @@ pxa2x0_lcd_alloc_screen(void *v, const struct wsscreen_descr *_type, /* * initialize raster operation for this screen. */ - scr->rinfo.ri_flg = 0; - scr->rinfo.ri_depth = type->depth; - scr->rinfo.ri_bits = scr->buf_va; - scr->rinfo.ri_width = sc->geometry->panel_width; - scr->rinfo.ri_height = sc->geometry->panel_height; - scr->rinfo.ri_stride = scr->rinfo.ri_width * scr->rinfo.ri_depth / 8; + ri = &scr->rinfo; + ri->ri_hw = (void *)scr; + ri->ri_flg = 0; + ri->ri_depth = type->depth; + ri->ri_bits = scr->buf_va; + ri->ri_width = sc->geometry->panel_width; + ri->ri_height = sc->geometry->panel_height; + ri->ri_stride = ri->ri_width * ri->ri_depth / 8; #ifdef notyet - scr->rinfo.ri_wsfcookie = -1; /* XXX */ + ri->ri_wsfcookie = -1; /* XXX */ #endif - rasops_init(&scr->rinfo, type->c.nrows, type->c.ncols); + rasops_init(ri, type->c.nrows, type->c.ncols); - scr->rinfo.ri_ops.alloc_attr(&scr->rinfo, 0, 0, 0, attrp); + ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp); - *cookiep = scr; + *cookiep = ri; *curxp = 0; *curyp = 0; @@ -574,7 +586,8 @@ void pxa2x0_lcd_free_screen(void *v, void *cookie) { struct pxa2x0_lcd_softc *sc = v; - struct pxa2x0_lcd_screen *scr = cookie; + struct rasops_info *ri = cookie; + struct pxa2x0_lcd_screen *scr = ri->ri_hw; LIST_REMOVE(scr, link); sc->n_screens--; @@ -654,83 +667,3 @@ pxa2x0_lcd_mmap(void *v, off_t offset, int prot) return (bus_dmamem_mmap(sc->dma_tag, screen->segs, screen->nsegs, offset, prot, BUS_DMA_WAITOK | BUS_DMA_COHERENT)); } - -static void -pxa2x0_lcd_cursor(void *cookie, int on, int row, int col) -{ - struct pxa2x0_lcd_screen *scr = cookie; - - (* scr->rinfo.ri_ops.cursor)(&scr->rinfo, on, row, col); -} - -static int -pxa2x0_lcd_mapchar(void *cookie, int c, unsigned int *cp) -{ - struct pxa2x0_lcd_screen *scr = cookie; - - return (* scr->rinfo.ri_ops.mapchar)(&scr->rinfo, c, cp); -} - -static void -pxa2x0_lcd_putchar(void *cookie, int row, int col, u_int uc, long attr) -{ - struct pxa2x0_lcd_screen *scr = cookie; - - (* scr->rinfo.ri_ops.putchar)(&scr->rinfo, - row, col, uc, attr); -} - -static void -pxa2x0_lcd_copycols(void *cookie, int row, int src, int dst, int num) -{ - struct pxa2x0_lcd_screen *scr = cookie; - - (* scr->rinfo.ri_ops.copycols)(&scr->rinfo, - row, src, dst, num); -} - -static void -pxa2x0_lcd_erasecols(void *cookie, int row, int col, int num, long attr) -{ - struct pxa2x0_lcd_screen *scr = cookie; - - (* scr->rinfo.ri_ops.erasecols)(&scr->rinfo, - row, col, num, attr); -} - -static void -pxa2x0_lcd_copyrows(void *cookie, int src, int dst, int num) -{ - struct pxa2x0_lcd_screen *scr = cookie; - - (* scr->rinfo.ri_ops.copyrows)(&scr->rinfo, - src, dst, num); -} - -static void -pxa2x0_lcd_eraserows(void *cookie, int row, int num, long attr) -{ - struct pxa2x0_lcd_screen *scr = cookie; - - (* scr->rinfo.ri_ops.eraserows)(&scr->rinfo, - row, num, attr); -} - -static int -pxa2x0_lcd_alloc_attr(void *cookie, int fg, int bg, int flg, long *attr) -{ - struct pxa2x0_lcd_screen *scr = cookie; - - return scr->rinfo.ri_ops.alloc_attr(&scr->rinfo, fg, bg, flg, attr); -} - -const struct wsdisplay_emulops pxa2x0_lcd_emulops = { - pxa2x0_lcd_cursor, - pxa2x0_lcd_mapchar, - pxa2x0_lcd_putchar, - pxa2x0_lcd_copycols, - pxa2x0_lcd_erasecols, - pxa2x0_lcd_copyrows, - pxa2x0_lcd_eraserows, - pxa2x0_lcd_alloc_attr -}; diff --git a/sys/arch/arm/xscale/pxa2x0_lcd.h b/sys/arch/arm/xscale/pxa2x0_lcd.h index 12200d87af3..94f7c38a840 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.4 2005/01/05 19:12:47 miod Exp $ */ +/* $OpenBSD: pxa2x0_lcd.h,v 1.5 2005/01/06 16:50:44 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,6 +85,8 @@ 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 */ + void *ih; /* interrupt handler */ }; @@ -134,8 +136,9 @@ struct pxa2x0_wsscreen_descr { int depth; /* bits per pixel */ }; -int pxa2x0_lcd_setup_wsscreen(struct pxa2x0_wsscreen_descr *, - const struct lcd_panel_geometry *, const char * ); +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 *); @@ -145,6 +148,4 @@ int pxa2x0_lcd_alloc_screen(void *, const struct wsscreen_descr *, void **, int *, int *, long *); void pxa2x0_lcd_free_screen(void *, void *); -extern const struct wsdisplay_emulops pxa2x0_lcd_emulops; - #endif /* _ARM_XSCALE_PXA2X0_LCD_H */ diff --git a/sys/arch/zaurus/zaurus/zaurus_lcd.c b/sys/arch/zaurus/zaurus/zaurus_lcd.c index 60df729bbbc..518f6f86ad1 100644 --- a/sys/arch/zaurus/zaurus/zaurus_lcd.c +++ b/sys/arch/zaurus/zaurus/zaurus_lcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_lcd.c,v 1.6 2005/01/05 23:28:54 drahn Exp $ */ +/* $OpenBSD: zaurus_lcd.c,v 1.7 2005/01/06 16:50:45 miod Exp $ */ /* $NetBSD: lubbock_lcd.c,v 1.1 2003/08/09 19:38:53 bsh Exp $ */ /* @@ -70,21 +70,18 @@ int lcdintr(void *); struct pxa2x0_wsscreen_descr lcd_bpp16_screen = { { - "std" /* "bpp16" */, 0, 0, - &pxa2x0_lcd_emulops, + "std" /* "bpp16" */ }, 16 /* bits per pixel */ #ifdef notyet }, lcd_bpp8_screen = { { - "bpp8", 0, 0, - &pxa2x0_lcd_emulops, + "bpp8" }, 8 /* bits per pixel */ }, lcd_bpp4_screen = { { - "bpp4", 0, 0, - &pxa2x0_lcd_emulops, + "bpp4" }, 4 /* bits per pixel */ #endif @@ -134,7 +131,7 @@ lcd_match(struct device *parent, void *cf, void *aux) return 1; } -#define CURRENT_DISPLAY sharp_zaurus_C3000 +#define CURRENT_DISPLAY &sharp_zaurus_C3000 static const struct lcd_panel_geometry sharp_zaurus_C3000 = { @@ -161,13 +158,13 @@ lcd_attach(struct device *parent, struct device *self, void *aux) struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)self; struct wsemuldisplaydev_attach_args aa; - pxa2x0_lcd_attach_sub(sc, aux, &CURRENT_DISPLAY); + pxa2x0_lcd_attach_sub(sc, aux, CURRENT_DISPLAY); /* make wsdisplay screen list */ - pxa2x0_lcd_setup_wsscreen(&lcd_bpp16_screen, &CURRENT_DISPLAY, NULL); + pxa2x0_lcd_setup_wsscreen(sc, &lcd_bpp16_screen, CURRENT_DISPLAY, NULL); #ifdef notyet - pxa2x0_lcd_setup_wsscreen(&lcd_bpp8_screen, &CURRENT_DISPLAY, NULL); - pxa2x0_lcd_setup_wsscreen(&lcd_bpp4_screen, &CURRENT_DISPLAY, NULL); + pxa2x0_lcd_setup_wsscreen(sc, &lcd_bpp8_screen, CURRENT_DISPLAY, NULL); + pxa2x0_lcd_setup_wsscreen(sc, &lcd_bpp4_screen, CURRENT_DISPLAY, NULL); #endif aa.console = 0; /* XXX */ |