HDMI: Modify color output policy.

Introduce feature SUPPORT_YCBCR_INPUT. If VOP can
        output YCbCr, VOP output color mode is equal to HDMI
        output color mode. Otherwise, VOP just output RGB,
        HDMI will conver color space.

Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
This commit is contained in:
Zheng Yang
2015-03-09 11:11:52 +08:00
parent e5caa5929c
commit 9b5e918130
5 changed files with 31 additions and 28 deletions

View File

@@ -78,12 +78,6 @@ static void hdmi_wq_set_video(struct hdmi *hdmi)
DBG("%s", __func__);
video.vic = hdmi->vic & HDMI_VIC_MASK;
if (hdmi->vic & HDMI_VIDEO_YUV420)
video.color_input = HDMI_COLOR_YCBCR420;
else if (hdmi->edid.sink_hdmi == 0)
video.color_input = HDMI_COLOR_RGB_0_255;
else
video.color_input = HDMI_COLOR_YCBCR444;
video.sink_hdmi = hdmi->edid.sink_hdmi;
video.format_3d = hdmi->mode_3d;
/* For DVI, output RGB */
@@ -112,6 +106,16 @@ static void hdmi_wq_set_video(struct hdmi *hdmi)
if (hdmi->vic & HDMI_VIDEO_YUV420)
video.color_output = HDMI_COLOR_YCBCR420;
pr_info("hdmi output corlor mode is %d\n", video.color_output);
video.color_input = HDMI_COLOR_RGB_0_255;
if (hdmi->property->feature & SUPPORT_YCBCR_INPUT) {
if (video.color_output == HDMI_COLOR_YCBCR444 ||
video.color_output == HDMI_COLOR_YCBCR422)
video.color_input = HDMI_COLOR_YCBCR444;
else if (video.color_output == HDMI_COLOR_YCBCR420)
video.color_input = HDMI_COLOR_YCBCR420;
}
hdmi->colormode_input = video.color_input;
hdmi_set_lcdc(hdmi);
if (hdmi->ops->setvideo)
hdmi->ops->setvideo(hdmi, &video);
}
@@ -211,7 +215,6 @@ static void hdmi_wq_insert(struct hdmi *hdmi)
hdmi_send_uevent(hdmi, KOBJ_ADD);
if (hdmi->enable) {
/*hdmi->autoset = 0;*/
hdmi_set_lcdc(hdmi);
hdmi_wq_set_video(hdmi);
#ifdef CONFIG_SWITCH
if ((hdmi->edid.baseaudio_support &&
@@ -347,9 +350,8 @@ static void hdmi_work_queue(struct work_struct *work)
msleep(2000);
else
msleep(1000);
hdmi_set_lcdc(hdmi);
hdmi_send_uevent(hdmi, KOBJ_CHANGE);
hdmi_wq_set_video(hdmi);
hdmi_send_uevent(hdmi, KOBJ_CHANGE);
hdmi_wq_set_audio(hdmi);
hdmi_wq_set_output(hdmi, hdmi->mute);
if (hdmi->ops->hdcp_cb)

View File

@@ -54,10 +54,10 @@ static int hdmi_set_info(struct rk_screen *screen, struct hdmi *hdmi)
/* screen type & face */
screen->type = SCREEN_HDMI;
if (hdmi->edid.sink_hdmi)
screen->color_mode = COLOR_YCBCR;
else
if (hdmi->colormode_input == HDMI_COLOR_RGB_0_255)
screen->color_mode = COLOR_RGB;
else
screen->color_mode = COLOR_YCBCR;
if (hdmi->vic & HDMI_VIDEO_YUV420)
screen->face = OUT_YUV_420;
else
@@ -451,7 +451,7 @@ static void hdmi_sort_modelist(struct hdmi_edid *edid, int feature)
if (vic == hdmi_mode[i].vic ||
vic == hdmi_mode[i].vic_2nd) {
if ((((feature & SUPPORT_TMDS_600M) == 0 &&
!(modelist->vic & HDMI_VIDEO_YUV420)) ||
!(modelist->vic & HDMI_VIDEO_YUV420)) ||
edid->maxtmdsclock < 340000000) &&
hdmi_mode[i].mode.pixclock > 340000000)
continue;

View File

@@ -330,6 +330,7 @@ enum rk_hdmi_feature {
SUPPORT_CEC = (1 << 9),
SUPPORT_HDCP = (1 << 10),
SUPPORT_HDCP2 = (1 << 11),
SUPPORT_YCBCR_INPUT = (1 << 12),
};
struct hdmi_property {
@@ -372,9 +373,9 @@ struct hdmi {
2 means mute audio,
1 means mute display;
0 is unmute*/
int colordepth;
int colormode;
int colordepth; /* Ouput color depth*/
int colormode; /* Ouput color mode*/
int colormode_input; /* Input color mode*/
struct hdmi_edid edid; /* EDID information*/
int enable; /* Enable flag*/
int sleep; /* Sleep flag*/

View File

@@ -416,7 +416,8 @@ static int rockchip_hdmiv2_probe(struct platform_device *pdev)
rk_hdmi_property.feature |=
SUPPORT_4K |
SUPPORT_4K_4096 |
SUPPORT_YUV420;
SUPPORT_YUV420 |
SUPPORT_YCBCR_INPUT;
}
hdmi_dev->hdmi =
rockchip_hdmi_register(&rk_hdmi_property, &rk_hdmi_ops);
@@ -442,8 +443,7 @@ static int rockchip_hdmiv2_probe(struct platform_device *pdev)
hdmi_dev->debugfs_dir,
hdmi_dev, &rockchip_hdmiv2_reg_fops);
#endif
if (rk_fb_get_display_policy() == DISPLAY_POLICY_BOX)
rk_display_device_enable(hdmi_dev->hdmi->ddev);
rk_display_device_enable(hdmi_dev->hdmi->ddev);
#ifndef HDMI_INT_USE_POLL
/* get and request the IRQ */

View File

@@ -39,22 +39,22 @@ enum {
16-235 output accroding
BT709 that is 10bit clolor
depth */
CSC_ITU601_16_235_TO_RGB_16_235_8BIT, /* YCbCr 16-235 input to RGB
16-235 output according
BT601 that is 8bit clolor
depth */
CSC_ITU709_16_235_TO_RGB_16_235_8BIT, /* YCbCr 16-235 input to RGB
16-235 output according
BT709 that is 8bit clolor
depth */
CSC_ITU601_16_235_TO_RGB_0_255_8BIT, /* YCbCr 16-235 input to RGB
0-255 output according
BT601 that is 8bit clolor
depth */
CSC_ITU709_16_235_TO_RGB_0_255_8BIT /* YCbCr 16-235 input to RGB
CSC_ITU709_16_235_TO_RGB_0_255_8BIT, /* YCbCr 16-235 input to RGB
0-255 output according
BT709 that is 8bit clolor
depth */
CSC_ITU601_16_235_TO_RGB_16_235_8BIT, /* YCbCr 16-235 input to RGB
16-235 output according
BT601 that is 8bit clolor
depth */
CSC_ITU709_16_235_TO_RGB_16_235_8BIT /* YCbCr 16-235 input to RGB
16-235 output according
BT709 that is 8bit clolor
depth */
};
#define HDMI_SCL_RATE (100*1000)