drm/nouveau: consume the return of large GSP message
[drm/drm-misc.git] / drivers / video / fbdev / atafb_mfb.c
blob384fd3e4d3e139353c723b77c5c659827ac70dae
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/string.h>
13 #include <linux/fb.h>
15 #include "atafb.h"
16 #include "atafb_utils.h"
20 * Monochrome
23 void atafb_mfb_copyarea(struct fb_info *info, u_long next_line,
24 int sy, int sx, int dy, int dx,
25 int height, int width)
27 u8 *src, *dest;
28 u_int rows;
30 if (sx == 0 && dx == 0 && width == next_line) {
31 src = (u8 *)info->screen_base + sy * (width >> 3);
32 dest = (u8 *)info->screen_base + dy * (width >> 3);
33 fb_memmove(dest, src, height * (width >> 3));
34 } else if (dy <= sy) {
35 src = (u8 *)info->screen_base + sy * next_line + (sx >> 3);
36 dest = (u8 *)info->screen_base + dy * next_line + (dx >> 3);
37 for (rows = height; rows--;) {
38 fb_memmove(dest, src, width >> 3);
39 src += next_line;
40 dest += next_line;
42 } else {
43 src = (u8 *)info->screen_base + (sy + height - 1) * next_line + (sx >> 3);
44 dest = (u8 *)info->screen_base + (dy + height - 1) * next_line + (dx >> 3);
45 for (rows = height; rows--;) {
46 fb_memmove(dest, src, width >> 3);
47 src -= next_line;
48 dest -= next_line;
53 void atafb_mfb_fillrect(struct fb_info *info, u_long next_line, u32 color,
54 int sy, int sx, int height, int width)
56 u8 *dest;
57 u_int rows;
59 dest = (u8 *)info->screen_base + sy * next_line + (sx >> 3);
61 if (sx == 0 && width == next_line) {
62 if (color)
63 fb_memset255(dest, height * (width >> 3));
64 else
65 fb_memclear(dest, height * (width >> 3));
66 } else {
67 for (rows = height; rows--; dest += next_line) {
68 if (color)
69 fb_memset255(dest, width >> 3);
70 else
71 fb_memclear_small(dest, width >> 3);
76 void atafb_mfb_linefill(struct fb_info *info, u_long next_line,
77 int dy, int dx, u32 width,
78 const u8 *data, u32 bgcolor, u32 fgcolor)
80 u8 *dest;
81 u_int rows;
83 dest = (u8 *)info->screen_base + dy * next_line + (dx >> 3);
85 for (rows = width / 8; rows--; /* check margins */ ) {
86 // use fast_memmove or fb_memmove
87 *dest++ = *data++;