dts: rk312x: default enable emmc
[firefly-linux-kernel-4.4.55.git] / drivers / video / aty / mach64_cursor.c
index 95ec042ddbf8ee4f93eda9592ee55f0f6a3c6063..0fe02e22d9a436e46cbc46fc7053e5afa83e3b2d 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/string.h>
+#include "../fb_draw.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 (j = 0; j < width; j++) {
+                       u16 l = 0xaaaa;
                        b = *src++;
                        m = *msk++;
                        switch (cursor->rop) {
                        case ROP_XOR:
                            // 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
-                           fb_writeb(cursor_bits_lookup[(b ^ m) & 0x0f],
-                                     dst++);
+                                   (cursor_bits_lookup[(b ^ m) & 0x0f] << 8);
                            break;
                        case ROP_COPY:
                            // 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
-                           fb_writeb(cursor_bits_lookup[(b & m) & 0x0f],
-                                     dst++);
+                                   (cursor_bits_lookup[(b & m) & 0x0f] << 8);
                            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;
            }