From patchwork Wed Aug 21 08:41:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "hongchi.peng" X-Patchwork-Id: 13772048 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 805EAC52D6F for ; Wed, 21 Aug 2024 20:51:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F01DA10E416; Wed, 21 Aug 2024 20:51:19 +0000 (UTC) X-Greylist: delayed 1280 seconds by postgrey-1.36 at gabe; Wed, 21 Aug 2024 08:44:37 UTC Received: from mail03.siengine.com (mail03.siengine.com [43.240.192.165]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7769910E04D for ; Wed, 21 Aug 2024 08:44:37 +0000 (UTC) Received: from dsgsiengine01.siengine.com ([10.8.1.61]) by mail03.siengine.com with ESMTPS id 47L8fm2N076000 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Aug 2024 16:41:48 +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 4Wpfvb2DcFz7ZMpD; Wed, 21 Aug 2024 16:41:47 +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:41:47 +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:41:46 +0800 Received: from SEEXMB03-2019.siengine.com ([fe80::23e0:1bbb:3ec9:73fe]) by SEEXMB03-2019.siengine.com ([fe80::23e0:1bbb:3ec9:73fe%16]) with mapi id 15.02.1544.011; Wed, 21 Aug 2024 16:41:46 +0800 From: =?eucgb2312_cn?b?UGVuZyBIb25nY2hpL8Xtuumz2w==?= To: =?eucgb2312_cn?b?UGVuZyBIb25nY2hpL8Xtuumz2w==?= , "liviu.dudau@arm.com" CC: "maarten.lankhorst@linux.intel.com" , "mripard@kernel.org" , "tzimmermann@suse.de" , "airlied@gmail.com" , "daniel@ffwll.ch" , "dri-devel@lists.freedesktop.org" Subject: =?eucgb2312_cn?b?u9i4tDogW1BBVENIXSBkcm06IGtvbWVkYTogRml4IGFuIGlzc3VlIHJl?= =?eucgb2312_cn?b?bGF0ZWQgdG8gbm9ybWFsaXplZCB6cG9z?= Thread-Topic: [PATCH] drm: komeda: Fix an issue related to normalized zpos Thread-Index: AQHa86MyGBv66CmiKEqzP2nKr0rHV7IxYmVA Date: Wed, 21 Aug 2024 08:41:46 +0000 Message-ID: <01446fc98394446eb82a6346953f4fd0@siengine.com> References: <20240821081910.5062-1-hongchi.peng@siengine.com> In-Reply-To: <20240821081910.5062-1-hongchi.peng@siengine.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.12.10.38] MIME-Version: 1.0 X-DKIM-Results: [10.8.1.61]; dkim=none; X-DNSRBL: X-MAIL: mail03.siengine.com 47L8fm2N076000 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" Hi, all: I'm sorry that I forgot to add a pair of brackets, and I'll send it again soon. Best Regards, Hongchi Peng -----邮件原件----- 发件人: hongchi.peng 发送时间: 2024年8月21日 16:19 收件人: liviu.dudau@arm.com 抄送: maarten.lankhorst@linux.intel.com; mripard@kernel.org; tzimmermann@suse.de; airlied@gmail.com; daniel@ffwll.ch; dri-devel@lists.freedesktop.org; Peng Hongchi/彭洪驰 主题: [PATCH] drm: komeda: Fix an issue related to normalized zpos 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(-) -- 2.34.1 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;