From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C5541C1AC7; Tue, 10 Sep 2024 17:24:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725989054; cv=none; b=PO/1P4VMYbYWjQvTRJU7dLf7ky0rrG+EE8Isv5PlgSGMLHYdG0OhUT+IQGCxxlIPYnqwideC7Cg49BSfTGJVtM8Lu7nUcX+1vZjfaAlVQZUNzWSFvDn69luaS7poCFPREXDSAiKR5p6Dnpnq4ln3Z5z6qUoqrEgkx8ulM3xleX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725989054; c=relaxed/simple; bh=Doo8ztSrQS+RUYxDlrPXbAgQWij2KmYKJLiuohWgCuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ugQVZd+RhOrNIORKY0I28vfZnD/Hxgn/jQk3YggCKYiRAVYg8yn8KL/ajPABPg3ecE98QriFAgjb8BKKx6Q1ZbrIlRmmIhxxVcF5git2TmK4+GzqDQHVLr2PdXWQ3+wh7VwgMtxXGzFQ6Q9nHFco2bqF4w0FGKCzpoY2tH0OpeI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CoLWo9aG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CoLWo9aG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6190C4CECE; Tue, 10 Sep 2024 17:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725989053; bh=Doo8ztSrQS+RUYxDlrPXbAgQWij2KmYKJLiuohWgCuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CoLWo9aGkc62KMSGvaWcNnuKqP7NmQsZWIb0NPjA7jtyz0Pvvc6bZSKGxRxCwjO04 0LsVJqjgynVC80uagCQWK9O9SYn8b9NEfNcrTJrzd3ZDEjgbG61+KOyWGWldKbYwSp 3NE3ueTlHYUmWd5kj7mAAuSrJYg0RoUPKuvU8WezyAbbnsPL+vHU47gyROdai9SSb1 nXQxkcUD037j9YyQsuxsRLwS1uGZTHccboOpgHJf7s4pY40Gy+B81smtKrTew1fqLl 8xOpUwvFJnkOQUoisPX0e0/+VkmYPT/WP0q0p8Z0iKtqAxs07rX+610FUJXNY8vkTK fyk6PVq3rALcg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "hongchi.peng" , Liviu Dudau , Sasha Levin , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.10 3/4] drm: komeda: Fix an issue related to normalized zpos Date: Tue, 10 Sep 2024 13:24:02 -0400 Message-ID: <20240910172406.2416588-3-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240910172406.2416588-1-sashal@kernel.org> References: <20240910172406.2416588-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.10.225 Content-Transfer-Encoding: 8bit From: "hongchi.peng" [ Upstream commit 258905cb9a6414be5c9ca4aa20ef855f8dc894d4 ] 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 Acked-by: Liviu Dudau Signed-off-by: Liviu Dudau Link: https://patchwork.freedesktop.org/patch/msgid/20240826024517.3739-1-hongchi.peng@siengine.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 10 +++++++--- 1 file changed, 7 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 1f6682032ca4..ac8b7fb20d8f 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -142,6 +142,7 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, struct drm_plane *plane; struct list_head zorder_list; int order = 0, err; + u32 slave_zpos = 0; DRM_DEBUG_ATOMIC("[CRTC:%d:%s] calculating normalized zpos values\n", crtc->base.id, crtc->name); @@ -181,10 +182,13 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, plane_st->zpos, plane_st->normalized_zpos); /* calculate max slave zorder */ - if (has_bit(drm_plane_index(plane), kcrtc->slave_planes)) + 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; -- 2.43.0