All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Trivial code cleanup around color resources
@ 2023-02-14 12:14 Melissa Wen
  2023-02-14 12:14 ` [PATCH 1/6] drm/amd/display: ident braces in dcn30_acquire_post_bldn_3dlut correctly Melissa Wen
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Melissa Wen @ 2023-02-14 12:14 UTC (permalink / raw)
  To: amd-gfx
  Cc: sunpeng.li, Xinhui.Pan, Rodrigo.Siqueira, kernel-dev,
	alexander.deucher, harry.wentland, christian.koenig

Hi,

Sorry for the noise, but while I've been working on wiring 3D LUT
support to AMD display driver [1] I found some annoying code style
issues in the shared-code part. So I'm just sending what I've been
cleaning to better examine the code.

Most seem trivial, except the last one "remove unused
_calculate_degamma_curve" since this could just be a matter of missing
parts. If so, happy to remove the patch and include a comment describing
the situation (or the potential usage of it).

Thanks,

Melissa

[1] https://lore.kernel.org/dri-devel/20230109143846.1966301-1-mwen@igalia.com/

Melissa Wen (6):
  drm/amd/display: ident braces in dcn30_acquire_post_bldn_3dlut
    correctly
  drm/amd/display: clean code-style issues in dcn30_set_mpc_shaper_3dlut
  drm/amd/display: camel case cleanup in color_gamma file
  drm/amd/display: unset initial value for tf since it's never used
  drm/amd/display: remove unused func declaration from resource headers
  drm/amd/display: remove unused _calculate_degamma_curve function

 .../drm/amd/display/dc/dcn30/dcn30_hwseq.c    |  37 ++---
 .../drm/amd/display/dc/dcn30/dcn30_resource.c |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/resource.h |   4 -
 .../amd/display/modules/color/color_gamma.c   | 140 ++++--------------
 .../amd/display/modules/color/color_gamma.h   |   3 -
 5 files changed, 48 insertions(+), 138 deletions(-)

-- 
2.39.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/6] drm/amd/display: ident braces in dcn30_acquire_post_bldn_3dlut correctly
  2023-02-14 12:14 [PATCH 0/6] Trivial code cleanup around color resources Melissa Wen
@ 2023-02-14 12:14 ` Melissa Wen
  2023-02-14 12:14 ` [PATCH 2/6] drm/amd/display: clean code-style issues in dcn30_set_mpc_shaper_3dlut Melissa Wen
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Melissa Wen @ 2023-02-14 12:14 UTC (permalink / raw)
  To: amd-gfx
  Cc: sunpeng.li, Xinhui.Pan, Rodrigo.Siqueira, kernel-dev,
	alexander.deucher, harry.wentland, christian.koenig

Signed-off-by: Melissa Wen <mwen@igalia.com>
---
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
index feb4bb491525..60bb5634b6e2 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
@@ -1477,8 +1477,8 @@ bool dcn30_acquire_post_bldn_3dlut(
 				state->bits.mpc_rmu2_mux = mpcc_id;
 			ret = true;
 			break;
-			}
 		}
+	}
 	return ret;
 }
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/6] drm/amd/display: clean code-style issues in dcn30_set_mpc_shaper_3dlut
  2023-02-14 12:14 [PATCH 0/6] Trivial code cleanup around color resources Melissa Wen
  2023-02-14 12:14 ` [PATCH 1/6] drm/amd/display: ident braces in dcn30_acquire_post_bldn_3dlut correctly Melissa Wen
@ 2023-02-14 12:14 ` Melissa Wen
  2023-02-14 12:14 ` [PATCH 3/6] drm/amd/display: camel case cleanup in color_gamma file Melissa Wen
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Melissa Wen @ 2023-02-14 12:14 UTC (permalink / raw)
  To: amd-gfx
  Cc: sunpeng.li, Xinhui.Pan, Rodrigo.Siqueira, kernel-dev,
	alexander.deucher, harry.wentland, christian.koenig

This function has many conditions and all code style issues (identation,
missing braces, etc.) make reading it really annoying.

