]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display: Support plane level CTM
authorStylon Wang <stylon.wang@amd.com>
Tue, 10 Mar 2020 19:09:29 +0000 (15:09 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 31 Mar 2020 16:26:14 +0000 (12:26 -0400)
[Why]
CTM was only supported at CRTC level and we need color space conversion
in linear space at plane level.

[How]
- Add plane-level CTM to dc interface
- Program plane-level CTM in DCN

Signed-off-by: Stylon Wang <stylon.wang@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@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/dc.h
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c

index 1a2c2e3dd6d2aea78a4b2a3ea9677b205c02aedc..f21bbb295ad31b9fe978a571440d767b5d1d732b 100644 (file)
@@ -1726,6 +1726,9 @@ static enum surface_update_type det_surface_update(const struct dc *dc,
        if (u->coeff_reduction_factor)
                update_flags->bits.coeff_reduction_change = 1;
 
+       if (u->gamut_remap_matrix)
+               update_flags->bits.gamut_remap_change = 1;
+
        if (u->gamma) {
                enum surface_pixel_format format = SURFACE_PIXEL_FORMAT_GRPH_BEGIN;
 
@@ -1751,7 +1754,8 @@ static enum surface_update_type det_surface_update(const struct dc *dc,
 
        if (update_flags->bits.input_csc_change
                        || update_flags->bits.coeff_reduction_change
-                       || update_flags->bits.gamma_change) {
+                       || update_flags->bits.gamma_change
+                       || update_flags->bits.gamut_remap_change) {
                type = UPDATE_TYPE_FULL;
                elevate_update_type(&overall_type, type);
        }
@@ -1996,6 +2000,10 @@ static void copy_surface_update_to_plane(
        if (srf_update->coeff_reduction_factor)
                surface->coeff_reduction_factor =
                        *srf_update->coeff_reduction_factor;
+
+       if (srf_update->gamut_remap_matrix)
+               surface->gamut_remap_matrix =
+                       *srf_update->gamut_remap_matrix;
 }
 
 static void copy_stream_update_to_stream(struct dc *dc,
index d3ceb39e428efa0069166179bb9d31941e4c35cd..1935cf6601ebd03bb6dbd06689343fe82d9efe1a 100644 (file)
@@ -726,6 +726,7 @@ union surface_update_flags {
                uint32_t output_tf_change:1;
                uint32_t pixel_format_change:1;
                uint32_t plane_size_change:1;
+               uint32_t gamut_remap_change:1;
 
                /* Full updates */
                uint32_t new_plane:1;
@@ -760,6 +761,7 @@ struct dc_plane_state {
        struct dc_csc_transform input_csc_color_matrix;
        struct fixed31_32 coeff_reduction_factor;
        struct fixed31_32 hdr_mult;
+       struct colorspace_transform gamut_remap_matrix;
 
        // TODO: No longer used, remove
        struct dc_hdr_static_metadata hdr_static_ctx;
@@ -839,6 +841,7 @@ struct dc_surface_update {
        const struct dc_transfer_func *func_shaper;
        const struct dc_3dlut *lut3d_func;
        const struct dc_transfer_func *blend_tf;
+       const struct colorspace_transform *gamut_remap_matrix;
 };
 
 /*
index 9cc3314966bd158d596d04273867768ea414eb07..0be0100855754a187eedb7bbfbc9e8fb545fa9ba 100644 (file)
@@ -2004,6 +2004,12 @@ void dcn10_program_gamut_remap(struct pipe_ctx *pipe_ctx)
                for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
                        adjust.temperature_matrix[i] =
                                pipe_ctx->stream->gamut_remap_matrix.matrix[i];
+       } else if (pipe_ctx->plane_state &&
+                  pipe_ctx->plane_state->gamut_remap_matrix.enable_remap == true) {
+               adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
+               for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
+                       adjust.temperature_matrix[i] =
+                               pipe_ctx->plane_state->gamut_remap_matrix.matrix[i];
        }
 
        pipe_ctx->plane_res.dpp->funcs->dpp_set_gamut_remap(pipe_ctx->plane_res.dpp, &adjust);