summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiarhei Siamashka <siarhei.siamashka@gmail.com>2013-01-03 11:53:14 +0400
committerAlejandro Mery <amery@geeks.cl>2013-01-06 18:44:42 +0400
commitaf908788cc2201cd3269fcf51b0220027f4378ba (patch)
treeea9627da8f9f8943f01358e400b038848c4bd849
parent72cefa10c8296348f80d9360c4fafa73ca3f26f1 (diff)
downloadlinux-sunxi-af908788cc2201cd3269fcf51b0220027f4378ba.tar.xz
video: sunxi: don't silently change any 16bpp video mode to ARGB1555
Even in spite of having fb0_format/fb1_format configured to any of 16bpp choices (ARGB1555, ARGB1555, RGBA5551, ARGB4444, RGB655, RGB565, RGB556) in *.fex file, it was getting silently overrided with ARGB1555. But RGB565 is generally best supported in software and has more performance optimizations. It would be a shame if we could not use it. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Jari Helaakoski <tekkuli@gmail.com>
-rw-r--r--drivers/video/sunxi/disp/dev_fb.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/video/sunxi/disp/dev_fb.c b/drivers/video/sunxi/disp/dev_fb.c
index 5de789bc423a..dc0bd4942213 100644
--- a/drivers/video/sunxi/disp/dev_fb.c
+++ b/drivers/video/sunxi/disp/dev_fb.c
@@ -1034,12 +1034,28 @@ static int Fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
*/
static int Fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
+ __disp_pixel_fmt_t fmt;
__inf("Fb_check_var: %dx%d %dbits\n", var->xres, var->yres,
var->bits_per_pixel);
switch (var->bits_per_pixel) {
case 16:
- disp_fb_to_var(DISP_FORMAT_ARGB1555, DISP_SEQ_P10, 0, var);
+ if (var->transp.length == 1 && var->transp.offset == 15)
+ fmt = DISP_FORMAT_ARGB1555;
+ else if (var->transp.length == 1 && var->transp.offset == 0)
+ fmt = DISP_FORMAT_RGBA5551;
+ else if (var->transp.length == 4)
+ fmt = DISP_FORMAT_ARGB4444;
+ else if (var->red.length == 6)
+ fmt = DISP_FORMAT_RGB655;
+ else if (var->green.length == 6)
+ fmt = DISP_FORMAT_RGB565;
+ else if (var->blue.length == 6)
+ fmt = DISP_FORMAT_RGB556;
+ else
+ return -EINVAL;
+
+ disp_fb_to_var(fmt, DISP_SEQ_P10, 0, var);
break;
case 24:
disp_fb_to_var(DISP_FORMAT_RGB888, DISP_SEQ_ARGB, 0, var);