ARM HDLCD: Get it working under Android.
authorDietmar Eggemann <dietmar.eggemann@arm.com>
Thu, 21 Jun 2012 16:16:33 +0000 (17:16 +0100)
committerJon Medhurst <tixy@linaro.org>
Mon, 1 Jul 2013 10:04:24 +0000 (11:04 +0100)
Add a shortcut when set_par is called to only change the yoffset. Android is
doing that instead of calling pan_display to flip the framebuffer.

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

index 948d41c14130454bf3b3747a05ff5728fa8ce68a..526d771db9911a962ea1103f183c9b8e47357701 100644 (file)
@@ -166,6 +166,11 @@ static int hdlcd_set_output_mode(int xres, int yres)
        return set_dvi_mode(msgbuffer[0]);
 }
 
+
+/* prototype */
+static int hdlcd_pan_display(struct fb_var_screeninfo *var,
+       struct fb_info *info);
+
 #define WRITE_HDLCD_REG(reg, value)    writel((value), hdlcd->base + (reg))
 #define READ_HDLCD_REG(reg)            readl(hdlcd->base + (reg))
 
@@ -174,9 +179,22 @@ static int hdlcd_set_par(struct fb_info *info)
        struct hdlcd_device *hdlcd = to_hdlcd_device(info);
        int bytes_per_pixel = hdlcd->fb.var.bits_per_pixel / 8;
        int polarities;
-
-       if (!memcmp(&info->var, &cached_var_screeninfo, sizeof(struct fb_var_screeninfo)))
+       int old_yoffset;
+
+       /* check for shortcuts */
+       old_yoffset = cached_var_screeninfo.yoffset;
+       cached_var_screeninfo.yoffset = info->var.yoffset;
+       if (!memcmp(&info->var, &cached_var_screeninfo,
+                               sizeof(struct fb_var_screeninfo))) {
+               if(old_yoffset != info->var.yoffset) {
+                       /* we only changed yoffset */
+                       hdlcd_pan_display(&info->var, info);
+                       memcpy(&cached_var_screeninfo, &info->var,
+                               sizeof(struct fb_var_screeninfo));
+               }
+               /* or no change */
                return 0;
+       }
 
        hdlcd->fb.fix.line_length = hdlcd->fb.var.xres * bytes_per_pixel;