hdmitx: optimize 'valid_mode' checking

PD#138714: hdmitx: optimize 'valid_mode' checking
Pick from PD#139639.
For Y420 modes, only 4k50/60hz modes have this colorspace.
Forbidden for any other hdmi modes.

Change-Id: Ib929b55c68a6c2f535fb576ebe98254e464c1daa
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
This commit is contained in:
Zongdong Jiao
2017-03-22 11:15:46 +08:00
committed by Jianxin Pan
parent 4a20e1b118
commit a2faea7dc9
2 changed files with 28 additions and 2 deletions

View File

@@ -1430,10 +1430,10 @@ struct hdmi_format_para *hdmi_get_fmt_name(char const *name, char const *attr)
int i;
char *lname;
enum hdmi_vic vic = HDMI_Unknown;
struct hdmi_format_para *para = NULL;
struct hdmi_format_para *para = &fmt_para_non_hdmi_fmt;
if (!name)
return NULL;
return para;
for (i = 0; all_fmt_paras[i]; i++) {
lname = all_fmt_paras[i]->name;
@@ -1461,6 +1461,23 @@ struct hdmi_format_para *hdmi_get_fmt_name(char const *name, char const *attr)
}
if (strstr(name, "420"))
para->cs = COLORSPACE_YUV420;
/* only 2160p60/50hz smpte60/50hz have Y420 mode */
if (para->cs == COLORSPACE_YUV420) {
switch ((para->vic) & 0xff) {
case HDMI_3840x2160p50_16x9:
case HDMI_3840x2160p60_16x9:
case HDMI_4096x2160p50_256x135:
case HDMI_4096x2160p60_256x135:
case HDMI_3840x2160p50_64x27:
case HDMI_3840x2160p60_64x27:
break;
default:
para = &fmt_para_non_hdmi_fmt;
break;
}
}
return para;
}

View File

@@ -447,6 +447,15 @@ static int set_disp_mode_auto(void)
}
}
/* In the file hdmi_common/hdmi_parameters.c,
* the data array all_fmt_paras[] treat 2160p60hz and 2160p60hz420
* as two different modes, such Scrambler
* So if node "attr" contains 420, need append 420 to mode.
*/
if (strstr(fmt_attr, "420")) {
if (!strstr(mode, "420"))
strncat(mode, "420", 3);
}
para = hdmi_get_fmt_name(mode, fmt_attr);
hdev->para = para;
/* msleep(500); */