Skip to contentSkip to conversation

drm/amd/display: Fix recent checkpatch errors in amdgpu_dm

PATCH In review Harry Wentland 2 participants 3 messages Dec 21, 2023 – Jan 3, 2024

Subsystems (3)
lore
Share & tools
lore

Harry Wentland

author maintainer
#0 lore raw

PATCH 1/2 drm/amd/display: Fix recent checkpatch errors in amdgpu_dm

- Use tabs, not spaces.
- Brace and parentheses placement

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h       | 4 ++--
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c | 5 ++---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c  | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +2 -2
index 2d5af83d40b5..9c1871b866cc 100644
@@ -747,7 +747,7 @@ enum amdgpu_transfer_function {
 	AMDGPU_TRANSFER_FUNCTION_GAMMA22_INV_EOTF,
 	AMDGPU_TRANSFER_FUNCTION_GAMMA24_INV_EOTF,
 	AMDGPU_TRANSFER_FUNCTION_GAMMA26_INV_EOTF,
-        AMDGPU_TRANSFER_FUNCTION_COUNT
+	AMDGPU_TRANSFER_FUNCTION_COUNT
 };
 
 struct dm_plane_state {
@@ -844,7 +844,7 @@ struct dm_crtc_state {
 
 	int abm_level;
 
-        /**
+	/**
 	 * @regamma_tf:
 	 *
 	 * Pre-defined transfer function for converting internal FB -> wire
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +2 -3
index c6ed0d854b01..36bf65a8cd6e 100644
@@ -630,8 +630,7 @@ static int __set_input_tf(struct dc_color_caps *caps, struct dc_transfer_func *f
 static enum dc_transfer_func_predefined
 amdgpu_tf_to_dc_tf(enum amdgpu_transfer_function tf)
 {
-	switch (tf)
-	{
+	switch (tf) {
 	default:
 	case AMDGPU_TRANSFER_FUNCTION_DEFAULT:
 	case AMDGPU_TRANSFER_FUNCTION_IDENTITY:
@@ -1225,7 +1224,7 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,
 	 * plane and CRTC degamma at the same time. Explicitly reject atomic
 	 * updates when userspace sets both plane and CRTC degamma properties.
 	 */
-	if (has_crtc_cm_degamma && ret != -EINVAL){
+	if (has_crtc_cm_degamma && ret != -EINVAL) {
 		drm_dbg_kms(crtc->base.crtc->dev,
 			    "doesn't support plane and CRTC degamma at the same time\n");
 			return -EINVAL;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +1 -1
index 4439e5a27362..6e715ef3a556 100644
@@ -305,7 +305,7 @@ dm_crtc_additional_color_mgmt(struct drm_crtc *crtc)
 {
 	struct amdgpu_device *adev = drm_to_adev(crtc->dev);
 
-	if(adev->dm.dc->caps.color.mpc.ogam_ram)
+	if (adev->dm.dc->caps.color.mpc.ogam_ram)
 		drm_object_attach_property(&crtc->base,
 					   adev->mode_info.regamma_tf_property,
 					   AMDGPU_TRANSFER_FUNCTION_DEFAULT);
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 2/2 drm/amd/display: Move fixpt_from_s3132 to amdgpu_dm

Other environments don't like the unary minus operator on an unsigned value.

---
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c    | 18 +++++++++++++++---
 .../gpu/drm/amd/display/include/fixed31_32.h   | 12 ------------
 2 files changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +15 -3
index 36bf65a8cd6e..9b527bffe11a 100644
@@ -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;
drivers/gpu/drm/amd/display/include/fixed31_32.h +0 -12
index 84da1dd34efd..d4cf7ead1d87 100644
@@ -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
Signature · 1 line
2.43.0
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/amd/display: Move fixpt_from_s3132 to amdgpu_dm

Quoted 5 lines · Harry Wentland

Other environments don't like the unary minus operator on an unsigned value.

Series is:

Quoted 81 lines
---
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c    | 18 +++++++++++++++---
 .../gpu/drm/amd/display/include/fixed31_32.h   | 12 ------------
 2 files changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +15 -3
index 36bf65a8cd6e..9b527bffe11a 100644
@@ -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;
drivers/gpu/drm/amd/display/include/fixed31_32.h +0 -13
index 84da1dd34efd..d4cf7ead1d87 100644
@@ -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
--

2.43.0