Skip to content

Commit d65e0e9

Browse files
Harry Wentlandalexdeucher
authored andcommitted
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>
1 parent af7cefc commit d65e0e9

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ void amdgpu_dm_init_color_mod(void)
8585
setup_x_points_distribution();
8686
}
8787

88+
static inline struct fixed31_32 amdgpu_dm_fixpt_from_s3132(__u64 x)
89+
{
90+
struct fixed31_32 val;
91+
92+
/* If negative, convert to 2's complement. */
93+
if (x & (1ULL << 63))
94+
x = -(x & ~(1ULL << 63));
95+
96+
val.value = x;
97+
return val;
98+
}
99+
88100
#ifdef AMD_PRIVATE_COLOR
89101
/* Pre-defined Transfer Functions (TF)
90102
*
@@ -430,7 +442,7 @@ static void __drm_ctm_to_dc_matrix(const struct drm_color_ctm *ctm,
430442
}
431443

432444
/* gamut_remap_matrix[i] = ctm[i - floor(i/4)] */
433-
matrix[i] = dc_fixpt_from_s3132(ctm->matrix[i - (i / 4)]);
445+
matrix[i] = amdgpu_dm_fixpt_from_s3132(ctm->matrix[i - (i / 4)]);
434446
}
435447
}
436448

@@ -452,7 +464,7 @@ static void __drm_ctm_3x4_to_dc_matrix(const struct drm_color_ctm_3x4 *ctm,
452464
*/
453465
for (i = 0; i < 12; i++) {
454466
/* gamut_remap_matrix[i] = ctm[i - floor(i/4)] */
455-
matrix[i] = dc_fixpt_from_s3132(ctm->matrix[i]);
467+
matrix[i] = amdgpu_dm_fixpt_from_s3132(ctm->matrix[i]);
456468
}
457469
}
458470

@@ -1136,7 +1148,7 @@ amdgpu_dm_plane_set_color_properties(struct drm_plane_state *plane_state,
11361148
uint32_t shaper_size, lut3d_size, blend_size;
11371149
int ret;
11381150

1139-
dc_plane_state->hdr_mult = dc_fixpt_from_s3132(dm_plane_state->hdr_mult);
1151+
dc_plane_state->hdr_mult = amdgpu_dm_fixpt_from_s3132(dm_plane_state->hdr_mult);
11401152

11411153
shaper_lut = __extract_blob_lut(dm_plane_state->shaper_lut, &shaper_size);
11421154
shaper_size = shaper_lut != NULL ? shaper_size : 0;

drivers/gpu/drm/amd/display/include/fixed31_32.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,6 @@ static const struct fixed31_32 dc_fixpt_epsilon = { 1LL };
6969
static const struct fixed31_32 dc_fixpt_half = { 0x80000000LL };
7070
static const struct fixed31_32 dc_fixpt_one = { 0x100000000LL };
7171

72-
static inline struct fixed31_32 dc_fixpt_from_s3132(__u64 x)
73-
{
74-
struct fixed31_32 val;
75-
76-
/* If negative, convert to 2's complement. */
77-
if (x & (1ULL << 63))
78-
x = -(x & ~(1ULL << 63));
79-
80-
val.value = x;
81-
return val;
82-
}
83-
8472
/*
8573
* @brief
8674
* Initialization routines

0 commit comments

Comments
 (0)