diff options
| author | Joshua Ashton <joshua@froggi.es> | 2023-11-16 18:58:01 -0100 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2023-12-13 16:08:01 -0500 |
| commit | 889044f9e04f0829dd92640c551941bbe77bc0ea (patch) | |
| tree | a4294116d2b9b4ba68d9c78b142c6690f58190a5 /drivers/gpu/drm/amd/display/include | |
| parent | drm/amd/display: reject atomic commit if setting both plane and CRTC degamma (diff) | |
| download | linux-889044f9e04f0829dd92640c551941bbe77bc0ea.tar.gz linux-889044f9e04f0829dd92640c551941bbe77bc0ea.zip | |
drm/amd/display: add dc_fixpt_from_s3132 helper
Detach value translation from CTM to reuse it for programming HDR
multiplier property.
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Signed-off-by: Melissa Wen <mwen@igalia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/include')
| -rw-r--r-- | drivers/gpu/drm/amd/display/include/fixed31_32.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/display/include/fixed31_32.h b/drivers/gpu/drm/amd/display/include/fixed31_32.h index d4cf7ead1d87..84da1dd34efd 100644 --- a/drivers/gpu/drm/amd/display/include/fixed31_32.h +++ b/drivers/gpu/drm/amd/display/include/fixed31_32.h @@ -69,6 +69,18 @@ static const struct fixed31_32 dc_fixpt_epsilon = { 1LL }; static const struct fixed31_32 dc_fixpt_half = { 0x80000000LL }; static const struct fixed31_32 dc_fixpt_one = { 0x100000000LL }; +static inline struct fixed31_32 dc_fixpt_from_s3132(__u64 x) +{ + struct fixed31_32 val; + + /* If negative, convert to 2's complement. */ + if (x & (1ULL << 63)) + x = -(x & ~(1ULL << 63)); + + val.value = x; + return val; +} + /* * @brief * Initialization routines |
