CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Wed Jan 27 22:42:53 UTC 2021 Modified Files: src/sys/dev/wsfb: files.wsfb genfb.c genfbvar.h Log Message: add optional glyph cache for genfb enable with options GENFB_GLYPHCACHE=n with n being the desired size of the cache in MB. Should be enough to cache at least 900 glyphs in whatever video mode used in order to be effective in 32bit per pixel that's about 1MB To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/wsfb/files.wsfb cvs rdiff -u -r1.80 -r1.81 src/sys/dev/wsfb/genfb.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/wsfb/genfbvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/files.wsfb diff -u src/sys/dev/wsfb/files.wsfb:1.11 src/sys/dev/wsfb/files.wsfb:1.12 --- src/sys/dev/wsfb/files.wsfb:1.11 Fri Jul 26 10:48:45 2019 +++ src/sys/dev/wsfb/files.wsfb Wed Jan 27 22:42:53 2021 @@ -1,4 +1,4 @@ -# $NetBSD: files.wsfb,v 1.11 2019/07/26 10:48:45 rin Exp $ +# $NetBSD: files.wsfb,v 1.12 2021/01/27 22:42:53 macallan Exp $ # # wsdisplay framebuffer drivers @@ -13,3 +13,4 @@ define genfb: rasops1, rasops2, rasops4, device genfb: genfb, wsemuldisplaydev, drm, splash file dev/wsfb/genfb.c genfb needs-flag defflag opt_genfb.h GENFB_DEBUG GENFB_SHADOWFB +defparam opt_genfb.h GENFB_GLYPHCACHE=0 # glyphcache size in MB Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.80 src/sys/dev/wsfb/genfb.c:1.81 --- src/sys/dev/wsfb/genfb.c:1.80 Tue Jan 26 18:08:33 2021 +++ src/sys/dev/wsfb/genfb.c Wed Jan 27 22:42:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.80 2021/01/26 18:08:33 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.81 2021/01/27 22:42:53 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.80 2021/01/26 18:08:33 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.81 2021/01/27 22:42:53 macallan Exp $"); #include #include @@ -92,6 +92,11 @@ static void genfb_init_palette(struct ge static void genfb_brightness_up(device_t); static void genfb_brightness_down(device_t); +#if GENFB_GLYPHCACHE > 0 +static int genfb_setup_glyphcache(struct genfb_softc *, long); +static void genfb_putchar(void *, int, int, u_int, long); +#endif + extern const u_char rasops_cmap[768]; static int genfb_cnattach_called = 0; @@ -288,6 +293,10 @@ genfb_attach(struct genfb_softc *sc, str ); sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC; +#if GENFB_GLYPHCACHE > 0 + genfb_setup_glyphcache(sc, defattr); +#endif + #ifdef SPLASHSCREEN /* * If system isn't going to go multiuser, or user has requested to see @@ -632,7 +641,10 @@ genfb_init_screen(void *cookie, struct v sc->sc_width / ri->ri_font->fontwidth); ri->ri_hw = scr; - +#if GENFB_GLYPHCACHE > 0 + sc->sc_putchar = ri->ri_ops.putchar; + ri->ri_ops.putchar = genfb_putchar; +#endif #ifdef GENFB_DISABLE_TEXT if (scr == >sc_console_screen && !DISABLESPLASH) SCREEN_DISABLE_DRAWING(>sc_console_screen); @@ -890,3 +902,171 @@ genfb_disable_polling(device_t dev) vcons_disable_polling(>vd); } } + +#if GENFB_GLYPHCACHE > 0 +#define GLYPHCACHESIZE ((GENFB_GLYPHCACHE) * 1024 * 1024) + +static inline int +attr2idx(long attr) +{ + if ((attr & 0xf0f00ff8) != 0) + return -1; + + return (((attr >> 16) & 0x0f) | ((attr >> 20) & 0xf0)); +} + +static int +genfb_setup_glyphcache(struct genfb_softc *sc, long defattr) +{ + struct rasops_info *ri = >sc_console_screen.scr_ri, + *cri = >sc_cache_ri; + gc_bucket *b; + int i, usedcells = 0, idx, j; + + sc->sc_cache = kmem_alloc(GLYPHCACHESIZE, KM_SLEEP); + + /* + * now we build a mutant rasops_info for the cache - same pixel type + * and such as the real fb, but only one character per line for + * simplicity and locality + */ + memcpy(cri, ri, sizeof(struct rasops_info)); + cri->ri_ops.putchar = sc->sc_putchar; + cri->ri_width = ri->ri_font->fontwidth; + cri->ri_stride = ri->ri_xscale; + cri->ri_bits = sc->sc_cache; + cri->ri_hwbits = NULL; + cri->ri_origbits = sc->sc_cache; + cri->ri_cols = 1; + cri->ri_rows = GLYPHCACHESIZE / + (cri->ri_stride * cri->ri_font->fontheight); + cri->ri_xorigin = 0; + cri->ri_yorigin = 0; + cri->ri_xscale = ri->ri_xscale; + cri->ri_yscale = ri->ri_font->fontheight * ri->ri_xscale; + + printf("size %d %d %d\n", GLYPHCACHESIZE, ri->ri_width, ri->ri_stride); + printf("cells: %d\n", cri->ri_rows); + sc->sc_nbuckets = uimin(256, cri->ri_rows / 223); + sc->sc_buckets = kmem_alloc(sizeof(gc_bucket) * sc->sc_nbuckets, KM_SLEEP); + printf("buckets: %d\n", sc->sc_nbuckets); + for (i = 0; i < sc->sc_nbuckets; i++) { + b = >sc_buckets[i]; + b->gb_firstcell = usedcells; + b->gb_numcells = uimin(223, cri->ri_rows - usedcells); + usedcells += 223; + b->gb_usedcells = 0; + b->gb_index = -1; + for (j = 0; j < 223; j++) b->gb_map[j] = -1; + } + + /* initialize
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Tue Jan 26 18:08:33 UTC 2021 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: remove outdated comment To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.79 src/sys/dev/wsfb/genfb.c:1.80 --- src/sys/dev/wsfb/genfb.c:1.79 Sun Jan 17 00:23:38 2021 +++ src/sys/dev/wsfb/genfb.c Tue Jan 26 18:08:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.79 2021/01/17 00:23:38 jmcneill Exp $ */ +/* $NetBSD: genfb.c,v 1.80 2021/01/26 18:08:33 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.79 2021/01/17 00:23:38 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.80 2021/01/26 18:08:33 macallan Exp $"); #include #include @@ -631,7 +631,6 @@ genfb_init_screen(void *cookie, struct v rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight, sc->sc_width / ri->ri_font->fontwidth); - /* TODO: actually center output */ ri->ri_hw = scr; #ifdef GENFB_DISABLE_TEXT
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: jmcneill Date: Sun Jan 17 00:23:38 UTC 2021 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Prefer printing the framebuffer's PA instead of VA. It's much more useful.. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.78 src/sys/dev/wsfb/genfb.c:1.79 --- src/sys/dev/wsfb/genfb.c:1.78 Mon Oct 19 01:08:06 2020 +++ src/sys/dev/wsfb/genfb.c Sun Jan 17 00:23:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.78 2020/10/19 01:08:06 rin Exp $ */ +/* $NetBSD: genfb.c,v 1.79 2021/01/17 00:23:38 jmcneill Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.78 2020/10/19 01:08:06 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.79 2021/01/17 00:23:38 jmcneill Exp $"); #include #include @@ -41,6 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1. #include #include +#include + #include #include #include @@ -214,6 +216,7 @@ genfb_attach(struct genfb_softc *sc, str struct wsemuldisplaydev_attach_args aa; prop_dictionary_t dict; struct rasops_info *ri; + paddr_t fb_phys; uint16_t crow; long defattr; bool console; @@ -231,9 +234,16 @@ genfb_attach(struct genfb_softc *sc, str == false) sc->sc_want_clear = true; + fb_phys = (paddr_t)sc->sc_fboffset; + if (fb_phys == 0) { + KASSERT(sc->sc_fbaddr != NULL); + (void)pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_fbaddr, + _phys); + } + aprint_verbose_dev(sc->sc_dev, "framebuffer at %p, size %dx%d, depth %d, " "stride %d\n", - sc->sc_fboffset ? (void *)(intptr_t)sc->sc_fboffset : sc->sc_fbaddr, + fb_phys ? (void *)(intptr_t)fb_phys : sc->sc_fbaddr, sc->sc_width, sc->sc_height, sc->sc_depth, sc->sc_stride); sc->sc_defaultscreen_descr = (struct wsscreen_descr){
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: rin Date: Mon Oct 19 01:08:06 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Add "is_swapped" property which indicates 32-bpp framebuffer is byte-swapped. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.77 src/sys/dev/wsfb/genfb.c:1.78 --- src/sys/dev/wsfb/genfb.c:1.77 Sun Oct 18 12:47:37 2020 +++ src/sys/dev/wsfb/genfb.c Mon Oct 19 01:08:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.77 2020/10/18 12:47:37 rin Exp $ */ +/* $NetBSD: genfb.c,v 1.78 2020/10/19 01:08:06 rin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.77 2020/10/18 12:47:37 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.78 2020/10/19 01:08:06 rin Exp $"); #include #include @@ -539,7 +539,7 @@ genfb_init_screen(void *cookie, struct v struct genfb_softc *sc = cookie; struct rasops_info *ri = >scr_ri; int wantcols; - bool is_bgr; + bool is_bgr, is_swapped; ri->ri_depth = sc->sc_depth; ri->ri_width = sc->sc_width; @@ -565,24 +565,30 @@ genfb_init_screen(void *cookie, struct v switch (ri->ri_depth) { case 32: case 24: + ri->ri_rnum = ri->ri_gnum = ri->ri_bnum = 8; ri->ri_flg |= RI_ENABLE_ALPHA; is_bgr = false; prop_dictionary_get_bool(device_properties(sc->sc_dev), "is_bgr", _bgr); + + is_swapped = false; + prop_dictionary_get_bool(device_properties(sc->sc_dev), + "is_swapped", _swapped); + if (is_bgr) { /* someone requested BGR */ - ri->ri_rnum = 8; - ri->ri_gnum = 8; - ri->ri_bnum = 8; ri->ri_rpos = 0; ri->ri_gpos = 8; ri->ri_bpos = 16; + } else if (is_swapped) { + /* byte-swapped, must be 32 bpp */ + KASSERT(ri->ri_depth == 32); + ri->ri_rpos = 8; + ri->ri_gpos = 16; + ri->ri_bpos = 24; } else { /* assume RGB */ - ri->ri_rnum = 8; - ri->ri_gnum = 8; - ri->ri_bnum = 8; ri->ri_rpos = 16; ri->ri_gpos = 8; ri->ri_bpos = 0;
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: rin Date: Sun Oct 18 12:47:37 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Revert rev 1.75; do not set WSFB_VRAM_IS_RAM flag bit. It indicates memory type obtained by mmap. I just misunderstood its intention. Thanks to jmcneill for pointing it out! To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.76 src/sys/dev/wsfb/genfb.c:1.77 --- src/sys/dev/wsfb/genfb.c:1.76 Sun Oct 18 12:00:12 2020 +++ src/sys/dev/wsfb/genfb.c Sun Oct 18 12:47:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.76 2020/10/18 12:00:12 rin Exp $ */ +/* $NetBSD: genfb.c,v 1.77 2020/10/18 12:47:37 rin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.76 2020/10/18 12:00:12 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.77 2020/10/18 12:47:37 rin Exp $"); #include #include @@ -499,12 +499,7 @@ genfb_ioctl(void *v, void *vs, u_long cm case WSDISPLAYIO_GET_FBINFO: { struct wsdisplayio_fbinfo *fbi = data; - ret = wsdisplayio_get_fbinfo(>scr_ri, fbi); - if (ret == 0) { -if (sc->sc_enable_shadowfb) - fbi->fbi_flags |= WSFB_VRAM_IS_RAM; - } - return ret; + return wsdisplayio_get_fbinfo(>scr_ri, fbi); } } return EPASSTHROUGH;
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: rin Date: Sun Oct 18 12:00:12 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Remove stray TABs. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.75 src/sys/dev/wsfb/genfb.c:1.76 --- src/sys/dev/wsfb/genfb.c:1.75 Sun Oct 18 11:54:20 2020 +++ src/sys/dev/wsfb/genfb.c Sun Oct 18 12:00:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.75 2020/10/18 11:54:20 rin Exp $ */ +/* $NetBSD: genfb.c,v 1.76 2020/10/18 12:00:12 rin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.75 2020/10/18 11:54:20 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.76 2020/10/18 12:00:12 rin Exp $"); #include #include @@ -493,7 +493,6 @@ genfb_ioctl(void *v, void *vs, u_long cm */ switch (cmd) { case WSDISPLAYIO_GET_EDID: { - struct wsdisplayio_edid_info *d = data; return wsdisplayio_get_edid(sc->sc_dev, d); }
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: rin Date: Sun Oct 18 11:54:21 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: For WSDISPLAYIO_GET_FBINFO ioctl, set WSFB_VRAM_IS_RAM to fbi_flags when shadow FB is used. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.74 src/sys/dev/wsfb/genfb.c:1.75 --- src/sys/dev/wsfb/genfb.c:1.74 Thu Jun 11 02:39:31 2020 +++ src/sys/dev/wsfb/genfb.c Sun Oct 18 11:54:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.74 2020/06/11 02:39:31 thorpej Exp $ */ +/* $NetBSD: genfb.c,v 1.75 2020/10/18 11:54:20 rin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.74 2020/06/11 02:39:31 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.75 2020/10/18 11:54:20 rin Exp $"); #include #include @@ -500,7 +500,12 @@ genfb_ioctl(void *v, void *vs, u_long cm case WSDISPLAYIO_GET_FBINFO: { struct wsdisplayio_fbinfo *fbi = data; - return wsdisplayio_get_fbinfo(>scr_ri, fbi); + ret = wsdisplayio_get_fbinfo(>scr_ri, fbi); + if (ret == 0) { +if (sc->sc_enable_shadowfb) + fbi->fbi_flags |= WSFB_VRAM_IS_RAM; + } + return ret; } } return EPASSTHROUGH;
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: jdolecek Date: Sat May 30 14:15:43 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: reduce stack usage in genfb_calc_hsize() To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.72 src/sys/dev/wsfb/genfb.c:1.73 --- src/sys/dev/wsfb/genfb.c:1.72 Mon Apr 13 15:26:57 2020 +++ src/sys/dev/wsfb/genfb.c Sat May 30 14:15:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.72 2020/04/13 15:26:57 msaitoh Exp $ */ +/* $NetBSD: genfb.c,v 1.73 2020/05/30 14:15:43 jdolecek Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.72 2020/04/13 15:26:57 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.73 2020/05/30 14:15:43 jdolecek Exp $"); #include #include @@ -632,18 +632,25 @@ genfb_calc_hsize(struct genfb_softc *sc) device_t dev = sc->sc_dev; prop_dictionary_t dict = device_properties(dev); prop_data_t edid_data; - struct edid_info edid; + struct edid_info *edid; const char *edid_ptr; + int hsize; edid_data = prop_dictionary_get(dict, "EDID"); if (edid_data == NULL || prop_data_size(edid_data) < 128) return 0; + edid = kmem_alloc(sizeof(*edid), KM_SLEEP); + edid_ptr = prop_data_data_nocopy(edid_data); - if (edid_parse(__UNCONST(edid_ptr), ) != 0) - return 0; + if (edid_parse(__UNCONST(edid_ptr), edid) == 0) + hsize = (int)edid->edid_max_hsize * 10; + else + hsize = 0; + + kmem_free(edid, sizeof(*edid)); - return (int)edid.edid_max_hsize * 10; + return hsize; } /* Return the minimum number of character columns based on DPI */
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: msaitoh Date: Mon Apr 13 15:26:58 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Get genfb's address offset correctly when the vaule >= 4G. OK's by jmcneill. Tested on Intel BXNUC10I3FNK (Comet Lake U). To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.71 src/sys/dev/wsfb/genfb.c:1.72 --- src/sys/dev/wsfb/genfb.c:1.71 Sun Feb 23 14:44:23 2020 +++ src/sys/dev/wsfb/genfb.c Mon Apr 13 15:26:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.71 2020/02/23 14:44:23 martin Exp $ */ +/* $NetBSD: genfb.c,v 1.72 2020/04/13 15:26:57 msaitoh Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.71 2020/02/23 14:44:23 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.72 2020/04/13 15:26:57 msaitoh Exp $"); #include #include @@ -102,7 +102,7 @@ genfb_init(struct genfb_softc *sc) { prop_dictionary_t dict; uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb, br_cb, fbaddr; - uint32_t fboffset; + uint64_t fboffset; bool console; dict = device_properties(sc->sc_dev); @@ -124,13 +124,12 @@ genfb_init(struct genfb_softc *sc) return; } - /* XXX should be a 64bit value */ - if (!prop_dictionary_get_uint32(dict, "address", )) { + if (!prop_dictionary_get_uint64(dict, "address", )) { GPRINTF("no address property\n"); return; } - sc->sc_fboffset = fboffset; + sc->sc_fboffset = (bus_addr_t)fboffset; sc->sc_fbaddr = NULL; if (prop_dictionary_get_uint64(dict, "virtual_address", )) {
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: martin Date: Sun Feb 23 14:44:24 UTC 2020 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Do not replay the msgbuf if we are booting silent or quiet. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.70 src/sys/dev/wsfb/genfb.c:1.71 --- src/sys/dev/wsfb/genfb.c:1.70 Fri Aug 9 17:22:02 2019 +++ src/sys/dev/wsfb/genfb.c Sun Feb 23 14:44:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.70 2019/08/09 17:22:02 rin Exp $ */ +/* $NetBSD: genfb.c,v 1.71 2020/02/23 14:44:23 martin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.70 2019/08/09 17:22:02 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.71 2020/02/23 14:44:23 martin Exp $"); #include #include @@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1. #include #include #include +#include #include #include @@ -53,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1. #include #ifdef GENFB_DISABLE_TEXT -#include #define DISABLESPLASH (boothowto & (RB_SINGLE | RB_USERCONF | RB_ASKNAME | \ AB_VERBOSE | AB_DEBUG) ) #endif @@ -342,7 +342,7 @@ genfb_attach(struct genfb_softc *sc, str } #else genfb_init_palette(sc); - if (console) + if (console && (boothowto & (AB_SILENT|AB_QUIET)) == 0) vcons_replay_msgbuf(>sc_console_screen); #endif
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: mlelstv Date: Tue Mar 6 07:49:36 UTC 2018 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Fix cmap bounds checking. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.62 src/sys/dev/wsfb/genfb.c:1.63 --- src/sys/dev/wsfb/genfb.c:1.62 Sun Jan 21 04:20:10 2018 +++ src/sys/dev/wsfb/genfb.c Tue Mar 6 07:49:36 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.62 2018/01/21 04:20:10 christos Exp $ */ +/* $NetBSD: genfb.c,v 1.63 2018/03/06 07:49:36 mlelstv Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.62 2018/01/21 04:20:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.63 2018/03/06 07:49:36 mlelstv Exp $"); #include #include @@ -611,8 +611,9 @@ genfb_putcmap(struct genfb_softc *sc, st #ifdef GENFB_DEBUG aprint_debug("putcmap: %d %d\n",index, count); #endif - if (index + count > 256) + if (index >= 256 || count > 256 || index + count > 256) return EINVAL; + error = copyin(cm->red, [index], count); if (error) return error; @@ -646,7 +647,7 @@ genfb_getcmap(struct genfb_softc *sc, st u_int count = cm->count; int error; - if (index >= 255 || count > 256 || index + count > 256) + if (index >= 256 || count > 256 || index + count > 256) return EINVAL; error = copyout(>sc_cmap_red[index], cm->red, count);
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: christos Date: Sun Jan 21 04:20:10 UTC 2018 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: CID-1427771: Remove incorrect pre-condition (index cannot be 256!) To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.61 src/sys/dev/wsfb/genfb.c:1.62 --- src/sys/dev/wsfb/genfb.c:1.61 Wed May 31 22:45:12 2017 +++ src/sys/dev/wsfb/genfb.c Sat Jan 20 23:20:10 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.61 2017/06/01 02:45:12 chs Exp $ */ +/* $NetBSD: genfb.c,v 1.62 2018/01/21 04:20:10 christos Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.61 2017/06/01 02:45:12 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.62 2018/01/21 04:20:10 christos Exp $"); #include #include @@ -611,8 +611,7 @@ genfb_putcmap(struct genfb_softc *sc, st #ifdef GENFB_DEBUG aprint_debug("putcmap: %d %d\n",index, count); #endif - if (cm->index >= 256 || cm->count > 256 || - (cm->index + cm->count) > 256) + if (index + count > 256) return EINVAL; error = copyin(cm->red, [index], count); if (error)
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Fri May 19 19:23:25 UTC 2017 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: enable font loading and screen resizing To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.59 src/sys/dev/wsfb/genfb.c:1.60 --- src/sys/dev/wsfb/genfb.c:1.59 Sat Feb 25 01:11:55 2017 +++ src/sys/dev/wsfb/genfb.c Fri May 19 19:23:24 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.59 2017/02/25 01:11:55 nonaka Exp $ */ +/* $NetBSD: genfb.c,v 1.60 2017/05/19 19:23:24 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.59 2017/02/25 01:11:55 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.60 2017/05/19 19:23:24 macallan Exp $"); #include #include @@ -235,7 +235,8 @@ genfb_attach(struct genfb_softc *sc, str 0, 0, NULL, 8, 16, - WSSCREEN_WSCOLORS | WSSCREEN_HILIT, + WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE | + WSSCREEN_RESIZE, NULL }; sc->sc_screens[0] = >sc_defaultscreen_descr; @@ -538,6 +539,8 @@ genfb_init_screen(void *cookie, struct v if (sc->sc_want_clear) ri->ri_flg |= RI_FULLCLEAR; + scr->scr_flags |= VCONS_LOADFONT; + if (sc->sc_shadowfb != NULL) { ri->ri_hwbits = (char *)sc->sc_fbaddr; ri->ri_bits = (char *)sc->sc_shadowfb; @@ -582,8 +585,8 @@ genfb_init_screen(void *cookie, struct v rasops_init(ri, 0, 0); - ri->ri_caps = WSSCREEN_WSCOLORS; - + ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE | + WSSCREEN_RESIZE; rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight, sc->sc_width / ri->ri_font->fontwidth);
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: nonaka Date: Sat Feb 25 01:11:55 UTC 2017 Modified Files: src/sys/dev/wsfb: genfb.c genfbvar.h Log Message: genfb(4): Enabling/Disabling shadowfb can be controlled via prop. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/dev/wsfb/genfb.c cvs rdiff -u -r1.24 -r1.25 src/sys/dev/wsfb/genfbvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.58 src/sys/dev/wsfb/genfb.c:1.59 --- src/sys/dev/wsfb/genfb.c:1.58 Mon Jun 1 20:47:59 2015 +++ src/sys/dev/wsfb/genfb.c Sat Feb 25 01:11:55 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.58 2015/06/01 20:47:59 nat Exp $ */ +/* $NetBSD: genfb.c,v 1.59 2017/02/25 01:11:55 nonaka Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.58 2015/06/01 20:47:59 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.59 2017/02/25 01:11:55 nonaka Exp $"); #include #include @@ -130,6 +130,15 @@ genfb_init(struct genfb_softc *sc) sc->sc_fbaddr = (void *)(uintptr_t)fbaddr; } + sc->sc_shadowfb = NULL; + if (!prop_dictionary_get_bool(dict, "enable_shadowfb", + >sc_enable_shadowfb)) +#ifdef GENFB_SHADOWFB + sc->sc_enable_shadowfb = true; +#else + sc->sc_enable_shadowfb = false; +#endif + if (!prop_dictionary_get_uint32(dict, "linebytes", >sc_stride)) sc->sc_stride = (sc->sc_width * sc->sc_depth) >> 3; @@ -240,11 +249,11 @@ genfb_attach(struct genfb_softc *sc, str sc->sc_accessops.mmap = genfb_mmap; sc->sc_accessops.pollc = genfb_pollc; -#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 + if (sc->sc_enable_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); + } vcons_init(>vd, sc, >sc_defaultscreen_descr, >sc_accessops); @@ -529,14 +538,10 @@ genfb_init_screen(void *cookie, struct v 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 - { + } else { ri->ri_bits = (char *)sc->sc_fbaddr; scr->scr_flags |= VCONS_DONT_READ; } Index: src/sys/dev/wsfb/genfbvar.h diff -u src/sys/dev/wsfb/genfbvar.h:1.24 src/sys/dev/wsfb/genfbvar.h:1.25 --- src/sys/dev/wsfb/genfbvar.h:1.24 Thu Jul 24 21:35:13 2014 +++ src/sys/dev/wsfb/genfbvar.h Sat Feb 25 01:11:55 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: genfbvar.h,v 1.24 2014/07/24 21:35:13 riastradh Exp $ */ +/* $NetBSD: genfbvar.h,v 1.25 2017/02/25 01:11:55 nonaka Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -111,9 +111,8 @@ struct genfb_softc { struct genfb_mode_callback *sc_modecb; int sc_backlight_level, sc_backlight_on; void *sc_fbaddr; /* kva */ -#ifdef GENFB_SHADOWFB void *sc_shadowfb; -#endif + bool sc_enable_shadowfb; bus_addr_t sc_fboffset; /* bus address */ int sc_width, sc_height, sc_stride, sc_depth; size_t sc_fbsize;
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: nat Date: Mon Jun 1 20:47:59 UTC 2015 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Fix splashscreen on resolutions where text is centered. This commit was approved by macallan@ To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.57 src/sys/dev/wsfb/genfb.c:1.58 --- src/sys/dev/wsfb/genfb.c:1.57 Fri Mar 20 21:55:46 2015 +++ src/sys/dev/wsfb/genfb.c Mon Jun 1 20:47:59 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.57 2015/03/20 21:55:46 jmcneill Exp $ */ +/* $NetBSD: genfb.c,v 1.58 2015/06/01 20:47:59 nat Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.57 2015/03/20 21:55:46 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.58 2015/06/01 20:47:59 nat Exp $); #include sys/param.h #include sys/systm.h @@ -305,7 +305,7 @@ genfb_attach(struct genfb_softc *sc, str genfb_restore_palette(sc); sc-sc_splash.si_depth = sc-sc_depth; - sc-sc_splash.si_bits = sc-sc_console_screen.scr_ri.ri_bits; + sc-sc_splash.si_bits = sc-sc_console_screen.scr_ri.ri_origbits; sc-sc_splash.si_hwbits = sc-sc_fbaddr; sc-sc_splash.si_width = sc-sc_width; sc-sc_splash.si_height = sc-sc_height;
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: jmcneill Date: Fri Mar 20 21:55:46 UTC 2015 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: support 24bpp framebuffers To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.56 src/sys/dev/wsfb/genfb.c:1.57 --- src/sys/dev/wsfb/genfb.c:1.56 Wed Sep 10 07:40:52 2014 +++ src/sys/dev/wsfb/genfb.c Fri Mar 20 21:55:46 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.56 2014/09/10 07:40:52 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.57 2015/03/20 21:55:46 jmcneill Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.56 2014/09/10 07:40:52 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.57 2015/03/20 21:55:46 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -545,10 +545,12 @@ genfb_init_screen(void *cookie, struct v ri-ri_flg |= RI_CLEAR; } - if (ri-ri_depth == 32) { + if (ri-ri_depth == 32 || ri-ri_depth == 24) { bool is_bgr = false; - ri-ri_flg |= RI_ENABLE_ALPHA; + if (ri-ri_depth == 32) { + ri-ri_flg |= RI_ENABLE_ALPHA; + } prop_dictionary_get_bool(device_properties(sc-sc_dev), is_bgr, is_bgr); if (is_bgr) { @@ -568,7 +570,7 @@ genfb_init_screen(void *cookie, struct v ri-ri_gpos = 8; ri-ri_bpos = 0; } - } + } if (ri-ri_depth == 8 sc-sc_cmcb != NULL) ri-ri_flg |= RI_ENABLE_ALPHA | RI_8BIT_IS_RGB;
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Wed Sep 10 07:40:52 UTC 2014 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: handle WSDISPLAYIO_GET_EDID and WSDISPLAYIO_GET_FBINFO only if the bus frontend doesn't ( as in, returns EPASSTHROUGH or doesn't register a handler ) Now flags passed from things like bcm2835_genfb.c are actually seen by xf86-video-wsfb again and automatically disabling shadowfb works again, which results in a major speedup on this kind of hardware. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.55 src/sys/dev/wsfb/genfb.c:1.56 --- src/sys/dev/wsfb/genfb.c:1.55 Thu Jul 24 21:35:13 2014 +++ src/sys/dev/wsfb/genfb.c Wed Sep 10 07:40:52 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.55 2014/07/24 21:35:13 riastradh Exp $ */ +/* $NetBSD: genfb.c,v 1.56 2014/09/10 07:40:52 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.55 2014/07/24 21:35:13 riastradh Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.56 2014/09/10 07:40:52 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -354,7 +354,7 @@ genfb_ioctl(void *v, void *vs, u_long cm struct wsdisplay_fbinfo *wdf; struct vcons_screen *ms = vd-active; struct wsdisplay_param *param; - int new_mode, error, val; + int new_mode, error, val, ret; switch (cmd) { case WSDISPLAYIO_GINFO: @@ -459,9 +459,22 @@ genfb_ioctl(void *v, void *vs, u_long cm return sc-sc_backlight-gpc_set_parameter( sc-sc_backlight-gpc_cookie, val); } - return EPASSTHROUGH; - + return EPASSTHROUGH; + } + ret = EPASSTHROUGH; + if (sc-sc_ops.genfb_ioctl) + ret = sc-sc_ops.genfb_ioctl(sc, vs, cmd, data, flag, l); + if (ret != EPASSTHROUGH) + return ret; + /* + * XXX + * handle these only if there either is no ioctl() handler or it didn't + * know how to deal with them. This allows bus frontends to override + * them but still provides fallback implementations + */ + switch (cmd) { case WSDISPLAYIO_GET_EDID: { + struct wsdisplayio_edid_info *d = data; return wsdisplayio_get_edid(sc-sc_dev, d); } @@ -470,11 +483,6 @@ genfb_ioctl(void *v, void *vs, u_long cm struct wsdisplayio_fbinfo *fbi = data; return wsdisplayio_get_fbinfo(ms-scr_ri, fbi); } - - default: - if (sc-sc_ops.genfb_ioctl) -return sc-sc_ops.genfb_ioctl(sc, vs, cmd, -data, flag, l); } return EPASSTHROUGH; }
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: riastradh Date: Wed Jul 23 16:56:49 UTC 2014 Modified Files: src/sys/dev/wsfb: genfbvar.h Log Message: RCS IDs do not go in header files. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/wsfb/genfbvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfbvar.h diff -u src/sys/dev/wsfb/genfbvar.h:1.22 src/sys/dev/wsfb/genfbvar.h:1.23 --- src/sys/dev/wsfb/genfbvar.h:1.22 Tue Mar 18 18:20:42 2014 +++ src/sys/dev/wsfb/genfbvar.h Wed Jul 23 16:56:49 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: genfbvar.h,v 1.22 2014/03/18 18:20:42 riastradh Exp $ */ +/* $NetBSD: genfbvar.h,v 1.23 2014/07/23 16:56:49 riastradh Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -26,9 +26,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfbvar.h,v 1.22 2014/03/18 18:20:42 riastradh Exp $); - #ifndef GENFBVAR_H #define GENFBVAR_H
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: skrll Date: Wed Jan 22 18:47:11 UTC 2014 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Provide a wsdisplay_accessops.pollc This makes sure that the screen gets painted properly during early boot input (e.g. boot -a) on the Raspberry PI. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.51 src/sys/dev/wsfb/genfb.c:1.52 --- src/sys/dev/wsfb/genfb.c:1.51 Wed Oct 9 17:20:54 2013 +++ src/sys/dev/wsfb/genfb.c Wed Jan 22 18:47:11 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.51 2013/10/09 17:20:54 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.52 2014/01/22 18:47:11 skrll Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.51 2013/10/09 17:20:54 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.52 2014/01/22 18:47:11 skrll Exp $); #include sys/param.h #include sys/systm.h @@ -68,6 +68,8 @@ __KERNEL_RCSID(0, $NetBSD: genfb.c,v 1. static int genfb_ioctl(void *, void *, u_long, void *, int, struct lwp *); static paddr_t genfb_mmap(void *, void *, off_t, int); +static void genfb_pollc(void *, int); + static void genfb_init_screen(void *, struct vcons_screen *, int, long *); static int genfb_putcmap(struct genfb_softc *, struct wsdisplay_cmap *); @@ -234,6 +236,7 @@ genfb_attach(struct genfb_softc *sc, str sc-sc_accessops.ioctl = genfb_ioctl; sc-sc_accessops.mmap = genfb_mmap; + sc-sc_accessops.pollc = genfb_pollc; #ifdef GENFB_SHADOWFB sc-sc_shadowfb = kmem_alloc(sc-sc_fbsize, KM_SLEEP); @@ -485,6 +488,21 @@ genfb_mmap(void *v, void *vs, off_t offs } static void +genfb_pollc(void *v, int on) +{ + struct vcons_data *vd = v; + struct genfb_softc *sc = vd-cookie; + + if (sc == NULL) + return; + + if (on) + genfb_enable_polling(sc-sc_dev); + else + genfb_disable_polling(sc-sc_dev); +} + +static void genfb_init_screen(void *cookie, struct vcons_screen *scr, int existing, long *defattr) {
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: jmcneill Date: Thu Jan 10 22:06:59 UTC 2013 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: for WSDISPLAYIO_SMODE, if the bus ioctl handler returns EPASSTHROUGH, dont treat it as an error To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.49 src/sys/dev/wsfb/genfb.c:1.50 --- src/sys/dev/wsfb/genfb.c:1.49 Wed Jan 9 01:57:59 2013 +++ src/sys/dev/wsfb/genfb.c Thu Jan 10 22:06:59 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.49 2013/01/09 01:57:59 jmcneill Exp $ */ +/* $NetBSD: genfb.c,v 1.50 2013/01/10 22:06:59 jmcneill Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.49 2013/01/09 01:57:59 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.50 2013/01/10 22:06:59 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -380,7 +380,7 @@ genfb_ioctl(void *v, void *vs, u_long cm if (sc-sc_ops.genfb_ioctl) error = sc-sc_ops.genfb_ioctl(sc, vs, cmd, data, flag, l); - if (error) + if (error error != EPASSTHROUGH) return error; if (new_mode != sc-sc_mode) {
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: jmcneill Date: Wed Jan 9 01:58:00 UTC 2013 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: aprint_verbose - aprint_debug To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.48 src/sys/dev/wsfb/genfb.c:1.49 --- src/sys/dev/wsfb/genfb.c:1.48 Thu Apr 12 22:36:15 2012 +++ src/sys/dev/wsfb/genfb.c Wed Jan 9 01:57:59 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.48 2012/04/12 22:36:15 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.49 2013/01/09 01:57:59 jmcneill Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.48 2012/04/12 22:36:15 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.49 2013/01/09 01:57:59 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -61,7 +61,7 @@ __KERNEL_RCSID(0, $NetBSD: genfb.c,v 1. #ifdef GENFB_DEBUG #define GPRINTF panic #else -#define GPRINTF aprint_verbose +#define GPRINTF aprint_debug #endif #define GENFB_BRIGHTNESS_STEP 15
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Wed Jan 11 16:13:12 UTC 2012 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: use rasops_init(0, 0) To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.45 src/sys/dev/wsfb/genfb.c:1.46 --- src/sys/dev/wsfb/genfb.c:1.45 Wed Jan 4 20:18:28 2012 +++ src/sys/dev/wsfb/genfb.c Wed Jan 11 16:13:11 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.45 2012/01/04 20:18:28 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.46 2012/01/11 16:13:11 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.45 2012/01/04 20:18:28 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.46 2012/01/11 16:13:11 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -514,7 +514,7 @@ genfb_init_screen(void *cookie, struct v ri-ri_flg |= RI_ENABLE_ALPHA | RI_8BIT_IS_RGB; - rasops_init(ri, sc-sc_height / 8, sc-sc_width / 8); + rasops_init(ri, 0, 0); ri-ri_caps = WSSCREEN_WSCOLORS; rasops_reconfig(ri, sc-sc_height / ri-ri_font-fontheight,
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Wed Jan 4 20:18:29 UTC 2012 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: support anti-aliased fonts in 8 bit, generate an appropriate colour map To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.44 src/sys/dev/wsfb/genfb.c:1.45 --- src/sys/dev/wsfb/genfb.c:1.44 Wed Dec 28 18:37:58 2011 +++ src/sys/dev/wsfb/genfb.c Wed Jan 4 20:18:28 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.44 2011/12/28 18:37:58 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.45 2012/01/04 20:18:28 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.44 2011/12/28 18:37:58 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.45 2012/01/04 20:18:28 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -74,6 +74,7 @@ static int genfb_putcmap(struct genfb_so static int genfb_getcmap(struct genfb_softc *, struct wsdisplay_cmap *); static int genfb_putpalreg(struct genfb_softc *, uint8_t, uint8_t, uint8_t, uint8_t); +static void genfb_init_palette(struct genfb_softc *); static void genfb_brightness_up(device_t); static void genfb_brightness_down(device_t); @@ -196,9 +197,9 @@ genfb_attach(struct genfb_softc *sc, str struct rasops_info *ri; uint16_t crow; long defattr; - int i, j; bool console; #ifdef SPLASHSCREEN + int i, j; int error = ENXIO; #endif @@ -280,14 +281,9 @@ genfb_attach(struct genfb_softc *sc, str if (sc-sc_want_clear) (*ri-ri_ops.eraserows)(ri, 0, ri-ri_rows, defattr); +#ifdef SPLASHSCREEN j = 0; for (i = 0; i min(1 sc-sc_depth, 256); i++) { -#ifndef SPLASHSCREEN - sc-sc_cmap_red[i] = rasops_cmap[j]; - sc-sc_cmap_green[i] = rasops_cmap[j + 1]; - sc-sc_cmap_blue[i] = rasops_cmap[j + 2]; - j += 3; -#else if (i = SPLASH_CMAP_OFFSET i SPLASH_CMAP_OFFSET + SPLASH_CMAP_SIZE) { splash_get_cmap(i, @@ -300,11 +296,9 @@ genfb_attach(struct genfb_softc *sc, str sc-sc_cmap_blue[i] = rasops_cmap[j + 2]; } j += 3; -#endif } genfb_restore_palette(sc); -#ifdef SPLASHSCREEN sc-sc_splash.si_depth = sc-sc_depth; sc-sc_splash.si_bits = sc-sc_console_screen.scr_ri.ri_bits; sc-sc_splash.si_hwbits = sc-sc_fbaddr; @@ -317,10 +311,12 @@ genfb_attach(struct genfb_softc *sc, str SPLASH_F_CENTER|SPLASH_F_FILL); if (error) { SCREEN_ENABLE_DRAWING(sc-sc_console_screen); + genfb_init_palette(sc); vcons_replay_msgbuf(sc-sc_console_screen); } } #else + genfb_init_palette(sc); vcons_replay_msgbuf(sc-sc_console_screen); #endif @@ -406,6 +402,7 @@ genfb_ioctl(void *v, void *vs, u_long cm SPLASH_F_CENTER|SPLASH_F_FILL); } else { SCREEN_ENABLE_DRAWING(sc-sc_console_screen); +genfb_init_palette(sc); } vcons_redraw_screen(ms); return 0; @@ -513,6 +510,10 @@ genfb_init_screen(void *cookie, struct v if (ri-ri_depth == 32) ri-ri_flg |= RI_ENABLE_ALPHA; + if (ri-ri_depth == 8) + ri-ri_flg |= RI_ENABLE_ALPHA | RI_8BIT_IS_RGB; + + rasops_init(ri, sc-sc_height / 8, sc-sc_width / 8); ri-ri_caps = WSSCREEN_WSCOLORS; @@ -605,6 +606,47 @@ genfb_restore_palette(struct genfb_softc } } +static void +genfb_init_palette(struct genfb_softc *sc) +{ + int i, j, tmp; + + if (sc-sc_depth == 8) { + /* generate an r3g3b2 colour map */ + for (i = 0; i 256; i++) { + tmp = i 0xe0; + /* + * replicate bits so 0xe0 maps to a red value of 0xff + * in order to make white look actually white + */ + tmp |= (tmp 3) | (tmp 6); + sc-sc_cmap_red[i] = tmp; + + tmp = (i 0x1c) 3; + tmp |= (tmp 3) | (tmp 6); + sc-sc_cmap_green[i] = tmp; + + tmp = (i 0x03) 6; + tmp |= tmp 2; + tmp |= tmp 4; + sc-sc_cmap_blue[i] = tmp; + + genfb_putpalreg(sc, i, sc-sc_cmap_red[i], + sc-sc_cmap_green[i], + sc-sc_cmap_blue[i]); + } + } else { + /* steal rasops' ANSI cmap */ + j = 0; + for (i = 0; i 256; i++) { + sc-sc_cmap_red[i] = rasops_cmap[j]; + sc-sc_cmap_green[i] = rasops_cmap[j + 1]; + sc-sc_cmap_blue[i] = rasops_cmap[j + 2]; + j += 3; + } + } +} + static int genfb_putpalreg(struct genfb_softc *sc, uint8_t idx, uint8_t r, uint8_t g, uint8_t b)
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Wed Dec 28 18:37:58 UTC 2011 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: if the cursor row passed in a device property doesn't fit on the screen just ignore it and clear the screen To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.43 src/sys/dev/wsfb/genfb.c:1.44 --- src/sys/dev/wsfb/genfb.c:1.43 Thu Dec 22 04:53:43 2011 +++ src/sys/dev/wsfb/genfb.c Wed Dec 28 18:37:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.43 2011/12/22 04:53:43 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.44 2011/12/28 18:37:58 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.43 2011/12/22 04:53:43 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.44 2011/12/28 18:37:58 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -267,6 +267,11 @@ genfb_attach(struct genfb_softc *sc, str sc-sc_defaultscreen_descr.nrows = ri-ri_rows; sc-sc_defaultscreen_descr.ncols = ri-ri_cols; + if (crow = ri-ri_rows) { + crow = 0; + sc-sc_want_clear = 1; + } + if (console) wsdisplay_cnattach(sc-sc_defaultscreen_descr, ri, 0, crow, defattr);
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Thu Dec 22 04:53:43 UTC 2011 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: support anti-aliased fonts in 32bit colour To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.42 src/sys/dev/wsfb/genfb.c:1.43 --- src/sys/dev/wsfb/genfb.c:1.42 Wed Jul 13 22:47:29 2011 +++ src/sys/dev/wsfb/genfb.c Thu Dec 22 04:53:43 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.42 2011/07/13 22:47:29 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.43 2011/12/22 04:53:43 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.42 2011/07/13 22:47:29 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.43 2011/12/22 04:53:43 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -505,6 +505,9 @@ genfb_init_screen(void *cookie, struct v ri-ri_flg |= RI_CLEAR; } + if (ri-ri_depth == 32) + ri-ri_flg |= RI_ENABLE_ALPHA; + rasops_init(ri, sc-sc_height / 8, sc-sc_width / 8); ri-ri_caps = WSSCREEN_WSCOLORS;
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Wed Jul 13 22:47:29 UTC 2011 Modified Files: src/sys/dev/wsfb: genfb.c genfbvar.h Log Message: use callbacks that match the ioctl() interface to control backlight To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/wsfb/genfb.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/wsfb/genfbvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.41 src/sys/dev/wsfb/genfb.c:1.42 --- src/sys/dev/wsfb/genfb.c:1.41 Thu Jun 2 02:33:42 2011 +++ src/sys/dev/wsfb/genfb.c Wed Jul 13 22:47:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.41 2011/06/02 02:33:42 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.42 2011/07/13 22:47:29 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.41 2011/06/02 02:33:42 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.42 2011/07/13 22:47:29 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -64,6 +64,8 @@ #define GPRINTF aprint_verbose #endif +#define GENFB_BRIGHTNESS_STEP 15 + static int genfb_ioctl(void *, void *, u_long, void *, int, struct lwp *); static paddr_t genfb_mmap(void *, void *, off_t, int); static void genfb_init_screen(void *, struct vcons_screen *, int, long *); @@ -75,10 +77,6 @@ static void genfb_brightness_up(device_t); static void genfb_brightness_down(device_t); -/* set backlight level */ -static void genfb_set_backlight(struct genfb_softc *, int); -/* turn backlight on and off without messing with the level */ -static void genfb_switch_backlight(struct genfb_softc *, int); extern const u_char rasops_cmap[768]; @@ -91,7 +89,7 @@ genfb_init(struct genfb_softc *sc) { prop_dictionary_t dict; - uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb, fbaddr; + uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb, br_cb, fbaddr; uint32_t fboffset; bool console; @@ -165,17 +163,24 @@ if (prop_dictionary_get_uint64(dict, backlight_callback, bl_cb)) { if (bl_cb != 0) { sc-sc_backlight = (void *)(vaddr_t)bl_cb; - sc-sc_backlight_on = 1; - aprint_naive_dev(sc-sc_dev, + aprint_naive_dev(sc-sc_dev, enabling backlight control\n); - sc-sc_backlight_level = - sc-sc_backlight-gpc_get_parameter( - sc-sc_backlight-gpc_cookie); - if (console) { -pmf_event_register(sc-sc_dev, + } + } + + /* optional brightness control callback */ + sc-sc_brightness = NULL; + if (prop_dictionary_get_uint64(dict, brightness_callback, br_cb)) { + if (br_cb != 0) { + sc-sc_brightness = (void *)(vaddr_t)br_cb; + aprint_naive_dev(sc-sc_dev, + enabling brightness control\n); + if (console + sc-sc_brightness-gpc_upd_parameter != NULL) { +pmf_event_register(sc-sc_dev, PMFE_DISPLAY_BRIGHTNESS_UP, genfb_brightness_up, TRUE); -pmf_event_register(sc-sc_dev, +pmf_event_register(sc-sc_dev, PMFE_DISPLAY_BRIGHTNESS_DOWN, genfb_brightness_down, TRUE); } @@ -206,8 +211,8 @@ == false) sc-sc_want_clear = true; - aprint_verbose_dev(sc-sc_dev, framebuffer at %p, size %dx%d, - depth %d, stride %d\n, + aprint_verbose_dev(sc-sc_dev, framebuffer at %p, size %dx%d, depth %d, + stride %d\n, sc-sc_fboffset ? (void *)(intptr_t)sc-sc_fboffset : sc-sc_fbaddr, sc-sc_width, sc-sc_height, sc-sc_depth, sc-sc_stride); @@ -341,7 +346,7 @@ struct wsdisplay_fbinfo *wdf; struct vcons_screen *ms = vd-active; struct wsdisplay_param *param; - int new_mode, error; + int new_mode, error, val; switch (cmd) { case WSDISPLAYIO_GINFO: @@ -404,35 +409,51 @@ #endif case WSDISPLAYIO_GETPARAM: param = (struct wsdisplay_param *)data; - if (sc-sc_backlight == NULL) -return EPASSTHROUGH; switch (param-param) { case WSDISPLAYIO_PARAM_BRIGHTNESS: +if (sc-sc_brightness == NULL) + return EPASSTHROUGH; param-min = 0; param-max = 255; -param-curval = sc-sc_backlight_level; -return 0; +return sc-sc_brightness-gpc_get_parameter( +sc-sc_brightness-gpc_cookie, +param-curval); case WSDISPLAYIO_PARAM_BACKLIGHT: +if (sc-sc_backlight == NULL) + return EPASSTHROUGH; param-min = 0; param-max = 1; -param-curval = sc-sc_backlight_on; -return 0; +return sc-sc_backlight-gpc_get_parameter( +sc-sc_backlight-gpc_cookie, +param-curval); } return EPASSTHROUGH; case WSDISPLAYIO_SETPARAM: param = (struct wsdisplay_param *)data; - if (sc-sc_backlight == NULL) -return EPASSTHROUGH; switch (param-param) { case WSDISPLAYIO_PARAM_BRIGHTNESS: -genfb_set_backlight(sc, param-curval); -return 0; +if (sc-sc_brightness == NULL) + return EPASSTHROUGH; +val = param-curval; +if (val 0) val = 0; +if (val 255) val =
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Thu Jun 2 02:33:42 UTC 2011 Modified Files: src/sys/dev/wsfb: genfb.c genfbvar.h Log Message: some steps to make multiple instances work: - don't bail if we're not the console. If we get the right paramters there is no reason not to work - move wsdisplay_accessops into the softc - call wsdisplay_cnattach only if we're the console To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/dev/wsfb/genfb.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/wsfb/genfbvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.40 src/sys/dev/wsfb/genfb.c:1.41 --- src/sys/dev/wsfb/genfb.c:1.40 Tue Mar 8 04:47:10 2011 +++ src/sys/dev/wsfb/genfb.c Thu Jun 2 02:33:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.40 2011/03/08 04:47:10 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.41 2011/06/02 02:33:42 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.40 2011/03/08 04:47:10 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.41 2011/06/02 02:33:42 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -85,17 +85,6 @@ static int genfb_cnattach_called = 0; static int genfb_enabled = 1; -struct wsdisplay_accessops genfb_accessops = { - genfb_ioctl, - genfb_mmap, - NULL, /* alloc_screen */ - NULL, /* free_screen */ - NULL, /* show_screen */ - NULL, /* load_font */ - NULL, /* pollc */ - NULL /* scroll */ -}; - static struct genfb_softc *genfb_softc = NULL; void @@ -217,14 +206,8 @@ == false) sc-sc_want_clear = true; - /* do not attach when we're not console */ - if (!console) { - aprint_normal_dev(sc-sc_dev, no console, unable to continue\n); - return -1; - } - - aprint_verbose_dev(sc-sc_dev, framebuffer at %p, size %dx%d, depth %d, - stride %d\n, + aprint_verbose_dev(sc-sc_dev, framebuffer at %p, size %dx%d, + depth %d, stride %d\n, sc-sc_fboffset ? (void *)(intptr_t)sc-sc_fboffset : sc-sc_fbaddr, sc-sc_width, sc-sc_height, sc-sc_depth, sc-sc_stride); @@ -243,6 +226,9 @@ if (sc-sc_modecb != NULL) sc-sc_modecb-gmc_setmode(sc, sc-sc_mode); + sc-sc_accessops.ioctl = genfb_ioctl; + sc-sc_accessops.mmap = genfb_mmap; + #ifdef GENFB_SHADOWFB sc-sc_shadowfb = kmem_alloc(sc-sc_fbsize, KM_SLEEP); if (sc-sc_want_clear == false sc-sc_shadowfb != NULL) @@ -250,7 +236,7 @@ #endif vcons_init(sc-vd, sc, sc-sc_defaultscreen_descr, - genfb_accessops); + sc-sc_accessops); sc-vd.init_screen = genfb_init_screen; /* Do not print anything between this point and the screen @@ -275,8 +261,10 @@ sc-sc_defaultscreen_descr.capabilities = ri-ri_caps; sc-sc_defaultscreen_descr.nrows = ri-ri_rows; sc-sc_defaultscreen_descr.ncols = ri-ri_cols; - wsdisplay_cnattach(sc-sc_defaultscreen_descr, ri, 0, crow, - defattr); + + if (console) + wsdisplay_cnattach(sc-sc_defaultscreen_descr, ri, 0, crow, + defattr); /* Clear the whole screen to bring it to a known state. */ if (sc-sc_want_clear) @@ -331,7 +319,7 @@ aa.console = console; aa.scrdata = sc-sc_screenlist; - aa.accessops = genfb_accessops; + aa.accessops = sc-sc_accessops; aa.accesscookie = sc-vd; #ifdef GENFB_DISABLE_TEXT Index: src/sys/dev/wsfb/genfbvar.h diff -u src/sys/dev/wsfb/genfbvar.h:1.19 src/sys/dev/wsfb/genfbvar.h:1.20 --- src/sys/dev/wsfb/genfbvar.h:1.19 Wed Feb 9 13:19:19 2011 +++ src/sys/dev/wsfb/genfbvar.h Thu Jun 2 02:33:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfbvar.h,v 1.19 2011/02/09 13:19:19 jmcneill Exp $ */ +/* $NetBSD: genfbvar.h,v 1.20 2011/06/02 02:33:42 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfbvar.h,v 1.19 2011/02/09 13:19:19 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: genfbvar.h,v 1.20 2011/06/02 02:33:42 macallan Exp $); #ifndef GENFBVAR_H #define GENFBVAR_H @@ -109,6 +109,7 @@ #ifdef SPLASHSCREEN struct splash_info sc_splash; #endif + struct wsdisplay_accessops sc_accessops; }; void genfb_cnattach(void);
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Tue Mar 8 03:16:31 UTC 2011 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: look for a 'virtual_address' property and use it as fb address To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.38 src/sys/dev/wsfb/genfb.c:1.39 --- src/sys/dev/wsfb/genfb.c:1.38 Tue Feb 22 01:26:14 2011 +++ src/sys/dev/wsfb/genfb.c Tue Mar 8 03:16:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.38 2011/02/22 01:26:14 jmcneill Exp $ */ +/* $NetBSD: genfb.c,v 1.39 2011/03/08 03:16:30 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.38 2011/02/22 01:26:14 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.39 2011/03/08 03:16:30 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -102,7 +102,7 @@ genfb_init(struct genfb_softc *sc) { prop_dictionary_t dict; - uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb; + uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb, fbaddr; uint32_t fboffset; bool console; @@ -133,6 +133,11 @@ sc-sc_fboffset = fboffset; + sc-sc_fbaddr = NULL; + if (prop_dictionary_get_uint64(dict, virtual_address, fbaddr)) { + sc-sc_fbaddr = (void *)fbaddr; + } + if (!prop_dictionary_get_uint32(dict, linebytes, sc-sc_stride)) sc-sc_stride = (sc-sc_width * sc-sc_depth) 3;
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Tue Mar 8 04:47:10 UTC 2011 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: fix build for LP32 thanks to uebayasi@ To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.39 src/sys/dev/wsfb/genfb.c:1.40 --- src/sys/dev/wsfb/genfb.c:1.39 Tue Mar 8 03:16:30 2011 +++ src/sys/dev/wsfb/genfb.c Tue Mar 8 04:47:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.39 2011/03/08 03:16:30 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.40 2011/03/08 04:47:10 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.39 2011/03/08 03:16:30 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.40 2011/03/08 04:47:10 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -135,7 +135,7 @@ sc-sc_fbaddr = NULL; if (prop_dictionary_get_uint64(dict, virtual_address, fbaddr)) { - sc-sc_fbaddr = (void *)fbaddr; + sc-sc_fbaddr = (void *)(uintptr_t)fbaddr; } if (!prop_dictionary_get_uint32(dict, linebytes, sc-sc_stride))
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: jmcneill Date: Tue Feb 22 01:26:14 UTC 2011 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: genfb_enable/disable_polling only matters if genfb is the console screen, so make it a noop if it's not To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.37 src/sys/dev/wsfb/genfb.c:1.38 --- src/sys/dev/wsfb/genfb.c:1.37 Fri Feb 18 13:56:58 2011 +++ src/sys/dev/wsfb/genfb.c Tue Feb 22 01:26:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.37 2011/02/18 13:56:58 jmcneill Exp $ */ +/* $NetBSD: genfb.c,v 1.38 2011/02/22 01:26:14 jmcneill Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.37 2011/02/18 13:56:58 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.38 2011/02/22 01:26:14 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -691,9 +691,11 @@ { struct genfb_softc *sc = device_private(dev); - SCREEN_ENABLE_DRAWING(sc-sc_console_screen); - vcons_hard_switch(sc-sc_console_screen); - vcons_enable_polling(sc-vd); + if (sc-sc_console_screen.scr_vd) { + SCREEN_ENABLE_DRAWING(sc-sc_console_screen); + vcons_hard_switch(sc-sc_console_screen); + vcons_enable_polling(sc-vd); + } } void @@ -701,5 +703,7 @@ { struct genfb_softc *sc = device_private(dev); - vcons_disable_polling(sc-vd); + if (sc-sc_console_screen.scr_vd) { + vcons_disable_polling(sc-vd); + } }
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: jmcneill Date: Fri Feb 18 13:56:59 UTC 2011 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: call vcons_hard_switch to switch to the console screen when entering polling mode, makes ddb-from-X work with genfb on x86 To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.36 src/sys/dev/wsfb/genfb.c:1.37 --- src/sys/dev/wsfb/genfb.c:1.36 Sat Feb 12 17:15:27 2011 +++ src/sys/dev/wsfb/genfb.c Fri Feb 18 13:56:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.36 2011/02/12 17:15:27 phx Exp $ */ +/* $NetBSD: genfb.c,v 1.37 2011/02/18 13:56:58 jmcneill Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.36 2011/02/12 17:15:27 phx Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.37 2011/02/18 13:56:58 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -692,6 +692,7 @@ struct genfb_softc *sc = device_private(dev); SCREEN_ENABLE_DRAWING(sc-sc_console_screen); + vcons_hard_switch(sc-sc_console_screen); vcons_enable_polling(sc-vd); }
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: phx Date: Sat Feb 12 17:15:27 UTC 2011 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: Fixed NULL-pointer dereferencing when a mode-callback is not defined. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.35 src/sys/dev/wsfb/genfb.c:1.36 --- src/sys/dev/wsfb/genfb.c:1.35 Wed Feb 9 13:19:19 2011 +++ src/sys/dev/wsfb/genfb.c Sat Feb 12 17:15:27 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.35 2011/02/09 13:19:19 jmcneill Exp $ */ +/* $NetBSD: genfb.c,v 1.36 2011/02/12 17:15:27 phx Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.35 2011/02/09 13:19:19 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.36 2011/02/12 17:15:27 phx Exp $); #include sys/param.h #include sys/systm.h @@ -235,7 +235,7 @@ sc-sc_screenlist = (struct wsscreen_list){1, sc-sc_screens}; memcpy(sc-sc_ops, ops, sizeof(struct genfb_ops)); sc-sc_mode = WSDISPLAYIO_MODE_EMUL; - if (sc-sc_modecb-gmc_setmode) + if (sc-sc_modecb != NULL) sc-sc_modecb-gmc_setmode(sc, sc-sc_mode); #ifdef GENFB_SHADOWFB @@ -386,7 +386,7 @@ if (new_mode != sc-sc_mode) { sc-sc_mode = new_mode; -if (sc-sc_modecb-gmc_setmode) +if (sc-sc_modecb != NULL) sc-sc_modecb-gmc_setmode(sc, sc-sc_mode); if (new_mode == WSDISPLAYIO_MODE_EMUL) {
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Wed Oct 6 02:24:36 UTC 2010 Modified Files: src/sys/dev/wsfb: genfb.c genfbvar.h Log Message: add support for backlight control via machine dependent callbacks To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/wsfb/genfb.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/wsfb/genfbvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.30 src/sys/dev/wsfb/genfb.c:1.31 --- src/sys/dev/wsfb/genfb.c:1.30 Tue Aug 31 02:49:17 2010 +++ src/sys/dev/wsfb/genfb.c Wed Oct 6 02:24:35 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.30 2010/08/31 02:49:17 macallan Exp $ */ +/* $NetBSD: genfb.c,v 1.31 2010/10/06 02:24:35 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.30 2010/08/31 02:49:17 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.31 2010/10/06 02:24:35 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -73,6 +73,13 @@ static int genfb_putpalreg(struct genfb_softc *, uint8_t, uint8_t, uint8_t, uint8_t); +static void genfb_brightness_up(device_t); +static void genfb_brightness_down(device_t); +/* set backlight level */ +static void genfb_set_backlight(struct genfb_softc *, int); +/* turn backlight on and off without messing with the level */ +static void genfb_switch_backlight(struct genfb_softc *, int); + extern const u_char rasops_cmap[768]; static int genfb_cnattach_called = 0; @@ -95,13 +102,16 @@ genfb_init(struct genfb_softc *sc) { prop_dictionary_t dict; - uint64_t cmap_cb, pmf_cb; + uint64_t cmap_cb, pmf_cb, bl_cb; uint32_t fboffset; + bool console; dict = device_properties(sc-sc_dev); #ifdef GENFB_DEBUG printf(prop_dictionary_externalize(dict)); #endif + prop_dictionary_get_bool(dict, is_console, console); + if (!prop_dictionary_get_uint32(dict, width, sc-sc_width)) { GPRINTF(no width property\n); return; @@ -141,12 +151,35 @@ if (cmap_cb != 0) sc-sc_cmcb = (void *)(vaddr_t)cmap_cb; } + /* optional pmf callback */ sc-sc_pmfcb = NULL; if (prop_dictionary_get_uint64(dict, pmf_callback, pmf_cb)) { if (pmf_cb != 0) sc-sc_pmfcb = (void *)(vaddr_t)pmf_cb; } + + /* optional backlight control callback */ + sc-sc_backlight = NULL; + if (prop_dictionary_get_uint64(dict, backlight_callback, bl_cb)) { + if (bl_cb != 0) { + sc-sc_backlight = (void *)(vaddr_t)bl_cb; + sc-sc_backlight_on = 1; + aprint_naive_dev(sc-sc_dev, + enabling backlight control\n); + sc-sc_backlight_level = + sc-sc_backlight-gpc_get_parameter( + sc-sc_backlight-gpc_cookie); + if (console) { +pmf_event_register(sc-sc_dev, +PMFE_DISPLAY_BRIGHTNESS_UP, +genfb_brightness_up, TRUE); +pmf_event_register(sc-sc_dev, +PMFE_DISPLAY_BRIGHTNESS_DOWN, +genfb_brightness_down, TRUE); + } + } + } } int @@ -308,6 +341,7 @@ struct genfb_softc *sc = vd-cookie; struct wsdisplay_fbinfo *wdf; struct vcons_screen *ms = vd-active; + struct wsdisplay_param *param; int new_mode, error; switch (cmd) { @@ -382,6 +416,37 @@ #else return ENODEV; #endif + case WSDISPLAYIO_GETPARAM: + param = (struct wsdisplay_param *)data; + if (sc-sc_backlight == NULL) +return EPASSTHROUGH; + switch (param-param) { + case WSDISPLAYIO_PARAM_BRIGHTNESS: +param-min = 0; +param-max = 255; +param-curval = sc-sc_backlight_level; +return 0; + case WSDISPLAYIO_PARAM_BACKLIGHT: +param-min = 0; +param-max = 1; +param-curval = sc-sc_backlight_on; +return 0; + } + return EPASSTHROUGH; + + case WSDISPLAYIO_SETPARAM: + param = (struct wsdisplay_param *)data; + if (sc-sc_backlight == NULL) +return EPASSTHROUGH; + switch (param-param) { + case WSDISPLAYIO_PARAM_BRIGHTNESS: +genfb_set_backlight(sc, param-curval); +return 0; + case WSDISPLAYIO_PARAM_BACKLIGHT: +genfb_switch_backlight(sc, param-curval); +return 0; + } + return EPASSTHROUGH; default: if (sc-sc_ops.genfb_ioctl) return sc-sc_ops.genfb_ioctl(sc, vs, cmd, @@ -571,3 +636,59 @@ return sc-sc_ops.genfb_borrow(sc, addr, hdlp); return 0; } + +static void +genfb_set_backlight(struct genfb_softc *sc, int level) +{ + + KASSERT(sc-sc_backlight != NULL); + + /* + * should we do nothing when backlight is off, should we just store the + * level and use it when turning back on or should we just flip sc_bl_on + * and turn the backlight on? + * For now turn it on so a crashed screensaver can't get the user stuck + * with a dark screen as long as hotkeys work + */ + if (level 255) level = 255; + if (level 0) level = 0; + if (level == sc-sc_backlight_level) + return; + sc-sc_backlight_level = level; + if (sc-sc_backlight_on == 0) +
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Tue Aug 31 02:49:17 UTC 2010 Modified Files: src/sys/dev/wsfb: files.wsfb genfb.c genfbvar.h Log Message: make use of a shadow framebuffer optional, use VCONS_DONT_READ by default To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/wsfb/files.wsfb cvs rdiff -u -r1.29 -r1.30 src/sys/dev/wsfb/genfb.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/wsfb/genfbvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/files.wsfb diff -u src/sys/dev/wsfb/files.wsfb:1.6 src/sys/dev/wsfb/files.wsfb:1.7 --- src/sys/dev/wsfb/files.wsfb:1.6 Thu Aug 6 16:26:51 2009 +++ src/sys/dev/wsfb/files.wsfb Tue Aug 31 02:49:17 2010 @@ -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_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 Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.29 src/sys/dev/wsfb/genfb.c:1.30 --- src/sys/dev/wsfb/genfb.c:1.29 Mon Feb 22 05:55:10 2010 +++ src/sys/dev/wsfb/genfb.c Tue Aug 31 02:49:17 2010 @@ -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 @@ 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 @@ 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; Index: src/sys/dev/wsfb/genfbvar.h diff -u src/sys/dev/wsfb/genfbvar.h:1.14 src/sys/dev/wsfb/genfbvar.h:1.15 --- src/sys/dev/wsfb/genfbvar.h:1.14 Wed Feb 24 22:38:09 2010 +++ src/sys/dev/wsfb/genfbvar.h Tue Aug 31 02:49:17 2010 @@ -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 @@ #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_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;
CVS commit: src/sys/dev/wsfb
Module Name:src Committed By: macallan Date: Thu Aug 20 02:51:27 UTC 2009 Modified Files: src/sys/dev/wsfb: genfb.c Log Message: call vcons_replay_msgbuf() To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/wsfb/genfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wsfb/genfb.c diff -u src/sys/dev/wsfb/genfb.c:1.26 src/sys/dev/wsfb/genfb.c:1.27 --- src/sys/dev/wsfb/genfb.c:1.26 Sat Feb 21 17:24:47 2009 +++ src/sys/dev/wsfb/genfb.c Thu Aug 20 02:51:27 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb.c,v 1.26 2009/02/21 17:24:47 christos Exp $ */ +/* $NetBSD: genfb.c,v 1.27 2009/08/20 02:51:27 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.26 2009/02/21 17:24:47 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.27 2009/08/20 02:51:27 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -211,7 +211,7 @@ (*ri-ri_ops.eraserows)(ri, 0, ri-ri_rows, defattr); j = 0; - for (i = 0; i (1 sc-sc_depth); i++) { + for (i = 0; i min(1 sc-sc_depth, 256); i++) { sc-sc_cmap_red[i] = rasops_cmap[j]; sc-sc_cmap_green[i] = rasops_cmap[j + 1]; @@ -221,6 +221,8 @@ j += 3; } + vcons_replay_msgbuf(sc-sc_console_screen); + if (genfb_softc == NULL) genfb_softc = sc; @@ -338,6 +340,7 @@ rasops_reconfig(ri, sc-sc_height / ri-ri_font-fontheight, sc-sc_width / ri-ri_font-fontwidth); + /* TODO: actually center output */ ri-ri_hw = scr; } @@ -410,9 +413,11 @@ { int i; - for (i = 0; i (1 sc-sc_depth); i++) { - genfb_putpalreg(sc, i, sc-sc_cmap_red[i], - sc-sc_cmap_green[i], sc-sc_cmap_blue[i]); + if (sc-sc_depth = 8) { + for (i = 0; i (1 sc-sc_depth); i++) { + genfb_putpalreg(sc, i, sc-sc_cmap_red[i], + sc-sc_cmap_green[i], sc-sc_cmap_blue[i]); + } } }