mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 20:46:48 +02:00
drm/amd/display: Move fixpt_from_s3132 to amdgpu_dm
Other environments don't like the unary minus operator on an unsigned value. Signed-off-by: Harry Wentland <harry.wentland@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
af7cefc618
commit
d65e0e9166
|
|
@ -85,6 +85,18 @@ void amdgpu_dm_init_color_mod(void)
|
|||
setup_x_points_distribution();
|
||||
}
|
||||
|
||||
static inline struct fixed31_32 amdgpu_dm_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;
|
||||
}
|
||||
|
||||
#ifdef AMD_PRIVATE_COLOR
|
||||
/* Pre-defined Transfer Functions (TF)
|
||||
*
|
||||
|
|
@ -430,7 +442,7 @@ static void __drm_ctm_to_dc_matrix(const struct drm_color_ctm *ctm,
|
|||
}
|
||||
|
||||
/* gamut_remap_matrix[i] = ctm[i - floor(i/4)] */
|
||||
matrix[i] = dc_fixpt_from_s3132(ctm->matrix[i - (i / 4)]);
|
||||
matrix[i] = amdgpu_dm_fixpt_from_s3132(ctm->matrix[i - (i / 4)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -452,7 +464,7 @@ static void __drm_ctm_3x4_to_dc_matrix(const struct drm_color_ctm_3x4 *ctm,
|
|||
*/
|
||||
for (i = 0; i < 12; i++) {
|
||||
/* gamut_remap_matrix[i] = ctm[i - floor(i/4)] */
|
||||
matrix[i] = dc_fixpt_from_s3132(ctm->matrix[i]);
|
||||
matrix[i] = amdgpu_dm_fixpt_from_s3132(ctm->matrix[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1136,7 +1148,7 @@ amdgpu_dm_plane_set_color_properties(struct drm_plane_state *plane_state,
|
|||
uint32_t shaper_size, lut3d_size, blend_size;
|
||||
int ret;
|
||||
|
||||
dc_plane_state->hdr_mult = dc_fixpt_from_s3132(dm_plane_state->hdr_mult);
|
||||
dc_plane_state->hdr_mult = amdgpu_dm_fixpt_from_s3132(dm_plane_state->hdr_mult);
|
||||
|
||||
shaper_lut = __extract_blob_lut(dm_plane_state->shaper_lut, &shaper_size);
|
||||
shaper_size = shaper_lut != NULL ? shaper_size : 0;
|
||||
|
|
|
|||
|
|
@ -69,18 +69,6 @@ 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user