[RAMEN9610-10495] fbdev: dpu20: modified dqe for supporting boosted in aosp colors
authorChiHun Won <chihun.won@samsung.com>
Tue, 8 Jan 2019 06:21:11 +0000 (15:21 +0900)
committerhskang <hs1218.kang@samsung.com>
Tue, 8 Jan 2019 08:05:04 +0000 (17:05 +0900)
Change-Id: I8f87b23a646eec2c231ea08b86a4ef54e0478fa0
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
drivers/video/fbdev/exynos/dpu20/dqe.h
drivers/video/fbdev/exynos/dpu20/dqe_drv.c

index 51fe116b318de4ed7b0032de8dd239f480a58c75..b72a265dd1119106e66b66f8fe226bd1b38b5fda 100644 (file)
@@ -89,6 +89,7 @@ struct dqe_ctx {
        bool need_udpate;
        u32 color_mode;
        u32 night_light_on;
+       u32 boosted_on;
 };
 
 struct dqe_device {
index 5c9d6bdde603f1f5da6c50f62717d344b618be18..dc2651e2c1b36d1d440a14786520e35b05b59cad 100644 (file)
@@ -996,19 +996,19 @@ static ssize_t decon_dqe_aosp_colors_store(struct device *dev, struct device_att
 
        case 1:/* Boosted */
                for (i = 0; i < 50; i++)
-                       cgc_lut[i] = tune_mode[1][i];
+                       cgc_lut[i] = tune_mode[2][i];
                for (i = 0; i < 35; i++)
-                       hsc_lut[i] = tune_mode[1][i + 245];
+                       hsc_lut[i] = tune_mode[2][i + 245];
                break;
 
        case 2:/* Saturated */
                for (i = 0; i < 50; i++)
-                       cgc_lut[i] = tune_mode[2][i];
+                       cgc_lut[i] = tune_mode[3][i];
                for (i = 0; i < 35; i++)
-                       hsc_lut[i] = tune_mode[2][i + 245];
+                       hsc_lut[i] = tune_mode[3][i + 245];
                break;
 
-       case 90:/* mode0 */
+       case 90:/* mode0 (bypass) */
                for (i = 0; i < 50; i++)
                        cgc_lut[i] = tune_mode[0][i];
                for (i = 0; i < 35; i++)
@@ -1110,20 +1110,21 @@ int decon_dqe_set_color_mode(struct decon_color_mode_with_render_intent_info *mo
 
        switch (mode->color_mode) {
        case HAL_COLOR_MODE_SRGB:
-               for (i = 0; i < 50; i++)
-                       cgc_lut[i] = tune_mode[1][i];
-               for (i = 0; i < 35; i++)
-                       hsc_lut[i] = tune_mode[1][i + 245];
+       case HAL_COLOR_MODE_DCI_P3:
+               if (dqe->ctx.boosted_on) {
+                       for (i = 0; i < 50; i++)
+                               cgc_lut[i] = tune_mode[2][i];
+                       for (i = 0; i < 35; i++)
+                               hsc_lut[i] = tune_mode[2][i + 245];
+               } else {
+                       for (i = 0; i < 50; i++)
+                               cgc_lut[i] = tune_mode[1][i];
+                       for (i = 0; i < 35; i++)
+                               hsc_lut[i] = tune_mode[1][i + 245];
+               }
                break;
 
        case HAL_COLOR_MODE_NATIVE:
-               for (i = 0; i < 50; i++)
-                       cgc_lut[i] = tune_mode[2][i];
-               for (i = 0; i < 35; i++)
-                       hsc_lut[i] = tune_mode[2][i + 245];
-               break;
-
-       case HAL_COLOR_MODE_DCI_P3:
                for (i = 0; i < 50; i++)
                        cgc_lut[i] = tune_mode[3][i];
                for (i = 0; i < 35; i++)
@@ -1202,6 +1203,8 @@ int decon_dqe_set_color_transform(struct decon_color_transform_info *transform)
 
        mutex_lock(&dqe->lock);
 
+       dqe->ctx.boosted_on = 0;
+
        if (decon) {
                if ((decon->state == DECON_STATE_OFF) ||
                        (decon->state == DECON_STATE_INIT)) {
@@ -1222,6 +1225,8 @@ int decon_dqe_set_color_transform(struct decon_color_transform_info *transform)
                for (i = 0; i < 16; i++)
                        if (transform->matrix[i] == -1 || transform->matrix[i] == 1)
                                transform->matrix[i] = 0;
+
+               dqe->ctx.boosted_on = 1;
        }
 
        for (i = 0; i < 16; i++) {
@@ -1250,6 +1255,25 @@ int decon_dqe_set_color_transform(struct decon_color_transform_info *transform)
        else
                dqe->ctx.night_light_on = 1;
 
+       if (dqe->ctx.color_mode == HAL_COLOR_MODE_SRGB ||
+               dqe->ctx.color_mode == HAL_COLOR_MODE_DCI_P3) {
+               if (dqe->ctx.boosted_on) {
+                       for (i = 0; i < 50; i++)
+                               cgc_lut[i] = tune_mode[2][i];
+                       for (i = 0; i < 35; i++)
+                               hsc_lut[i] = tune_mode[2][i + 245];
+               } else {
+                       for (i = 0; i < 50; i++)
+                               cgc_lut[i] = tune_mode[1][i];
+                       for (i = 0; i < 35; i++)
+                               hsc_lut[i] = tune_mode[1][i + 245];
+               }
+               dqe_cgc_lut_set();
+               dqe_hsc_lut_set();
+               dqe->ctx.cgc_on = DQE_CGC_ON_MASK;
+               dqe->ctx.hsc_on = DQE_HSC_ON_MASK;
+       }
+
        for (i = 0; i < 3; i++)
                for (j = 0; j < 65; j++)
                        gamma_lut[i][j] = bypass_gamma_tune[i][j];
@@ -1282,8 +1306,8 @@ int decon_dqe_set_color_transform(struct decon_color_transform_info *transform)
 err:
        mutex_unlock(&dqe->lock);
 
-       dqe_info("%s : ret=%d color_mode=%d, hint=%d\n",
-               __func__,ret , dqe->ctx.color_mode, transform->hint);
+       dqe_info("%s : ret=%d color_mode=%d, hint=%d, boosted=%d\n",
+               __func__,ret , dqe->ctx.color_mode, transform->hint, dqe->ctx.boosted_on);
 
        return ret;
 }