Commit 8d26795a authored by Joshua Ashton's avatar Joshua Ashton Committed by Alex Deucher
Browse files

drm/amd/display: handle empty LUTs in __set_input_tf



Unlike degamma, blend gamma doesn't support hardcoded curve
(predefined/ROM), but we can use AMD color module to fill blend gamma
parameters when we have non-linear plane gamma TF without plane gamma
LUT. The regular degamma path doesn't hit this.

Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarJoshua Ashton <joshua@froggi.es>
Signed-off-by: default avatarMelissa Wen <mwen@igalia.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 486c95af
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -578,6 +578,7 @@ static int __set_input_tf(struct dc_transfer_func *func,
	struct dc_gamma *gamma = NULL;
	bool res;

	if (lut_size) {
		gamma = dc_create_gamma();
		if (!gamma)
			return -ENOMEM;
@@ -586,8 +587,11 @@ static int __set_input_tf(struct dc_transfer_func *func,
		gamma->num_entries = lut_size;

		__drm_lut_to_dc_gamma(lut, gamma, false);
	}

	res = mod_color_calculate_degamma_params(NULL, func, gamma, true);
	res = mod_color_calculate_degamma_params(NULL, func, gamma, gamma != NULL);

	if (gamma)
		dc_gamma_release(&gamma);

	return res ? 0 : -ENOMEM;