vt_fb.c (257013) | vt_fb.c (257725) |
---|---|
1/*- 2 * Copyright (c) 2013 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Aleksandr Rybalko under sponsorship from the 6 * FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2013 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Aleksandr Rybalko under sponsorship from the 6 * FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c 257013 2013-10-23 19:45:14Z ray $ | 29 * $FreeBSD: user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c 257725 2013-11-05 23:01:57Z ray $ |
30 */ 31 32#include <sys/cdefs.h> | 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c 257013 2013-10-23 19:45:14Z ray $"); | 33__FBSDID("$FreeBSD: user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c 257725 2013-11-05 23:01:57Z ray $"); |
34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/malloc.h> 38#include <sys/queue.h> 39#include <sys/fbio.h> 40#include <dev/vt/vt.h> 41#include <dev/vt/hw/fb/vt_fb.h> 42#include <dev/vt/colors/vt_termcolors.h> 43 | 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/malloc.h> 38#include <sys/queue.h> 39#include <sys/fbio.h> 40#include <dev/vt/vt.h> 41#include <dev/vt/hw/fb/vt_fb.h> 42#include <dev/vt/colors/vt_termcolors.h> 43 |
44static vd_init_t vt_fb_init; 45static vd_blank_t vt_fb_blank; 46static vd_bitbltchr_t vt_fb_bitbltchr; 47static vd_postswitch_t vt_fb_postswitch; 48 | |
49static struct vt_driver vt_fb_driver = { 50 .vd_init = vt_fb_init, 51 .vd_blank = vt_fb_blank, 52 .vd_bitbltchr = vt_fb_bitbltchr, 53 .vd_postswitch = vt_fb_postswitch, 54 .vd_priority = VD_PRIORITY_GENERIC+10, 55}; 56 | 44static struct vt_driver vt_fb_driver = { 45 .vd_init = vt_fb_init, 46 .vd_blank = vt_fb_blank, 47 .vd_bitbltchr = vt_fb_bitbltchr, 48 .vd_postswitch = vt_fb_postswitch, 49 .vd_priority = VD_PRIORITY_GENERIC+10, 50}; 51 |
57static void | 52void |
58vt_fb_blank(struct vt_device *vd, term_color_t color) 59{ 60 struct fb_info *info; 61 uint32_t c; 62 u_int o; 63 64 info = vd->vd_softc; 65 c = info->fb_cmap[color]; | 53vt_fb_blank(struct vt_device *vd, term_color_t color) 54{ 55 struct fb_info *info; 56 uint32_t c; 57 u_int o; 58 59 info = vd->vd_softc; 60 c = info->fb_cmap[color]; |
61 |
|
66 switch (FBTYPE_GET_BYTESPP(info)) { 67 case 1: 68 for (o = 0; o < info->fb_stride; o++) 69 info->wr1(info, o, c); 70 break; 71 case 2: 72 for (o = 0; o < info->fb_stride; o += 2) 73 info->wr2(info, o, c); --- 16 unchanged lines hidden (view full) --- 90 } 91 /* Copy line0 to all other lines. */ 92 /* XXX will copy with borders. */ 93 for (o = info->fb_stride; o < info->fb_size; o += info->fb_stride) { 94 info->copy(info, o, 0, info->fb_stride); 95 } 96} 97 | 62 switch (FBTYPE_GET_BYTESPP(info)) { 63 case 1: 64 for (o = 0; o < info->fb_stride; o++) 65 info->wr1(info, o, c); 66 break; 67 case 2: 68 for (o = 0; o < info->fb_stride; o += 2) 69 info->wr2(info, o, c); --- 16 unchanged lines hidden (view full) --- 86 } 87 /* Copy line0 to all other lines. */ 88 /* XXX will copy with borders. */ 89 for (o = info->fb_stride; o < info->fb_size; o += info->fb_stride) { 90 info->copy(info, o, 0, info->fb_stride); 91 } 92} 93 |
98static void | 94void |
99vt_fb_bitbltchr(struct vt_device *vd, const uint8_t *src, 100 vt_axis_t top, vt_axis_t left, unsigned int width, unsigned int height, 101 term_color_t fg, term_color_t bg) 102{ 103 struct fb_info *info; 104 uint32_t fgc, bgc, cc, o; 105 int c, l, bpp; 106 u_long line; --- 35 unchanged lines hidden (view full) --- 142 /* panic? */ 143 break; 144 } 145 } 146 line += info->fb_stride; 147 } 148} 149 | 95vt_fb_bitbltchr(struct vt_device *vd, const uint8_t *src, 96 vt_axis_t top, vt_axis_t left, unsigned int width, unsigned int height, 97 term_color_t fg, term_color_t bg) 98{ 99 struct fb_info *info; 100 uint32_t fgc, bgc, cc, o; 101 int c, l, bpp; 102 u_long line; --- 35 unchanged lines hidden (view full) --- 138 /* panic? */ 139 break; 140 } 141 } 142 line += info->fb_stride; 143 } 144} 145 |
150static void | 146void |
151vt_fb_postswitch(struct vt_device *vd) 152{ 153 struct fb_info *info; 154 155 info = vd->vd_softc; 156 157 if (info->enter != NULL) 158 info->enter(info->fb_priv); --- 17 unchanged lines hidden (view full) --- 176 case 32: /* Ignore alpha. */ 177 return (vt_generate_vga_palette(cmap, COLOR_FORMAT_RGB, 178 0xff, 0, 0xff, 8, 0xff, 16)); 179 default: 180 return (1); 181 } 182} 183 | 147vt_fb_postswitch(struct vt_device *vd) 148{ 149 struct fb_info *info; 150 151 info = vd->vd_softc; 152 153 if (info->enter != NULL) 154 info->enter(info->fb_priv); --- 17 unchanged lines hidden (view full) --- 172 case 32: /* Ignore alpha. */ 173 return (vt_generate_vga_palette(cmap, COLOR_FORMAT_RGB, 174 0xff, 0, 0xff, 8, 0xff, 16)); 175 default: 176 return (1); 177 } 178} 179 |
184static int | 180int |
185vt_fb_init(struct vt_device *vd) 186{ 187 struct fb_info *info; 188 int err; 189 190 info = vd->vd_softc; 191 vd->vd_height = info->fb_height; 192 vd->vd_width = info->fb_width; --- 14 unchanged lines hidden (view full) --- 207 return (CN_INTERNAL); 208} 209 210int 211vt_fb_attach(struct fb_info *info) 212{ 213 214 vt_allocate(&vt_fb_driver, info); | 181vt_fb_init(struct vt_device *vd) 182{ 183 struct fb_info *info; 184 int err; 185 186 info = vd->vd_softc; 187 vd->vd_height = info->fb_height; 188 vd->vd_width = info->fb_width; --- 14 unchanged lines hidden (view full) --- 203 return (CN_INTERNAL); 204} 205 206int 207vt_fb_attach(struct fb_info *info) 208{ 209 210 vt_allocate(&vt_fb_driver, info); |
211 |
|
215 return (0); 216} | 212 return (0); 213} |