From patchwork Wed Aug 21 08:19:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "hongchi.peng" X-Patchwork-Id: 13772050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9540C52D7C for ; Wed, 21 Aug 2024 20:51:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E1C010E6A5; Wed, 21 Aug 2024 20:51:20 +0000 (UTC) Received: from mail03.siengine.com (mail03.siengine.com [43.240.192.165]) by gabe.freedesktop.org (Postfix) with ESMTPS id 243D710E04D for ; Wed, 21 Aug 2024 08:55:36 +0000 (UTC) Received: from mail03.siengine.com (localhost [127.0.0.2] (may be forged)) by mail03.siengine.com with ESMTP id 47L8NHfC072647 for ; Wed, 21 Aug 2024 16:23:17 +0800 (+08) (envelope-from hongchi.peng@siengine.com) Received: from dsgsiengine01.siengine.com ([10.8.1.61]) by mail03.siengine.com with ESMTPS id 47L8M2UU072585 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Aug 2024 16:22:02 +0800 (+08) (envelope-from hongchi.peng@siengine.com) Received: from SEEXMB03-2019.siengine.com (SEEXMB03-2019.siengine.com [10.8.1.33]) by dsgsiengine01.siengine.com (SkyGuard) with ESMTPS id 4WpfSn2XYCz7ZMsj; Wed, 21 Aug 2024 16:22:01 +0800 (CST) Received: from SEEXMB05-2019.siengine.com (10.8.1.153) by SEEXMB03-2019.siengine.com (10.8.1.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1544.11; Wed, 21 Aug 2024 16:22:01 +0800 Received: from SEEXMB03-2019.siengine.com (10.8.1.33) by SEEXMB05-2019.siengine.com (10.8.1.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1544.9; Wed, 21 Aug 2024 16:22:01 +0800 Received: from localhost (10.12.10.38) by SEEXMB03-2019.siengine.com (10.8.1.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.2.1544.11 via Frontend Transport; Wed, 21 Aug 2024 16:22:00 +0800 From: "hongchi.peng" To: CC: , , , , , , Subject: [PATCH] drm: komeda: Fix an issue related to normalized zpos Date: Wed, 21 Aug 2024 16:19:10 +0800 Message-ID: <20240821081910.5062-1-hongchi.peng@siengine.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-DKIM-Results: [10.8.1.61]; dkim=none; X-DNSRBL: X-MAIL: mail03.siengine.com 47L8NHfC072647 X-Mailman-Approved-At: Wed, 21 Aug 2024 20:51:19 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We use komeda_crtc_normalize_zpos to normalize zpos of affected planes to their blending zorder in CU. If there's only one slave plane in affected planes and its layer_split property is enabled, order++ for its split layer, so that when calculating the normalized_zpos of master planes, the split layer of the slave plane is included, but the max_slave_zorder does not include the split layer and keep zero because there's only one slave plane in affacted planes, although we actually use two slave layers in this commit. In most cases, this bug does not result in a commit failure, but assume the following situation: slave_layer 0: zpos = 0, layer split enabled, normalized_zpos = 0;(use slave_layer 2 as its split layer) master_layer 0: zpos = 2, layer_split enabled, normalized_zpos = 2;(use master_layer 2 as its split layer) master_layer 1: zpos = 4, normalized_zpos = 4; master_layer 3: zpos = 5, normalized_zpos = 5; kcrtc_st->max_slave_zorder = 0; When we use master_layer 3 as a input of CU in function komeda_compiz_set_input and check it with function komeda_component_check_input, the parameter idx is equal to normailzed_zpos minus max_slave_zorder, the value of idx is 5 and is euqal to CU's max_active_inputs, so that komeda_component_check_input returns a -EINVAL value. To fix the bug described above, when calculating the max_slave_zorder with the layer_split enabled, count the split layer in this calculation directly. Signed-off-by: hongchi.peng --- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index fe46b0ebefea..0554954c8cea 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -159,7 +159,7 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, struct drm_plane_state *plane_st; struct drm_plane *plane; struct list_head zorder_list; - int order = 0, err; + int order = 0, slave_zpos, err; DRM_DEBUG_ATOMIC("[CRTC:%d:%s] calculating normalized zpos values\n", crtc->base.id, crtc->name); @@ -200,9 +200,11 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, /* calculate max slave zorder */ if (has_bit(drm_plane_index(plane), kcrtc->slave_planes)) + slave_zpos = plane_st->normalized_zpos; + if (to_kplane_st(plane_st)->layer_split) + slave_zpos++; kcrtc_st->max_slave_zorder = - max(plane_st->normalized_zpos, - kcrtc_st->max_slave_zorder); + max(slave_zpos, kcrtc_st->max_slave_zorder); } crtc_st->zpos_changed = true;