2 * linux/drivers/video/console/tileblit.c -- Tile Blitting Operation
4 * Copyright (C) 2004 Antonino Daplas <adaplas @pol.net>
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
11 #include <linux/config.h>
12 #include <linux/module.h>
13 #include <linux/string.h>
15 #include <linux/vt_kern.h>
16 #include <linux/console.h>
17 #include <asm/types.h>
20 static void tile_bmove(struct vc_data *vc, struct fb_info *info, int sy,
21 int sx, int dy, int dx, int height, int width)
23 struct fb_tilearea area;
32 info->tileops->fb_tilecopy(info, &area);
35 static void tile_clear(struct vc_data *vc, struct fb_info *info, int sy,
36 int sx, int height, int width)
38 struct fb_tilerect rect;
39 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
40 int fgshift = (vc->vc_hi_font_mask) ? 9 : 8;
42 rect.index = vc->vc_video_erase_char &
43 ((vc->vc_hi_font_mask) ? 0x1ff : 0xff);
44 rect.fg = attr_fgcol_ec(fgshift, vc);
45 rect.bg = attr_bgcol_ec(bgshift, vc);
52 info->tileops->fb_tilefill(info, &rect);
55 static void tile_putcs(struct vc_data *vc, struct fb_info *info,
56 const unsigned short *s, int count, int yy, int xx,
59 struct fb_tileblit blit;
60 unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
61 int size = sizeof(u32) * count, i;
70 blit.indices = (u32 *) fb_get_buffer_offset(info, &info->pixmap, size);
71 for (i = 0; i < count; i++)
72 blit.indices[i] = (u32)(scr_readw(s++) & charmask);
74 info->tileops->fb_tileblit(info, &blit);
77 static void tile_clear_margins(struct vc_data *vc, struct fb_info *info,
83 static void tile_cursor(struct vc_data *vc, struct fb_info *info,
84 struct display *p, int mode, int softback_lines,
87 struct fb_tilecursor cursor;
88 int use_sw = (vc->vc_cursor_type & 0x01);
92 cursor.mode = (mode == CM_ERASE || use_sw) ? 0 : 1;
96 switch (vc->vc_cursor_type & 0x0f) {
98 cursor.shape = FB_TILE_CURSOR_NONE;
101 cursor.shape = FB_TILE_CURSOR_UNDERLINE;
103 case CUR_LOWER_THIRD:
104 cursor.shape = FB_TILE_CURSOR_LOWER_THIRD;
107 cursor.shape = FB_TILE_CURSOR_LOWER_HALF;
110 cursor.shape = FB_TILE_CURSOR_TWO_THIRDS;
114 cursor.shape = FB_TILE_CURSOR_BLOCK;
118 info->tileops->fb_tilecursor(info, &cursor);
121 static int tile_update_start(struct fb_info *info)
123 struct fbcon_ops *ops = info->fbcon_par;
126 err = fb_pan_display(info, &ops->var);
127 ops->var.xoffset = info->var.xoffset;
128 ops->var.yoffset = info->var.yoffset;
129 ops->var.vmode = info->var.vmode;
133 void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info,
134 struct display *p, struct fbcon_ops *ops)
136 struct fb_tilemap map;
138 ops->bmove = tile_bmove;
139 ops->clear = tile_clear;
140 ops->putcs = tile_putcs;
141 ops->clear_margins = tile_clear_margins;
142 ops->cursor = tile_cursor;
143 ops->update_start = tile_update_start;
146 map.width = vc->vc_font.width;
147 map.height = vc->vc_font.height;
149 map.length = (p->userfont) ?
150 FNTCHARCNT(p->fontdata) : 256;
151 map.data = p->fontdata;
152 info->tileops->fb_settile(info, &map);
156 EXPORT_SYMBOL(fbcon_set_tileops);
158 MODULE_AUTHOR("Antonino Daplas <adaplas@pol.net>");
159 MODULE_DESCRIPTION("Tile Blitting Operation");
160 MODULE_LICENSE("GPL");