ARM HDLCD: Change default byte ordering to match Android assumption
authorChris Redpath <chris.redpath@arm.com>
Fri, 29 Jun 2012 12:10:35 +0000 (13:10 +0100)
committerJon Medhurst <tixy@linaro.org>
Mon, 1 Jul 2013 10:04:25 +0000 (11:04 +0100)
Change color byte location in 32-bit word from argb to abgr to match
the assumption made in Android when 32-bit color displays are used.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
drivers/video/arm-hdlcd.c

index 526d771db9911a962ea1103f183c9b8e47357701..9b5b21ab136ffa963edf653cb09ac3c10e8001b2 100644 (file)
@@ -116,10 +116,25 @@ static int hdlcd_set_bitfields(struct hdlcd_device *hdlcd,
        }
 
        if (!ret) {
-               var->green.offset = var->blue.length;
-               var->red.offset = var->green.offset + var->green.length;
-               if (var->bits_per_pixel == 32)
-                       var->transp.offset = var->red.offset + var->red.length;
+               if(var->bits_per_pixel != 32)
+               {
+                       var->green.offset = var->blue.length;
+                       var->red.offset = var->green.offset + var->green.length;
+               }
+               else
+               {
+                       /* Previously, the byte ordering for 32-bit color was
+                        * (msb)<alpha><red><green><blue>(lsb)
+                        * but this does not match what android expects and
+                        * the colors are odd. Instead, use
+                        * <alpha><blue><green><red>
+                        * Since we tell fb what we are doing, console
+                        * , X and directfb access should work fine.
+                        */
+                       var->green.offset = var->red.length;
+                       var->blue.offset = var->green.offset + var->green.length;
+                       var->transp.offset = var->blue.offset + var->blue.length;
+               }
        }
 
        return ret;