Skip to contentSkip to conversation

drm/amd: Remove unused variables

PATCH In review Caio Novais 3 participants 18 messages Mar 27, 2023 – Mar 28, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover drm/amd: Remove unused variables

This patchset cleans the code removing unused variables and one unused function.

Caio Novais (12):
Remove unused variable 'r'
Remove unused variable 'value0'
Remove unused variable 'pixel_width'
Remove unused variable 'hubp'
Remove unused variable 'speakers'
Remove unused variable 'mc_vm_apt_default'
Remove unused variable 'optc'
Remove two unused variables 'speakers' and 'channels' and remove
unused function 'speakers_to_channels'
Remove two unused variables 'is_pipe_split_expected' and 'state' Remove unused variable 'cursor_bpp'
Remove unused variable 'scl_enable'
Remove two unused variables 'result_write_min_hblank' and
'hblank_size'

 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c       |  8 ----
 .../amd/display/dc/dcn10/dcn10_link_encoder.c |  3 --
 .../drm/amd/display/dc/dcn201/dcn201_dpp.c    |  6 ---
 .../drm/amd/display/dc/dcn201/dcn201_hwseq.c  |  2 -
 .../gpu/drm/amd/display/dc/dcn30/dcn30_afmt.c |  2 -
 .../gpu/drm/amd/display/dc/dcn30/dcn30_hubp.c |  4 --
 .../drm/amd/display/dc/dcn30/dcn30_hwseq.c    |  3 --
 .../gpu/drm/amd/display/dc/dcn31/dcn31_apg.c  | 39 -------------------
 .../drm/amd/display/dc/dcn32/dcn32_resource.c |  4 --
 .../display/dc/dcn32/dcn32_resource_helpers.c |  4 --
 .../dc/dml/dcn31/display_rq_dlg_calc_31.c     |  2 -
 .../dc/link/protocols/link_dp_capability.c    |  7 ----
 12 files changed, 84 deletions(-)
Signature · 1 line
2.40.0
#1 lore raw

