drm/amd/display: Modify DHCUB waterwark structures and functions
authorDillon Varone <dillon.varone@amd.com>
Fri, 15 Mar 2024 20:50:47 +0000 (16:50 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 27 Mar 2024 05:43:28 +0000 (01:43 -0400)
[WHY&HOW]
Converting the watermark set structure to a union and modifying some interfaces
to accommodate future usage.

Reviewed-by: Chaitanya Dhere <chaitanya.dhere@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Dillon Varone <dillon.varone@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
17 files changed:
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.h
drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hubbub.c
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.h
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubbub.c
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubbub.h
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hubbub.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hubbub.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hubbub.h
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_hubbub.c
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
drivers/gpu/drm/amd/display/dc/inc/core_types.h
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h

index d51f1ce0287480f69f35edb29647008dc651ab81..d9ade9ee0aebc9e3b027ad8ea9a0b2c1ddad60a3 100644 (file)
@@ -242,7 +242,7 @@ void hubbub1_wm_change_req_wa(struct hubbub *hubbub)
 
 bool hubbub1_program_urgent_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -356,7 +356,7 @@ bool hubbub1_program_urgent_watermarks(
 
 bool hubbub1_program_stutter_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -501,7 +501,7 @@ bool hubbub1_program_stutter_watermarks(
 
 bool hubbub1_program_pstate_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -582,7 +582,7 @@ bool hubbub1_program_pstate_watermarks(
 
 bool hubbub1_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
index 4201b76270306786e1871062485425fa2a30995e..d1f9e63944c8852586f19ad5a74e6f4d93cbcb20 100644 (file)
@@ -409,7 +409,7 @@ struct dcn10_hubbub {
        const struct dcn_hubbub_shift *shifts;
        const struct dcn_hubbub_mask *masks;
        unsigned int debug_test_index_pstate;
-       struct dcn_watermark_set watermarks;
+       union dcn_watermark_set watermarks;
 };
 
 void hubbub1_update_dchub(
@@ -423,7 +423,7 @@ void hubbub1_wm_change_req_wa(struct hubbub *hubbub);
 
 bool hubbub1_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 
@@ -446,17 +446,17 @@ void hubbub1_construct(struct hubbub *hubbub,
 
 bool hubbub1_program_urgent_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 bool hubbub1_program_stutter_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 bool hubbub1_program_pstate_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 
index 6eebcb22e31739916a77ef9024da1f6ded89dcd7..c6f859871d11e63b1b0b9bc44258a39026a78423 100644 (file)
@@ -570,7 +570,7 @@ void hubbub2_get_dchub_ref_freq(struct hubbub *hubbub,
 
 static bool hubbub2_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
index 2f6146bf1d328f162392d74e46357fd7276036ee..24a9c45988edcaed1ba58513d1345928bd11e259 100644 (file)
@@ -85,7 +85,7 @@ struct dcn20_hubbub {
        const struct dcn_hubbub_shift *shifts;
        const struct dcn_hubbub_mask *masks;
        unsigned int debug_test_index_pstate;
-       struct dcn_watermark_set watermarks;
+       union dcn_watermark_set watermarks;
        int num_vmid;
        struct dcn20_vmid vmid[16];
        unsigned int detile_buf_size;
index 037d265431c65d1bbf8e30ad9f741933803a7785..09ea65acb2c439bdb8b1f1f1bab92b746c450e55 100644 (file)
@@ -52,7 +52,7 @@
 
 static bool hubbub201_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
index aeb0e0d9b70a475f6482df74e94e3391a82b04c0..2546224b326a83adbd7c070d89147d24e77de46c 100644 (file)
@@ -140,7 +140,7 @@ int hubbub21_init_dchub(struct hubbub *hubbub,
 
 bool hubbub21_program_urgent_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -334,7 +334,7 @@ bool hubbub21_program_urgent_watermarks(
 
 bool hubbub21_program_stutter_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -487,7 +487,7 @@ bool hubbub21_program_stutter_watermarks(
 
 bool hubbub21_program_pstate_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -573,7 +573,7 @@ bool hubbub21_program_pstate_watermarks(
 
 bool hubbub21_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
index d8eb2bb7282c9705e417847333af562fd4294e8e..ab2ce03135293a73851bb63e3aec4576d1940b90 100644 (file)
@@ -127,22 +127,22 @@ int hubbub21_init_dchub(struct hubbub *hubbub,
                struct dcn_hubbub_phys_addr_config *pa_config);
 bool hubbub21_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 bool hubbub21_program_urgent_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 bool hubbub21_program_stutter_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 bool hubbub21_program_pstate_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 
index 152c9c5733f1cd5ad6d3636260d41337a1126e4c..6a5af3da4b459055555ddac8039eb3862f654b20 100644 (file)
@@ -95,7 +95,7 @@ int hubbub3_init_dchub_sys_ctx(struct hubbub *hubbub,
 
 bool hubbub3_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
index 7b597908b937e05e99ccb935f67b02690ac2bfc5..ca6233e8f1f44317ced16c6d45396419b7373dd3 100644 (file)
@@ -124,7 +124,7 @@ bool hubbub3_get_dcc_compression_cap(struct hubbub *hubbub,
 
 bool hubbub3_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 
index 5b5b5e0775fa6d8b9b5eb4bd8f169f6c37c7a9a3..b906db6e7355fa73883ab0ee4c22eab9113d9461 100644 (file)
@@ -172,7 +172,7 @@ static uint32_t convert_and_clamp(
 
 static bool hubbub31_program_urgent_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -362,7 +362,7 @@ static bool hubbub31_program_urgent_watermarks(
 
 static bool hubbub31_program_stutter_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -635,7 +635,7 @@ static bool hubbub31_program_stutter_watermarks(
 
 static bool hubbub31_program_pstate_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -717,7 +717,7 @@ static bool hubbub31_program_pstate_watermarks(
 
 static bool hubbub31_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
index 88dfc907553d4c1fa4edc9ee74bd6c75c1e9869f..515c4c2b4c21f8d776e18136e785ab7fc2542825 100644 (file)
@@ -167,7 +167,7 @@ static uint32_t convert_and_clamp(
 
 bool hubbub32_program_urgent_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -357,7 +357,7 @@ bool hubbub32_program_urgent_watermarks(
 
 bool hubbub32_program_stutter_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -503,7 +503,7 @@ bool hubbub32_program_stutter_watermarks(
 
 bool hubbub32_program_pstate_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -656,7 +656,7 @@ bool hubbub32_program_pstate_watermarks(
 
 bool hubbub32_program_usr_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -750,7 +750,7 @@ void hubbub32_force_usr_retraining_allow(struct hubbub *hubbub, bool allow)
 
 static bool hubbub32_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
index f073839a4b6d2360b628531a8898d40d6fdee0ac..e439ba0fa30fa62d39fdbfc4781216c897d9739a 100644 (file)
 
 bool hubbub32_program_urgent_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 
 bool hubbub32_program_stutter_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 
 bool hubbub32_program_pstate_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 
 bool hubbub32_program_usr_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower);
 
index 339bf0c722dd90a1435cb07319da4960ee47eb32..6293173ba2b9d50bafe8d9fe11711ae020c66c14 100644 (file)
@@ -111,7 +111,7 @@ static uint32_t convert_and_clamp(
 
 static bool hubbub35_program_stutter_z8_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
@@ -297,7 +297,7 @@ static void hubbub35_get_dchub_ref_freq(struct hubbub *hubbub,
 
 static bool hubbub35_program_watermarks(
                struct hubbub *hubbub,
-               struct dcn_watermark_set *watermarks,
+               union dcn_watermark_set *watermarks,
                unsigned int refclk_mhz,
                bool safe_to_lower)
 {
index 1530b1f8f8be50ec63cebee559238f6cc9779ba3..f983041ce9a4e0101f7519f83841eed9a20936d1 100644 (file)
@@ -1910,9 +1910,11 @@ static void dcn20_program_pipe(
                        dc->res_pool->hubbub->funcs->force_wm_propagate_to_pipes(dc->res_pool->hubbub);
        }
 
-       if (dc->res_pool->hubbub->funcs->program_det_size && pipe_ctx->update_flags.bits.det_size)
-               dc->res_pool->hubbub->funcs->program_det_size(
-                       dc->res_pool->hubbub, pipe_ctx->plane_res.hubp->inst, pipe_ctx->det_buffer_size_kb);
+       if (pipe_ctx->update_flags.bits.det_size) {
+               if (dc->res_pool->hubbub->funcs->program_det_size)
+                       dc->res_pool->hubbub->funcs->program_det_size(
+                               dc->res_pool->hubbub, pipe_ctx->plane_res.hubp->inst, pipe_ctx->det_buffer_size_kb);
+       }
 
        if (pipe_ctx->update_flags.raw || pipe_ctx->plane_state->update_flags.raw || pipe_ctx->stream->update_flags.raw)
                dcn20_update_dchubp_dpp(dc, pipe_ctx, context);
@@ -2073,9 +2075,11 @@ void dcn20_program_front_end_for_ctx(
                         * turned on (i.e. in an MCLK switch) which can come in too late and cause issues with
                         * DET allocation.
                         */
-                       if (hubbub->funcs->program_det_size && (context->res_ctx.pipe_ctx[i].update_flags.bits.disable ||
-                                       (context->res_ctx.pipe_ctx[i].plane_state && dc_state_get_pipe_subvp_type(context, &context->res_ctx.pipe_ctx[i]) == SUBVP_PHANTOM)))
-                               hubbub->funcs->program_det_size(hubbub, dc->current_state->res_ctx.pipe_ctx[i].plane_res.hubp->inst, 0);
+                       if ((context->res_ctx.pipe_ctx[i].update_flags.bits.disable ||
+                                       (context->res_ctx.pipe_ctx[i].plane_state && dc_state_get_pipe_subvp_type(context, &context->res_ctx.pipe_ctx[i]) == SUBVP_PHANTOM))) {
+                               if (hubbub->funcs->program_det_size)
+                                       hubbub->funcs->program_det_size(hubbub, dc->current_state->res_ctx.pipe_ctx[i].plane_res.hubp->inst, 0);
+                       }
                        hws->funcs.plane_atomic_disconnect(dc, dc->current_state, &dc->current_state->res_ctx.pipe_ctx[i]);
                        DC_LOG_DC("Reset mpcc for pipe %d\n", dc->current_state->res_ctx.pipe_ctx[i].pipe_idx);
                }
index a66676c00c6c5567805315d164683913a6004fb2..3f6876aafee09c62e42bf81f7a380308c2e94b4e 100644 (file)
@@ -499,7 +499,7 @@ struct dcn_bw_writeback {
 
 struct dcn_bw_output {
        struct dc_clocks clk;
-       struct dcn_watermark_set watermarks;
+       union dcn_watermark_set watermarks;
        struct dcn_bw_writeback bw_writeback;
        int compbuf_size_kb;
        unsigned int mall_ss_size_bytes;
index 2ae7484d18afb0f6f705015f2b81dc7c6b67d256..305fdc127bfcd0369727606c2f56cacb40325622 100644 (file)
@@ -160,7 +160,7 @@ struct hubbub_funcs {
 
        bool (*program_watermarks)(
                        struct hubbub *hubbub,
-                       struct dcn_watermark_set *watermarks,
+                       union dcn_watermark_set *watermarks,
                        unsigned int refclk_mhz,
                        bool safe_to_lower);
 
index b72fb314d804a7659899ad41d94713d193d38ec7..86c12cd6f47d6e4c8e23355611c7cb79cb697deb 100644 (file)
@@ -50,11 +50,13 @@ struct dcn_watermarks {
        uint32_t usr_retraining_ns;
 };
 
-struct dcn_watermark_set {
-       struct dcn_watermarks a;
-       struct dcn_watermarks b;
-       struct dcn_watermarks c;
-       struct dcn_watermarks d;
+union dcn_watermark_set {
+       struct {
+               struct dcn_watermarks a;
+               struct dcn_watermarks b;
+               struct dcn_watermarks c;
+               struct dcn_watermarks d;
+       }; // legacy
 };
 
 struct dce_watermarks {