Commit e35b71b0 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbdev: Support for bigger than 16x32 fonts in rivafb cursor

- 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: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 44f4ee83
...@@ -444,6 +444,8 @@ static void rivafb_load_cursor_image(struct riva_par *par, u8 *data8, ...@@ -444,6 +444,8 @@ static void rivafb_load_cursor_image(struct riva_par *par, u8 *data8,
bg = le16_to_cpu(bg); bg = le16_to_cpu(bg);
fg = le16_to_cpu(fg); fg = le16_to_cpu(fg);
w = (w + 1) & ~1;
for (i = 0; i < h; i++) { for (i = 0; i < h; i++) {
b = *data++; b = *data++;
reverse_order(&b); reverse_order(&b);
...@@ -1577,6 +1579,10 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -1577,6 +1579,10 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
u16 fg, bg; u16 fg, bg;
int i, set = cursor->set; int i, set = cursor->set;
if (cursor->image.width > MAX_CURS ||
cursor->image.height > MAX_CURS)
return soft_cursor(info, cursor);
par->riva.ShowHideCursor(&par->riva, 0); par->riva.ShowHideCursor(&par->riva, 0);
if (par->cursor_reset) { if (par->cursor_reset) {
...@@ -1606,38 +1612,46 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -1606,38 +1612,46 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
u32 d_pitch = MAX_CURS/8; u32 d_pitch = MAX_CURS/8;
u8 *dat = (u8 *) cursor->image.data; u8 *dat = (u8 *) cursor->image.data;
u8 *msk = (u8 *) cursor->mask; u8 *msk = (u8 *) cursor->mask;
u8 src[64]; u8 *src;
switch (cursor->rop) {
case ROP_XOR:
for (i = 0; i < s_pitch * cursor->image.height;
i++)
src[i] = dat[i] ^ msk[i];
break;
case ROP_COPY:
default:
for (i = 0; i < s_pitch * cursor->image.height;
i++)
src[i] = dat[i] & msk[i];
break;
}
fb_sysmove_buf_aligned(info, &info->pixmap, data, d_pitch, src, src = kmalloc(s_pitch * cursor->image.height, GFP_ATOMIC);
s_pitch, cursor->image.height);
if (src) {
switch (cursor->rop) {
case ROP_XOR:
for (i = 0; i < s_pitch * cursor->image.height;
i++)
src[i] = dat[i] ^ msk[i];
break;
case ROP_COPY:
default:
for (i = 0; i < s_pitch * cursor->image.height;
i++)
src[i] = dat[i] & msk[i];
break;
}
bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | fb_sysmove_buf_aligned(info, &info->pixmap, data,
((info->cmap.green[bg_idx] & 0xf8) << 2) | d_pitch, src, s_pitch,
((info->cmap.blue[bg_idx] & 0xf8) >> 3) | 1 << 15; cursor->image.height);
fg = ((info->cmap.red[fg_idx] & 0xf8) << 7) | bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) |
((info->cmap.green[fg_idx] & 0xf8) << 2) | ((info->cmap.green[bg_idx] & 0xf8) << 2) |
((info->cmap.blue[fg_idx] & 0xf8) >> 3) | 1 << 15; ((info->cmap.blue[bg_idx] & 0xf8) >> 3) |
1 << 15;
par->riva.LockUnlock(&par->riva, 0); fg = ((info->cmap.red[fg_idx] & 0xf8) << 7) |
((info->cmap.green[fg_idx] & 0xf8) << 2) |
((info->cmap.blue[fg_idx] & 0xf8) >> 3) |
1 << 15;
par->riva.LockUnlock(&par->riva, 0);
rivafb_load_cursor_image(par, data, bg, fg, rivafb_load_cursor_image(par, data, bg, fg,
cursor->image.width, cursor->image.width,
cursor->image.height); cursor->image.height);
kfree(src);
}
} }
if (cursor->enable) if (cursor->enable)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment