Skip to content

Commit 5c41c02

Browse files
Stylon Wangalexdeucher
authored andcommitted
drm/amd/display: Support plane level CTM
[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 <[email protected]> Reviewed-by: Nicholas Kazlauskas <[email protected]> Acked-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 58edb07 commit 5c41c02

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,9 @@ static enum surface_update_type det_surface_update(const struct dc *dc,
17261726
if (u->coeff_reduction_factor)
17271727
update_flags->bits.coeff_reduction_change = 1;
17281728

1729+
if (u->gamut_remap_matrix)
1730+
update_flags->bits.gamut_remap_change = 1;
1731+
17291732
if (u->gamma) {
17301733
enum surface_pixel_format format = SURFACE_PIXEL_FORMAT_GRPH_BEGIN;
17311734

@@ -1751,7 +1754,8 @@ static enum surface_update_type det_surface_update(const struct dc *dc,
17511754

17521755
if (update_flags->bits.input_csc_change
17531756
|| update_flags->bits.coeff_reduction_change
1754-
|| update_flags->bits.gamma_change) {
1757+
|| update_flags->bits.gamma_change
1758+
|| update_flags->bits.gamut_remap_change) {
17551759
type = UPDATE_TYPE_FULL;
17561760
elevate_update_type(&overall_type, type);
17571761
}
@@ -1996,6 +2000,10 @@ static void copy_surface_update_to_plane(
19962000
if (srf_update->coeff_reduction_factor)
19972001
surface->coeff_reduction_factor =
19982002
*srf_update->coeff_reduction_factor;
2003+
2004+
if (srf_update->gamut_remap_matrix)
2005+
surface->gamut_remap_matrix =
2006+
*srf_update->gamut_remap_matrix;
19992007
}
20002008

20012009
static void copy_stream_update_to_stream(struct dc *dc,

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ union surface_update_flags {
726726
uint32_t output_tf_change:1;
727727
uint32_t pixel_format_change:1;
728728
uint32_t plane_size_change:1;
729+
uint32_t gamut_remap_change:1;
729730

730731
/* Full updates */
731732
uint32_t new_plane:1;
@@ -760,6 +761,7 @@ struct dc_plane_state {
760761
struct dc_csc_transform input_csc_color_matrix;
761762
struct fixed31_32 coeff_reduction_factor;
762763
struct fixed31_32 hdr_mult;
764+
struct colorspace_transform gamut_remap_matrix;
763765

764766
// TODO: No longer used, remove
765767
struct dc_hdr_static_metadata hdr_static_ctx;
@@ -839,6 +841,7 @@ struct dc_surface_update {
839841
const struct dc_transfer_func *func_shaper;
840842
const struct dc_3dlut *lut3d_func;
841843
const struct dc_transfer_func *blend_tf;
844+
const struct colorspace_transform *gamut_remap_matrix;
842845
};
843846

844847
/*

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,6 +2004,12 @@ void dcn10_program_gamut_remap(struct pipe_ctx *pipe_ctx)
20042004
for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
20052005
adjust.temperature_matrix[i] =
20062006
pipe_ctx->stream->gamut_remap_matrix.matrix[i];
2007+
} else if (pipe_ctx->plane_state &&
2008+
pipe_ctx->plane_state->gamut_remap_matrix.enable_remap == true) {
2009+
adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
2010+
for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
2011+
adjust.temperature_matrix[i] =
2012+
pipe_ctx->plane_state->gamut_remap_matrix.matrix[i];
20072013
}
20082014

20092015
pipe_ctx->plane_res.dpp->funcs->dpp_set_gamut_remap(pipe_ctx->plane_res.dpp, &adjust);

0 commit comments

Comments
 (0)