drm/amd/display: print messages when programming shaper/3dlut fails
authorAlex Hung <alex.hung@amd.com>
Wed, 2 Oct 2024 23:55:11 +0000 (17:55 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Oct 2024 15:23:37 +0000 (11:23 -0400)
[WHAT & HOW]
Print error messages when programming shaper lut or 3dlut fails.

This fixes 5 UNUSED_VALUE issues reported by Coverity.

Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Roman Li <roman.li@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c

index 9e1777f..e89ebfd 100644 (file)
@@ -245,6 +245,7 @@ static bool dcn30_set_mpc_shaper_3dlut(struct pipe_ctx *pipe_ctx,
 {
        struct dpp *dpp_base = pipe_ctx->plane_res.dpp;
        int mpcc_id = pipe_ctx->plane_res.hubp->inst;
+       struct dc *dc = pipe_ctx->stream->ctx->dc;
        struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc;
        bool result = false;
        int acquired_rmu = 0;
@@ -283,8 +284,14 @@ static bool dcn30_set_mpc_shaper_3dlut(struct pipe_ctx *pipe_ctx,
 
                result = mpc->funcs->program_3dlut(mpc, &stream->lut3d_func->lut_3d,
                                                   stream->lut3d_func->state.bits.rmu_mux_num);
+               if (!result)
+                       DC_LOG_ERROR("%s: program_3dlut failed\n", __func__);
+
                result = mpc->funcs->program_shaper(mpc, shaper_lut,
                                                    stream->lut3d_func->state.bits.rmu_mux_num);
+               if (!result)
+                       DC_LOG_ERROR("%s: program_shaper failed\n", __func__);
+
        } else {
                // loop through the available mux and release the requested mpcc_id
                mpc->funcs->release_rmu(mpc, mpcc_id);
index 119c6d0..d7f8b2d 100644 (file)
@@ -439,6 +439,7 @@ bool dcn32_set_mpc_shaper_3dlut(
 {
        struct dpp *dpp_base = pipe_ctx->plane_res.dpp;
        int mpcc_id = pipe_ctx->plane_res.hubp->inst;
+       struct dc *dc = pipe_ctx->stream->ctx->dc;
        struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc;
        bool result = false;
 
@@ -458,13 +459,13 @@ bool dcn32_set_mpc_shaper_3dlut(
        if (stream->lut3d_func &&
                stream->lut3d_func->state.bits.initialized == 1) {
 
-               result = mpc->funcs->program_3dlut(mpc,
-                                                               &stream->lut3d_func->lut_3d,
-                                                               mpcc_id);
+               result = mpc->funcs->program_3dlut(mpc, &stream->lut3d_func->lut_3d, mpcc_id);
+               if (!result)
+                       DC_LOG_ERROR("%s: program_3dlut failed\n", __func__);
 
-               result = mpc->funcs->program_shaper(mpc,
-                                                               shaper_lut,
-                                                               mpcc_id);
+               result = mpc->funcs->program_shaper(mpc, shaper_lut, mpcc_id);
+               if (!result)
+                       DC_LOG_ERROR("%s: program_shaper failed\n", __func__);
        }
 
        return result;
index 27b881f..a42c56a 100644 (file)
@@ -1107,9 +1107,13 @@ enum dc_status dpcd_set_link_settings(
 
        status = core_link_write_dpcd(link, DP_DOWNSPREAD_CTRL,
                &downspread.raw, sizeof(downspread));
+       if (status != DC_OK)
+               DC_LOG_ERROR("%s:%d: core_link_write_dpcd (DP_DOWNSPREAD_CTRL) failed\n", __func__, __LINE__);
 
        status = core_link_write_dpcd(link, DP_LANE_COUNT_SET,
                &lane_count_set.raw, 1);
+       if (status != DC_OK)
+               DC_LOG_ERROR("%s:%d: core_link_write_dpcd (DP_LANE_COUNT_SET) failed\n", __func__, __LINE__);
 
        if (link->dpcd_caps.dpcd_rev.raw >= DPCD_REV_13 &&
                        lt_settings->link_settings.use_link_rate_set == true) {
@@ -1125,12 +1129,19 @@ enum dc_status dpcd_set_link_settings(
                                        supported_link_rates, sizeof(supported_link_rates));
                }
                status = core_link_write_dpcd(link, DP_LINK_BW_SET, &rate, 1);
+               if (status != DC_OK)
+                       DC_LOG_ERROR("%s:%d: core_link_write_dpcd (DP_LINK_BW_SET) failed\n", __func__, __LINE__);
+
                status = core_link_write_dpcd(link, DP_LINK_RATE_SET,
                                &lt_settings->link_settings.link_rate_set, 1);
+               if (status != DC_OK)
+                       DC_LOG_ERROR("%s:%d: core_link_write_dpcd (DP_LINK_RATE_SET) failed\n", __func__, __LINE__);
        } else {
                rate = get_dpcd_link_rate(&lt_settings->link_settings);
 
                status = core_link_write_dpcd(link, DP_LINK_BW_SET, &rate, 1);
+               if (status != DC_OK)
+                       DC_LOG_ERROR("%s:%d: core_link_write_dpcd (DP_LINK_BW_SET) failed\n", __func__, __LINE__);
        }
 
        if (rate) {