Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp888684pxj; Wed, 16 Jun 2021 16:22:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfuB6eOkeH7RXcbQqA1OC3GYw3kli8ERaZtyJc9fyPTG5DMkJ9LeHz0PGe5VPj+fYONp2j X-Received: by 2002:a5d:94d5:: with SMTP id y21mr1379316ior.110.1623885747903; Wed, 16 Jun 2021 16:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623885747; cv=none; d=google.com; s=arc-20160816; b=Op/Nn/fXKYudZhnVZE5/4i39cmUzNTJGCoyKpPLSd6GJ4/dDTO8xF6v2nbs45mHA7s JBqhU9v1qXMY9mCzm9h0VK/52vlWpqtZLJNivXuuSkxpvvqU2BH4afsBaTyGPMYnuXj1 2RJMgxzFe8viRSS2IXBV9b7SH8hBROYvSv5sG5SiGcZDzY05lMIVx+0wsInoRED3oEIw BF79VGcqSJgR+j6aN04PgsHlEZ4akMdPMdSEVtUjgz5v+pcxzoaO4pq93t2q8yqru0SI ZeufMwA9s80oJWnlYR6NaHCH5xgX5+BWj/MjycQfTVkdNgnx+WL1Cijv3mQA1r2v3Bmm UjtQ== 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=znk/LTvE0dbR4X/s1824D/Rjo7Zte0y7w6juIjGUzBE=; b=LpqdVh8Y81Uj218wI5Pwa9UsYwstGY6lmaQ4zlr5WpBRqG+3KEXGRaaUn5w1cTHdCF VBgy2xPf0tzhIpNE/RAwcTvevfMEhLMxnwtFJ06p3Dxt/05Lr84i4LZEDfmG0Z+fvffo 4jsae26PTtgZKgDKc/UwN95IAw8Y26/t6rwj9MpqDLFi+v18PXzxcXcjPG3l6GtuVuLd qrnvlbGs8PM8MgA9Zmo81M1BHlOJsyk+ldCeiF8iB2FzDkAjgzVPTu+QnkE0jP7DsITJ QA6Tt3jzzD+fUchxONQd4GBFII3//QVxqDWRb5FOhAYkFotMVUOVmTgivyQoSAF57j0Y htdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d3qd2nX+; 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 a14si3972100ilh.72.2021.06.16.16.22.15; Wed, 16 Jun 2021 16:22:27 -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=d3qd2nX+; 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 S234440AbhFPPpA (ORCPT + 99 others); Wed, 16 Jun 2021 11:45:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:51316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235470AbhFPPmA (ORCPT ); Wed, 16 Jun 2021 11:42:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AB17461403; Wed, 16 Jun 2021 15:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623857870; bh=p4wmOn+TNC5YGsNrtgkO02CFSowApYNpV1fmt6+KvXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d3qd2nX+KNXEQzlXZWvIYW0v1OSzRBUicUfBNUvMnJHjSMcYiIgK/8rfTceYQLhnp t3c6jlL4+O6cNoOVRyb3F7NRifgemtVxyaD6oQcuKVY/q0QnrI4aJIPlC2Odw7D42X UMSkuv7Ct5yiz/kFpqpvpK0TA+26PAoQ34d7Y0Ls= 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.12 42/48] drm/amd/display: Fix overlay validation by considering cursors Date: Wed, 16 Jun 2021 17:33:52 +0200 Message-Id: <20210616152837.971271576@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210616152836.655643420@linuxfoundation.org> References: <20210616152836.655643420@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 b63f55ea8758..69023b4b0a8b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -9349,7 +9349,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) { @@ -9379,6 +9379,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