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/module.h>
12 #include <linux/string.h>
14 #include <linux/vt_kern.h>
15 #include <linux/console.h>
16 #include <asm/types.h>
19 static void tile_bmove(struct vc_data
*vc
, struct fb_info
*info
, int sy
,
20 int sx
, int dy
, int dx
, int height
, int width
)
22 struct fb_tilearea area
;
31 info
->tileops
->fb_tilecopy(info
, &area
);
34 static void tile_clear(struct vc_data
*vc
, struct fb_info
*info
, int sy
,
35 int sx
, int height
, int width
)
37 struct fb_tilerect rect
;
38 int bgshift
= (vc
->vc_hi_font_mask
) ? 13 : 12;
39 int fgshift
= (vc
->vc_hi_font_mask
) ? 9 : 8;
41 rect
.index
= vc
->vc_video_erase_char
&
42 ((vc
->vc_hi_font_mask
) ? 0x1ff : 0xff);
43 rect
.fg
= attr_fgcol_ec(fgshift
, vc
);
44 rect
.bg
= attr_bgcol_ec(bgshift
, vc
);
51 info
->tileops
->fb_tilefill(info
, &rect
);
54 static void tile_putcs(struct vc_data
*vc
, struct fb_info
*info
,
55 const unsigned short *s
, int count
, int yy
, int xx
,
58 struct fb_tileblit blit
;
59 unsigned short charmask
= vc
->vc_hi_font_mask
? 0x1ff : 0xff;
60 int size
= sizeof(u32
) * count
, i
;
69 blit
.indices
= (u32
*) fb_get_buffer_offset(info
, &info
->pixmap
, size
);
70 for (i
= 0; i
< count
; i
++)
71 blit
.indices
[i
] = (u32
)(scr_readw(s
++) & charmask
);
73 info
->tileops
->fb_tileblit(info
, &blit
);
76 static void tile_clear_margins(struct vc_data
*vc
, struct fb_info
*info
,
82 static void tile_cursor(struct vc_data
*vc
, struct fb_info
*info
, int mode
,
83 int softback_lines
, int fg
, int bg
)
85 struct fb_tilecursor cursor
;
86 int use_sw
= (vc
->vc_cursor_type
& 0x01);
90 cursor
.mode
= (mode
== CM_ERASE
|| use_sw
) ? 0 : 1;
94 switch (vc
->vc_cursor_type
& 0x0f) {
96 cursor
.shape
= FB_TILE_CURSOR_NONE
;
99 cursor
.shape
= FB_TILE_CURSOR_UNDERLINE
;
101 case CUR_LOWER_THIRD
:
102 cursor
.shape
= FB_TILE_CURSOR_LOWER_THIRD
;
105 cursor
.shape
= FB_TILE_CURSOR_LOWER_HALF
;
108 cursor
.shape
= FB_TILE_CURSOR_TWO_THIRDS
;
112 cursor
.shape
= FB_TILE_CURSOR_BLOCK
;
116 info
->tileops
->fb_tilecursor(info
, &cursor
);
119 static int tile_update_start(struct fb_info
*info
)
121 struct fbcon_ops
*ops
= info
->fbcon_par
;
124 err
= fb_pan_display(info
, &ops
->var
);
125 ops
->var
.xoffset
= info
->var
.xoffset
;
126 ops
->var
.yoffset
= info
->var
.yoffset
;
127 ops
->var
.vmode
= info
->var
.vmode
;
131 void fbcon_set_tileops(struct vc_data
*vc
, struct fb_info
*info
)
133 struct fb_tilemap map
;
134 struct fbcon_ops
*ops
= info
->fbcon_par
;
136 ops
->bmove
= tile_bmove
;
137 ops
->clear
= tile_clear
;
138 ops
->putcs
= tile_putcs
;
139 ops
->clear_margins
= tile_clear_margins
;
140 ops
->cursor
= tile_cursor
;
141 ops
->update_start
= tile_update_start
;
144 map
.width
= vc
->vc_font
.width
;
145 map
.height
= vc
->vc_font
.height
;
147 map
.length
= (ops
->p
->userfont
) ?
148 FNTCHARCNT(ops
->p
->fontdata
) : 256;
149 map
.data
= ops
->p
->fontdata
;
150 info
->tileops
->fb_settile(info
, &map
);
154 EXPORT_SYMBOL(fbcon_set_tileops
);
156 MODULE_AUTHOR("Antonino Daplas <adaplas@pol.net>");
157 MODULE_DESCRIPTION("Tile Blitting Operation");
158 MODULE_LICENSE("GPL");