diff -Naur linux-2.5.61-fbdev/cfb_tileops.c linux-2.5.61/cfb_tileops.c --- linux-2.5.61-fbdev/cfb_tileops.c 1970-01-01 00:00:00.000000000 +0000 +++ linux-2.5.61/cfb_tileops.c 2003-02-23 04:17:36.000000000 +0000 @@ -0,0 +1,130 @@ +/* + * Generic TileBLT function for frame buffer with packed pixels of any depth. + * + * Copyright (C) June 1999 James Simmons + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + * + * NOTES: + * + * This is a test program to implement Tile Blitting using classical blitting + * routines. This is naturally slower, so don't use this for your default + * operations. + */ +#include +#include +#include +#include +#include + +static struct fb_tiledata cfb_tileinfo; +static u8 *cfb_tiledata = NULL; + +static int cfb_loadtiles(struct fb_info *info, + const struct fb_tiledata *tileinfo) +{ + u32 size = (tileinfo->tile.width + 7)/8 * tileinfo->tile.height; + + size *= tileinfo->len; + if (cfb_tiledata) { + if (info->fbops->fb_sync) + info->fbops->fb_sync(info); + kfree(cfb_tiledata); + cfb_tiledata = NULL; + } + + cfb_tiledata = kmalloc(size, GFP_KERNEL); + if (cfb_tiledata == NULL) + return 1; + cfb_tileinfo = *tileinfo; + cfb_tileinfo.data = cfb_tiledata; + memcpy(cfb_tiledata, tileinfo->data, size); + + return 0; +} + +static void cfb_tileblit(struct fb_info *info, + const struct fb_tileblit *tilemap) +{ + struct fb_image image; + u32 width = cfb_tileinfo.tile.width; + u32 height = cfb_tileinfo.tile.height; + u32 cellsize = (width + 7)/8 * height; + int i; + + image.dx = tilemap->dx * width; + image.dy = tilemap->dy * height; + image.width = width; + image.height = tilemap->height * height; + image.fg_color = tilemap->fg_color; + image.bg_color = tilemap->bg_color; + image.depth = 0; + + for (i = 0; i < tilemap->width; i++) { + image.data = cfb_tileinfo.data + (tilemap->data[i] * cellsize); + info->fbops->fb_imageblit(info, &image); + image.dx += width; + } +} + +static void cfb_tilefill(struct fb_info *info, + const struct fb_tilefill *tilerect) +{ + struct fb_image image; + u32 width = cfb_tileinfo.tile.width; + u32 height = cfb_tileinfo.tile.height; + u32 dx, dy, i, j; + + dx = tilerect->dx * width; + dy = tilerect->dy * height; + image.width = width; + image.height = height; + image.fg_color = tilerect->fg_color; + image.bg_color = tilerect->bg_color; + image.data = cfb_tileinfo.data + + tilerect->idx * ((width + 7)/8 * height); + image.depth = 0; + + for (i = 0; i < tilerect->height; i++) { + image.dy = dy; + for (j = 0; j < tilerect->width; j++) { + image.dx = dx; + info->fbops->fb_imageblit(info, &image); + dx += width; + } + dy += height; + } +} + +static void cfb_tilecopy(struct fb_info *info, const struct fb_tilecopy *tileregion) +{ + struct fb_copyarea area; + u32 width = cfb_tileinfo.tile.width; + u32 height = cfb_tileinfo.tile.height; + + area.dx = tileregion->dx * width; + area.dy = tileregion->dy * height; + area.sx = tileregion->sx * width; + area.sy = tileregion->sy * height; + area.width = tileregion->width * width; + area.height = tileregion->height * height; + + info->fbops->fb_copyarea(info, &area); +} + +struct fb_tileops cfb_tileops = { + .fb_loadtiles = cfb_loadtiles, + .fb_tileblit = cfb_tileblit, + .fb_tilecopy = cfb_tilecopy, + .fb_tilefill = cfb_tilefill, +}; + +EXPORT_SYMBOL(cfb_tileops); +MODULE_AUTHOR("James Simmons , " + "Antonino Daplas "); +MODULE_DESCRIPTION("Low Level Tile Blitting Ops"); +MODULE_LICENSE("GPL"); + +