drm/amd/display: Add writeback enable/disable in dc
authorAlex Hung <alex.hung@amd.com>
Thu, 2 Feb 2023 01:54:51 +0000 (18:54 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 3 Oct 2023 19:42:12 +0000 (15:42 -0400)
[WHAT]
The enable and disable writeback calls need to be included in the
coressponding functions in dc_stream.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_stream.c
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c

index dad1c85a1df3e4ceb64c45baa2cde06b59d762ea..8b7f138bce0f3da2f5e9e97b200807655fc40d4d 100644 (file)
@@ -516,6 +516,25 @@ bool dc_stream_add_writeback(struct dc *dc,
                struct dwbc *dwb = dc->res_pool->dwbc[wb_info->dwb_pipe_inst];
                dwb->otg_inst = stream_status->primary_otg_inst;
        }
+
+       if (!dc->hwss.update_bandwidth(dc, dc->current_state)) {
+               dm_error("DC: update_bandwidth failed!\n");
+               return false;
+       }
+
+       /* enable writeback */
+       if (dc->hwss.enable_writeback) {
+               struct dwbc *dwb = dc->res_pool->dwbc[wb_info->dwb_pipe_inst];
+
+               if (dwb->funcs->is_enabled(dwb)) {
+                       /* writeback pipe already enabled, only need to update */
+                       dc->hwss.update_writeback(dc, wb_info, dc->current_state);
+               } else {
+                       /* Enable writeback pipe from scratch*/
+                       dc->hwss.enable_writeback(dc, wb_info, dc->current_state);
+               }
+       }
+
        return true;
 }
 
@@ -560,6 +579,20 @@ bool dc_stream_remove_writeback(struct dc *dc,
        }
        stream->num_wb_info = j;
 
+       /* recalculate and apply DML parameters */
+       if (!dc->hwss.update_bandwidth(dc, dc->current_state)) {
+               dm_error("DC: update_bandwidth failed!\n");
+               return false;
+       }
+
+       /* disable writeback */
+       if (dc->hwss.disable_writeback) {
+               struct dwbc *dwb = dc->res_pool->dwbc[dwb_pipe_inst];
+
+               if (dwb->funcs->is_enabled(dwb))
+                       dc->hwss.disable_writeback(dc, dwb_pipe_inst);
+       }
+
        return true;
 }
 
index fce9b33c0f8816a77484a1530b9bc49844d6932f..af9a9fc7db48d37da40c4f46efb1dc798ba7b191 100644 (file)
@@ -367,6 +367,10 @@ void dcn30_enable_writeback(
        DC_LOG_DWB("%s dwb_pipe_inst = %d, mpcc_inst = %d",\
                __func__, wb_info->dwb_pipe_inst,\
                wb_info->mpcc_inst);
+
+       /* Warmup interface */
+       dcn30_mmhubbub_warmup(dc, 1, wb_info);
+
        /* Update writeback pipe */
        dcn30_set_writeback(dc, wb_info, context);