[RAMEN9610-10033] fbdev: dpu20: added exception for checking diagonal matrix
authorChiHun Won <chihun.won@samsung.com>
Thu, 27 Dec 2018 01:32:59 +0000 (10:32 +0900)
committerhskang <hs1218.kang@samsung.com>
Fri, 28 Dec 2018 09:55:34 +0000 (18:55 +0900)
Change-Id: If3dceec7047aaf537677656ec532d1e23f2c5483
Signed-off-by: ChiHun Won <chihun.won@samsung.com>
drivers/video/fbdev/exynos/dpu20/decon_core.c
drivers/video/fbdev/exynos/dpu20/dqe_drv.c

index 202580c7b00165167c17bf5a1c2b6197522fd49d..f57ab7b4f20ddf1c488f3d9746729648f47a4a3c 100644 (file)
@@ -3067,7 +3067,7 @@ static int decon_ioctl(struct fb_info *info, unsigned int cmd,
                decon_dbg("DQE: EXYNOS_SET_COLOR_MOE_WITH_RENDER_INTENT: %d %d\n",
                        cm_intent_info.color_mode, cm_intent_info.render_intent);
 #if defined(CONFIG_EXYNOS_DECON_DQE)
-               decon_dqe_set_color_mode(&cm_intent_info);
+               ret = decon_dqe_set_color_mode(&cm_intent_info);
 #endif
                break;
 
@@ -3080,7 +3080,7 @@ static int decon_ioctl(struct fb_info *info, unsigned int cmd,
 
                decon_dbg("DQE: EXYNOS_SET_COLOR_TRANSFORM: %d\n", transform_info.hint);
 #if defined(CONFIG_EXYNOS_DECON_DQE)
-               decon_dqe_set_color_transform(&transform_info);
+               ret = decon_dqe_set_color_transform(&transform_info);
 #endif
                break;
 
index aeeb9982b5c2dbb9c46f4772496b52ba39787d59..b281fc36fcb2b21e01b3df1a512530b55a870966 100644 (file)
@@ -1189,9 +1189,10 @@ int decon_dqe_set_color_transform(struct decon_color_transform_info *transform)
 {
        int ret = 0;
        int i, j;
-       int temp[16];
+       int input[16], temp[16];
        struct dqe_device *dqe = dqe_drvdata;
        struct decon_device *decon = get_decon_drvdata(0);
+       int diag_matrix[16] = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
 
        mutex_lock(&dqe->lock);
 
@@ -1199,38 +1200,53 @@ int decon_dqe_set_color_transform(struct decon_color_transform_info *transform)
                if ((decon->state == DECON_STATE_OFF) ||
                        (decon->state == DECON_STATE_INIT)) {
                        dqe_err("decon is not enabled!(%d)\n", decon->state);
-                       ret = -1;
                        goto err;
                }
        } else {
                dqe_err("decon is NULL!\n");
-               ret = -1;
                goto err;
        }
 
        if (transform->matrix[0] != 65536/*transform->hint*/) {
                for (i = 0; i < 16; i++)
-                       dqe_dbg("matrix[%d] = %d\n", i, transform->matrix[i]);
-
-               for (i = 0; i < 16; i++)
-                       temp[i] = transform->matrix[i];
+                       input[i] = temp[i] = transform->matrix[i];
 
                dqe_color_transform_night_light(temp, transform->matrix);
 
                for (i = 0; i < 16; i++)
-                       dqe_dbg("night[%d] = %d\n", i, transform->matrix[i]);
+                       if (transform->matrix[i] == -1 || transform->matrix[i] == 1)
+                               transform->matrix[i] = 0;
+       }
+
+       for (i = 0; i < 16; i++) {
+               if (transform->matrix[i] && diag_matrix[i])
+                       continue;
+               if (!transform->matrix[i] && !diag_matrix[i])
+                       continue;
+
+               for (j = 0; j < 4; j++)
+                       dqe_info("%6d %6d %6d %6d\n",
+                               input[j * 4], input[j * 4 + 1],
+                               input[j * 4 + 2], input[j * 4 + 3]);
+               for (j = 0; j < 4; j++)
+                       dqe_info("%6d %6d %6d %6d\n",
+                               transform->matrix[j * 4], transform->matrix[j * 4 + 1],
+                               transform->matrix[j * 4 + 2], transform->matrix[j * 4 + 3]);
+               ret = -1;
+               goto err;
        }
 
        if (transform->matrix[0] == 65536 &&
                transform->matrix[5] == 65536 &&
-               transform->matrix[10] == 65536)
+               transform->matrix[10] == 65536 &&
+               transform->matrix[15] == 65536)
                dqe->ctx.night_light_on = 0;
        else
                dqe->ctx.night_light_on = 1;
 
-               for (i = 0; i < 3; i++)
-                       for (j = 0; j < 65; j++)
-                               gamma_lut[i][j] = bypass_gamma_tune[i][j];
+       for (i = 0; i < 3; i++)
+               for (j = 0; j < 65; j++)
+                       gamma_lut[i][j] = bypass_gamma_tune[i][j];
 
        for (j = 0; j < 65; j++) {
                int inR, inG, inB, outR, outG, outB;