Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp811916pxj; Wed, 16 Jun 2021 14:16:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXEudmTzLrublGzEwxtiR/FVErrC17R86k3ykBVBzA8V4gTkJr+A41qoL8i43FEYViizXX X-Received: by 2002:a6b:8e97:: with SMTP id q145mr1010558iod.144.1623878211830; Wed, 16 Jun 2021 14:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623878211; cv=none; d=google.com; s=arc-20160816; b=os6vpqv+gJhet5KwqDj00XFHBAGlvF0J6ta8WuS65nu1kKtFO+LGfHlXG83yqFX3f1 BApmQNfdca2I69HPHfFLIMr/9WusJn/gyPBLXasAqqZ2UgfdXJsExrNe0jHHwu29Zz12 t/ViuQexD9ot11qNQNxZMErjckq2ziOMJi0hvpPHPoCajljQ66+3bM8HYjuhOFtdZ6Ba Dyc+oMQHZkttKDNTAlakx72MdDmrTgvOEAncVJReUPSHrreZAWrwgr9dndPnQLXMt8w9 evwGTzb0MXyGwQGJ3Jsho+cQCoqlW3u+JR2SRa9I/MTC14FOr3zf32bqjltZ9DUQLTJn zwbA== 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=nVNSIuajoZ+tTMV0pgAWgAAuvy4jsQzwFrGs5gQDMSs=; b=EcQSZG2xbLyViC0jZEYNV9yAF3SUhFDKXfQKEBWlNH8TvmOEs1yRGuLS9j197dOT6o lNZpxISMzSQIhvhFjzHus+mDKufspUic2Zdn0KVwj9s1c1a9Gbesq95WkpZQi3AAYIFk l3Xw/ksduwgNr0Re59nfwh5CRO5mGOTxQdRiqz55UD5dC3wtWNZHj2HY5ks8K2OCrkDW 1bHFNB79FWxamVLPpKyOGoWbmNwI6kxE3I59YjyThIS5anFEhD4e4+hu1L6262nffyfd Y2HbeDtgnpBw7HFAzpgay/55aQMkJ4f3u5ITwIZozMLF+L7T/j0I7wVt1ZmheqMVTu4L Eteg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="jcpXpb/9"; 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 k24si3975738jan.49.2021.06.16.14.16.38; Wed, 16 Jun 2021 14:16:51 -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="jcpXpb/9"; 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 S234786AbhFPPhL (ORCPT + 99 others); Wed, 16 Jun 2021 11:37:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:49906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234717AbhFPPgu (ORCPT ); Wed, 16 Jun 2021 11:36:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2EB2613DF; Wed, 16 Jun 2021 15:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623857684; bh=mYvHvXZJaZFo1WptzMlwCY+IEbNrIkIXURIIStBeZKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jcpXpb/9I2mrsADOxHRD8/SqNQcqMLN54bqP5n4Vss7nRJPgJJIXhr6I8lvxvdb4R YYEAPoHr7KdOYVZeQAb8cLQC2AbnUiy8EOEnCsdkRj4duQUJq660StpXezusqT1vhk Y7Wt8Gw/P6uTNXsOo0AN4DYMSElgi0j2MNvseq4c= 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.4 24/28] drm/amd/display: Fix overlay validation by considering cursors Date: Wed, 16 Jun 2021 17:33:35 +0200 Message-Id: <20210616152834.918209675@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210616152834.149064097@linuxfoundation.org> References: <20210616152834.149064097@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 6e31e899192c..29657844bac1 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -7272,7 +7272,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) { @@ -7302,6 +7302,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