Commit b055ca93 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] Amifb updates

Amifb: Updates for fbdev changes in 2.5.66 and 2.5.68:
  - Last parameter of fb_{fillrect,copyarea,imageblit}() became const
parent eb50c84f
...@@ -1123,9 +1123,12 @@ static int amifb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -1123,9 +1123,12 @@ static int amifb_setcolreg(unsigned regno, unsigned red, unsigned green,
static int amifb_blank(int blank, struct fb_info *info); static int amifb_blank(int blank, struct fb_info *info);
static int amifb_pan_display(struct fb_var_screeninfo *var, static int amifb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info); struct fb_info *info);
static void amifb_fillrect(struct fb_info *info, struct fb_fillrect *rect); static void amifb_fillrect(struct fb_info *info,
static void amifb_copyarea(struct fb_info *info, struct fb_copyarea *region); const struct fb_fillrect *rect);
static void amifb_imageblit(struct fb_info *info, struct fb_image *image); static void amifb_copyarea(struct fb_info *info,
const struct fb_copyarea *region);
static void amifb_imageblit(struct fb_info *info,
const struct fb_image *image);
static int amifb_ioctl(struct inode *inode, struct file *file, static int amifb_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg, unsigned int cmd, unsigned long arg,
struct fb_info *info); struct fb_info *info);
...@@ -1949,11 +1952,13 @@ static inline void xor_one_line(int bpp, unsigned long next_plane, ...@@ -1949,11 +1952,13 @@ static inline void xor_one_line(int bpp, unsigned long next_plane,
} }
static void amifb_fillrect(struct fb_info *info, struct fb_fillrect *rect) static void amifb_fillrect(struct fb_info *info,
const struct fb_fillrect *rect)
{ {
struct amifb_par *par = (struct amifb_par *)info->par; struct amifb_par *par = (struct amifb_par *)info->par;
int dst_idx, x2, y2; int dst_idx, x2, y2;
unsigned long *dst; unsigned long *dst;
u32 width, height;
if (!rect->width || !rect->height) if (!rect->width || !rect->height)
return; return;
...@@ -1966,25 +1971,24 @@ static void amifb_fillrect(struct fb_info *info, struct fb_fillrect *rect) ...@@ -1966,25 +1971,24 @@ static void amifb_fillrect(struct fb_info *info, struct fb_fillrect *rect)
y2 = rect->dy + rect->height; y2 = rect->dy + rect->height;
x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual; x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual;
y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual; y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual;
rect->width = x2 - rect->dx; width = x2 - rect->dx;
rect->height = y2 - rect->dy; height = y2 - rect->dy;
dst = (unsigned long *) dst = (unsigned long *)
((unsigned long)info->screen_base & ~(BYTES_PER_LONG-1)); ((unsigned long)info->screen_base & ~(BYTES_PER_LONG-1));
dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG-1))*8; dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG-1))*8;
dst_idx += rect->dy*par->next_line*8+rect->dx; dst_idx += rect->dy*par->next_line*8+rect->dx;
while (rect->height--) { while (height--) {
switch (rect->rop) { switch (rect->rop) {
case ROP_COPY: case ROP_COPY:
fill_one_line(info->var.bits_per_pixel, fill_one_line(info->var.bits_per_pixel,
par->next_plane, dst, dst_idx, par->next_plane, dst, dst_idx, width,
rect->width, rect->color); rect->color);
break; break;
case ROP_XOR: case ROP_XOR:
xor_one_line(info->var.bits_per_pixel, xor_one_line(info->var.bits_per_pixel, par->next_plane,
par->next_plane, dst, dst_idx, dst, dst_idx, width, rect->color);
rect->width, rect->color);
break; break;
} }
dst_idx += par->next_line*8; dst_idx += par->next_line*8;
...@@ -2026,47 +2030,38 @@ static inline void copy_one_line_rev(int bpp, unsigned long next_plane, ...@@ -2026,47 +2030,38 @@ static inline void copy_one_line_rev(int bpp, unsigned long next_plane,
} }
static void amifb_copyarea(struct fb_info *info, struct fb_copyarea *area) static void amifb_copyarea(struct fb_info *info,
const struct fb_copyarea *area)
{ {
struct amifb_par *par = (struct amifb_par *)info->par; struct amifb_par *par = (struct amifb_par *)info->par;
int x2, y2, old_dx, old_dy; int x2, y2;
u32 dx, dy, sx, sy, width, height;
unsigned long *dst, *src; unsigned long *dst, *src;
int dst_idx, src_idx, height; int dst_idx, src_idx;
int rev_copy = 0; int rev_copy = 0;
/* clip the destination */ /* clip the destination */
old_dx = area->dx;
old_dy = area->dy;
/*
* We could use hardware clipping but on many cards you get around
* hardware clipping by writing to framebuffer directly.
*/
x2 = area->dx + area->width; x2 = area->dx + area->width;
y2 = area->dy + area->height; y2 = area->dy + area->height;
area->dx = area->dx > 0 ? area->dx : 0; dx = area->dx > 0 ? area->dx : 0;
area->dy = area->dy > 0 ? area->dy : 0; dy = area->dy > 0 ? area->dy : 0;
x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual; x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual;
y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual; y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual;
area->width = x2 - area->dx; width = x2 - dx;
area->height = y2 - area->dy; height = y2 - dy;
/* update sx1,sy1 */
area->sx += (area->dx - old_dx);
area->sy += (area->dy - old_dy);
height = area->height; /* update sx,sy */
sx = area->sx + (dx - area->dx);
sy = area->sy + (dy - area->dy);
/* the source must be completely inside the virtual screen */ /* the source must be completely inside the virtual screen */
if (area->sx < 0 || area->sy < 0 || if (sx < 0 || sy < 0 || (sx + width) > info->var.xres_virtual ||
(area->sx + area->width) > info->var.xres_virtual || (sy + height) > info->var.yres_virtual)
(area->sy + area->height) > info->var.yres_virtual)
return; return;
if (area->dy > area->sy || if (dy > sy || (dy == sy && dx > sx)) {
(area->dy == area->sy && area->dx > area->sx)) { dy += height;
area->dy += area->height; sy += height;
area->sy += area->height;
rev_copy = 1; rev_copy = 1;
} }
dst = (unsigned long *) dst = (unsigned long *)
...@@ -2074,21 +2069,21 @@ static void amifb_copyarea(struct fb_info *info, struct fb_copyarea *area) ...@@ -2074,21 +2069,21 @@ static void amifb_copyarea(struct fb_info *info, struct fb_copyarea *area)
src = dst; src = dst;
dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG-1))*8; dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG-1))*8;
src_idx = dst_idx; src_idx = dst_idx;
dst_idx += area->dy*par->next_line*8+area->dx; dst_idx += dy*par->next_line*8+dx;
src_idx += area->sy*par->next_line*8+area->sx; src_idx += sy*par->next_line*8+sx;
if (rev_copy) { if (rev_copy) {
while (height--) { while (height--) {
dst_idx -= par->next_line*8; dst_idx -= par->next_line*8;
src_idx -= par->next_line*8; src_idx -= par->next_line*8;
copy_one_line_rev(info->var.bits_per_pixel, copy_one_line_rev(info->var.bits_per_pixel,
par->next_plane, dst, dst_idx, src, par->next_plane, dst, dst_idx, src,
src_idx, area->width); src_idx, width);
} }
} else { } else {
while (height--) { while (height--) {
copy_one_line(info->var.bits_per_pixel, copy_one_line(info->var.bits_per_pixel,
par->next_plane, dst, dst_idx, src, par->next_plane, dst, dst_idx, src,
src_idx, area->width); src_idx, width);
dst_idx += par->next_line*8; dst_idx += par->next_line*8;
src_idx += par->next_line*8; src_idx += par->next_line*8;
} }
...@@ -2125,7 +2120,7 @@ static inline void expand_one_line(int bpp, unsigned long next_plane, ...@@ -2125,7 +2120,7 @@ static inline void expand_one_line(int bpp, unsigned long next_plane,
} }
static void amifb_imageblit(struct fb_info *info, struct fb_image *image) static void amifb_imageblit(struct fb_info *info, const struct fb_image *image)
{ {
struct amifb_par *par = (struct amifb_par *)info->par; struct amifb_par *par = (struct amifb_par *)info->par;
int x2, y2; int x2, y2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment