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>
This commit is contained in:
parent
e593068d2e
commit
f6fb77ca7d
1 changed files with 24 additions and 2 deletions
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#define pr_fmt(fmt) "%s: " fmt, __func__
|
#define pr_fmt(fmt) "%s: " fmt, __func__
|
||||||
|
|
||||||
|
#include <linux/videodev2.h>
|
||||||
#include <linux/bootmem.h>
|
#include <linux/bootmem.h>
|
||||||
#include <linux/console.h>
|
#include <linux/console.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
|
@ -2955,9 +2956,23 @@ static int mdss_fb_pan_display_sub(struct fb_var_screeninfo *var,
|
||||||
return 0;
|
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,
|
static void mdss_fb_var_to_panelinfo(struct fb_var_screeninfo *var,
|
||||||
struct mdss_panel_info *pinfo)
|
struct mdss_panel_info *pinfo)
|
||||||
{
|
{
|
||||||
|
int format = -EINVAL;
|
||||||
|
|
||||||
pinfo->xres = var->xres;
|
pinfo->xres = var->xres;
|
||||||
pinfo->yres = var->yres;
|
pinfo->yres = var->yres;
|
||||||
pinfo->lcdc.v_front_porch = var->lower_margin;
|
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_back_porch = var->left_margin;
|
||||||
pinfo->lcdc.h_pulse_width = var->hsync_len;
|
pinfo->lcdc.h_pulse_width = var->hsync_len;
|
||||||
pinfo->clk_rate = var->pixclock;
|
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,
|
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)
|
if (var->rotate != FB_ROTATE_UR && var->rotate != FB_ROTATE_UD)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (var->grayscale != info->var.grayscale)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
switch (var->bits_per_pixel) {
|
switch (var->bits_per_pixel) {
|
||||||
case 16:
|
case 16:
|
||||||
|
|
Loading…
Add table
Reference in a new issue