diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 3f601a3d2d7d..6f71c63b973a 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -607,6 +607,13 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) init_data.flags.enable_mipi_converter_optimization = true; + /* + * Request HW cursor offload so DMUB programs the cursor; cursor + * updates then avoid the DMUB inbox0 HW lock during mclk switches. + * dc_dmub_srv_cursor_offload_init() self-gates on FW capability. + */ + init_data.flags.enable_cursor_offload = true; + init_data.dcn_reg_offsets = adev->reg_offset[DCE_HWIP][0]; init_data.nbio_reg_offsets = adev->reg_offset[NBIO_HWIP][0]; init_data.clk_reg_offsets = adev->reg_offset[CLK_HWIP][0]; @@ -724,6 +731,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) dc_hardware_init(adev->dm.dc); + /* Enable cursor offload if the DMUB firmware supports it. */ + dc_dmub_srv_cursor_offload_init(adev->dm.dc); + /* GOP/vBIOS may leave an OPTC enabled for a display present at power-on * but no longer driven (e.g. an external DP unplugged at boot). Such a * dangling pipe keeps DCN out of idle and blocks s0i3. Power it down 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 e23137034130..1e7071f8d53f 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c @@ -1211,9 +1211,16 @@ void dc_dmub_srv_subvp_save_surf_addr(const struct dc_dmub_srv *dc_dmub_srv, con void dc_dmub_srv_cursor_offload_init(struct dc *dc) { struct dmub_rb_cmd_cursor_offload_init *init; - struct dc_dmub_srv *dc_dmub_srv = dc->ctx->dmub_srv; + struct dc_dmub_srv *dc_dmub_srv; union dmub_rb_cmd cmd; + if (!dc || !dc->ctx) + return; + + dc_dmub_srv = dc->ctx->dmub_srv; + if (!dc_dmub_srv || !dc_dmub_srv->dmub) + return; + if (!dc->config.enable_cursor_offload) return;