linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tony" <adaplas@hotpop.com>
To: "Thomas S. Iversen" <zensonic@zensonic.dk>,
	linux-fbdev-devel@lists.sourceforge.net
Subject: RE: Bug in software cursor flash code, when align!=1?
Date: Sun, 21 Sep 2003 20:55:38 +0800	[thread overview]
Message-ID: <000101c3803f$a7e1e480$f217b1cb@bom> (raw)
In-Reply-To: <20030915083820.GA22164@zensonic.dk>

> 
> Hi Again
> 
> Being puzzled by the fact that my software cursor did not work when
> everything else worked with my accelerated routines I tried 
> to investigate
> where the problem was located. This being when scan_align!=1 which
> my accel routines need.
>

Oops, sorry, try this instead.

Tony

int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
{
	struct fb_image image;
	unsigned int scan_align = info->pixmap.scan_align - 1;
	unsigned int buf_align = info->pixmap.buf_align - 1;
	u8 *dst = (u8 *) info->cursor.image.data;
	u8 *s, *d;
	unsigned int i, size, p, pitch;
	
	/* p is the source pitch which is always byte aligned */
	p = (info->cursor.image.width + 7) >> 3;

	/* pitch is the destination data pitch, which is padded
	   to hardware requirements */
	pitch = p + scan_align;
	pitch &= ~scan_align;
	size = pitch * info->cursor.image.height + buf_align;
	size &= ~buf_align;
 	
	if (cursor->set & FB_CUR_SETSIZE) {
 		info->cursor.image.height = cursor->image.height;
 		info->cursor.image.width = cursor->image.width;
 	}
 
 	if (cursor->set & FB_CUR_SETPOS) {
	info->cursor.image.dx = cursor->image.dx;
 		info->cursor.image.dy = cursor->image.dy;
 	}

 	if (cursor->set & FB_CUR_SETHOT)
 		info->cursor.hot = cursor->hot;
 	
 	if (cursor->set & FB_CUR_SETCMAP) {
 		if (cursor->image.depth == 1) {
 			info->cursor.image.bg_color = cursor->image.bg_color;
 			info->cursor.image.fg_color = cursor->image.fg_color;
 		} else {
 			if (cursor->image.cmap.len)
 				fb_copy_cmap(&cursor->image.cmap, &info->cursor.image.cmap, 0);
		}
		info->cursor.image.depth = cursor->image.depth;
 	}	
 
 	if (cursor->set & FB_CUR_SETSHAPE) {
 		switch (info->cursor.rop) {
 		case ROP_XOR:
 			for (i = 0; i < size; i++)
 				dst[i] ^= info->cursor.mask[i]; 
			break;
 		case ROP_COPY:
 		default:
 			for (i = 0; i < size; i++)
 				dst[i] &= info->cursor.mask[i];
			break;
 		}
 	}
 	
 	if (!info->cursor.enable) {
 		for (i = 0; i < size; i++)
 			dst[i] ^= info->cursor.mask[i];
 	}
	
	/* Once cursor image processing is finished, start transferring
	   data to pixmap */

	/* First, get a chunk from scratch memory... */
	image = info->cursor.image;
	image.data = d = fb_get_buffer_offset(info, &info->pixmap, size);
	s = dst;

	/* ... then move data to scratch memory ... */
	if (info->cursor.image.data) {
		for (i = info->cursor.image.height; i--; ) {
			info->pixmap.outbuf(info, d, s, p)	
			d += pitch;
			s += p;
		}
	}
		
	/* ... draw the cursor ... */
 	info->fbops->fb_imageblit(info, &image);

	/* ... tell fb we're done. */
	atomic_dec(info->pixmap.count);
	smb_mb__after_atomic_dec();

 	return 0;
}



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

      parent reply	other threads:[~2003-09-21 12:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-15  8:38 Bug in software cursor flash code, when align!=1? Thomas S. Iversen
2003-09-21 11:50 ` Tony
2003-09-21 12:55 ` Tony [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000101c3803f$a7e1e480$f217b1cb@bom' \
    --to=adaplas@hotpop.com \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=zensonic@zensonic.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).