From patchwork Wed Jul 3 10:51:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Walklin X-Patchwork-Id: 13722067 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 60F08C2BD09 for ; Wed, 3 Jul 2024 11:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=V6kXhDOR28GY7K17QHJNbJAm+pQYGaOIMaC93g+Xacc=; b=MBSWfJ4czQgCBNIZnxQpCmbYqF sYo5SB557FD4OzhMCaDzyhjFlQtxhMjXLUUOWYJRny2AtDnOFXh3xU8PLCftwvDxzxlCZsUUJPOPn d5z9FFkWFydjxt8SN0YGwR39Ve8rBS72ebvkWoedWo/1jVBDerP/eR50snzUrjRUApbtHMm6GY0H9 dNGmXGHSY1emHjojX7UNbTeMapWlHm9QJQDMm5BetNlxo7od3vjtlSjfbR0bcSic3oG8hPHlquHPv K25mduysYHK106FTth/ZY+lJ+c1+asxCLv0qqEdYoErfIlkFeXMHwgXknHpx3S/+uW8tBCSUjUZ2j tsZ4bnLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOxix-00000009wDv-2fQC; Wed, 03 Jul 2024 11:00:31 +0000 Received: from fout6-smtp.messagingengine.com ([103.168.172.149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOxg5-00000009uyZ-0l7M for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 10:57:35 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 962041380501; Wed, 3 Jul 2024 06:57:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 03 Jul 2024 06:57:32 -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=fm2; t=1720004252; x= 1720090652; bh=V6kXhDOR28GY7K17QHJNbJAm+pQYGaOIMaC93g+Xacc=; b=w ISD4EBFcWv9irGxX/6oaEYjxEZqyQmA2hl5l0KKSTHL8nSudnhbjE+aqQPymX7Y2 4eV2qHaoP79P1kRjtzqB3PM//ubKQP8hOwy/TYQioCAoQLTRYlHYTeW3vNBXTXM3 Ats8C/0XGooDPJly7pUHvflkVANsJxB4butIId/muuRgEgo+iE9g5dz7w5W3FYNs i0SU+UuQGTnuEDDxBxjyacWER54CG1YTotX8ZFqvT+E/2XrYYgJg/z7/e90/DsUs i+Y82+TlZXUUN6PDMH41y3kb2DJx1GpZ1s2da6ItN52R+zW/H8e3IvblOGb/dPxT pAM1uRYUk3sIbUfO1KNog== 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=fm2; t=1720004252; x= 1720090652; bh=V6kXhDOR28GY7K17QHJNbJAm+pQYGaOIMaC93g+Xacc=; b=D g2sO7lVgFTPcHwJQ5prJjDIUJETyv4M8nhkAw+wtg/BRDCPaStbZQJ9rwvT7Hn9h WDA+nnCGMHNkW3+10i5WFlchHwijC2FiB977MhQ3hgPptRS3siY/u3Dond2/WQoT R4yxtIXe5/YJf+5yeUKEZkfdXNbY2UPYLN8R2NTap4VSwVlIFWDGQEf73+hdFR75 HKpkkgAwx2JeVk79IJRV+/yxdKDoRPRPpBZzUR+OHAdpg6JEYRFczH/dsfCHTmIa ufM8YAs6A3hDLqr+oJGQ0BGgHQ71v3323yN6JNieHc5Mfvyh4RwynceNf3gd5/PB TVYAs/BaSFY0pG/A3dJ6A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudejgdefgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefthigrnhcu hggrlhhklhhinhcuoehrhigrnhesthgvshhtthhorghsthdrtghomheqnecuggftrfgrth htvghrnhepffehieffgedtgfffjeetveegfeekleeileekveeuteffteetudffveegieei heetnecuvehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmrghilhhfrhhomheprh ihrghnsehtvghsthhtohgrshhtrdgtohhm X-ME-Proxy: Feedback-ID: idc0145fc:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Jul 2024 06:57:26 -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, Ryan Walklin Subject: [PATCH v2 22/23] drm: sun4i: de33: fmt: add Display Engine 3.3 (DE33) support Date: Wed, 3 Jul 2024 22:51:12 +1200 Message-ID: <20240703105454.41254-23-ryan@testtoast.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703105454.41254-1-ryan@testtoast.com> References: <20240703105454.41254-1-ryan@testtoast.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_035733_314564_9DDA13EC X-CRM114-Status: GOOD ( 13.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 Like the DE3, the DE33 has a FMT (formatter) module, which provides YUV444 to YUV422/YUV420 conversion, format re-mapping and color depth conversion, although the DE33 module appears significantly more capable, including up to 4K video support. Add support for the DE33. Signed-off-by: Jernej Skrabec Signed-off-by: Ryan Walklin --- drivers/gpu/drm/sun4i/sun50i_fmt.c | 21 +++++++++++++++++++-- drivers/gpu/drm/sun4i/sun50i_fmt.h | 1 + 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun50i_fmt.c b/drivers/gpu/drm/sun4i/sun50i_fmt.c index 050a8716ae862..39682d4e6d208 100644 --- a/drivers/gpu/drm/sun4i/sun50i_fmt.c +++ b/drivers/gpu/drm/sun4i/sun50i_fmt.c @@ -51,6 +51,19 @@ static void sun50i_fmt_de3_limits(u32 *limits, u32 colorspace, bool bit10) } } +static void sun50i_fmt_de33_limits(u32 *limits, u32 colorspace) +{ + if (colorspace == SUN50I_FMT_CS_YUV444RGB) { + limits[0] = SUN50I_FMT_LIMIT(0, 4095); + limits[1] = SUN50I_FMT_LIMIT(0, 4095); + limits[2] = SUN50I_FMT_LIMIT(0, 4095); + } else { + limits[0] = SUN50I_FMT_LIMIT(256, 3840); + limits[1] = SUN50I_FMT_LIMIT(256, 3840); + limits[2] = SUN50I_FMT_LIMIT(256, 3840); + } +} + void sun50i_fmt_setup(struct sun8i_mixer *mixer, u16 width, u16 height, u32 format) { @@ -60,10 +73,14 @@ void sun50i_fmt_setup(struct sun8i_mixer *mixer, u16 width, colorspace = sun50i_fmt_get_colorspace(format); bit10 = sun50i_fmt_is_10bit(format); - base = SUN50I_FMT_DE3; + base = mixer->cfg->de_type == sun8i_mixer_de3 ? + SUN50I_FMT_DE3 : SUN50I_FMT_DE33; regs = sun8i_blender_regmap(mixer); - sun50i_fmt_de3_limits(limit, colorspace, bit10); + if (mixer->cfg->de_type == sun8i_mixer_de3) + sun50i_fmt_de3_limits(limit, colorspace, bit10); + else + sun50i_fmt_de33_limits(limit, colorspace); regmap_write(regs, SUN50I_FMT_CTRL(base), 0); diff --git a/drivers/gpu/drm/sun4i/sun50i_fmt.h b/drivers/gpu/drm/sun4i/sun50i_fmt.h index 4127f7206aade..3e60d5c788b39 100644 --- a/drivers/gpu/drm/sun4i/sun50i_fmt.h +++ b/drivers/gpu/drm/sun4i/sun50i_fmt.h @@ -9,6 +9,7 @@ #include "sun8i_mixer.h" #define SUN50I_FMT_DE3 0xa8000 +#define SUN50I_FMT_DE33 0x5000 #define SUN50I_FMT_CTRL(base) ((base) + 0x00) #define SUN50I_FMT_SIZE(base) ((base) + 0x04)