OSDN Git Service

drm/amd/display: Pass full 3x4 remap matrix for color transform
authorKrunoslav Kovac <Krunoslav.Kovac@amd.com>
Fri, 15 Dec 2017 22:58:45 +0000 (17:58 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 19 Feb 2018 19:17:22 +0000 (14:17 -0500)
Signed-off-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc_hw_types.h
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/inc/hw/transform.h

index 03029f7..1110408 100644 (file)
@@ -413,12 +413,14 @@ struct dc_cursor_mi_param {
 enum {
        GAMMA_RGB_256_ENTRIES = 256,
        GAMMA_RGB_FLOAT_1024_ENTRIES = 1024,
-       GAMMA_MAX_ENTRIES = 1024
+       GAMMA_CS_TFM_1D_ENTRIES = 4096,
+       GAMMA_MAX_ENTRIES = 4096
 };
 
 enum dc_gamma_type {
        GAMMA_RGB_256 = 1,
-       GAMMA_RGB_FLOAT_1024 = 2
+       GAMMA_RGB_FLOAT_1024 = 2,
+       GAMMA_CS_TFM_1D = 3,
 };
 
 struct dc_gamma {
index 0f662e6..2e5524f 100644 (file)
@@ -879,6 +879,7 @@ static void dce_transform_set_gamut_remap(
        const struct xfm_grph_csc_adjustment *adjust)
 {
        struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm);
+       int i = 0;
 
        if (adjust->gamut_adjust_type != GRAPHICS_GAMUT_ADJUST_TYPE_SW)
                /* Bypass if type is bypass or hw */
@@ -887,20 +888,8 @@ static void dce_transform_set_gamut_remap(
                struct fixed31_32 arr_matrix[GAMUT_MATRIX_SIZE];
                uint16_t arr_reg_val[GAMUT_MATRIX_SIZE];
 
-               arr_matrix[0] = adjust->temperature_matrix[0];
-               arr_matrix[1] = adjust->temperature_matrix[1];
-               arr_matrix[2] = adjust->temperature_matrix[2];
-               arr_matrix[3] = dal_fixed31_32_zero;
-
-               arr_matrix[4] = adjust->temperature_matrix[3];
-               arr_matrix[5] = adjust->temperature_matrix[4];
-               arr_matrix[6] = adjust->temperature_matrix[5];
-               arr_matrix[7] = dal_fixed31_32_zero;
-
-               arr_matrix[8] = adjust->temperature_matrix[6];
-               arr_matrix[9] = adjust->temperature_matrix[7];
-               arr_matrix[10] = adjust->temperature_matrix[8];
-               arr_matrix[11] = dal_fixed31_32_zero;
+               for (i = 0; i < GAMUT_MATRIX_SIZE; i++)
+                       arr_matrix[i] = adjust->temperature_matrix[i];
 
                convert_float_matrix(
                        arr_reg_val, arr_matrix, GAMUT_MATRIX_SIZE);
index 1a28938..d046212 100644 (file)
@@ -2121,6 +2121,7 @@ static void program_surface_visibility(const struct dc *dc,
 
 static void program_gamut_remap(struct pipe_ctx *pipe_ctx)
 {
+       int i = 0;
        struct xfm_grph_csc_adjustment adjust;
        memset(&adjust, 0, sizeof(adjust));
        adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS;
@@ -2128,33 +2129,10 @@ static void program_gamut_remap(struct pipe_ctx *pipe_ctx)
 
        if (pipe_ctx->stream->gamut_remap_matrix.enable_remap == true) {
                adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
-               adjust.temperature_matrix[0] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[0];
-               adjust.temperature_matrix[1] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[1];
-               adjust.temperature_matrix[2] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[2];
-               adjust.temperature_matrix[3] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[4];
-               adjust.temperature_matrix[4] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[5];
-               adjust.temperature_matrix[5] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[6];
-               adjust.temperature_matrix[6] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[8];
-               adjust.temperature_matrix[7] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[9];
-               adjust.temperature_matrix[8] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[10];
+
+               for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
+                       adjust.temperature_matrix[i] =
+                               pipe_ctx->stream->gamut_remap_matrix.matrix[i];
        }
 
        pipe_ctx->plane_res.xfm->funcs->transform_set_gamut_remap(pipe_ctx->plane_res.xfm, &adjust);
@@ -2195,33 +2173,10 @@ static void set_plane_config(
 
        if (pipe_ctx->stream->gamut_remap_matrix.enable_remap == true) {
                adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
-               adjust.temperature_matrix[0] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[0];
-               adjust.temperature_matrix[1] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[1];
-               adjust.temperature_matrix[2] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[2];
-               adjust.temperature_matrix[3] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[4];
-               adjust.temperature_matrix[4] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[5];
-               adjust.temperature_matrix[5] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[6];
-               adjust.temperature_matrix[6] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[8];
-               adjust.temperature_matrix[7] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[9];
-               adjust.temperature_matrix[8] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[10];
+
+               for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
+                       adjust.temperature_matrix[i] =
+                               pipe_ctx->stream->gamut_remap_matrix.matrix[i];
        }
 
        pipe_ctx->plane_res.xfm->funcs->transform_set_gamut_remap(pipe_ctx->plane_res.xfm, &adjust);
@@ -2689,33 +2644,10 @@ static void dce110_program_front_end_for_pipe(
 
        if (pipe_ctx->stream->gamut_remap_matrix.enable_remap == true) {
                adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
-               adjust.temperature_matrix[0] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[0];
-               adjust.temperature_matrix[1] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[1];
-               adjust.temperature_matrix[2] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[2];
-               adjust.temperature_matrix[3] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[4];
-               adjust.temperature_matrix[4] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[5];
-               adjust.temperature_matrix[5] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[6];
-               adjust.temperature_matrix[6] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[8];
-               adjust.temperature_matrix[7] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[9];
-               adjust.temperature_matrix[8] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[10];
+
+               for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
+                       adjust.temperature_matrix[i] =
+                               pipe_ctx->stream->gamut_remap_matrix.matrix[i];
        }
 
        pipe_ctx->plane_res.xfm->funcs->transform_set_gamut_remap(pipe_ctx->plane_res.xfm, &adjust);
index a5b0990..2482390 100644 (file)
@@ -193,6 +193,7 @@ void dpp1_cm_set_gamut_remap(
        const struct dpp_grph_csc_adjustment *adjust)
 {
        struct dcn10_dpp *dpp = TO_DCN10_DPP(dpp_base);
+       int i = 0;
 
        if (adjust->gamut_adjust_type != GRAPHICS_GAMUT_ADJUST_TYPE_SW)
                /* Bypass if type is bypass or hw */
@@ -201,20 +202,8 @@ void dpp1_cm_set_gamut_remap(
                struct fixed31_32 arr_matrix[12];
                uint16_t arr_reg_val[12];
 
-               arr_matrix[0] = adjust->temperature_matrix[0];
-               arr_matrix[1] = adjust->temperature_matrix[1];
-               arr_matrix[2] = adjust->temperature_matrix[2];
-               arr_matrix[3] = dal_fixed31_32_zero;
-
-               arr_matrix[4] = adjust->temperature_matrix[3];
-               arr_matrix[5] = adjust->temperature_matrix[4];
-               arr_matrix[6] = adjust->temperature_matrix[5];
-               arr_matrix[7] = dal_fixed31_32_zero;
-
-               arr_matrix[8] = adjust->temperature_matrix[6];
-               arr_matrix[9] = adjust->temperature_matrix[7];
-               arr_matrix[10] = adjust->temperature_matrix[8];
-               arr_matrix[11] = dal_fixed31_32_zero;
+               for (i = 0; i < 12; i++)
+                       arr_matrix[i] = adjust->temperature_matrix[i];
 
                convert_float_matrix(
                        arr_reg_val, arr_matrix, 12);
index 0f5a22e..77c4376 100644 (file)
@@ -1380,6 +1380,7 @@ static void dcn10_enable_plane(
 
 static void program_gamut_remap(struct pipe_ctx *pipe_ctx)
 {
+       int i = 0;
        struct dpp_grph_csc_adjustment adjust;
        memset(&adjust, 0, sizeof(adjust));
        adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS;
@@ -1387,33 +1388,9 @@ static void program_gamut_remap(struct pipe_ctx *pipe_ctx)
 
        if (pipe_ctx->stream->gamut_remap_matrix.enable_remap == true) {
                adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
-               adjust.temperature_matrix[0] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[0];
-               adjust.temperature_matrix[1] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[1];
-               adjust.temperature_matrix[2] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[2];
-               adjust.temperature_matrix[3] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[4];
-               adjust.temperature_matrix[4] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[5];
-               adjust.temperature_matrix[5] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[6];
-               adjust.temperature_matrix[6] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[8];
-               adjust.temperature_matrix[7] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[9];
-               adjust.temperature_matrix[8] =
-                               pipe_ctx->stream->
-                               gamut_remap_matrix.matrix[10];
+               for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
+                       adjust.temperature_matrix[i] =
+                               pipe_ctx->stream->gamut_remap_matrix.matrix[i];
        }
 
        pipe_ctx->plane_res.dpp->funcs->dpp_set_gamut_remap(pipe_ctx->plane_res.dpp, &adjust);
index 6f6c02b..c5b3623 100644 (file)
@@ -30,7 +30,7 @@
 #include "dc_hw_types.h"
 #include "fixed31_32.h"
 
-#define CSC_TEMPERATURE_MATRIX_SIZE 9
+#define CSC_TEMPERATURE_MATRIX_SIZE 12
 
 struct bit_depth_reduction_params;