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 <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>
This commit is contained in:
committed by
Alex Deucher
parent
58edb07910
commit
5c41c023f8
@@ -1726,6 +1726,9 @@ static enum surface_update_type det_surface_update(const struct dc *dc,
|
|||||||
if (u->coeff_reduction_factor)
|
if (u->coeff_reduction_factor)
|
||||||
update_flags->bits.coeff_reduction_change = 1;
|
update_flags->bits.coeff_reduction_change = 1;
|
||||||
|
|
||||||
|
if (u->gamut_remap_matrix)
|
||||||
|
update_flags->bits.gamut_remap_change = 1;
|
||||||
|
|
||||||
if (u->gamma) {
|
if (u->gamma) {
|
||||||
enum surface_pixel_format format = SURFACE_PIXEL_FORMAT_GRPH_BEGIN;
|
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
|
if (update_flags->bits.input_csc_change
|
||||||
|| update_flags->bits.coeff_reduction_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;
|
type = UPDATE_TYPE_FULL;
|
||||||
elevate_update_type(&overall_type, type);
|
elevate_update_type(&overall_type, type);
|
||||||
}
|
}
|
||||||
@@ -1996,6 +2000,10 @@ static void copy_surface_update_to_plane(
|
|||||||
if (srf_update->coeff_reduction_factor)
|
if (srf_update->coeff_reduction_factor)
|
||||||
surface->coeff_reduction_factor =
|
surface->coeff_reduction_factor =
|
||||||
*srf_update->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,
|
static void copy_stream_update_to_stream(struct dc *dc,
|
||||||
|
|||||||
@@ -726,6 +726,7 @@ union surface_update_flags {
|
|||||||
uint32_t output_tf_change:1;
|
uint32_t output_tf_change:1;
|
||||||
uint32_t pixel_format_change:1;
|
uint32_t pixel_format_change:1;
|
||||||
uint32_t plane_size_change:1;
|
uint32_t plane_size_change:1;
|
||||||
|
uint32_t gamut_remap_change:1;
|
||||||
|
|
||||||
/* Full updates */
|
/* Full updates */
|
||||||
uint32_t new_plane:1;
|
uint32_t new_plane:1;
|
||||||
@@ -760,6 +761,7 @@ struct dc_plane_state {
|
|||||||
struct dc_csc_transform input_csc_color_matrix;
|
struct dc_csc_transform input_csc_color_matrix;
|
||||||
struct fixed31_32 coeff_reduction_factor;
|
struct fixed31_32 coeff_reduction_factor;
|
||||||
struct fixed31_32 hdr_mult;
|
struct fixed31_32 hdr_mult;
|
||||||
|
struct colorspace_transform gamut_remap_matrix;
|
||||||
|
|
||||||
// TODO: No longer used, remove
|
// TODO: No longer used, remove
|
||||||
struct dc_hdr_static_metadata hdr_static_ctx;
|
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_transfer_func *func_shaper;
|
||||||
const struct dc_3dlut *lut3d_func;
|
const struct dc_3dlut *lut3d_func;
|
||||||
const struct dc_transfer_func *blend_tf;
|
const struct dc_transfer_func *blend_tf;
|
||||||
|
const struct colorspace_transform *gamut_remap_matrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -2004,6 +2004,12 @@ void dcn10_program_gamut_remap(struct pipe_ctx *pipe_ctx)
|
|||||||
for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
|
for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
|
||||||
adjust.temperature_matrix[i] =
|
adjust.temperature_matrix[i] =
|
||||||
pipe_ctx->stream->gamut_remap_matrix.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);
|
pipe_ctx->plane_res.dpp->funcs->dpp_set_gamut_remap(pipe_ctx->plane_res.dpp, &adjust);
|
||||||
|
|||||||
Reference in New Issue
Block a user