summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Prosyak <vitaly.prosyak@amd.com>2018-07-12 14:26:47 -0500
committerAlex Deucher <alexander.deucher@amd.com>2018-08-27 11:09:59 -0500
commit1fdf7a4b1f96520467a578bdd9c90793cf7e8728 (patch)
tree55c1be88887968c8ee32a4a51d721c7f3114b62b
parentdc6c981d202733fd5718d4db627f7d85fee651eb (diff)
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>
-rw-r--r--drivers/gpu/drm/amd/display/modules/color/color_gamma.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
index 3d1b89a30b3b..15427f4fc990 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
@@ -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;