<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: "Antonino A. Daplas" &lt;adaplas@hotpop.com&gt;

- Add support for fonts bigger thatn 16x32 by dynamically allocating buffer
  based on font dimensions instead of statically allocating at 64 bytes.

- use softcursor if cursor size exceeds 32x32.

- fix rivafb_cursor if cursor width is not divisible by 2

Signed-off-by: Antonino Daplas &lt;adaplas@pol.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 25-akpm/drivers/video/riva/fbdev.c |   72 ++++++++++++++++++++++---------------
 1 files changed, 43 insertions(+), 29 deletions(-)

diff -puN drivers/video/riva/fbdev.c~fbdev-support-for-bigger-than-16x32-fonts-in-rivafb-cursor drivers/video/riva/fbdev.c
--- 25/drivers/video/riva/fbdev.c~fbdev-support-for-bigger-than-16x32-fonts-in-rivafb-cursor	2004-11-10 18:36:11.996574592 -0800
+++ 25-akpm/drivers/video/riva/fbdev.c	2004-11-10 18:36:12.001573832 -0800
@@ -444,6 +444,8 @@ static void rivafb_load_cursor_image(str
 	bg = le16_to_cpu(bg);
 	fg = le16_to_cpu(fg);
 
+	w = (w + 1) &amp; ~1;
+
 	for (i = 0; i &lt; h; i++) {
 		b = *data++;
 		reverse_order(&amp;b);
@@ -1577,6 +1579,10 @@ static int rivafb_cursor(struct fb_info 
 	u16 fg, bg;
 	int i, set = cursor-&gt;set;
 
+	if (cursor-&gt;image.width &gt; MAX_CURS ||
+	    cursor-&gt;image.height &gt; MAX_CURS)
+		return soft_cursor(info, cursor);
+
 	par-&gt;riva.ShowHideCursor(&amp;par-&gt;riva, 0);
 
 	if (par-&gt;cursor_reset) {
@@ -1606,38 +1612,46 @@ static int rivafb_cursor(struct fb_info 
 		u32 d_pitch = MAX_CURS/8;
 		u8 *dat = (u8 *) cursor-&gt;image.data;
 		u8 *msk = (u8 *) cursor-&gt;mask;
-		u8 src[64];	
-		
-		switch (cursor-&gt;rop) {
-		case ROP_XOR:
-			for (i = 0; i &lt; s_pitch * cursor-&gt;image.height;
-			     i++)
-				src[i] = dat[i] ^ msk[i];
-			break;
-		case ROP_COPY:
-		default:
-			for (i = 0; i &lt; s_pitch * cursor-&gt;image.height;
-			     i++)
-				src[i] = dat[i] &amp; msk[i];
-			break;
-		}
+		u8 *src;
 		
-		fb_sysmove_buf_aligned(info, &amp;info-&gt;pixmap, data, d_pitch, src,
-				       s_pitch, cursor-&gt;image.height);
+		src = kmalloc(s_pitch * cursor-&gt;image.height, GFP_ATOMIC);
 
-		bg = ((info-&gt;cmap.red[bg_idx] &amp; 0xf8) &lt;&lt; 7) |
-		     ((info-&gt;cmap.green[bg_idx] &amp; 0xf8) &lt;&lt; 2) |
-		     ((info-&gt;cmap.blue[bg_idx] &amp; 0xf8) &gt;&gt; 3) | 1 &lt;&lt; 15;
-
-		fg = ((info-&gt;cmap.red[fg_idx] &amp; 0xf8) &lt;&lt; 7) |
-		     ((info-&gt;cmap.green[fg_idx] &amp; 0xf8) &lt;&lt; 2) |
-		     ((info-&gt;cmap.blue[fg_idx] &amp; 0xf8) &gt;&gt; 3) | 1 &lt;&lt; 15;
-
-		par-&gt;riva.LockUnlock(&amp;par-&gt;riva, 0);
+		if (src) {
+			switch (cursor-&gt;rop) {
+			case ROP_XOR:
+				for (i = 0; i &lt; s_pitch * cursor-&gt;image.height;
+				     i++)
+					src[i] = dat[i] ^ msk[i];
+				break;
+			case ROP_COPY:
+			default:
+				for (i = 0; i &lt; s_pitch * cursor-&gt;image.height;
+				     i++)
+					src[i] = dat[i] &amp; msk[i];
+				break;
+			}
 
-		rivafb_load_cursor_image(par, data, bg, fg,
-					 cursor-&gt;image.width,
-					 cursor-&gt;image.height);
+			fb_sysmove_buf_aligned(info, &amp;info-&gt;pixmap, data,
+					       d_pitch, src, s_pitch,
+					       cursor-&gt;image.height);
+
+			bg = ((info-&gt;cmap.red[bg_idx] &amp; 0xf8) &lt;&lt; 7) |
+				((info-&gt;cmap.green[bg_idx] &amp; 0xf8) &lt;&lt; 2) |
+				((info-&gt;cmap.blue[bg_idx] &amp; 0xf8) &gt;&gt; 3) |
+				1 &lt;&lt; 15;
+
+			fg = ((info-&gt;cmap.red[fg_idx] &amp; 0xf8) &lt;&lt; 7) |
+				((info-&gt;cmap.green[fg_idx] &amp; 0xf8) &lt;&lt; 2) |
+				((info-&gt;cmap.blue[fg_idx] &amp; 0xf8) &gt;&gt; 3) |
+				1 &lt;&lt; 15;
+
+			par-&gt;riva.LockUnlock(&amp;par-&gt;riva, 0);
+
+			rivafb_load_cursor_image(par, data, bg, fg,
+						 cursor-&gt;image.width,
+						 cursor-&gt;image.height);
+			kfree(src);
+		}
 	}
 
 	if (cursor-&gt;enable)
_
</pre></body></html>