1
0
Fork 0

drm/amd/display: Add check for num of entries in gamma

This check avoids potential bugs related to gamma.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
hifive-unleashed-5.1
Vitaly Prosyak 2018-07-12 14:26:47 -05:00 committed by Alex Deucher
parent dc6c981d20
commit 1fdf7a4b1f
1 changed files with 2 additions and 1 deletions

View File

@ -1580,7 +1580,8 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf,
/* we can use hardcoded curve for plain SRGB TF */
if (input_tf->type == TF_TYPE_PREDEFINED &&
input_tf->tf == TRANSFER_FUNCTION_SRGB &&
(!mapUserRamp && ramp->type == GAMMA_RGB_256))
(!mapUserRamp &&
(ramp->type == GAMMA_RGB_256 || ramp->num_entries == 0)))
return true;
input_tf->type = TF_TYPE_DISTRIBUTED_POINTS;