From: James S. <jsi...@us...> - 2002-03-05 17:14:31
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/video In directory usw-pr-cvs1:/tmp/cvs-serv19726/drivers/video Modified Files: cfbcopyarea.c cfbfillrect.c Log Message: MOved to cleaner fbdev api for accel handling. Index: cfbcopyarea.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/video/cfbcopyarea.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cfbcopyarea.c 4 Apr 2001 02:05:26 -0000 1.3 +++ cfbcopyarea.c 5 Mar 2002 17:14:28 -0000 1.4 @@ -26,9 +26,9 @@ #include <linux/slab.h> #include <asm/types.h> #include <asm/io.h> +#include <video/fbcon.h> -void cfb_copyarea(struct fb_info *p, int sx, int sy, unsigned int width, - unsigned int rows, int dx, int dy) +void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) { unsigned long start_index, end_index, start_mask, end_mask, last,tmp, height; int x2, y2, n, j, lineincr, shift, shift_right, shift_left, old_dx,old_dy; @@ -37,49 +37,49 @@ char *src1,*dst1; /* clip the destination */ - old_dx=dx; - old_dy=dy; + 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 = dx + width; - y2 = dy + rows; - dx = dx > 0 ? dx : 0; - dy = dy > 0 ? dy : 0; + x2 = area->dx + area->width; + y2 = area->dy + area->height; + area->dx = area->dx > 0 ? area->dx : 0; + area->dy = area->dy > 0 ? area->dy : 0; x2 = x2 < p->var.xres_virtual ? x2 : p->var.xres_virtual; y2 = y2 < p->var.yres_virtual ? y2 : p->var.yres_virtual; - width = x2 - dx; - rows = y2 - dy; + area->width = x2 - area->dx; + area->height = y2 - area->dy; /* update sx1,sy1 */ - sx += (dx - old_dx); - sy += (dy - old_dy); + area->sx += (area->dx - old_dx); + area->sy += (area->dy - old_dy); - height = rows; + height = area->height; /* the source must be completely inside the virtual screen */ - if (sx < 0 || sy < 0 || (sx + width) > p->var.xres_virtual || - (sy + height) > p->var.yres_virtual) return; + if (area->sx < 0 || area->sy < 0 || (area->sx + area->width) > p->var.xres_virtual || + (area->sy + area->height) > p->var.yres_virtual) return; - if (dy < sy || (dy == sy && dx < sx)) { + if (area->dy < area->sy || (area->dy == area->sy && area->dx < area->sx)) { /* start at the top */ - src1 = p->screen_base + sy * linesize + - ((sx * p->var.bits_per_pixel) >> 3); - dst1 = p->screen_base + dy * linesize + - ((dx * p->var.bits_per_pixel) >> 3); + src1 = p->screen_base + area->sy * linesize + + ((area->sx * p->var.bits_per_pixel) >> 3); + dst1 = p->screen_base + area->dy * linesize + + ((area->dx * p->var.bits_per_pixel) >> 3); lineincr = linesize; } else { /* start at the bottom */ - src1 = p->screen_base + (sy + height - 1) * linesize + - (((sx + width - 1) * p->var.bits_per_pixel) >> 3); - dst1 = p->screen_base + (dy + height - 1) * linesize + - (((dx + width - 1) * p->var.bits_per_pixel) >> 3); + src1 = p->screen_base + (area->sy + area->height - 1) * linesize + + (((area->sx + area->width - 1) * p->var.bits_per_pixel) >> 3); + dst1 = p->screen_base + (area->dy + area->height - 1) * linesize + + (((area->dx + area->width - 1) * p->var.bits_per_pixel) >> 3); lineincr = -linesize; } if ((BITS_PER_LONG % p->var.bits_per_pixel) == 0) { int ppw = BITS_PER_LONG/p->var.bits_per_pixel; - int n = ((width * p->var.bits_per_pixel) >> 3); + int n = ((area->width * p->var.bits_per_pixel) >> 3); start_index = ((unsigned long) src1 & (bpl-1)); end_index = ((unsigned long) (src1 + n) & (bpl-1)); Index: cfbfillrect.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/video/cfbfillrect.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- cfbfillrect.c 16 Apr 2001 15:05:29 -0000 1.5 +++ cfbfillrect.c 5 Mar 2002 17:14:28 -0000 1.6 @@ -20,9 +20,9 @@ #include <linux/string.h> #include <linux/fb.h> #include <asm/types.h> +#include <video/fbcon.h> -void cfb_fillrect(struct fb_info *p, int x1, int y1, unsigned int width, - unsigned int rows, unsigned long color, int rop) +void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect) { unsigned long start_index, end_index, start_mask = 0, end_mask = 0; unsigned long height, ppw, fg; @@ -31,22 +31,22 @@ unsigned long *dst; char *dst1; - if (!width || !rows) return; + if (!rect->width || !rect->height) return; /* We could use hardware clipping but on many cards you get around hardware clipping by writing to framebuffer directly. */ - x2 = x1 + width; - y2 = y1 + rows; + x2 = rect->dx + rect->width; + y2 = rect->dy + rect->height; x2 = x2 < p->var.xres_virtual ? x2 : p->var.xres_virtual; y2 = y2 < p->var.yres_virtual ? y2 : p->var.yres_virtual; - width = x2 - x1; - height = y2 - y1; + rect->width = x2 - rect->dx; + height = y2 - rect->dy; /* Size of the scanline in bytes */ - n = ((width * p->var.bits_per_pixel) >> 3); + n = ((rect->width * p->var.bits_per_pixel) >> 3); ppw = BITS_PER_LONG/p->var.bits_per_pixel; - dst1 = p->screen_base + y1 * linesize + ((x1 * p->var.bits_per_pixel) >> 3); + dst1 = p->screen_base + rect->dy * linesize + ((rect->dx * p->var.bits_per_pixel) >> 3); start_index = ((unsigned long) dst1 & (bpl-1)); end_index = ((unsigned long)(dst1 + n) & (bpl-1)); @@ -54,11 +54,11 @@ // printk("end_index is %ld\n", end_index); // printk("width is %d\n", width); - fg = color; + fg = rect->color; for (i = 0; i < ppw; i++) { fg <<= p->var.bits_per_pixel; - fg |= color; + fg |= rect->color; } if (start_index) { @@ -89,7 +89,7 @@ // printk("n is %d\n", n); if ((BITS_PER_LONG % p->var.bits_per_pixel) == 0) { - switch(rop) { + switch (rect->rop) { case ROP_COPY: do { /* Word align to increases performace :-) */ @@ -159,14 +159,14 @@ /* start_mask =& PFILL24(x1,fg); end_mask_or = end_mask & PFILL24(x1+width-1,fg); */ - n = (width - start_index - end_index)/ppw; + n = (rect->width - start_index - end_index)/ppw; - switch(rop) { + switch (rect->rop) { case ROP_COPY: do { dst = (unsigned long *)dst1; if (start_mask) *dst |= start_mask; - if ((start_index + width) > ppw) dst++; + if ((start_index + rect->width) > ppw) dst++; /* XXX: slow */ for(i=0;i<n;i++) { @@ -180,7 +180,7 @@ do { dst = (unsigned long *)dst1; if (start_mask) *dst ^= start_mask; - if ((start_mask + width) > ppw) dst++; + if ((start_mask + rect->width) > ppw) dst++; for(i=0;i<n;i++) { *dst++ ^= fg; /* PFILL24(fg,x1+i); */ |