From patchwork Fri Jun 7 11:00:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Walklin X-Patchwork-Id: 13689702 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 44590C27C53 for ; Fri, 7 Jun 2024 11:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kVtA0OJAY5V/lwA79Ti4HUQqvKM9yyVBVpSnBwjDr4k=; b=xLLUWVAeG0cRVr XrglV/1HTkuCfmUNSkm9LcPM8cm9C4BfUVGnZUc8Ic0e2VGODkpZu/EiWrie8kkS5ww9WhCnl9zGI fkR0kskMJNJwZF1z2yl3YWB5x4epJmIO6X2AkLT7cUwAgCHgj4xhZ8eiiLumJGJLB0L8onjqnw/zl 6W4COnrb6myRLWJ+6aOBb0Nw/WvXAPExN5kh1e69GP6JtuRJXOtWSb6GplsIIg15tWOJ5nfFN1lNH oTl8okwnCL7Lnup8i5EIdAlJAHUnt7ubLvwSLEGNJv5eEIJCvxI6W84H2GyrUDqmeunf6kmSKHU/l O+zxXmqjxc8Elk9SSc7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFXNh-0000000DdnX-40BY; Fri, 07 Jun 2024 11:03:37 +0000 Received: from wfhigh3-smtp.messagingengine.com ([64.147.123.154]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFXNe-0000000DdkS-2HZo for linux-arm-kernel@lists.infradead.org; Fri, 07 Jun 2024 11:03:36 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.west.internal (Postfix) with ESMTP id 18E07180014B; Fri, 7 Jun 2024 07:03:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 07 Jun 2024 07:03:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=testtoast.com; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1717758211; x= 1717844611; bh=gjHFAumnKJcTZvrMARevkTtJN9PJo4wyCg8SOfOhIB0=; b=v OIovY1/ditJFJcJMhwnz7Cn8Ha5FdZWDBNjFyMJgLbjPJj8/RUK8lG/9MlwmCp2y Eq50L7FHBgkeCoEB6vcJlJyQOJ0zXw4BqO0D/od3R7mmgCCAMSxxR3W53PgRnkHi 9uD4d6Una6qaqtLRlJrtA3NLFYqT6V+exl55Bq59nyfkCBrEyGNqDBOhNIOGJtjq 1UC34qKAd3o9QDzgyd34SlcPWcECRnLWCn3IVNUz7xd4JQhvmyqH22YkMrNbLmgH pOkPcm2+cHBap7mHFg/LHrP8HW6iVhz1QV9tCB7iNLbBLkYtQWVZCVtDzkP0yHlQ MTn5fHCl8m0Q7rZ9XPPWA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1717758211; x= 1717844611; bh=gjHFAumnKJcTZvrMARevkTtJN9PJo4wyCg8SOfOhIB0=; b=C D/AibnJ5Hzw93UQnt2nMWXQP2gGHsN4ZbcQ5Si4wUgazfCF9QmvCUaJHPi+oUDbq eNbbj83cJFk5CI6KQyriOEp97ZZXoMTYGd3BYSTugySXzNZnRDwJ5jQkp7DsMTZz oxLv4Mgq/9vZ+Qh+jzNOCJkHW3ugmsffNzc4le/0qyNhUPLRS3+PexkLVI/qftBr eX1GGYATSOA8UE2wgl0ViDNelnfkrbrlntJKUZniEm8ga/xq0YALAc496akJ0C6H 7eIp5FJVXV86nMUcI14t0x2MmvqSTxmqJjP0aXrwe3TNSZKVqOi8fpuChTjcLXqW 2XrqoP2pVAjCRHvzz70pg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedtuddgudduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheptfihrghn ucghrghlkhhlihhnuceorhihrghnsehtvghsthhtohgrshhtrdgtohhmqeenucggtffrrg htthgvrhhnpeffheeiffegtdfgffejteevgeefkeelieelkeevueetffetteduffevgeei ieehteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hrhigrnhesthgvshhtthhorghsthdrtghomh X-ME-Proxy: Feedback-ID: idc0145fc:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Jun 2024 07:03:24 -0400 (EDT) From: Ryan Walklin To: Maxime Ripard , Chen-Yu Tsai , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jernej Skrabec , Samuel Holland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Turquette , Stephen Boyd Cc: Andre Przywara , Chris Morgan , John Watts , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, Jernej Skrabec , Ryan Walklin Subject: [PATCH RFC 4/8] drm/sun4i: de2/de3: call csc setup also for UI layer Date: Fri, 7 Jun 2024 23:00:00 +1200 Message-ID: <20240607110227.49848-5-ryan@testtoast.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240607110227.49848-1-ryan@testtoast.com> References: <20240607110227.49848-1-ryan@testtoast.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240607_040334_841055_C3B89640 X-CRM114-Status: GOOD ( 12.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jernej Skrabec Currently, only VI layer calls CSC setup function. This comes from DE2 limitation, which doesn't have CSC unit for UI layers. However, DE3 has separate CSC units for each layer. This allows display pipeline to make output signal in different color spaces. To support both use cases, add a call to CSC setup function also in UI layer code. For DE2, this will be a no-op, but it will allow DE3 to output signal in multiple formats. Signed-off-by: Jernej Skrabec Co-developed-by: Ryan Walklin Signed-off-by: Ryan Walklin --- drivers/gpu/drm/sun4i/sun8i_csc.c | 8 +++++--- drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.c b/drivers/gpu/drm/sun4i/sun8i_csc.c index 0dcbc0866ae82..68d955c63b05b 100644 --- a/drivers/gpu/drm/sun4i/sun8i_csc.c +++ b/drivers/gpu/drm/sun4i/sun8i_csc.c @@ -209,8 +209,10 @@ void sun8i_csc_set_ccsc(struct sun8i_mixer *mixer, int layer, return; } - base = ccsc_base[mixer->cfg->ccsc][layer]; + if (layer < mixer->cfg->vi_num) { + base = ccsc_base[mixer->cfg->ccsc][layer]; - sun8i_csc_setup(mixer->engine.regs, base, - fmt_type, encoding, range); + sun8i_csc_setup(mixer->engine.regs, base, + fmt_type, encoding, range); + } } diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c index ca75ca0835a63..884abe3cf773a 100644 --- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c +++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c @@ -20,6 +20,7 @@ #include #include +#include "sun8i_csc.h" #include "sun8i_mixer.h" #include "sun8i_ui_layer.h" #include "sun8i_ui_scaler.h" @@ -184,6 +185,11 @@ static int sun8i_ui_layer_update_formats(struct sun8i_mixer *mixer, int channel, SUN8I_MIXER_CHAN_UI_LAYER_ATTR(ch_base, overlay), SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_MASK, val); + /* Note: encoding and range arguments are ignored for RGB */ + sun8i_csc_set_ccsc(mixer, channel, FORMAT_TYPE_RGB, + DRM_COLOR_YCBCR_BT601, + DRM_COLOR_YCBCR_FULL_RANGE); + return 0; }