Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3871735ybz; Mon, 4 May 2020 11:14:48 -0700 (PDT) X-Google-Smtp-Source: APiQypJRDupJNu/mngs7HNvBO1jJ4Q9iey1MSH+atFB8MpG8H0Y4g2knyih5poOcQNDRWUt6PPm3 X-Received: by 2002:a17:907:9481:: with SMTP id dm1mr16740833ejc.268.1588616088041; Mon, 04 May 2020 11:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588616088; cv=none; d=google.com; s=arc-20160816; b=G/O/LzSVojKdSG1gxM31atglskfiK8ScIea/m0+/nG3/izni7TQnC1Lu+RNDDYwwRu yLPO9D2hGwSFRJEO12vx5f9dtYDHVhrBOnHEFdkRqPseVsgPESKnAD5k57mHdazelBMC FTmqiau7K8DlfG9crpAxmkL7dSN1R5nGBmY+2W8pCEOUJJFlVRwrS4jAw7Vka0eJz1lb /B2HspVEbkZYwauDsxRo8lv7MUZJ6pWTBxcLbagCua8H9mSBYilw0sA1u2bTZfqTttf6 WcgpRpBwJh7VRWFQiEVO+MOhDjUEA3gBzl3PGl9IJ5hQ0Gk34DNLmn+v7u4tSUAnNcN5 Xc4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AuZyMdf+wSxhHdSd0JGH/TZiQFXNwDzu78QtwteMFxA=; b=KqiXDHUhZq4ZzKlBt7uo/0x+ijpeZKoNnjpjRouR3yim0Qdxenuk5Suer+87D9EZvM 54Gr7IajcS16qDddqomhb03vvDEiWyHHx4WW5YKOQgZPQEnS0x6a+ntYF1elkgM02nfj RAbi8JwcKHdSDKs7YF+IVUL+SWgAeMxeZiE0QghwdsxaaMtw2PTk4a5R4V//PB93oQdz 9ricJqezG723miXuojAnTV0+70RlGniZxBkEQgCV4TA74h7iLnMaJnTGWBRsBTyxMGNQ l88RCsNcqed9JrGAsOzpTF2FZwTot2K0wK1Kt3RC7cyO9Sny80ZbP3btCu+tONz45mPg oc/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jPjP6RwR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si7128366edv.534.2020.05.04.11.14.24; Mon, 04 May 2020 11:14:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jPjP6RwR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731636AbgEDSJp (ORCPT + 99 others); Mon, 4 May 2020 14:09:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:36616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731943AbgEDSGU (ORCPT ); Mon, 4 May 2020 14:06:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 71CA2206B8; Mon, 4 May 2020 18:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588615579; bh=UEsvsLFY7/HtXESKZ/Exh6Pru9+fDNYrBHmBwGsyn5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jPjP6RwRclPi4AwUY2iER14MUhFpzBzRookvrz2p2dc4NpMGOVDQ+KHfCtS6NLjYr hDrJOtSJEvFaZDwLbVEFehwFQIIzOrrbb5iuNOToQo8rLvBIvShiuJvWsBSpL+rmfx Gqad5/ufl207Byhht4yEramHCuaHUJYKABWITvq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Kazlauskas , Rodrigo Siqueira , Nicholas Kazlauskas , Alex Deucher Subject: [PATCH 5.6 05/73] drm/amd/display: Fix green screen issue after suspend Date: Mon, 4 May 2020 19:57:08 +0200 Message-Id: <20200504165502.808824161@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200504165501.781878940@linuxfoundation.org> References: <20200504165501.781878940@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rodrigo Siqueira commit 87b7ebc2e16c14d32a912f18206a4d6cc9abc3e8 upstream. [why] We have seen a green screen after resume from suspend in a Raven system connected with two displays (HDMI and DP) on X based system. We noticed that this issue is related to bad DCC metadata from user space which may generate hangs and consequently an underflow on HUBP. After taking a deep look at the code path we realized that after resume we try to restore the commit with the DCC enabled framebuffer but the framebuffer is no longer valid. [how] This problem was only reported on Raven based system and after suspend, for this reason, this commit adds a new parameter on fill_plane_dcc_attributes() to give the option of disabling DCC programmatically. In summary, for disabling DCC we first verify if is a Raven system and if it is in suspend; if both conditions are true we disable DCC temporarily, otherwise, it is enabled. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1099 Co-developed-by: Nicholas Kazlauskas Signed-off-by: Nicholas Kazlauskas Signed-off-by: Rodrigo Siqueira Reviewed-by: Nicholas Kazlauskas Acked-by: Rodrigo Siqueira Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 38 ++++++++++++++++------ 1 file changed, 29 insertions(+), 9 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3212,7 +3212,8 @@ fill_plane_dcc_attributes(struct amdgpu_ const union dc_tiling_info *tiling_info, const uint64_t info, struct dc_plane_dcc_param *dcc, - struct dc_plane_address *address) + struct dc_plane_address *address, + bool force_disable_dcc) { struct dc *dc = adev->dm.dc; struct dc_dcc_surface_param input; @@ -3224,6 +3225,9 @@ fill_plane_dcc_attributes(struct amdgpu_ memset(&input, 0, sizeof(input)); memset(&output, 0, sizeof(output)); + if (force_disable_dcc) + return 0; + if (!offset) return 0; @@ -3273,7 +3277,8 @@ fill_plane_buffer_attributes(struct amdg union dc_tiling_info *tiling_info, struct plane_size *plane_size, struct dc_plane_dcc_param *dcc, - struct dc_plane_address *address) + struct dc_plane_address *address, + bool force_disable_dcc) { const struct drm_framebuffer *fb = &afb->base; int ret; @@ -3379,7 +3384,8 @@ fill_plane_buffer_attributes(struct amdg ret = fill_plane_dcc_attributes(adev, afb, format, rotation, plane_size, tiling_info, - tiling_flags, dcc, address); + tiling_flags, dcc, address, + force_disable_dcc); if (ret) return ret; } @@ -3471,7 +3477,8 @@ fill_dc_plane_info_and_addr(struct amdgp const struct drm_plane_state *plane_state, const uint64_t tiling_flags, struct dc_plane_info *plane_info, - struct dc_plane_address *address) + struct dc_plane_address *address, + bool force_disable_dcc) { const struct drm_framebuffer *fb = plane_state->fb; const struct amdgpu_framebuffer *afb = @@ -3550,7 +3557,8 @@ fill_dc_plane_info_and_addr(struct amdgp plane_info->rotation, tiling_flags, &plane_info->tiling_info, &plane_info->plane_size, - &plane_info->dcc, address); + &plane_info->dcc, address, + force_disable_dcc); if (ret) return ret; @@ -3573,6 +3581,7 @@ static int fill_dc_plane_attributes(stru struct dc_plane_info plane_info; uint64_t tiling_flags; int ret; + bool force_disable_dcc = false; ret = fill_dc_scaling_info(plane_state, &scaling_info); if (ret) @@ -3587,9 +3596,11 @@ static int fill_dc_plane_attributes(stru if (ret) return ret; + force_disable_dcc = adev->asic_type == CHIP_RAVEN && adev->in_suspend; ret = fill_dc_plane_info_and_addr(adev, plane_state, tiling_flags, &plane_info, - &dc_plane_state->address); + &dc_plane_state->address, + force_disable_dcc); if (ret) return ret; @@ -5171,6 +5182,7 @@ static int dm_plane_helper_prepare_fb(st uint64_t tiling_flags; uint32_t domain; int r; + bool force_disable_dcc = false; dm_plane_state_old = to_dm_plane_state(plane->state); dm_plane_state_new = to_dm_plane_state(new_state); @@ -5229,11 +5241,13 @@ static int dm_plane_helper_prepare_fb(st dm_plane_state_old->dc_state != dm_plane_state_new->dc_state) { struct dc_plane_state *plane_state = dm_plane_state_new->dc_state; + force_disable_dcc = adev->asic_type == CHIP_RAVEN && adev->in_suspend; fill_plane_buffer_attributes( adev, afb, plane_state->format, plane_state->rotation, tiling_flags, &plane_state->tiling_info, &plane_state->plane_size, &plane_state->dcc, - &plane_state->address); + &plane_state->address, + force_disable_dcc); } return 0; @@ -6514,7 +6528,12 @@ static void amdgpu_dm_commit_planes(stru fill_dc_plane_info_and_addr( dm->adev, new_plane_state, tiling_flags, &bundle->plane_infos[planes_count], - &bundle->flip_addrs[planes_count].address); + &bundle->flip_addrs[planes_count].address, + false); + + DRM_DEBUG_DRIVER("plane: id=%d dcc_en=%d\n", + new_plane_state->plane->index, + bundle->plane_infos[planes_count].dcc.enable); bundle->surface_updates[planes_count].plane_info = &bundle->plane_infos[planes_count]; @@ -7935,7 +7954,8 @@ dm_determine_update_type_for_commit(stru ret = fill_dc_plane_info_and_addr( dm->adev, new_plane_state, tiling_flags, plane_info, - &flip_addr->address); + &flip_addr->address, + false); if (ret) goto cleanup;