From b32b1a0948a3ee9817e9b3ea421ffe74f09a4103 Mon Sep 17 00:00:00 2001 From: Jun Lei Date: Wed, 16 Dec 2015 14:41:31 -0500 Subject: [PATCH 0624/1110] drm/amd/dal: Add new gamma ramp interface to dc Signed-off-by: Jun Lei Acked-by: Jordan Lazare --- drivers/gpu/drm/amd/dal/dc/dc.h | 3 ++- drivers/gpu/drm/amd/dal/dc/dc_types.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/dal/dc/dc.h b/drivers/gpu/drm/amd/dal/dc/dc.h index 264b428..c9cdd9c 100644 --- a/drivers/gpu/drm/amd/dal/dc/dc.h +++ b/drivers/gpu/drm/amd/dal/dc/dc.h @@ -75,7 +75,8 @@ struct dc_surface { enum dc_rotation_angle rotation; enum plane_stereo_format stereo_format; - struct gamma_ramp gamma_correction; + struct gamma_ramp gamma_correction; /* deprecated */ + struct dc_gamma_ramp gamma; }; /* diff --git a/drivers/gpu/drm/amd/dal/dc/dc_types.h b/drivers/gpu/drm/amd/dal/dc/dc_types.h index b6526e9..1834fe0 100644 --- a/drivers/gpu/drm/amd/dal/dc/dc_types.h +++ b/drivers/gpu/drm/amd/dal/dc/dc_types.h @@ -665,6 +665,38 @@ enum dc_connection_type { dc_connection_active_dongle }; +/* + * Gamma ramp representation in DC + * + * A gamma ramp is just a curve defined within the range of [min, max] with + * arbitrary precision. + * + * DM is responsible for providing DC with an interface to obtain any y value + * within that range with a selected precision. + * + * bit32 ------------------------------------------------- bit 0 + * [ padding ][ exponent bits ][ fraction bits ] + * + * DC specifies the input x value and precision to the callback function + * get_gamma_value as well as providing the context and DM returns the y + * value. + * + * If fraction_bits + exponent_bits exceed width of 32 bits, get_gamma_value + * returns 0. If x is outside the bounds of [min, max], get_gamma_value + * returns 0. + * + */ +struct dc_gamma_ramp { + uint32_t (*get_gamma_value) ( + void *context, + uint8_t exponent_bits, + uint8_t fraction_bits, + uint32_t x); + void *context; + uint32_t min; + uint32_t max; +}; + struct dc_csc_adjustments { struct fixed31_32 contrast; struct fixed31_32 saturation; -- 2.7.4