* [PATCH] Fix softcursor issues
@ 2004-02-09 6:56 Benjamin Herrenschmidt
2004-02-09 18:04 ` James Simmons
0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2004-02-09 6:56 UTC (permalink / raw)
To: James Simmons; +Cc: Linux Fbdev development list
Hi James !
I'm having troubles with softcursor in the new tree. It can tap
outside of the ioremap'ed region of the framebuffer because it
doesn't properly crop the saved area at the bottom of the screen.
Here's a quick fix that works for me with offb (offb ioremap's just
the exact size of the framebuffer and so would trigger it).
I also added calls to fb_sync since we are touching the framebuffer,
we must make sure pending accel operations are properly completed.
Ben.
diff -urN fbdev-2.5/drivers/video/softcursor.c linuxppc-2.5-benh/drivers/video/softcursor.c
--- fbdev-2.5/drivers/video/softcursor.c 2004-01-28 16:50:07.000000000 +1100
+++ linuxppc-2.5-benh/drivers/video/softcursor.c 2004-02-09 17:51:13.338387792 +1100
@@ -29,9 +29,10 @@
{
unsigned int scan_align = info->sprite.scan_align - 1;
u8 *addr = info->sprite.addr, *dst;
- unsigned int size, i, j;
+ unsigned int size, i, j, ysize;
unsigned long *save;
-
+ int needsync = 1;
+
if (cursor->image.height > 32 || cursor->image.width > 32)
return -ENXIO;
@@ -63,14 +64,20 @@
fb_load_cursor_image(info);
if (!cursor->enable || (info->cursor.enable && (cursor->set & FB_CUR_SETPOS))) {
+ if (needsync && info->fbops->fb_sync) {
+ info->fbops->fb_sync(info);
+ needsync = 0;
+ }
// Draw saved area
i = (info->cursor.image.width * info->var.bits_per_pixel + 7) >> 3;
size = (i + scan_align) & ~scan_align;
i = (info->cursor.image.dx * info->var.bits_per_pixel >> 3);
dst = info->screen_base + info->cursor.image.dy * info->fix.line_length + i;
-
+ ysize = 32;
+ if ((info->cursor.image.dy + ysize) > info->var.yres_virtual)
+ ysize = info->var.yres_virtual - info->cursor.image.dy;
save = (unsigned long *) (addr + info->sprite.size/2);
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < ysize; i++) {
unsigned long *dst0 = (unsigned long *) dst;
for (j = 0; j < size; j++) {
FB_WRITEL(FB_READL(save++), dst0++);
@@ -80,14 +87,21 @@
}
if (!info->cursor.enable || (cursor->set & FB_CUR_SETPOS)) {
+ if (needsync && info->fbops->fb_sync) {
+ info->fbops->fb_sync(info);
+ needsync = 0;
+ }
// Save the area under the cursor
i = (info->cursor.image.width * info->var.bits_per_pixel + 7) >> 3;
size = (i + scan_align) & ~scan_align;
i = (info->cursor.image.dx * info->var.bits_per_pixel >> 3);
dst = info->screen_base + info->cursor.image.dy * info->fix.line_length + i;
+ ysize = 32;
+ if ((info->cursor.image.dy + ysize) > info->var.yres_virtual)
+ ysize = info->var.yres_virtual - info->cursor.image.dy;
save = (unsigned long *) (addr + info->sprite.size/2);
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < ysize; i++) {
unsigned long *dst0 = (unsigned long *) dst;
for (j = 0; j < size; j++) {
FB_WRITEL(FB_READL(dst0++), save++);
@@ -96,10 +110,8 @@
}
}
- if (cursor->enable) {
- //info->cursor.image.data = addr;
+ if (cursor->enable)
info->fbops->fb_imageblit(info, &info->cursor.image);
- }
return 0;
}
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix softcursor issues
2004-02-09 6:56 [PATCH] Fix softcursor issues Benjamin Herrenschmidt
@ 2004-02-09 18:04 ` James Simmons
0 siblings, 0 replies; 2+ messages in thread
From: James Simmons @ 2004-02-09 18:04 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Linux Fbdev development list
Thanks. Applied.
On Mon, 9 Feb 2004, Benjamin Herrenschmidt wrote:
> Hi James !
>
> I'm having troubles with softcursor in the new tree. It can tap
> outside of the ioremap'ed region of the framebuffer because it
> doesn't properly crop the saved area at the bottom of the screen.
>
> Here's a quick fix that works for me with offb (offb ioremap's just
> the exact size of the framebuffer and so would trigger it).
>
> I also added calls to fb_sync since we are touching the framebuffer,
> we must make sure pending accel operations are properly completed.
>
> Ben.
>
> diff -urN fbdev-2.5/drivers/video/softcursor.c linuxppc-2.5-benh/drivers/video/softcursor.c
> --- fbdev-2.5/drivers/video/softcursor.c 2004-01-28 16:50:07.000000000 +1100
> +++ linuxppc-2.5-benh/drivers/video/softcursor.c 2004-02-09 17:51:13.338387792 +1100
> @@ -29,9 +29,10 @@
> {
> unsigned int scan_align = info->sprite.scan_align - 1;
> u8 *addr = info->sprite.addr, *dst;
> - unsigned int size, i, j;
> + unsigned int size, i, j, ysize;
> unsigned long *save;
> -
> + int needsync = 1;
> +
> if (cursor->image.height > 32 || cursor->image.width > 32)
> return -ENXIO;
>
> @@ -63,14 +64,20 @@
> fb_load_cursor_image(info);
>
> if (!cursor->enable || (info->cursor.enable && (cursor->set & FB_CUR_SETPOS))) {
> + if (needsync && info->fbops->fb_sync) {
> + info->fbops->fb_sync(info);
> + needsync = 0;
> + }
> // Draw saved area
> i = (info->cursor.image.width * info->var.bits_per_pixel + 7) >> 3;
> size = (i + scan_align) & ~scan_align;
> i = (info->cursor.image.dx * info->var.bits_per_pixel >> 3);
> dst = info->screen_base + info->cursor.image.dy * info->fix.line_length + i;
> -
> + ysize = 32;
> + if ((info->cursor.image.dy + ysize) > info->var.yres_virtual)
> + ysize = info->var.yres_virtual - info->cursor.image.dy;
> save = (unsigned long *) (addr + info->sprite.size/2);
> - for (i = 0; i < 32; i++) {
> + for (i = 0; i < ysize; i++) {
> unsigned long *dst0 = (unsigned long *) dst;
> for (j = 0; j < size; j++) {
> FB_WRITEL(FB_READL(save++), dst0++);
> @@ -80,14 +87,21 @@
> }
>
> if (!info->cursor.enable || (cursor->set & FB_CUR_SETPOS)) {
> + if (needsync && info->fbops->fb_sync) {
> + info->fbops->fb_sync(info);
> + needsync = 0;
> + }
> // Save the area under the cursor
> i = (info->cursor.image.width * info->var.bits_per_pixel + 7) >> 3;
> size = (i + scan_align) & ~scan_align;
> i = (info->cursor.image.dx * info->var.bits_per_pixel >> 3);
> dst = info->screen_base + info->cursor.image.dy * info->fix.line_length + i;
>
> + ysize = 32;
> + if ((info->cursor.image.dy + ysize) > info->var.yres_virtual)
> + ysize = info->var.yres_virtual - info->cursor.image.dy;
> save = (unsigned long *) (addr + info->sprite.size/2);
> - for (i = 0; i < 32; i++) {
> + for (i = 0; i < ysize; i++) {
> unsigned long *dst0 = (unsigned long *) dst;
> for (j = 0; j < size; j++) {
> FB_WRITEL(FB_READL(dst0++), save++);
> @@ -96,10 +110,8 @@
> }
> }
>
> - if (cursor->enable) {
> - //info->cursor.image.data = addr;
> + if (cursor->enable)
> info->fbops->fb_imageblit(info, &info->cursor.image);
> - }
> return 0;
> }
>
>
>
>
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-09 18:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-09 6:56 [PATCH] Fix softcursor issues Benjamin Herrenschmidt
2004-02-09 18:04 ` James Simmons
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).