Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp846094pxj; Wed, 16 Jun 2021 15:12:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3Dk78iK/xu6i6sZWAifBTvr+iJow2OPlWL5EAbMIxbd+LH3TjOewpHL02abHQl32MdldV X-Received: by 2002:a50:b2c5:: with SMTP id p63mr2286650edd.5.1623881574831; Wed, 16 Jun 2021 15:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623881574; cv=none; d=google.com; s=arc-20160816; b=KBUb9pwDilbEgACqRiA0APbc0++bXhmiTXwUYhDwg5oVYoEngR87W2WTjlnhqgWx1k eOp7LnDuvingWIrFBcVJDvg3bwgRvvGKrCg1cmRcFp16wja4i6TRzcO3FPrTfK+A4VnH 97ATiuTtzzor0dh+tLAkKw1ItOEmi/T6ybvQRmIFKCK3O2uq2G7yypuNueJGyPOKPCwN fxk/4xWGZY41y2rPhDa62pVH07EhylJsbKWbDAv/yqtITpkXE7FecHxB+IraJqHmzee5 QzrlcldLo6jN/92ikK/uW1xFeAWiI7zSqQ7h9l6d50XpCsQuw74pddSX8c2hEcPna2z/ AhyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RaKB1gRfeDa0gQuT5ryzdV2t09RrfEMQkQyh2e3Bnf4=; b=krAE4YBDr6MmBdnG+bzhpoYE5oEwKD4NOW+3J6WCL6etrT4rCwXtBKA6aBNWggGB1Z xlNau8g8YObMV9gBIayoG51ovuyf3cgo0Ovsqa8MoEH5HpgRIpDAY7XqP2z1x0VIzbqr P31RKg4zFP5Z184pADXPZPdyvLg5urct8yXgMpXYxtISGBNOkpuSnYjU/PyqxGpmEApk a7Knhh+giFoIdZwssRWQGy87cn8jr7dhySzt2gyVd26SmoBdRUSAu55AjfSc0fAntvWs w0UPIBfx3aXvkClKD2U5ewtmPCnqE9HwL3k8ishubxSiQBVjuxFq7jVpwgwtVG1NIQSw 2DRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RA+tU+6H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si3343269ejz.127.2021.06.16.15.11.21; Wed, 16 Jun 2021 15:12:54 -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=@linuxfoundation.org header.s=korg header.b=RA+tU+6H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234853AbhFPPj7 (ORCPT + 99 others); Wed, 16 Jun 2021 11:39:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:50334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235072AbhFPPiV (ORCPT ); Wed, 16 Jun 2021 11:38:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 304BD61166; Wed, 16 Jun 2021 15:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623857767; bh=d2ZN03nQKfadh+LSeiMEoiYz2/mAdXM3bE/ciLZ2Ndw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RA+tU+6HSNGwoJ5DWLkb+hF8I4Cnvbhdkn9R6Oi1Kk9oD3XcsSDCsl3GolC9glACA wzMonRrrzufX+eJ5NYMcGAO57VY5e4XSuU82pXhc/6Hyvhf2xG0P3rXtwIvLabwucl OvxO1rkg7sPBE9E1g62nm3AnB3pUvvxUZBFe4Fk4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Tianci.Yin" , Harry Wentland , Nicholas Choi , Bhawanpreet Lakha , Nicholas Kazlauskas , Mark Yacoub , Daniel Wheeler , Rodrigo Siqueira , Alex Deucher , Sasha Levin Subject: [PATCH 5.10 32/38] drm/amd/display: Fix overlay validation by considering cursors Date: Wed, 16 Jun 2021 17:33:41 +0200 Message-Id: <20210616152836.409676264@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210616152835.407925718@linuxfoundation.org> References: <20210616152835.407925718@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rodrigo Siqueira [ Upstream commit 33f409e60eb0c59a4d0d06a62ab4642a988e17f7 ] A few weeks ago, we saw a two cursor issue in a ChromeOS system. We fixed it in the commit: drm/amd/display: Fix two cursor duplication when using overlay (read the commit message for more details) After this change, we noticed that some IGT subtests related to kms_plane and kms_plane_scaling started to fail. After investigating this issue, we noticed that all subtests that fail have a primary plane covering the overlay plane, which is currently rejected by amdgpu dm. Fail those IGT tests highlight that our verification was too broad and compromises the overlay usage in our drive. This patch fixes this issue by ensuring that we only reject commits where the primary plane is not fully covered by the overlay when the cursor hardware is enabled. With this fix, all IGT tests start to pass again, which means our overlay support works as expected. Cc: Tianci.Yin Cc: Harry Wentland Cc: Nicholas Choi Cc: Bhawanpreet Lakha Cc: Nicholas Kazlauskas Cc: Mark Yacoub Cc: Daniel Wheeler Tested-by: Daniel Wheeler Signed-off-by: Rodrigo Siqueira Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 fbbb1bde6b06..4792228ed481 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -8616,7 +8616,7 @@ static int validate_overlay(struct drm_atomic_state *state) int i; struct drm_plane *plane; struct drm_plane_state *old_plane_state, *new_plane_state; - struct drm_plane_state *primary_state, *overlay_state = NULL; + struct drm_plane_state *primary_state, *cursor_state, *overlay_state = NULL; /* Check if primary plane is contained inside overlay */ for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { @@ -8646,6 +8646,14 @@ static int validate_overlay(struct drm_atomic_state *state) if (!primary_state->crtc) return 0; + /* check if cursor plane is enabled */ + cursor_state = drm_atomic_get_plane_state(state, overlay_state->crtc->cursor); + if (IS_ERR(cursor_state)) + return PTR_ERR(cursor_state); + + if (drm_atomic_plane_disabling(plane->state, cursor_state)) + return 0; + /* Perform the bounds check to ensure the overlay plane covers the primary */ if (primary_state->crtc_x < overlay_state->crtc_x || primary_state->crtc_y < overlay_state->crtc_y || -- 2.30.2