diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/video/console/tileblit.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/video/console/tileblit.c')
-rw-r--r-- | drivers/video/console/tileblit.c | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/drivers/video/console/tileblit.c b/drivers/video/console/tileblit.c new file mode 100644 index 000000000000..7f76e2c6a4a1 --- /dev/null +++ b/drivers/video/console/tileblit.c | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * linux/drivers/video/console/tileblit.c -- Tile Blitting Operation | ||
3 | * | ||
4 | * Copyright (C) 2004 Antonino Daplas <adaplas @pol.net> | ||
5 | * | ||
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 | ||
8 | * more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/string.h> | ||
14 | #include <linux/fb.h> | ||
15 | #include <linux/vt_kern.h> | ||
16 | #include <linux/console.h> | ||
17 | #include <asm/types.h> | ||
18 | #include "fbcon.h" | ||
19 | |||
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) | ||
22 | { | ||
23 | struct fb_tilearea area; | ||
24 | |||
25 | area.sx = sx; | ||
26 | area.sy = sy; | ||
27 | area.dx = dx; | ||
28 | area.dy = dy; | ||
29 | area.height = height; | ||
30 | area.width = width; | ||
31 | |||
32 | info->tileops->fb_tilecopy(info, &area); | ||
33 | } | ||
34 | |||
35 | static void tile_clear(struct vc_data *vc, struct fb_info *info, int sy, | ||
36 | int sx, int height, int width) | ||
37 | { | ||
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; | ||
41 | |||
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); | ||
46 | rect.sx = sx; | ||
47 | rect.sy = sy; | ||
48 | rect.width = width; | ||
49 | rect.height = height; | ||
50 | rect.rop = ROP_COPY; | ||
51 | |||
52 | info->tileops->fb_tilefill(info, &rect); | ||
53 | } | ||
54 | |||
55 | static void tile_putcs(struct vc_data *vc, struct fb_info *info, | ||
56 | const unsigned short *s, int count, int yy, int xx, | ||
57 | int fg, int bg) | ||
58 | { | ||
59 | struct fb_tileblit blit; | ||
60 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; | ||
61 | int size = sizeof(u32) * count, i; | ||
62 | |||
63 | blit.sx = xx; | ||
64 | blit.sy = yy; | ||
65 | blit.width = count; | ||
66 | blit.height = 1; | ||
67 | blit.fg = fg; | ||
68 | blit.bg = bg; | ||
69 | blit.length = count; | ||
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); | ||
73 | |||
74 | info->tileops->fb_tileblit(info, &blit); | ||
75 | } | ||
76 | |||
77 | static void tile_clear_margins(struct vc_data *vc, struct fb_info *info, | ||
78 | int bottom_only) | ||
79 | { | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | static void tile_cursor(struct vc_data *vc, struct fb_info *info, | ||
84 | struct display *p, int mode, int softback_lines, | ||
85 | int fg, int bg) | ||
86 | { | ||
87 | struct fb_tilecursor cursor; | ||
88 | int use_sw = (vc->vc_cursor_type & 0x01); | ||
89 | |||
90 | cursor.sx = vc->vc_x; | ||
91 | cursor.sy = vc->vc_y; | ||
92 | cursor.mode = (mode == CM_ERASE || use_sw) ? 0 : 1; | ||
93 | cursor.fg = fg; | ||
94 | cursor.bg = bg; | ||
95 | |||
96 | switch (vc->vc_cursor_type & 0x0f) { | ||
97 | case CUR_NONE: | ||
98 | cursor.shape = FB_TILE_CURSOR_NONE; | ||
99 | break; | ||
100 | case CUR_UNDERLINE: | ||
101 | cursor.shape = FB_TILE_CURSOR_UNDERLINE; | ||
102 | break; | ||
103 | case CUR_LOWER_THIRD: | ||
104 | cursor.shape = FB_TILE_CURSOR_LOWER_THIRD; | ||
105 | break; | ||
106 | case CUR_LOWER_HALF: | ||
107 | cursor.shape = FB_TILE_CURSOR_LOWER_HALF; | ||
108 | break; | ||
109 | case CUR_TWO_THIRDS: | ||
110 | cursor.shape = FB_TILE_CURSOR_TWO_THIRDS; | ||
111 | break; | ||
112 | case CUR_BLOCK: | ||
113 | default: | ||
114 | cursor.shape = FB_TILE_CURSOR_BLOCK; | ||
115 | break; | ||
116 | } | ||
117 | |||
118 | info->tileops->fb_tilecursor(info, &cursor); | ||
119 | } | ||
120 | |||
121 | void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info, | ||
122 | struct display *p, struct fbcon_ops *ops) | ||
123 | { | ||
124 | struct fb_tilemap map; | ||
125 | |||
126 | ops->bmove = tile_bmove; | ||
127 | ops->clear = tile_clear; | ||
128 | ops->putcs = tile_putcs; | ||
129 | ops->clear_margins = tile_clear_margins; | ||
130 | ops->cursor = tile_cursor; | ||
131 | |||
132 | if (p) { | ||
133 | map.width = vc->vc_font.width; | ||
134 | map.height = vc->vc_font.height; | ||
135 | map.depth = 1; | ||
136 | map.length = (p->userfont) ? | ||
137 | FNTCHARCNT(p->fontdata) : 256; | ||
138 | map.data = p->fontdata; | ||
139 | info->tileops->fb_settile(info, &map); | ||
140 | } | ||
141 | } | ||
142 | |||
143 | EXPORT_SYMBOL(fbcon_set_tileops); | ||
144 | |||
145 | MODULE_AUTHOR("Antonino Daplas <adaplas@pol.net>"); | ||
146 | MODULE_DESCRIPTION("Tile Blitting Operation"); | ||
147 | MODULE_LICENSE("GPL"); | ||
148 | |||