From: Vitaly Prosyak Date: Tue, 13 Dec 2016 14:23:16 -0600 Subject: drm/amd/display: re gamma programming Git-commit: 1e3d346f4fbb48f0a89134f4b834d3be2df3cc25 Patch-mainline: v4.15-rc1 References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166 Fix gamma update logic to avoid crash Signed-off-by: Vitaly Prosyak Reviewed-by: Tony Cheng Acked-by: Harry Wentland Signed-off-by: Alex Deucher Acked-by: Petr Tesarik --- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -1445,7 +1445,8 @@ void dc_update_surfaces_for_target(struc } } - if (updates[i].gamma) { + if (updates[i].gamma && updates[i].gamma != + surface->public.gamma_correction) { if (surface->public.gamma_correction != NULL) dc_gamma_release(surface->public. gamma_correction);