hdr: fix hdr color abnormal

PD#171738: hdr: fix hdr color abnormal

1. lcd send hdr flag according to panel config
2. 32bit revert

Change-Id: I6865d76e69acd504911dfa2ff30ab13e2cd8431d
Signed-off-by: MingLiang Dong <mingliang.dong@amlogic.com>
This commit is contained in:
MingLiang Dong
2018-08-28 15:34:20 +08:00
committed by Jianxin Pan
parent eda9b6d1ac
commit d7299a9fa9
2 changed files with 9 additions and 28 deletions

View File

@@ -3643,8 +3643,6 @@ enum vpp_matrix_csc_e get_csc_type(void)
/* smpte st-2084 */
if (signal_color_primaries != 9)
pr_csc("\tWARNING: non-standard HDR!!!\n");
if (signal_range == 0)
pr_csc("\tWARNING: full range HDR!!!\n");
csc_type = VPP_MATRIX_BT2020YUV_BT2020RGB;
} else if (signal_transfer_characteristic == 14) {
/* bt2020-10 */
@@ -3730,28 +3728,21 @@ static void mtx_dot_mul(
int64_t (*out)[3], int32_t norm)
{
int i, j;
int64_t tmp;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++) {
tmp = a[i][j] * b[i][j] + (norm >> 1);
div_s64(tmp, norm);
out[i][j] = tmp;
}
for (j = 0; j < 3; j++)
out[i][j] = (a[i][j] * b[i][j] + (norm >> 1)) / norm;
}
static void mtx_mul(int64_t (*a)[3], int64_t *b, int64_t *out, int32_t norm)
{
int j, k;
int64_t tmp;
for (j = 0; j < 3; j++) {
out[j] = 0;
for (k = 0; k < 3; k++)
out[j] += a[k][j] * b[k];
tmp = out[j] + (norm >> 1);
div_s64(tmp, norm);
out[j] = tmp;
out[j] = (out[j] + (norm >> 1)) / norm;
}
}
@@ -3760,16 +3751,13 @@ static void mtx_mul_mtx(
int64_t (*out)[3], int32_t norm)
{
int i, j, k;
int64_t tmp;
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++) {
out[i][j] = 0;
for (k = 0; k < 3; k++)
out[i][j] += a[k][j] * b[i][k];
tmp = out[i][j] + (norm >> 1);
div_s64(tmp, norm);
out[i][j] = tmp;
out[i][j] = (out[i][j] + (norm >> 1)) / norm;
}
}
@@ -3779,7 +3767,6 @@ static void inverse_3x3(
{
int i, j;
int64_t determinant = 0;
int64_t tmp;
for (i = 0; i < 3; i++)
determinant +=
@@ -3794,9 +3781,8 @@ static void inverse_3x3(
out[j][i] -= (in[(i + 1) % 3][(j + 2) % 3]
* in[(i + 2) % 3][(j + 1) % 3]);
out[j][i] = (out[j][i] * norm) << (obl - 1);
tmp = out[j][i] + (determinant >> 1);
div_s64(tmp, determinant);
out[j][i] = tmp;
out[j][i] =
(out[j][i] + (determinant >> 1)) / determinant;
}
}
}
@@ -3812,7 +3798,6 @@ static void calc_T(
int64_t C[3];
int64_t D[3][3];
int64_t E[3][3];
int64_t tmp;
for (i = 0; i < 4; i++)
z[i] = norm - prmy[i][0] - prmy[i][1];
@@ -3822,13 +3807,9 @@ static void calc_T(
A[i][j] = prmy[i][j];
A[i][2] = z[i];
}
tmp = norm * prmy[3][0] * 2;
div_s64(tmp, prmy[3][1]);
B[0] = (tmp + 1) >> 1;
B[0] = ((int64_t)norm * prmy[3][0] * 2 / prmy[3][1] + 1) >> 1;
B[1] = norm;
tmp = norm * z[3] * 2;
div_s64(tmp, prmy[3][1]);
B[2] = (tmp + 1) >> 1;
B[2] = (norm * z[3] * 2 / prmy[3][1] + 1) >> 1;
inverse_3x3(A, D, norm, obl);
mtx_mul(D, B, C, norm);
for (i = 0; i < 3; i++)

View File

@@ -687,7 +687,7 @@ void lcd_optical_vinfo_update(void)
pconf = lcd_drv->lcd_config;
disp_vinfo = &lcd_drv->lcd_info->master_display_info;
disp_vinfo->present_flag = 1; /* valid parameters */
disp_vinfo->present_flag = pconf->optical_info.hdr_support;
disp_vinfo->features = pconf->optical_info.features;
disp_vinfo->primaries[0][0] = pconf->optical_info.primaries_g_x;
disp_vinfo->primaries[0][1] = pconf->optical_info.primaries_g_y;