From dffc4ee3af58eb1f31ade966ec57232a27b4d653 Mon Sep 17 00:00:00 2001 From: Krunoslav Kovac Date: Wed, 9 Dec 2015 11:19:01 -0500 Subject: [PATCH 0604/1110] drm/amd/dal: Fix regamma code path [Description] Fix the logic in dal3 for enabling regamma, so that regamma can be applied correctly. Signed-off-by: Harry Wentland Acked-by: Harry Wentland --- drivers/gpu/drm/amd/dal/dc/core/dc_target.c | 6 +- .../gpu/drm/amd/dal/dc/dce110/dce110_opp_regamma.c | 64 +++++++++++----------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_target.c b/drivers/gpu/drm/amd/dal/dc/core/dc_target.c index 6e89050..9ae98c5 100644 --- a/drivers/gpu/drm/amd/dal/dc/core/dc_target.c +++ b/drivers/gpu/drm/amd/dal/dc/core/dc_target.c @@ -142,7 +142,7 @@ static void build_gamma_params( gamma_param->regamma_adjust_type = GRAPHICS_REGAMMA_ADJUST_SW; gamma_param->degamma_adjust_type = GRAPHICS_REGAMMA_ADJUST_SW; - gamma_param->selected_gamma_lut = GRAPHICS_GAMMA_LUT_LEGACY; + gamma_param->selected_gamma_lut = GRAPHICS_GAMMA_LUT_REGAMMA; /* TODO support non-legacy gamma */ gamma_param->disable_adjustments = false; @@ -151,8 +151,8 @@ static void build_gamma_params( gamma_param->flag.bits.gamma_update = 1; /* Set regamma */ - gamma_param->regamma.features.bits.GRAPHICS_DEGAMMA_SRGB = 0; - gamma_param->regamma.features.bits.OVERLAY_DEGAMMA_SRGB = 0; + gamma_param->regamma.features.bits.GRAPHICS_DEGAMMA_SRGB = 1; + gamma_param->regamma.features.bits.OVERLAY_DEGAMMA_SRGB = 1; gamma_param->regamma.features.bits.GAMMA_RAMP_ARRAY = 0; gamma_param->regamma.features.bits.APPLY_DEGAMMA = 0; diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_opp_regamma.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_opp_regamma.c index 4cba172..cf116f1 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_opp_regamma.c +++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_opp_regamma.c @@ -1027,42 +1027,42 @@ static bool build_regamma_curve( uint32_t i; - if (!params->regamma.features.bits.GAMMA_RAMP_ARRAY && - params->regamma.features.bits.APPLY_DEGAMMA) { - struct gamma_coefficients coeff; + struct gamma_coefficients coeff; - struct hw_x_point *coord_x = - opp110->regamma.coordinates_x; + struct hw_x_point *coord_x = + opp110->regamma.coordinates_x; - build_regamma_coefficients( - ¶ms->regamma, - params->regamma.features.bits.GRAPHICS_DEGAMMA_SRGB, - &coeff); - - /* Use opp110->regamma.coordinates_x to retrieve - * coordinates chosen base on given user curve (future task). - * The x values are exponentially distributed and currently - * it is hard-coded, the user curve shape is ignored. - * The future task is to recalculate opp110- - * regamma.coordinates_x based on input/user curve, - * translation from 256/1025 to 128 pwl points. - */ + build_regamma_coefficients( + ¶ms->regamma, + params->regamma.features.bits.GRAPHICS_DEGAMMA_SRGB, + &coeff); - i = 0; + /* Use opp110->regamma.coordinates_x to retrieve + * coordinates chosen base on given user curve (future task). + * The x values are exponentially distributed and currently + * it is hard-coded, the user curve shape is ignored. + * The future task is to recalculate opp110- + * regamma.coordinates_x based on input/user curve, + * translation from 256/1025 to 128 pwl points. + */ - while (i != opp110->regamma.hw_points_num + 1) { - rgb->r = translate_from_linear_space_ex( - coord_x->adjusted_x, &coeff, 0); - rgb->g = translate_from_linear_space_ex( - coord_x->adjusted_x, &coeff, 1); - rgb->b = translate_from_linear_space_ex( - coord_x->adjusted_x, &coeff, 2); - - ++coord_x; - ++rgb; - ++i; - } - } else { + i = 0; + + while (i != opp110->regamma.hw_points_num + 1) { + rgb->r = translate_from_linear_space_ex( + coord_x->adjusted_x, &coeff, 0); + rgb->g = translate_from_linear_space_ex( + coord_x->adjusted_x, &coeff, 1); + rgb->b = translate_from_linear_space_ex( + coord_x->adjusted_x, &coeff, 2); + + ++coord_x; + ++rgb; + ++i; + } + + if (params->regamma.features.bits.GAMMA_RAMP_ARRAY && + !params->regamma.features.bits.APPLY_DEGAMMA) { const uint32_t max_entries = RGB_256X3X16 + opp110->regamma.extra_points - 1; -- 2.7.4