drm/amd/display: Integrate color transform3x4 with 3dlut tm
authorVitaly Prosyak <vitaly.prosyak@amd.com>
Thu, 18 Apr 2019 14:51:12 +0000 (09:51 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Sat, 22 Jun 2019 14:34:12 +0000 (09:34 -0500)
[Why & How]
Reuse existent code path (dcn1+) and in order to do that apply de gamma
in 1D blender LUT and re use MPC OGAM.
Follow up is required.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Vitaly Prosyak <Vitaly.Prosyak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/core/dc_surface.c
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/modules/inc/mod_shared.h

index 6abf22aaf57155a5f6ac165bcdff22efbaf1cf87..867a84c2bfbf43e03d90378a785dd408fde88396 100644 (file)
@@ -1669,6 +1669,13 @@ static void copy_surface_update_to_plane(
                        srf_update->lut3d_func))
                memcpy(surface->lut3d_func, srf_update->lut3d_func,
                sizeof(*surface->lut3d_func));
+
+       if (srf_update->blend_tf &&
+                       (surface->blend_tf !=
+                       srf_update->blend_tf))
+               memcpy(surface->blend_tf, srf_update->blend_tf,
+               sizeof(*surface->blend_tf));
+
 #endif
        if (srf_update->input_csc_color_matrix)
                surface->input_csc_color_matrix =
index 60f20d96f9e0257003c0a9f464c6ac96226aa262..394a879816144ec900eb7157b1cc2c37b3f7adc7 100644 (file)
@@ -60,6 +60,11 @@ static void construct(struct dc_context *ctx, struct dc_plane_state *plane_state
                plane_state->lut3d_func->ctx = ctx;
                plane_state->lut3d_func->initialized = false;
        }
+       plane_state->blend_tf = dc_create_transfer_func();
+       if (plane_state->blend_tf != NULL) {
+               plane_state->blend_tf->type = TF_TYPE_BYPASS;
+               plane_state->blend_tf->ctx = ctx;
+       }
 
 #endif
 }
@@ -85,6 +90,11 @@ static void destruct(struct dc_plane_state *plane_state)
                                plane_state->lut3d_func);
                plane_state->lut3d_func = NULL;
        }
+       if (plane_state->blend_tf != NULL) {
+               dc_transfer_func_release(
+                               plane_state->blend_tf);
+               plane_state->blend_tf = NULL;
+       }
 
 #endif
 }
index 139ea7354910d5357a1a0df2bccf17fab13c5f93..53a3876841cc50c32abbec3a7035aa78c21478a9 100644 (file)
@@ -761,6 +761,7 @@ struct dc_surface_update {
 #if defined(CONFIG_DRM_AMD_DC_DCN2_0)
        const struct dc_transfer_func *func_shaper;
        const struct dc_3dlut *lut3d_func;
+       const struct dc_transfer_func *blend_tf;
 #endif
 };
 
index 6c877eeba4297c27f01bb0db96e3182585e22096..b45f7d65e76a8a197f2d3dadfc126e91993c6e0f 100644 (file)
@@ -64,7 +64,8 @@ union lut3d_control_flags {
                unsigned int use_gamut_map_lib                                  :1;
                unsigned int chromatic_adaptation_src                           :1;
                unsigned int chromatic_adaptation_dst                           :1;
-               unsigned int reseved                                    :5;
+               unsigned int do_blender_lut_degamma             :1;
+               unsigned int reseved                                    :4;
        } bits;
 };
 
@@ -78,8 +79,8 @@ enum lut3d_control_gamut_map {
        lut3d_control_gamut_map_none = 0,
        lut3d_control_gamut_map_tonemap,
        lut3d_control_gamut_map_chto,
-       lut3d_control_gamut_map_chto_chso,
-       lut3d_control_gamut_map_chto_chci
+       lut3d_control_gamut_map_chso,
+       lut3d_control_gamut_map_chci
 };
 
 enum lut3d_control_rotation_mode {