Signed-off-by: Melissa Wen <mwen@igalia.com>
---
 .../drm/amd/display/dc/dcn30/dcn30_hwseq.c    | 37 ++++++++++---------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
index 9ce86f288130..df787fcf8e86 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
@@ -90,8 +90,8 @@ bool dcn30_set_blend_lut(
 	return result;
 }
 
-static bool dcn30_set_mpc_shaper_3dlut(
-	struct pipe_ctx *pipe_ctx, const struct dc_stream_state *stream)
+static bool dcn30_set_mpc_shaper_3dlut(struct pipe_ctx *pipe_ctx,
+				       const struct dc_stream_state *stream)
 {
 	struct dpp *dpp_base = pipe_ctx->plane_res.dpp;
 	int mpcc_id = pipe_ctx->plane_res.hubp->inst;
@@ -103,19 +103,18 @@ static bool dcn30_set_mpc_shaper_3dlut(
 	const struct pwl_params *shaper_lut = NULL;
 	//get the shaper lut params
 	if (stream->func_shaper) {
-		if (stream->func_shaper->type == TF_TYPE_HWPWL)
+		if (stream->func_shaper->type == TF_TYPE_HWPWL) {
 			shaper_lut = &stream->func_shaper->pwl;
-		else if (stream->func_shaper->type == TF_TYPE_DISTRIBUTED_POINTS) {
-			cm_helper_translate_curve_to_hw_format(
-					stream->func_shaper,
-					&dpp_base->shaper_params, true);
+		} else if (stream->func_shaper->type == TF_TYPE_DISTRIBUTED_POINTS) {
+			cm_helper_translate_curve_to_hw_format(stream->func_shaper,
+							       &dpp_base->shaper_params, true);
 			shaper_lut = &dpp_base->shaper_params;
 		}
 	}
 
 	if (stream->lut3d_func &&
-		stream->lut3d_func->state.bits.initialized == 1 &&
-		stream->lut3d_func->state.bits.rmu_idx_valid == 1) {
+	    stream->lut3d_func->state.bits.initialized == 1 &&
+	    stream->lut3d_func->state.bits.rmu_idx_valid == 1) {
 		if (stream->lut3d_func->state.bits.rmu_mux_num == 0)
 			mpcc_id_projected = stream->lut3d_func->state.bits.mpc_rmu0_mux;
 		else if (stream->lut3d_func->state.bits.rmu_mux_num == 1)
@@ -124,20 +123,22 @@ static bool dcn30_set_mpc_shaper_3dlut(
 			mpcc_id_projected = stream->lut3d_func->state.bits.mpc_rmu2_mux;
 		if (mpcc_id_projected != mpcc_id)
 			BREAK_TO_DEBUGGER();
-		/*find the reason why logical layer assigned a differant mpcc_id into acquire_post_bldn_3dlut*/
+		/* find the reason why logical layer assigned a different
+		 * mpcc_id into acquire_post_bldn_3dlut
+		 */
 		acquired_rmu = mpc->funcs->acquire_rmu(mpc, mpcc_id,
-				stream->lut3d_func->state.bits.rmu_mux_num);
+						       stream->lut3d_func->state.bits.rmu_mux_num);
 		if (acquired_rmu != stream->lut3d_func->state.bits.rmu_mux_num)
 			BREAK_TO_DEBUGGER();
-		result = mpc->funcs->program_3dlut(mpc,
-								&stream->lut3d_func->lut_3d,
-								stream->lut3d_func->state.bits.rmu_mux_num);
+
+		result = mpc->funcs->program_3dlut(mpc, &stream->lut3d_func->lut_3d,
+						   stream->lut3d_func->state.bits.rmu_mux_num);
 		result = mpc->funcs->program_shaper(mpc, shaper_lut,
-				stream->lut3d_func->state.bits.rmu_mux_num);
-	} else
-		/*loop through the available mux and release the requested mpcc_id*/
+						    stream->lut3d_func->state.bits.rmu_mux_num);
+	} else {
+		// loop through the available mux and release the requested mpcc_id
 		mpc->funcs->release_rmu(mpc, mpcc_id);
-
+	}
 
 	return result;
 }
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/6] drm/amd/display: camel case cleanup in color_gamma file
  2023-02-14 12:14 [PATCH 0/6] Trivial code cleanup around color resources Melissa Wen
  2023-02-14 12:14 ` [PATCH 1/6] drm/amd/display: ident braces in dcn30_acquire_post_bldn_3dlut correctly Melissa Wen
  2023-02-14 12:14 ` [PATCH 2/6] drm/amd/display: clean code-style issues in dcn30_set_mpc_shaper_3dlut Melissa Wen
