drm/amd/display: Move fixpt_from_s3132 to amdgpu_dm
authorHarry Wentland <harry.wentland@amd.com>
Wed, 20 Dec 2023 21:25:48 +0000 (16:25 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 5 Jan 2024 21:10:44 +0000 (16:10 -0500)
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>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
drivers/gpu/drm/amd/display/include/fixed31_32.h

index 36bf65a8cd6e6670c172e94fb6f9e46aa9eccb69..9b527bffe11a1f55e1a63d94c937c829e0d6f820 100644 (file)
@@ -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;
index 84da1dd34efd18e90b1112c2b5f9de4cd5755a10..d4cf7ead1d877e7bfd1a75fa651c81e6062cefc7 100644 (file)
@@ -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