 /* We want rotation but lack hardware to do it for us. */ if (!p->fbops->fb_rotate && p->var.rotate) { }  vxres = p->var.xres_virtual; vyres = p->var.yres_virtual;  if (!rect->width || !rect->height || rect->dx > vxres || rect->dy > vyres) return;  /* We could use hardware clipping but on many cards you get around * hardware clipping by writing to framebuffer directly. */  x2 = rect->dx + rect->width; y2 = rect->dy + rect->height; x2 = x2 < vxres ? x2 : vxres; y2 = y2 < vyres ? y2 : vyres; width = x2 - rect->dx; height = y2 - rect->dy; 
void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect){	unsigned long x2, y2, vxres, vyres, height, width, pat, fg;	int bits = BITS_PER_LONG, bytes = bits >> 3;	u32 bpp = p->var.bits_per_pixel;	unsigned long __iomem *dst;	int dst_idx, left;	if (p->state != FBINFO_STATE_RUNNING)		return;	/* We want rotation but lack hardware to do it for us. */	if (!p->fbops->fb_rotate && p->var.rotate) {	}	vxres = p->var.xres_virtual;	vyres = p->var.yres_virtual;	if (!rect->width || !rect->height ||	    rect->dx > vxres || rect->dy > vyres)		return;	/* We could use hardware clipping but on many cards you get around	 * hardware clipping by writing to framebuffer directly. */	x2 = rect->dx + rect->width;	y2 = rect->dy + rect->height;	x2 = x2 < vxres ? x2 : vxres;	y2 = y2 < vyres ? y2 : vyres;	width = x2 - rect->dx;	height = y2 - rect->dy;	if (p->fix.visual == FB_VISUAL_TRUECOLOR ||	    p->fix.visual == FB_VISUAL_DIRECTCOLOR )		fg = ((u32 *) (p->pseudo_palette))[rect->color];	else		fg = rect->color;	pat = pixel_to_pat( bpp, fg);	dst = (unsigned long __iomem *)((unsigned long)p->screen_base & ~(bytes-1));	dst_idx = ((unsigned long)p->screen_base & (bytes - 1))*8;	dst_idx += rect->dy*p->fix.line_length*8+rect->dx*bpp;	/* FIXME For now we support 1-32 bpp only */	left = bits % bpp;	if (p->fbops->fb_sync)		p->fbops->fb_sync(p);	if (!left) {		void (*fill_op32)(unsigned long __iomem *dst, int dst_idx,		                  unsigned long pat, unsigned n, int bits) = NULL;		switch (rect->rop) {		case ROP_XOR:			fill_op32 = bitfill_aligned_rev;			break;		case ROP_COPY:			fill_op32 = bitfill_aligned;			break;		default:			printk( KERN_ERR "cfb_fillrect(): unknown rop, defaulting to ROP_COPY\n");			fill_op32 = bitfill_aligned;			break;		}		while (height--) {			dst += dst_idx >> (ffs(bits) - 1);			dst_idx &= (bits - 1);			fill_op32(dst, dst_idx, pat, width*bpp, bits);			dst_idx += p->fix.line_length*8;		}	} else {		int right;		int r;		int rot = (left-dst_idx) % bpp;		void (*fill_op)(unsigned long __iomem *dst, int dst_idx,		                unsigned long pat, int left, int right,		                unsigned n, int bits) = NULL;		/* rotate pattern to correct start position */		pat = pat << rot | pat >> (bpp-rot);		right = bpp-left;		switch (rect->rop) {		case ROP_XOR:			fill_op = bitfill_unaligned_rev;			break;		case ROP_COPY:			fill_op = bitfill_unaligned;			break;		default:			printk( KERN_ERR "cfb_fillrect(): unknown rop, defaulting to ROP_COPY\n");			fill_op = bitfill_unaligned;			break;		}		while (height--) {			dst += dst_idx >> (ffs(bits) - 1);			dst_idx &= (bits - 1);			fill_op(dst, dst_idx, pat, left, right,				width*bpp, bits);			r = (p->fix.line_length*8) % bpp;			pat = pat << (bpp-r) | pat >> r;			dst_idx += p->fix.line_length*8;		}	}}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/b4d8aea6d66aabc1d79aaeb1ecc90562abb8f575/cfbfillrect.c/buggy/drivers/video/cfbfillrect.c