@ 2023-02-14 12:14 ` Melissa Wen
  2023-02-14 12:14 ` [PATCH 4/6] drm/amd/display: unset initial value for tf since it's never used Melissa Wen
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Melissa Wen @ 2023-02-14 12:14 UTC (permalink / raw)
  To: amd-gfx
  Cc: sunpeng.li, Xinhui.Pan, Rodrigo.Siqueira, kernel-dev,
	alexander.deucher, harry.wentland, christian.koenig

Rename mapUserRamp to map_user_ramp and doClamping to do_clamping

Signed-off-by: Melissa Wen <mwen@igalia.com>
---
 .../amd/display/modules/color/color_gamma.c   | 50 ++++++++++---------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
index f6034213c700..fdb20dfc70c9 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
@@ -1715,8 +1715,8 @@ static bool map_regamma_hw_to_x_user(
 	const struct pwl_float_data_ex *rgb_regamma,
 	uint32_t hw_points_num,
 	struct dc_transfer_func_distributed_points *tf_pts,
-	bool mapUserRamp,
-	bool doClamping)
+	bool map_user_ramp,
+	bool do_clamping)
 {
 	/* setup to spare calculated ideal regamma values */
 
@@ -1724,7 +1724,7 @@ static bool map_regamma_hw_to_x_user(
 	struct hw_x_point *coords = coords_x;
 	const struct pwl_float_data_ex *regamma = rgb_regamma;
 
-	if (ramp && mapUserRamp) {
+	if (ramp && map_user_ramp) {
 		copy_rgb_regamma_to_coordinates_x(coords,
 				hw_points_num,
 				rgb_regamma);
@@ -1744,7 +1744,7 @@ static bool map_regamma_hw_to_x_user(
 		}
 	}
 
-	if (doClamping) {
+	if (do_clamping) {
 		/* this should be named differently, all it does is clamp to 0-1 */
 		build_new_custom_resulted_curve(hw_points_num, tf_pts);
 	}
@@ -1875,7 +1875,7 @@ bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf,
 
 bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps,
 		struct dc_transfer_func *input_tf,
-		const struct dc_gamma *ramp, bool mapUserRamp)
+		const struct dc_gamma *ramp, bool map_user_ramp)
 {
 	struct dc_transfer_func_distributed_points *tf_pts = &input_tf->tf_pts;
 	struct dividers dividers;
@@ -1891,12 +1891,12 @@ bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps,
 		return false;
 
 	/* we can use hardcoded curve for plain SRGB TF
-	 * If linear, it's bypass if on user ramp
+	 * If linear, it's bypass if no user ramp
 	 */
 	if (input_tf->type == TF_TYPE_PREDEFINED) {
 		if ((input_tf->tf == TRANSFER_FUNCTION_SRGB ||
 				input_tf->tf == TRANSFER_FUNCTION_LINEAR) &&
-				!mapUserRamp)
+				!map_user_ramp)
 			return true;
 
 		if (dc_caps != NULL &&
@@ -1919,7 +1919,7 @@ bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps,
 
 	input_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
 
-	if (mapUserRamp && ramp && ramp->type == GAMMA_RGB_256) {
+	if (map_user_ramp && ramp && ramp->type == GAMMA_RGB_256) {
 		rgb_user = kvcalloc(ramp->num_entries + _EXTRA_POINTS,
 				sizeof(*rgb_user),
 				GFP_KERNEL);
@@ -2007,7 +2007,7 @@ bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps,
 		map_regamma_hw_to_x_user(ramp, coeff, rgb_user,
 				coordinates_x, axis_x, curve,
 				MAX_HW_POINTS, tf_pts,
-				mapUserRamp && ramp && ramp->type == GAMMA_RGB_256,
+				map_user_ramp && ramp && ramp->type == GAMMA_RGB_256,
 				true);
 	}
 
@@ -2112,9 +2112,11 @@ static bool calculate_curve(enum dc_transfer_func_predefined trans,
 }
 
 bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
-		const struct dc_gamma *ramp, bool mapUserRamp, bool canRomBeUsed,
-		const struct hdr_tm_params *fs_params,
-		struct calculate_buffer *cal_buffer)
+					const struct dc_gamma *ramp,
+					bool map_user_ramp,
+					bool can_rom_be_used,
+					const struct hdr_tm_params *fs_params,
+					struct calculate_buffer *cal_buffer)
 {
 	struct dc_transfer_func_distributed_points *tf_pts = &output_tf->tf_pts;
 	struct dividers dividers;
@@ -2124,26 +2126,26 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
 	struct gamma_pixel *axis_x = NULL;
 	struct pixel_gamma_point *coeff = NULL;
 	enum dc_transfer_func_predefined tf = TRANSFER_FUNCTION_SRGB;
-	bool doClamping = true;
+	bool do_clamping = true;
 	bool ret = false;
 
 	if (output_tf->type == TF_TYPE_BYPASS)
 		return false;
 
 	/* we can use hardcoded curve for plain SRGB TF */
-	if (output_tf->type == TF_TYPE_PREDEFINED && canRomBeUsed == true &&
+	if (output_tf->type == TF_TYPE_PREDEFINED && can_rom_be_used == true &&
 			output_tf->tf == TRANSFER_FUNCTION_SRGB) {
 		if (ramp == NULL)
 			return true;
 		if ((ramp->is_identity && ramp->type != GAMMA_CS_TFM_1D) ||
-				(!mapUserRamp && ramp->type == GAMMA_RGB_256))
+		    (!map_user_ramp && ramp->type == GAMMA_RGB_256))
 			return true;
 	}
 
 	output_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
 
 	if (ramp && ramp->type != GAMMA_CS_TFM_1D &&
-			(mapUserRamp || ramp->type != GAMMA_RGB_256)) {
+	    (map_user_ramp || ramp->type != GAMMA_RGB_256)) {
 		rgb_user = kvcalloc(ramp->num_entries + _EXTRA_POINTS,
 			    sizeof(*rgb_user),
 			    GFP_KERNEL);
@@ -2164,7 +2166,7 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
 				ramp->num_entries,
 				dividers);
 
-		if (ramp->type == GAMMA_RGB_256 && mapUserRamp)
+		if (ramp->type == GAMMA_RGB_256 && map_user_ramp)
 			scale_gamma(rgb_user, ramp, dividers);
 		else if (ramp->type == GAMMA_RGB_FLOAT_1024)
 			scale_gamma_dx(rgb_user, ramp, dividers);
@@ -2191,15 +2193,15 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
 			cal_buffer);
 
 	if (ret) {
-		doClamping = !(output_tf->tf == TRANSFER_FUNCTION_GAMMA22 &&
-			fs_params != NULL && fs_params->skip_tm == 0);
+		do_clamping = !(output_tf->tf == TRANSFER_FUNCTION_GAMMA22 &&
+				fs_params != NULL && fs_params->skip_tm == 0);
 
 		map_regamma_hw_to_x_user(ramp, coeff, rgb_user,
-				coordinates_x, axis_x, rgb_regamma,
-				MAX_HW_POINTS, tf_pts,
-				(mapUserRamp || (ramp && ramp->type != GAMMA_RGB_256)) &&
-				(ramp && ramp->type != GAMMA_CS_TFM_1D),
-				doClamping);
+					 coordinates_x, axis_x, rgb_regamma,
+					 MAX_HW_POINTS, tf_pts,
+					 (map_user_ramp || (ramp && ramp->type != GAMMA_RGB_256)) &&
+					 (ramp && ramp->type != GAMMA_CS_TFM_1D),
+					 do_clamping);
 
 		if (ramp && ramp->type == GAMMA_CS_TFM_1D)
 			apply_lut_1d(ramp, MAX_HW_POINTS, tf_pts);
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/6] drm/amd/display: unset initial value for tf since it's never used
  2023-02-14 12:14 [PATCH 0/6] Trivial code cleanup around color resources Melissa Wen
                   ` (2 preceding siblings ...)
  2023-02-14 12:14 ` [PATCH 3/6] drm/amd/display: camel case cleanup in color_gamma file Melissa Wen
@ 2023-02-14 12:14 ` Melissa Wen
  2023-02-14 12:14 ` [PATCH 5/6] drm/amd/display: remove unused func declaration from resource headers Melissa Wen
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Melissa Wen @ 2023-02-14 12:14 UTC (permalink / raw)
  To: amd-gfx
  Cc: sunpeng.li, Xinhui.Pan, Rodrigo.Siqueira, kernel-dev,
	alexander.deucher, harry.wentland, christian.koenig

In mod_color_calculate_{degamma/regamma}_params(), a tf variable is
initialized as TRANSFER_FUNCTION_SRGB but tf is only used after tf =
input->tf, therefore, better to just remove this initial value and avoid
misleading interpretations.

Signed-off-by: Melissa Wen <mwen@igalia.com>
---
 drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
index fdb20dfc70c9..6e606b11286a 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
@@ -1883,7 +1883,7 @@ bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps,
 	struct pwl_float_data_ex *curve = NULL;
 	struct gamma_pixel *axis_x = NULL;
 	struct pixel_gamma_point *coeff = NULL;
-	enum dc_transfer_func_predefined tf = TRANSFER_FUNCTION_SRGB;
+	enum dc_transfer_func_predefined tf;
 	uint32_t i;
 	bool ret = false;
 
@@ -2125,7 +2125,7 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
 	struct pwl_float_data_ex *rgb_regamma = NULL;
 	struct gamma_pixel *axis_x = NULL;
 	struct pixel_gamma_point *coeff = NULL;
-	enum dc_transfer_func_predefined tf = TRANSFER_FUNCTION_SRGB;
+	enum dc_transfer_func_predefined tf;
 	bool do_clamping = true;
 	bool ret = false;
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/6] drm/amd/display: remove unused func declaration from resource headers
  2023-02-14 12:14 [PATCH 0/6] Trivial code cleanup around color resources Melissa Wen
                   ` (3 preceding siblings ...)
  2023-02-14 12:14 ` [PATCH 4/6] drm/amd/display: unset initial value for tf since it's never used Melissa Wen
@ 2023-02-14 12:14 ` Melissa Wen
  2023-02-14 12:14 ` [PATCH 6/6] drm/amd/display: remove unused _calculate_degamma_curve function Melissa Wen
  2023-02-14 12:48 ` [PATCH 0/6] Trivial code cleanup around color resources Christian König
  6 siblings, 0 replies; 9+ messages in thread
From: Melissa Wen @ 2023-02-14 12:14 UTC (permalink / raw)
  To: amd-gfx
  Cc: sunpeng.li, Xinhui.Pan, Rodrigo.Siqueira, kernel-dev,
	alexander.deucher, harry.wentland, christian.koenig

The function resource_validate_ctx_update_pointer_after_copy() is
declared in resource.h but never defined, therefore, remove its
declaration from headers.

Signed-off-by: Melissa Wen <mwen@igalia.com>
---
 drivers/gpu/drm/amd/display/dc/inc/resource.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/inc/resource.h b/drivers/gpu/drm/amd/display/dc/inc/resource.h
index 4ab029e3326d..fa6da93caa88 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/resource.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/resource.h
@@ -165,10 +165,6 @@ bool resource_validate_attach_surfaces(
 		struct dc_state *context,
 		const struct resource_pool *pool);
 
-void resource_validate_ctx_update_pointer_after_copy(
-		const struct dc_state *src_ctx,
-		struct dc_state *dst_ctx);
-
 enum dc_status resource_map_clock_resources(
 		const struct dc *dc,
 		struct dc_state *context,
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/6] drm/amd/display: remove unused _calculate_degamma_curve function
  2023-02-14 12:14 [PATCH 0/6] Trivial code cleanup around color resources Melissa Wen
                   ` (4 preceding siblings ...)
  2023-02-14 12:14 ` [PATCH 5/6] drm/amd/display: remove unused func declaration from resource headers Melissa Wen
@ 2023-02-14 12:14 ` Melissa Wen
  2023-02-14 12:48 ` [PATCH 0/6] Trivial code cleanup around color resources Christian König
  6 siblings, 0 replies; 9+ messages in thread
From: Melissa Wen @ 2023-02-14 12:14 UTC (permalink / raw)
  To: amd-gfx
  Cc: sunpeng.li, Xinhui.Pan, Rodrigo.Siqueira, kernel-dev,
	alexander.deucher, harry.wentland, christian.koenig

We don't use this function anywhere, therefore, remove it.

Signed-off-by: Melissa Wen <mwen@igalia.com>
---
 .../amd/display/modules/color/color_gamma.c   | 86 -------------------
 .../amd/display/modules/color/color_gamma.h   |  3 -
 2 files changed, 89 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
index 6e606b11286a..67a062af3ab0 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
@@ -2217,89 +2217,3 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
 rgb_user_alloc_fail:
 	return ret;
 }
-
-bool  mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans,
-				struct dc_transfer_func_distributed_points *points)
-{
-	uint32_t i;
-	bool ret = false;
-	struct pwl_float_data_ex *rgb_degamma = NULL;
-
-	if (trans == TRANSFER_FUNCTION_UNITY ||
-		trans == TRANSFER_FUNCTION_LINEAR) {
-
-		for (i = 0; i <= MAX_HW_POINTS ; i++) {
-			points->red[i]    = coordinates_x[i].x;
-			points->green[i]  = coordinates_x[i].x;
-			points->blue[i]   = coordinates_x[i].x;
-		}
-		ret = true;
-	} else if (trans == TRANSFER_FUNCTION_PQ) {
-		rgb_degamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS,
-				       sizeof(*rgb_degamma),
-				       GFP_KERNEL);
-		if (!rgb_degamma)
-			goto rgb_degamma_alloc_fail;
-
-
-		build_de_pq(rgb_degamma,
-				MAX_HW_POINTS,
-				coordinates_x);
-		for (i = 0; i <= MAX_HW_POINTS ; i++) {
-			points->red[i]    = rgb_degamma[i].r;
-			points->green[i]  = rgb_degamma[i].g;
-			points->blue[i]   = rgb_degamma[i].b;
-		}
-		ret = true;
-
-		kvfree(rgb_degamma);
-	} else if (trans == TRANSFER_FUNCTION_SRGB ||
-		trans == TRANSFER_FUNCTION_BT709 ||
-		trans == TRANSFER_FUNCTION_GAMMA22 ||
-		trans == TRANSFER_FUNCTION_GAMMA24 ||
-		trans == TRANSFER_FUNCTION_GAMMA26) {
-		rgb_degamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS,
-				       sizeof(*rgb_degamma),
-				       GFP_KERNEL);
-		if (!rgb_degamma)
-			goto rgb_degamma_alloc_fail;
-
-		build_degamma(rgb_degamma,
-				MAX_HW_POINTS,
-				coordinates_x,
-				trans);
-		for (i = 0; i <= MAX_HW_POINTS ; i++) {
-			points->red[i]    = rgb_degamma[i].r;
-			points->green[i]  = rgb_degamma[i].g;
-			points->blue[i]   = rgb_degamma[i].b;
-		}
-		ret = true;
-
-		kvfree(rgb_degamma);
-	} else if (trans == TRANSFER_FUNCTION_HLG) {
-		rgb_degamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS,
-				       sizeof(*rgb_degamma),
-				       GFP_KERNEL);
-		if (!rgb_degamma)
-			goto rgb_degamma_alloc_fail;
-
-		build_hlg_degamma(rgb_degamma,
-				MAX_HW_POINTS,
-				coordinates_x,
-				80, 1000);
-		for (i = 0; i <= MAX_HW_POINTS ; i++) {
-			points->red[i]    = rgb_degamma[i].r;
-			points->green[i]  = rgb_degamma[i].g;
-			points->blue[i]   = rgb_degamma[i].b;
-		}
-		ret = true;
-		kvfree(rgb_degamma);
-	}
-	points->end_exponent = 0;
-	points->x_point_at_y1_red = 1;
-	points->x_point_at_y1_green = 1;
-	points->x_point_at_y1_blue = 1;
-
-rgb_degamma_alloc_fail:
-	return ret;
-}
diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.h b/drivers/gpu/drm/amd/display/modules/color/color_gamma.h
index 2893abf48208..ee5c466613de 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.h
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.h
@@ -115,9 +115,6 @@ bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps,
 		struct dc_transfer_func *output_tf,
 		const struct dc_gamma *ramp, bool mapUserRamp);
 
-bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans,
-				struct dc_transfer_func_distributed_points *points);
-
 bool calculate_user_regamma_coeff(struct dc_transfer_func *output_tf,
 		const struct regamma_lut *regamma,
 		struct calculate_buffer *cal_buffer,
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/6] Trivial code cleanup around color resources
  2023-02-14 12:14 [PATCH 0/6] Trivial code cleanup around color resources Melissa Wen
                   ` (5 preceding siblings ...)
  2023-02-14 12:14 ` [PATCH 6/6] drm/amd/display: remove unused _calculate_degamma_curve function Melissa Wen
@ 2023-02-14 12:48 ` Christian König
  2023-02-14 17:39   ` Alex Deucher
  6 siblings, 1 reply; 9+ messages in thread
From: Christian König @ 2023-02-14 12:48 UTC (permalink / raw)
  To: Melissa Wen, amd-gfx
  Cc: sunpeng.li, Xinhui.Pan, Rodrigo.Siqueira, kernel-dev,
	alexander.deucher, harry.wentland, christian.koenig

Am 14.02.23 um 13:14 schrieb Melissa Wen:
> Hi,
>
> Sorry for the noise, but while I've been working on wiring 3D LUT
> support to AMD display driver [1] I found some annoying code style
> issues in the shared-code part. So I'm just sending what I've been
> cleaning to better examine the code.
>
> Most seem trivial, except the last one "remove unused
> _calculate_degamma_curve" since this could just be a matter of missing
> parts. If so, happy to remove the patch and include a comment describing
> the situation (or the potential usage of it).

The display stack is not my field of expertise, but those cleanups are 
so obvious that I think I can safely give my Reviewed-by: Christian 
König <christian.koenig@amd.com> for the entire series.

Thanks,
Christian.

>
> Thanks,
>
> Melissa
>
> [1] https://lore.kernel.org/dri-devel/20230109143846.1966301-1-mwen@igalia.com/
>
> Melissa Wen (6):
>    drm/amd/display: ident braces in dcn30_acquire_post_bldn_3dlut
>      correctly
>    drm/amd/display: clean code-style issues in dcn30_set_mpc_shaper_3dlut
>    drm/amd/display: camel case cleanup in color_gamma file
>    drm/amd/display: unset initial value for tf since it's never used
>    drm/amd/display: remove unused func declaration from resource headers
>    drm/amd/display: remove unused _calculate_degamma_curve function
>
>   .../drm/amd/display/dc/dcn30/dcn30_hwseq.c    |  37 ++---
>   .../drm/amd/display/dc/dcn30/dcn30_resource.c |   2 +-
>   drivers/gpu/drm/amd/display/dc/inc/resource.h |   4 -
>   .../amd/display/modules/color/color_gamma.c   | 140 ++++--------------
>   .../amd/display/modules/color/color_gamma.h   |   3 -
>   5 files changed, 48 insertions(+), 138 deletions(-)
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/6] Trivial code cleanup around color resources
  2023-02-14 12:48 ` [PATCH 0/6] Trivial code cleanup around color resources Christian König
@ 2023-02-14 17:39   ` Alex Deucher
  0 siblings, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2023-02-14 17:39 UTC (permalink / raw)
  To: Christian König
  Cc: sunpeng.li, Xinhui.Pan, Rodrigo.Siqueira, amd-gfx, Melissa Wen,
	kernel-dev, alexander.deucher, harry.wentland, christian.koenig

Applied.  Thanks!

Alex

On Tue, Feb 14, 2023 at 7:48 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 14.02.23 um 13:14 schrieb Melissa Wen:
> > Hi,
> >
> > Sorry for the noise, but while I've been working on wiring 3D LUT
> > support to AMD display driver [1] I found some annoying code style
> > issues in the shared-code part. So I'm just sending what I've been
> > cleaning to better examine the code.
> >
> > Most seem trivial, except the last one "remove unused
> > _calculate_degamma_curve" since this could just be a matter of missing
> > parts. If so, happy to remove the patch and include a comment describing
> > the situation (or the potential usage of it).
>
> The display stack is not my field of expertise, but those cleanups are
> so obvious that I think I can safely give my Reviewed-by: Christian
> König <christian.koenig@amd.com> for the entire series.
>
> Thanks,
> Christian.
>
> >
> > Thanks,
> >
> > Melissa
> >
> > [1] https://lore.kernel.org/dri-devel/20230109143846.1966301-1-mwen@igalia.com/
> >
> > Melissa Wen (6):
> >    drm/amd/display: ident braces in dcn30_acquire_post_bldn_3dlut
> >      correctly
> >    drm/amd/display: clean code-style issues in dcn30_set_mpc_shaper_3dlut
> >    drm/amd/display: camel case cleanup in color_gamma file
> >    drm/amd/display: unset initial value for tf since it's never used
> >    drm/amd/display: remove unused func declaration from resource headers
> >    drm/amd/display: remove unused _calculate_degamma_curve function
> >
> >   .../drm/amd/display/dc/dcn30/dcn30_hwseq.c    |  37 ++---
> >   .../drm/amd/display/dc/dcn30/dcn30_resource.c |   2 +-
> >   drivers/gpu/drm/amd/display/dc/inc/resource.h |   4 -
> >   .../amd/display/modules/color/color_gamma.c   | 140 ++++--------------
> >   .../amd/display/modules/color/color_gamma.h   |   3 -
> >   5 files changed, 48 insertions(+), 138 deletions(-)
> >
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-02-14 17:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-14 12:14 [PATCH 0/6] Trivial code cleanup around color resources Melissa Wen
2023-02-14 12:14 ` [PATCH 1/6] drm/amd/display: ident braces in dcn30_acquire_post_bldn_3dlut correctly Melissa Wen
2023-02-14 12:14 ` [PATCH 2/6] drm/amd/display: clean code-style issues in dcn30_set_mpc_shaper_3dlut Melissa Wen
2023-02-14 12:14 ` [PATCH 3/6] drm/amd/display: camel case cleanup in color_gamma file Melissa Wen
2023-02-14 12:14 ` [PATCH 4/6] drm/amd/display: unset initial value for tf since it's never used Melissa Wen
2023-02-14 12:14 ` [PATCH 5/6] drm/amd/display: remove unused func declaration from resource headers Melissa Wen
2023-02-14 12:14 ` [PATCH 6/6] drm/amd/display: remove unused _calculate_degamma_curve function Melissa Wen
2023-02-14 12:48 ` [PATCH 0/6] Trivial code cleanup around color resources Christian König
2023-02-14 17:39   ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.