ARM: mcpm: introduce helpers for platform coherency exit/setup
[linux/fpc-iii.git] / drivers / video / atafb_mfb.c
blob6a352d62eecf2b737336cce422198c1fe357bc55
1 /*
2 * linux/drivers/video/mfb.c -- Low level frame buffer operations for
3 * monochrome
5 * Created 5 Apr 1997 by Geert Uytterhoeven
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
12 #include <linux/module.h>
13 #include <linux/string.h>
14 #include <linux/fb.h>
16 #include "atafb.h"
17 #include "atafb_utils.h"
21 * Monochrome
24 void atafb_mfb_copyarea(struct fb_info *info, u_long next_line,
25 int sy, int sx, int dy, int dx,
26 int height, int width)
28 u8 *src, *dest;
29 u_int rows;
31 if (sx == 0 && dx == 0 && width == next_line) {
32 src = (u8 *)info->screen_base + sy * (width >> 3);
33 dest = (u8 *)info->screen_base + dy * (width >> 3);
34 fb_memmove(dest, src, height * (width >> 3));
35 } else if (dy <= sy) {
36 src = (u8 *)info->screen_base + sy * next_line + (sx >> 3);
37 dest = (u8 *)info->screen_base + dy * next_line + (dx >> 3);
38 for (rows = height; rows--;) {
39 fb_memmove(dest, src, width >> 3);
40 src += next_line;
41 dest += next_line;
43 } else {
44 src = (u8 *)info->screen_base + (sy + height - 1) * next_line + (sx >> 3);
45 dest = (u8 *)info->screen_base + (dy + height - 1) * next_line + (dx >> 3);
46 for (rows = height; rows--;) {
47 fb_memmove(dest, src, width >> 3);
48 src -= next_line;
49 dest -= next_line;
54 void atafb_mfb_fillrect(struct fb_info *info, u_long next_line, u32 color,
55 int sy, int sx, int height, int width)
57 u8 *dest;
58 u_int rows;
60 dest = (u8 *)info->screen_base + sy * next_line + (sx >> 3);
62 if (sx == 0 && width == next_line) {
63 if (color)
64 fb_memset255(dest, height * (width >> 3));
65 else
66 fb_memclear(dest, height * (width >> 3));
67 } else {
68 for (rows = height; rows--; dest += next_line) {
69 if (color)
70 fb_memset255(dest, width >> 3);
71 else
72 fb_memclear_small(dest, width >> 3);
77 void atafb_mfb_linefill(struct fb_info *info, u_long next_line,
78 int dy, int dx, u32 width,
79 const u8 *data, u32 bgcolor, u32 fgcolor)
81 u8 *dest;
82 u_int rows;
84 dest = (u8 *)info->screen_base + dy * next_line + (dx >> 3);
86 for (rows = width / 8; rows--; /* check margins */ ) {
87 // use fast_memmove or fb_memmove
88 *dest++ = *data++;
92 #ifdef MODULE
93 MODULE_LICENSE("GPL");
95 int init_module(void)
97 return 0;
100 void cleanup_module(void)
103 #endif /* MODULE */
107 * Visible symbols for modules
110 EXPORT_SYMBOL(atafb_mfb_copyarea);
111 EXPORT_SYMBOL(atafb_mfb_fillrect);
112 EXPORT_SYMBOL(atafb_mfb_linefill);