19 #include <linux/module.h>
20 #include <linux/pci.h>
21 #include <linux/slab.h>
22 #if defined(CONFIG_OF)
31 struct mb862xxfb_par *par = info->
par;
35 while (total < count) {
46 static void mb86290fb_copyarea(
struct fb_info *info,
56 if (area->
sx >= area->
dx && area->
sy >= area->
dy)
58 else if (area->
sx >= area->
dx && area->
sy <= area->
dy)
60 else if (area->
sx <= area->
dx && area->
sy >= area->
dy)
65 cmd[3] = (area->
sy << 16) | area->
sx;
66 cmd[4] = (area->
dy << 16) | area->
dx;
68 mb862xxfb_write_fifo(6, cmd, info);
81 unsigned const char *
line;
97 bytes = (image->
width + 7) >> 3;
102 cmd[7] = (dy << 16) | dx;
103 cmd[8] = (height << 16) | width;
106 memcpy(&cmd[9 + i * step], line, step << 2);
107 #ifdef __LITTLE_ENDIAN
110 for (k = 0; k <
step; k++)
111 cmd[9 + i * step + k] =
124 static void mb86290fb_imageblit8(
u32 *cmd,
u16 step,
u16 dx,
u16 dy,
130 unsigned const char *line, *
ptr;
135 cmd[1] = (dy << 16) | dx;
136 cmd[2] = (height << 16) | width;
139 line = ptr = image->
data;
140 bytes = image->
width;
144 for (j = 0; j <
step; j++) {
145 cmd[3 + i * step +
j] =
148 cmd[3 + i * step +
j] |=
150 pseudo_palette))[*ptr]) & 0xffff) << 16;
163 static void mb86290fb_imageblit16(
u32 *cmd,
u16 step,
u16 dx,
u16 dy,
169 unsigned const char *line;
174 bytes = image->
width << 1;
178 cmd[1] = (dy << 16) | dx;
179 cmd[2] = (height << 16) | width;
182 memcpy(&cmd[3 + i * step], line, step);
188 static void mb86290fb_imageblit(
struct fb_info *info,
196 u32 fgcolor = 0, bgcolor = 0;
200 u16 dx = image->
dx, dy = image->
dy;
201 int x2, y2, vxres, vyres;
206 vxres = info->
var.xres_virtual;
207 vyres = info->
var.yres_virtual;
213 switch (image->
depth) {
215 step = (width + 31) >> 5;
216 cmdlen = 9 + height *
step;
217 cmdfn = mb86290fb_imageblit1;
232 step = (width + 1) >> 1;
233 cmdlen = 3 + height *
step;
234 cmdfn = mb86290fb_imageblit8;
238 step = (width + 1) >> 1;
239 cmdlen = 3 + height *
step;
240 cmdfn = mb86290fb_imageblit16;
251 cmdfn(cmd, step, dx, dy, width, height, fgcolor, bgcolor, image, info);
252 mb862xxfb_write_fifo(cmdlen, cmd, info);
256 static void mb86290fb_fillrect(
struct fb_info *info,
263 vxres = info->
var.xres_virtual;
264 vyres = info->
var.yres_virtual;
276 width = x2 - rect->
dx;
277 height = y2 - rect->
dy;
304 cmd[5] = (rect->
dy << 16) | (rect->
dx);
305 cmd[6] = (height << 16) | width;
307 mb862xxfb_write_fifo(7, cmd, info);
312 struct mb862xxfb_par *par = info->
par;
314 if (info->
var.bits_per_pixel == 32) {
320 info->
fbops->fb_fillrect = mb86290fb_fillrect;
321 info->
fbops->fb_copyarea = mb86290fb_copyarea;
322 info->
fbops->fb_imageblit = mb86290fb_imageblit;
331 info->
fix.accel = 0xff;