drm/amd/display: Internal refactoring to abstract color caps
[Why&How] modules/color calculates various colour operations which are translated to abstracted HW. DCE 5-12 had almost no important changes, but starting with DCN1, every new generation comes with fairly major differences in color pipeline. We would hack it with some DCN checks, but a better approach is to abstract color pipe capabilities so modules/DM can decide mapping to HW block based on logical capabilities, Signed-off-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com> Reviewed-by: Aric Cyr <Aric.Cyr@amd.com> Acked-by: Anthony Koo <Anthony.Koo@amd.com> Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -1782,7 +1782,8 @@ rgb_user_alloc_fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf,
|
||||
bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps,
|
||||
struct dc_transfer_func *input_tf,
|
||||
const struct dc_gamma *ramp, bool mapUserRamp)
|
||||
{
|
||||
struct dc_transfer_func_distributed_points *tf_pts = &input_tf->tf_pts;
|
||||
@@ -1801,11 +1802,29 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf,
|
||||
/* we can use hardcoded curve for plain SRGB TF
|
||||
* If linear, it's bypass if on user ramp
|
||||
*/
|
||||
if (input_tf->type == TF_TYPE_PREDEFINED &&
|
||||
(input_tf->tf == TRANSFER_FUNCTION_SRGB ||
|
||||
input_tf->tf == TRANSFER_FUNCTION_LINEAR) &&
|
||||
!mapUserRamp)
|
||||
return true;
|
||||
if (input_tf->type == TF_TYPE_PREDEFINED) {
|
||||
if ((input_tf->tf == TRANSFER_FUNCTION_SRGB ||
|
||||
input_tf->tf == TRANSFER_FUNCTION_LINEAR) &&
|
||||
!mapUserRamp)
|
||||
return true;
|
||||
|
||||
if (dc_caps != NULL &&
|
||||
dc_caps->dpp.dcn_arch == 1) {
|
||||
|
||||
if (input_tf->tf == TRANSFER_FUNCTION_PQ &&
|
||||
dc_caps->dpp.dgam_rom_caps.pq == 1)
|
||||
return true;
|
||||
|
||||
if (input_tf->tf == TRANSFER_FUNCTION_GAMMA22 &&
|
||||
dc_caps->dpp.dgam_rom_caps.gamma2_2 == 1)
|
||||
return true;
|
||||
|
||||
// HLG OOTF not accounted for
|
||||
if (input_tf->tf == TRANSFER_FUNCTION_HLG &&
|
||||
dc_caps->dpp.dgam_rom_caps.hlg == 1)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
input_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
|
||||
|
||||
|
@@ -30,6 +30,7 @@ struct dc_transfer_func;
|
||||
struct dc_gamma;
|
||||
struct dc_transfer_func_distributed_points;
|
||||
struct dc_rgb_fixed;
|
||||
struct dc_color_caps;
|
||||
enum dc_transfer_func_predefined;
|
||||
|
||||
/* For SetRegamma ADL interface support
|
||||
@@ -100,7 +101,8 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
|
||||
const struct dc_gamma *ramp, bool mapUserRamp, bool canRomBeUsed,
|
||||
const struct freesync_hdr_tf_params *fs_params);
|
||||
|
||||
bool mod_color_calculate_degamma_params(struct dc_transfer_func *output_tf,
|
||||
bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps,
|
||||
struct dc_transfer_func *output_tf,
|
||||
const struct dc_gamma *ramp, bool mapUserRamp);
|
||||
|
||||
bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans,
|
||||
|
Reference in New Issue
Block a user