mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
mach64: fix cursor when character width is not a multiple of 8 pixels
commit 43751a1b8e
upstream.
This patch fixes the hardware cursor on mach64 when font width is not a
multiple of 8 pixels.
If you load such a font, the cursor is expanded to the next 8-byte
boundary and a part of the next character after the cursor is not
visible.
For example, when you load a font with 12-pixel width, the cursor width
is 16 pixels and when the cursor is displayed, 4 pixels of the next
character are not visible.
The reason is this: atyfb_cursor is called with proper parameters to
load an image that is 12-pixel wide. However, the number is aligned on
the next 8-pixel boundary on the line
"unsigned int width = (cursor->image.width + 7) >> 3;" and the whole
function acts as it is was loading a 16-pixel image.
This patch fixes it so that the value written to the framebuffer is
padded with 0xaaaa (the transparent pattern) when the image size it not
a multiple of 8 pixels. The transparent pattern causes that the cursor
will not interfere with the next character.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
caf6f52449
commit
34dc182bf3
1 changed files with 16 additions and 6 deletions
|
@ -5,6 +5,7 @@
|
||||||
#include <linux/fb.h>
|
#include <linux/fb.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/string.h>
|
#include <linux/string.h>
|
||||||
|
#include "../fb_draw.h"
|
||||||
|
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
|
||||||
|
@ -157,24 +158,33 @@ static int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
|
||||||
|
|
||||||
for (i = 0; i < height; i++) {
|
for (i = 0; i < height; i++) {
|
||||||
for (j = 0; j < width; j++) {
|
for (j = 0; j < width; j++) {
|
||||||
|
u16 l = 0xaaaa;
|
||||||
b = *src++;
|
b = *src++;
|
||||||
m = *msk++;
|
m = *msk++;
|
||||||
switch (cursor->rop) {
|
switch (cursor->rop) {
|
||||||
case ROP_XOR:
|
case ROP_XOR:
|
||||||
// Upper 4 bits of mask data
|
// Upper 4 bits of mask data
|
||||||
fb_writeb(cursor_bits_lookup[(b ^ m) >> 4], dst++);
|
l = cursor_bits_lookup[(b ^ m) >> 4] |
|
||||||
// Lower 4 bits of mask
|
// Lower 4 bits of mask
|
||||||
fb_writeb(cursor_bits_lookup[(b ^ m) & 0x0f],
|
(cursor_bits_lookup[(b ^ m) & 0x0f] << 8);
|
||||||
dst++);
|
|
||||||
break;
|
break;
|
||||||
case ROP_COPY:
|
case ROP_COPY:
|
||||||
// Upper 4 bits of mask data
|
// Upper 4 bits of mask data
|
||||||
fb_writeb(cursor_bits_lookup[(b & m) >> 4], dst++);
|
l = cursor_bits_lookup[(b & m) >> 4] |
|
||||||
// Lower 4 bits of mask
|
// Lower 4 bits of mask
|
||||||
fb_writeb(cursor_bits_lookup[(b & m) & 0x0f],
|
(cursor_bits_lookup[(b & m) & 0x0f] << 8);
|
||||||
dst++);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* If cursor size is not a multiple of 8 characters
|
||||||
|
* we must pad it with transparent pattern (0xaaaa).
|
||||||
|
*/
|
||||||
|
if ((j + 1) * 8 > cursor->image.width) {
|
||||||
|
l = comp(l, 0xaaaa,
|
||||||
|
(1 << ((cursor->image.width & 7) * 2)) - 1);
|
||||||
|
}
|
||||||
|
fb_writeb(l & 0xff, dst++);
|
||||||
|
fb_writeb(l >> 8, dst++);
|
||||||
}
|
}
|
||||||
dst += offset;
|
dst += offset;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue