diff options
| author | Tatenda Chipeperekwa <tatendac@codeaurora.org> | 2015-02-23 21:18:29 -0800 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:43:40 -0700 |
| commit | f6fb77ca7d1147ddf2f0d96f02c0fc91c01466b0 (patch) | |
| tree | fd48f7d63cfc77679b39dd2ba3c16ef0780bdf13 | |
| parent | e593068d2e7b570e6037879120612c8d23e82f46 (diff) | |
msm: fb: add support to set the output format
Add support to set the output of the interface based on the
grayscale value. The grayscale value must be set to a format
specified according to the V4L2 FOURCC pixel format definitions.
We translate from the FOURCC pixel format to the corresponding
MDP format when setting the final output format. For example,
this is used to set the output format to YUV420 for HDMI TVs
that are HDMI 2.0 compliant.
Change-Id: Id5623f1211b743b54002c22b19d81dbd13e6564f
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_fb.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c index d90bef3b0739..1a4927c21f0c 100644 --- a/drivers/video/fbdev/msm/mdss_fb.c +++ b/drivers/video/fbdev/msm/mdss_fb.c @@ -16,6 +16,7 @@ #define pr_fmt(fmt) "%s: " fmt, __func__ +#include <linux/videodev2.h> #include <linux/bootmem.h> #include <linux/console.h> #include <linux/debugfs.h> @@ -2955,9 +2956,23 @@ static int mdss_fb_pan_display_sub(struct fb_var_screeninfo *var, return 0; } +static int mdss_grayscale_to_mdp_format(u32 grayscale) +{ + switch (grayscale) { + case V4L2_PIX_FMT_RGB24: + return MDP_RGB_888; + case V4L2_PIX_FMT_NV12: + return MDP_Y_CBCR_H2V2; + default: + return -EINVAL; + } +} + static void mdss_fb_var_to_panelinfo(struct fb_var_screeninfo *var, struct mdss_panel_info *pinfo) { + int format = -EINVAL; + pinfo->xres = var->xres; pinfo->yres = var->yres; pinfo->lcdc.v_front_porch = var->lower_margin; @@ -2967,6 +2982,15 @@ static void mdss_fb_var_to_panelinfo(struct fb_var_screeninfo *var, pinfo->lcdc.h_back_porch = var->left_margin; pinfo->lcdc.h_pulse_width = var->hsync_len; pinfo->clk_rate = var->pixclock; + + if (var->grayscale > 1) { + format = mdss_grayscale_to_mdp_format(var->grayscale); + if (!IS_ERR_VALUE(format)) + pinfo->out_format = format; + else + pr_warn("Failed to map grayscale value (%d) to an MDP format\n", + var->grayscale); + } } static void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo, @@ -3110,8 +3134,6 @@ static int mdss_fb_check_var(struct fb_var_screeninfo *var, if (var->rotate != FB_ROTATE_UR && var->rotate != FB_ROTATE_UD) return -EINVAL; - if (var->grayscale != info->var.grayscale) - return -EINVAL; switch (var->bits_per_pixel) { case 16: |
