]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/display: Add check for num of entries in gamma
authorVitaly Prosyak <vitaly.prosyak@amd.com>
Thu, 12 Jul 2018 19:26:47 +0000 (14:26 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 27 Aug 2018 16:09:59 +0000 (11:09 -0500)
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>
drivers/gpu/drm/amd/display/modules/color/color_gamma.c

index 3d1b89a30b3bbccb792004c58139cfd43b101f41..15427f4fc9900344d2bd5ba4f530588f35023eff 100644 (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;