From fb21c2f42879c05c76ea9e249b6905fc729f8529 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 13 Dec 2011 14:02:26 +0100 Subject: fbdev: Add FOURCC-based format configuration API This API will be used to support YUV frame buffer formats in a standard way. Last but not least, create a much needed fbdev API documentation and document the format setting APIs. Signed-off-by: Laurent Pinchart Signed-off-by: Florian Tobias Schandinat --- drivers/video/fbmem.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'drivers/video/fbmem.c') diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index ad936295d8f4..ac9141b85356 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -967,6 +967,20 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) { u32 activate = var->activate; + /* When using FOURCC mode, make sure the red, green, blue and + * transp fields are set to 0. + */ + if ((info->fix.capabilities & FB_CAP_FOURCC) && + var->grayscale > 1) { + if (var->red.offset || var->green.offset || + var->blue.offset || var->transp.offset || + var->red.length || var->green.length || + var->blue.length || var->transp.length || + var->red.msb_right || var->green.msb_right || + var->blue.msb_right || var->transp.msb_right) + return -EINVAL; + } + if (!info->fbops->fb_check_var) { *var = info->var; goto done; -- cgit v1.2.3