[PATCH 22/66] drm/amd/display: drain dmub inbox if queue is full

Qingqing Zhuo Qingqing.Zhuo at amd.com
Fri Apr 14 15:52:46 UTC 2023


From: Josip Pavic <Josip.Pavic at amd.com>

[Why & How]
If dmub command queuing fails due to the inbox being full, flush the
inbox and resubmit the comamnd. This was previously the default behavior
but was lost in a refactor.

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas at amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo at amd.com>
Signed-off-by: Josip Pavic <Josip.Pavic at amd.com>
---
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
index 954cbfdbc3b6..eef43577508c 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
+++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
@@ -139,6 +139,15 @@ bool dc_dmub_srv_cmd_run_list(struct dc_dmub_srv *dc_dmub_srv, unsigned int coun
 		// Queue command
 		status = dmub_srv_cmd_queue(dmub, &cmd_list[i]);
 
+		if (status == DMUB_STATUS_QUEUE_FULL) {
+			/* Execute and wait for queue to become empty again. */
+			dmub_srv_cmd_execute(dmub);
+			dmub_srv_wait_for_idle(dmub, 100000);
+
+			/* Requeue the command. */
+			status = dmub_srv_cmd_queue(dmub, &cmd_list[i]);
+		}
+
 		if (status != DMUB_STATUS_OK) {
 			DC_ERROR("Error queueing DMUB command: status=%d\n", status);
 			dc_dmub_srv_log_diagnostic_data(dc_dmub_srv);
-- 
2.34.1



More information about the amd-gfx mailing list