PATCH 1/12 drm/amd: Remove unused variable 'r'

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c: In function ‘amdgpu_mes_ctx_alloc_meta_data’:
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1099:13: warning: variable ‘r’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +0 -8
index 82e27bd4f038..e0130536f778 100644
@@ -1096,14 +1096,6 @@ uint32_t amdgpu_mes_get_aggregated_doorbell_index(struct amdgpu_device *adev,
 int amdgpu_mes_ctx_alloc_meta_data(struct amdgpu_device *adev,
 				   struct amdgpu_mes_ctx_data *ctx_data)
 {
-	int r;
-
-	r = amdgpu_bo_create_kernel(adev,
-			    sizeof(struct amdgpu_mes_ctx_meta_data),
-			    PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,
-			    &ctx_data->meta_data_obj,
-			    &ctx_data->meta_data_mc_addr,
-			    &ctx_data->meta_data_ptr);
 	if (!ctx_data->meta_data_obj)
 		return -ENOMEM;
 
Signature · 1 line
2.40.0
#2 lore raw

Re: [PATCH 01/12] drm/amd: Remove unused variable 'r'

Quoted 19 lines · Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c: In function ‘amdgpu_mes_ctx_alloc_meta_data’:
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1099:13: warning: variable ‘r’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +0 -0
index 82e27bd4f038..e0130536f778 100644
@@ -1096,14 +1096,6 @@ uint32_t amdgpu_mes_get_aggregated_doorbell_index(struct amdgpu_device *adev,
 int amdgpu_mes_ctx_alloc_meta_data(struct amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c uint32_t amdgpu_mes_get_aggregated_doorbell_index(struct amdgpu_device *adev, · line 1106

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +0 -8
                                   struct amdgpu_mes_ctx_data *ctx_data)
 {
-       int r;
-
-       r = amdgpu_bo_create_kernel(adev,
-                           sizeof(struct amdgpu_mes_ctx_meta_data),
-                           PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,
-                           &ctx_data->meta_data_obj,
-                           &ctx_data->meta_data_mc_addr,
-                           &ctx_data->meta_data_ptr);

You can't just remove the buffer allocation here. If you want to fix this then do something like
if (r)

    return r;

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +0 -1
        if (!ctx_data->meta_data_obj)
                return -ENOMEM;
 
--

2.40.0

#3 lore raw

PATCH 2/12 drm/amd: Remove unused variable 'value0'

In reply to Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_link_encoder.c: In function ‘dcn10_link_encoder_update_mst_stream_allocation_table’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_link_encoder.c:1222:18: warning: variable ‘value0’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +0 -3
index c4287147b853..81aa1631945a 100644
@@ -1219,7 +1219,6 @@ void dcn10_link_encoder_update_mst_stream_allocation_table(
 	const struct link_mst_stream_allocation_table *table)
 {
 	struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
-	uint32_t value0 = 0;
 	uint32_t value1 = 0;
 	uint32_t value2 = 0;
 	uint32_t slots = 0;
@@ -1321,8 +1320,6 @@ void dcn10_link_encoder_update_mst_stream_allocation_table(
 	do {
 		udelay(10);
 
-		value0 = REG_READ(DP_MSE_SAT_UPDATE);
-
 		REG_GET(DP_MSE_SAT_UPDATE,
 				DP_MSE_SAT_UPDATE, &value1);
 
Signature · 1 line
2.40.0
#4 lore raw

Re: [PATCH 02/12] drm/amd: Remove unused variable 'value0'

Quoted 26 lines · Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_link_encoder.c: In function ‘dcn10_link_encoder_update_mst_stream_allocation_table’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_link_encoder.c:1222:18: warning: variable ‘value0’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +0 -1
index c4287147b853..81aa1631945a 100644
@@ -1219,7 +1219,6 @@ void dcn10_link_encoder_update_mst_stream_allocation_table(
        const struct link_mst_stream_allocation_table *table)
 {
        struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
-       uint32_t value0 = 0;
        uint32_t value1 = 0;
        uint32_t value2 = 0;
        uint32_t slots = 0;

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c void dcn10_link_encoder_update_mst_stream_allocation_table( · line 1324

Quoted 4 lines
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +0 -1
@@ -1321,8 +1320,6 @@ void dcn10_link_encoder_update_mst_stream_allocation_table(
        do {
                udelay(10);
 
-               value0 = REG_READ(DP_MSE_SAT_UPDATE);

This reads a register. Removing it may adversely affect the programming sequence. If you want to avoid the set but unused warning, just drop the assignment, but leave the REG_READ.

Alex

Quoted 7 lines
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +0 -2
-
                REG_GET(DP_MSE_SAT_UPDATE,
                                DP_MSE_SAT_UPDATE, &value1);
 
--

2.40.0

#5 lore raw

PATCH 3/12 drm/amd/display: Remove unused variable 'pixel_width'

In reply to Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_dpp.c: In function ‘dpp201_get_optimal_number_of_taps’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_dpp.c:188:18: warning: variable ‘pixel_width’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 drivers/gpu/drm/amd/display/dc/dcn201/dcn201_dpp.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn201/dcn201_dpp.c +0 -6
index f50ab961bc17..f8ffc06593b2 100644
@@ -185,12 +185,6 @@ static bool dpp201_get_optimal_number_of_taps(
 		struct scaler_data *scl_data,
 		const struct scaling_taps *in_taps)
 {
-	uint32_t pixel_width;
-
-	if (scl_data->viewport.width > scl_data->recout.width)
-		pixel_width = scl_data->recout.width;
-	else
-		pixel_width = scl_data->viewport.width;
 
 	if (scl_data->viewport.width  != scl_data->h_active &&
 		scl_data->viewport.height != scl_data->v_active &&
Signature · 1 line
2.40.0
#6 lore raw

PATCH 4/12 drm/amd/display: Remove unused variable 'hubp'

In reply to Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_hwseq.c: In function ‘dcn201_pipe_control_lock’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_hwseq.c:544:22: warning: variable ‘hubp’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c +0 -2
index 61bcfa03c4e7..1aeb04fbd89d 100644
@@ -541,8 +541,6 @@ void dcn201_pipe_control_lock(
 	bool lock)
 {
 	struct dce_hwseq *hws = dc->hwseq;
-	struct hubp *hubp = NULL;
-	hubp = dc->res_pool->hubps[pipe->pipe_idx];
 	/* use TG master update lock to lock everything on the TG
 	 * therefore only top pipe need to lock
 	 */
Signature · 1 line
2.40.0
#7 lore raw

PATCH 5/12 drm/amd/display: Remove unused variable 'speakers'

In reply to Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_afmt.c: In function ‘afmt3_se_audio_setup’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_afmt.c:126:18: warning: variable ‘speakers’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_afmt.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_afmt.c +0 -2
index 95528e5ef89e..55e388c4c98b 100644
@@ -123,7 +123,6 @@ void afmt3_se_audio_setup(
 {
 	struct dcn30_afmt *afmt3 = DCN30_AFMT_FROM_AFMT(afmt);
 
-	uint32_t speakers = 0;
 	uint32_t channels = 0;
 
 	ASSERT(audio_info);
@@ -131,7 +130,6 @@ void afmt3_se_audio_setup(
 	if (audio_info == NULL)
 		return;
 
-	speakers = audio_info->flags.info.ALLSPEAKERS;
 	channels = speakers_to_channels(audio_info->flags.speaker_flags).all;
 
 	/* setup the audio stream source select (audio -> dig mapping) */
Signature · 1 line
2.40.0
#8 lore raw

PATCH 6/12 drm/amd/display: Remove unused variable 'mc_vm_apt_default'

In reply to Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_hubp.c: In function ‘hubp3_set_vm_system_aperture_settings’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_hubp.c:50:30: warning: variable ‘mc_vm_apt_default’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubp.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubp.c +0 -4
index dc3e8df706b3..e46bbe7ddcc9 100644
@@ -47,13 +47,9 @@ void hubp3_set_vm_system_aperture_settings(struct hubp *hubp,
 {
 	struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
 
-	PHYSICAL_ADDRESS_LOC mc_vm_apt_default;
 	PHYSICAL_ADDRESS_LOC mc_vm_apt_low;
 	PHYSICAL_ADDRESS_LOC mc_vm_apt_high;
 
-	// The format of default addr is 48:12 of the 48 bit addr
-	mc_vm_apt_default.quad_part = apt->sys_default.quad_part >> 12;
-
 	// The format of high/low are 48:18 of the 48 bit addr
 	mc_vm_apt_low.quad_part = apt->sys_low.quad_part >> 18;
 	mc_vm_apt_high.quad_part = apt->sys_high.quad_part >> 18;
Signature · 1 line
2.40.0
#9 lore raw

PATCH 7/12 drm/amd/display: Remove unused variable 'optc'

In reply to Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_hwseq.c: In function ‘dcn30_enable_writeback’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_hwseq.c:326:34: warning: variable ‘optc’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +0 -3
index 3b4d4d68359b..6ef85e71380c 100644
@@ -323,13 +323,10 @@ void dcn30_enable_writeback(
 {
 	struct dwbc *dwb;
 	struct mcif_wb *mcif_wb;
-	struct timing_generator *optc;
 
 	dwb = dc->res_pool->dwbc[wb_info->dwb_pipe_inst];
 	mcif_wb = dc->res_pool->mcif_wb[wb_info->dwb_pipe_inst];
 
-	/* set the OPTC source mux */
-	optc = dc->res_pool->timing_generators[dwb->otg_inst];
 	DC_LOG_DWB("%s dwb_pipe_inst = %d, mpcc_inst = %d",\
 		__func__, wb_info->dwb_pipe_inst,\
 		wb_info->mpcc_inst);
Signature · 1 line
2.40.0
#10 lore raw

PATCH 8/12 drm/amd/display: Remove two unused variables 'speakers' and 'channels' and remove unused function 'speakers_to_channels'

In reply to Caio Novais

Compiling AMD GPU drivers displays two warnings:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn31/dcn31_apg.c: In function ‘apg31_se_audio_setup’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn31/dcn31_apg.c:117:18: warning: variable ‘channels’ set but not used [-Wunused-but-set-variable] and
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn31/dcn31_apg.c:116:18: warning: variable ‘speakers’ set but not used [-Wunused-but-set-variable]

Get rid of them by removing the variables and the function "speakers_to_channels".

---
 .../gpu/drm/amd/display/dc/dcn31/dcn31_apg.c  | 39 -------------------
 1 file changed, 39 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_apg.c +0 -39
index 24e9ff65434d..e94d0ba915ce 100644
@@ -72,40 +72,6 @@ static void apg31_disable(
 	REG_UPDATE(APG_CONTROL2, APG_ENABLE, 0);
 }
 
-static union audio_cea_channels speakers_to_channels(
-	struct audio_speaker_flags speaker_flags)
-{
-	union audio_cea_channels cea_channels = {0};
-
-	/* these are one to one */
-	cea_channels.channels.FL = speaker_flags.FL_FR;
-	cea_channels.channels.FR = speaker_flags.FL_FR;
-	cea_channels.channels.LFE = speaker_flags.LFE;
-	cea_channels.channels.FC = speaker_flags.FC;
-
-	/* if Rear Left and Right exist move RC speaker to channel 7
-	 * otherwise to channel 5
-	 */
-	if (speaker_flags.RL_RR) {
-		cea_channels.channels.RL_RC = speaker_flags.RL_RR;
-		cea_channels.channels.RR = speaker_flags.RL_RR;
-		cea_channels.channels.RC_RLC_FLC = speaker_flags.RC;
-	} else {
-		cea_channels.channels.RL_RC = speaker_flags.RC;
-	}
-
-	/* FRONT Left Right Center and REAR Left Right Center are exclusive */
-	if (speaker_flags.FLC_FRC) {
-		cea_channels.channels.RC_RLC_FLC = speaker_flags.FLC_FRC;
-		cea_channels.channels.RRC_FRC = speaker_flags.FLC_FRC;
-	} else {
-		cea_channels.channels.RC_RLC_FLC = speaker_flags.RLC_RRC;
-		cea_channels.channels.RRC_FRC = speaker_flags.RLC_RRC;
-	}
-
-	return cea_channels;
-}
-
 static void apg31_se_audio_setup(
 	struct apg *apg,
 	unsigned int az_inst,
@@ -113,17 +79,12 @@ static void apg31_se_audio_setup(
 {
 	struct dcn31_apg *apg31 = DCN31_APG_FROM_APG(apg);
 
-	uint32_t speakers = 0;
-	uint32_t channels = 0;
 
 	ASSERT(audio_info);
 	/* This should not happen.it does so we don't get BSOD*/
 	if (audio_info == NULL)
 		return;
 
-	speakers = audio_info->flags.info.ALLSPEAKERS;
-	channels = speakers_to_channels(audio_info->flags.speaker_flags).all;
-
 	/* DisplayPort only allows for one audio stream with stream ID 0 */
 	REG_UPDATE(APG_CONTROL2, APG_DP_AUDIO_STREAM_ID, 0);
 
Signature · 1 line
2.40.0
#11 lore raw

PATCH 9/12 drm/amd/display: Remove two unused variables 'is_pipe_split_expected' and 'state'

In reply to Caio Novais

Compiling AMD GPU drivers displays two warnings:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_resource.c: In function ‘dcn32_acquire_post_bldn_3dlut’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_resource.c:1614:31: warning: variable ‘state’ set but not used [-Wunused-but-set-variable] and
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_resource.c: In function ‘dcn32_populate_dml_pipes_from_context’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_resource.c:1916:17: warning: variable ‘is_pipe_split_expected’ set but not used [-Wunused-but-set-variable]

Get rid of them by removing the variables.

---
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +0 -4
index 74e50c09bb62..3435d3294e0b 100644
@@ -1611,7 +1611,6 @@ bool dcn32_acquire_post_bldn_3dlut(
 		struct dc_transfer_func **shaper)
 {
 	bool ret = false;
-	union dc_3dlut_state *state;
 
 	ASSERT(*lut == NULL && *shaper == NULL);
 	*lut = NULL;
@@ -1620,7 +1619,6 @@ bool dcn32_acquire_post_bldn_3dlut(
 	if (!res_ctx->is_mpc_3dlut_acquired[mpcc_id]) {
 		*lut = pool->mpc_lut[mpcc_id];
 		*shaper = pool->mpc_shaper[mpcc_id];
-		state = &pool->mpc_lut[mpcc_id]->state;
 		res_ctx->is_mpc_3dlut_acquired[mpcc_id] = true;
 		ret = true;
 	}
@@ -1913,7 +1911,6 @@ int dcn32_populate_dml_pipes_from_context(
 	struct resource_context *res_ctx = &context->res_ctx;
 	struct pipe_ctx *pipe;
 	bool subvp_in_use = false;
-	uint8_t is_pipe_split_expected[MAX_PIPES] = {0};
 	struct dc_crtc_timing *timing;
 
 	dcn20_populate_dml_pipes_from_context(dc, context, pipes, fast_validate);
@@ -2002,7 +1999,6 @@ int dcn32_populate_dml_pipes_from_context(
 		}
 
 		DC_FP_START();
-		is_pipe_split_expected[i] = dcn32_predict_pipe_split(context, &pipes[pipe_cnt]);
 		DC_FP_END();
 
 		pipe_cnt++;
Signature · 1 line
2.40.0
#12 lore raw

Re: [PATCH 09/12] drm/amd/display: Remove two unused variables 'is_pipe_split_expected' and 'state'

Quoted 45 lines · Caio Novais

Compiling AMD GPU drivers displays two warnings:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_resource.c: In function ‘dcn32_acquire_post_bldn_3dlut’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_resource.c:1614:31: warning: variable ‘state’ set but not used [-Wunused-but-set-variable] and
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_resource.c: In function ‘dcn32_populate_dml_pipes_from_context’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_resource.c:1916:17: warning: variable ‘is_pipe_split_expected’ set but not used [-Wunused-but-set-variable]

Get rid of them by removing the variables.

---
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +0 -3
index 74e50c09bb62..3435d3294e0b 100644
@@ -1611,7 +1611,6 @@ bool dcn32_acquire_post_bldn_3dlut(
                struct dc_transfer_func **shaper)
 {
        bool ret = false;
-       union dc_3dlut_state *state;
 
        ASSERT(*lut == NULL && *shaper == NULL);
        *lut = NULL;
@@ -1620,7 +1619,6 @@ bool dcn32_acquire_post_bldn_3dlut(
        if (!res_ctx->is_mpc_3dlut_acquired[mpcc_id]) {
                *lut = pool->mpc_lut[mpcc_id];
                *shaper = pool->mpc_shaper[mpcc_id];
-               state = &pool->mpc_lut[mpcc_id]->state;
                res_ctx->is_mpc_3dlut_acquired[mpcc_id] = true;
                ret = true;
        }
@@ -1913,7 +1911,6 @@ int dcn32_populate_dml_pipes_from_context(
        struct resource_context *res_ctx = &context->res_ctx;
        struct pipe_ctx *pipe;
        bool subvp_in_use = false;
-       uint8_t is_pipe_split_expected[MAX_PIPES] = {0};
        struct dc_crtc_timing *timing;
 
        dcn20_populate_dml_pipes_from_context(dc, context, pipes, fast_validate);

drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c int dcn32_populate_dml_pipes_from_context( · line 2002

Quoted 5 lines
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +0 -1
@@ -2002,7 +1999,6 @@ int dcn32_populate_dml_pipes_from_context(
                }
 
                DC_FP_START();
-               is_pipe_split_expected[i] = dcn32_predict_pipe_split(context, &pipes[pipe_cnt]);
                DC_FP_END();

You can drop the DC_FP macros as well if you drop the function call.

Alex

Quoted 5 lines
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +0 -1
                pipe_cnt++;
--

2.40.0

#13 lore raw

PATCH 10/12 drm/amd/display: Remove unused variable 'cursor_bpp'

In reply to Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_resource_helpers.c: In function ‘dcn32_helper_calculate_mall_bytes_for_cursor’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_resource_helpers.c:62:18: warning: variable ‘cursor_bpp’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c +0 -4
index 3a2d7bcc4b6d..a616cf078cf4 100644
@@ -59,25 +59,21 @@ uint32_t dcn32_helper_calculate_mall_bytes_for_cursor(
 {
 	struct hubp *hubp = pipe_ctx->plane_res.hubp;
 	uint32_t cursor_size = hubp->curs_attr.pitch * hubp->curs_attr.height;
-	uint32_t cursor_bpp = 4;
 	uint32_t cursor_mall_size_bytes = 0;
 
 	switch (pipe_ctx->stream->cursor_attributes.color_format) {
 	case CURSOR_MODE_MONO:
 		cursor_size /= 2;
-		cursor_bpp = 4;
 		break;
 	case CURSOR_MODE_COLOR_1BIT_AND:
 	case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA:
 	case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA:
 		cursor_size *= 4;
-		cursor_bpp = 4;
 		break;
 
 	case CURSOR_MODE_COLOR_64BIT_FP_PRE_MULTIPLIED:
 	case CURSOR_MODE_COLOR_64BIT_FP_UN_PRE_MULTIPLIED:
 		cursor_size *= 8;
-		cursor_bpp = 8;
 		break;
 	}
 
Signature · 1 line
2.40.0
#14 lore raw

PATCH 11/12 drm/amd/display: Remove unused variable 'scl_enable'

In reply to Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_rq_dlg_calc_31.c: In function ‘dml_rq_dlg_get_dlg_params’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn31/display_rq_dlg_calc_31.c:905:14: warning: variable ‘scl_enable’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable.

---
 .../gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c   | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c +0 -2
index 35d10b4d018b..2244e4fb8c96 100644
@@ -902,7 +902,6 @@ static void dml_rq_dlg_get_dlg_params(
 	double hratio_c;
 	double vratio_l;
 	double vratio_c;
-	bool scl_enable;
 
 	unsigned int swath_width_ub_l;
 	unsigned int dpte_groups_per_row_ub_l;
@@ -1020,7 +1019,6 @@ static void dml_rq_dlg_get_dlg_params(
 	hratio_c = scl->hscl_ratio_c;
 	vratio_l = scl->vscl_ratio;
 	vratio_c = scl->vscl_ratio_c;
-	scl_enable = scl->scl_enable;
 
 	swath_width_ub_l = rq_dlg_param->rq_l.swath_width_ub;
 	dpte_groups_per_row_ub_l = rq_dlg_param->rq_l.dpte_groups_per_row_ub;
Signature · 1 line
2.40.0
#15 lore raw

PATCH 12/12 drm/amd/display: Remove two unused variables 'result_write_min_hblank' and 'hblank_size'

In reply to Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_capability.c: In function ‘dpcd_set_source_specific_data’:
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_capability.c:1290:32: warning: variable ‘result_write_min_hblank’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable 'result_write_min_hblank' and 'hblank_size'.

---
 .../drm/amd/display/dc/link/protocols/link_dp_capability.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +0 -7
index d4370856f164..7392fcf17653 100644
@@ -1287,7 +1287,6 @@ void dc_link_overwrite_extended_receiver_cap(
 void dpcd_set_source_specific_data(struct dc_link *link)
 {
 	if (!link->dc->vendor_signature.is_valid) {
-		enum dc_status result_write_min_hblank = DC_NOT_SUPPORTED;
 		struct dpcd_amd_signature amd_signature = {0};
 		struct dpcd_amd_device_id amd_device_id = {0};
 
@@ -1324,16 +1323,10 @@ void dpcd_set_source_specific_data(struct dc_link *link)
 		if (link->ctx->dce_version >= DCN_VERSION_2_0 &&
 			link->dc->caps.min_horizontal_blanking_period != 0) {
 
-			uint8_t hblank_size = (uint8_t)link->dc->caps.min_horizontal_blanking_period;
-
-			result_write_min_hblank = core_link_write_dpcd(link,
-				DP_SOURCE_MINIMUM_HBLANK_SUPPORTED, (uint8_t *)(&hblank_size),
-				sizeof(hblank_size));
 		}
 		DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
 							WPP_BIT_FLAG_DC_DETECTION_DP_CAPS,
 							"result=%u link_index=%u enum dce_version=%d DPCD=0x%04X min_hblank=%u branch_dev_id=0x%x branch_dev_name='%c%c%c%c%c%c'",
-							result_write_min_hblank,
 							link->link_index,
 							link->ctx->dce_version,
 							DP_SOURCE_MINIMUM_HBLANK_SUPPORTED,
Signature · 1 line
2.40.0
#16 lore raw

Re: [PATCH 12/12] drm/amd/display: Remove two unused variables 'result_write_min_hblank' and 'hblank_size'

Quoted 26 lines · Caio Novais

Compiling AMD GPU drivers displays a warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_capability.c: In function ‘dpcd_set_source_specific_data’:
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_capability.c:1290:32: warning: variable ‘result_write_min_hblank’ set but not used [-Wunused-but-set-variable]

Get rid of it by removing the variable 'result_write_min_hblank' and 'hblank_size'.

---
 .../drm/amd/display/dc/link/protocols/link_dp_capability.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +0 -1
index d4370856f164..7392fcf17653 100644
@@ -1287,7 +1287,6 @@ void dc_link_overwrite_extended_receiver_cap(
 void dpcd_set_source_specific_data(struct dc_link *link)
 {
        if (!link->dc->vendor_signature.is_valid) {
-               enum dc_status result_write_min_hblank = DC_NOT_SUPPORTED;
                struct dpcd_amd_signature amd_signature = {0};
                struct dpcd_amd_device_id amd_device_id = {0};
 

drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c void dpcd_set_source_specific_data(struct dc_link *link) · line 1331

Quoted 8 lines
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +0 -5
@@ -1324,16 +1323,10 @@ void dpcd_set_source_specific_data(struct dc_link *link)
                if (link->ctx->dce_version >= DCN_VERSION_2_0 &&
                        link->dc->caps.min_horizontal_blanking_period != 0) {
 
-                       uint8_t hblank_size = (uint8_t)link->dc->caps.min_horizontal_blanking_period;
-
-                       result_write_min_hblank = core_link_write_dpcd(link,
-                               DP_SOURCE_MINIMUM_HBLANK_SUPPORTED, (uint8_t *)(&hblank_size),
-                               sizeof(hblank_size));

This writes to the monitor. We shouldn't remove this.

drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c void dpcd_set_source_specific_data(struct dc_link *link) · line 1336

Quoted 5 lines
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +0 -1
                }
                DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
                                                        WPP_BIT_FLAG_DC_DETECTION_DP_CAPS,
                                                        "result=%u link_index=%u enum dce_version=%d DPCD=0x%04X min_hblank=%u branch_dev_id=0x%x branch_dev_name='%c%c%c%c%c%c'",
-                                                       result_write_min_hblank,

You are dropping information from the debug logging. Maybe it would be better to just flag this as maybe unused. Also, I'd suggest rebasing on the latest amdgpu -next branch, as I think a lot of these were already fixed last week or the week before.

Alex

Quoted 6 lines
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +0 -1
                                                        link->link_index,
                                                        link->ctx->dce_version,
                                                        DP_SOURCE_MINIMUM_HBLANK_SUPPORTED,
--

2.40.0

#17 lore raw
In reply to Caio Novais
Quoted 18 lines · Caio Novais

This patchset cleans the code removing unused variables and one unused function.

Caio Novais (12):
Remove unused variable 'r'
Remove unused variable 'value0'
Remove unused variable 'pixel_width'
Remove unused variable 'hubp'
Remove unused variable 'speakers'
Remove unused variable 'mc_vm_apt_default'
Remove unused variable 'optc'
Remove two unused variables 'speakers' and 'channels' and remove
unused function 'speakers_to_channels'
Remove two unused variables 'is_pipe_split_expected' and 'state' Remove unused variable 'cursor_bpp'
Remove unused variable 'scl_enable'
Remove two unused variables 'result_write_min_hblank' and
'hblank_size'

Curious, how did you create this? It does not match the patches.

BR,
Jani.

Quoted 14 lines
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c       |  8 ----
 .../amd/display/dc/dcn10/dcn10_link_encoder.c |  3 --
 .../drm/amd/display/dc/dcn201/dcn201_dpp.c    |  6 ---
 .../drm/amd/display/dc/dcn201/dcn201_hwseq.c  |  2 -
 .../gpu/drm/amd/display/dc/dcn30/dcn30_afmt.c |  2 -
 .../gpu/drm/amd/display/dc/dcn30/dcn30_hubp.c |  4 --
 .../drm/amd/display/dc/dcn30/dcn30_hwseq.c    |  3 --
 .../gpu/drm/amd/display/dc/dcn31/dcn31_apg.c  | 39 -------------------
 .../drm/amd/display/dc/dcn32/dcn32_resource.c |  4 --
 .../display/dc/dcn32/dcn32_resource_helpers.c |  4 --
 .../dc/dml/dcn31/display_rq_dlg_calc_31.c     |  2 -
 .../dc/link/protocols/link_dp_capability.c    |  7 ----
 12 files changed, 84 deletions(-)
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center