From patchwork Sat Aug 17 22:46: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: 13767323 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 EE17CC531DF for ; Sat, 17 Aug 2024 23:22:31 +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=YBpPNAKphXO049YWIXSeZ6qtTkpF7NVXa/Ter4IbJxk=; b=Z5ZyIL68yvifMU/v88voE4RUGk kTSAgk22cl97JjC8+yG+wzdzbX3sR8p3cAT6NV5630ASZSI4sBxUWBcyX9Wmky8rj8hdUiAAWn92y G3pR1BEKTdxsceWMhugDJN6IsyOIOocJvd0KaVQ84/8wuCjZb0vccg2olpF7otG/vSTQCIov0wkeM APiJqKmvRvyJMDT2sQJHGBsQAEJDJt9qBuwLyitB8OBb8RAhqU7DvCfDISanW99sI7j+X0BmWnjFb M9UJIfPadGYUnu0q9TFMK83cDbBphtA7P3BOdjA3vcEHj15G8tqYHr/b5/r1HcpX01wpN3XfvQE+e 8ZBkQJ2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfSkZ-0000000FsTZ-0S5p; Sat, 17 Aug 2024 23:22:23 +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 1sfSXK-0000000FqWI-36QV for linux-arm-kernel@lists.infradead.org; Sat, 17 Aug 2024 23:08:44 +0000 Received: from phl-compute-05.internal (phl-compute-05.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id 17C82138E14A; Sat, 17 Aug 2024 19:08:42 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Sat, 17 Aug 2024 19:08:42 -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=fm3; t=1723936122; x= 1724022522; bh=YBpPNAKphXO049YWIXSeZ6qtTkpF7NVXa/Ter4IbJxk=; b=b LUqfq+wNO8aJHBTdYPV2nbER3KL6T5IpwLT6Ml+xYGKT8SI2ye2WrlKAN58dfUJM 3rlgB2RY9OMu0kjU3Q+0PDpHsItizzLPTqw+jsCZ0AMc5lKCyxIEWzVx+DdwPgpF yYULZNG7tVUT1+L81ZDS7RTWRmFMnOb1eDZxZNT+N0Qe3QAHQjwcQDPtSqNDOU4J eGe+DJUff9pYebCfWfq39lM99K/Y7aibM4duCC/il7SAs0Gp5oN/oWUAnN3uXy9a XBK8GQuJeLGHAZVYg+jvKIw4gnydoDZV+ckjTp7IQ0JKKbHuULcpYh//yhGOKFs4 NLKOnFwwButTW8mfsBrmQ== 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=fm3; t=1723936122; x= 1724022522; bh=YBpPNAKphXO049YWIXSeZ6qtTkpF7NVXa/Ter4IbJxk=; b=g sN6SRWFHVD2J/AvX7sgPeSK6+08nd2vvJQg8SmgsW6iucoY/5vqjtAxLyUag2zYV IOSNwiGvP9L/bfUwz+ZbCer1Sjzinf7sMI2SKmgOONhGTCQeVEtcX3kJjYzQi3+M 7FO82w7Dx/NyOQNT5YMWT5KX9vvLhMaVt/LUl2x3W04eW0FhFMZHqX3NSJX49j3N YS1pS5LcH2FOnC2Cx4NAmSgOF9dQ/+C3xzM3B+Gr3ttfrLBHy0AwPAq/1o0D+1HM sPBP60Wqm9kkWRJo01YVZzNx3TCcJljX3FLNN4FT4zG1xj6bhz6r87pfmu/W3+OV /AWcA8pfav39lRHxTSucw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudduuddgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefufffkofgjfhgggfestdekredtredttden ucfhrhhomheptfihrghnucghrghlkhhlihhnuceorhihrghnsehtvghsthhtohgrshhtrd gtohhmqeenucggtffrrghtthgvrhhnpeffheeiffegtdfgffejteevgeefkeelieelkeev ueetffetteduffevgeeiieehteenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmh epmhgrihhlfhhrohhmpehrhigrnhesthgvshhtthhorghsthdrtghomhdpnhgspghrtghp thhtohepvddvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehmrhhiphgrrhguse hkvghrnhgvlhdrohhrghdprhgtphhtthhopeifvghnshestghsihgvrdhorhhgpdhrtghp thhtohepmhgrrghrthgvnhdrlhgrnhhkhhhorhhstheslhhinhhugidrihhnthgvlhdrtg homhdprhgtphhtthhopehtiihimhhmvghrmhgrnhhnsehsuhhsvgdruggvpdhrtghpthht oheprghirhhlihgvugesghhmrghilhdrtghomhdprhgtphhtthhopegurghnihgvlhesfh hffihllhdrtghhpdhrtghpthhtohepjhgvrhhnvghjrdhskhhrrggsvggtsehgmhgrihhl rdgtohhmpdhrtghpthhtohepshgrmhhuvghlsehshhholhhlrghnugdrohhrghdprhgtph htthhopehrohgshheskhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: idc0145fc:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Aug 2024 19:08:35 -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 v3 25/26] drm: sun4i: de33: fmt: add Display Engine 3.3 (DE33) support Date: Sun, 18 Aug 2024 10:46:12 +1200 Message-ID: <20240817230503.158889-26-ryan@testtoast.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240817230503.158889-1-ryan@testtoast.com> References: <20240817230503.158889-1-ryan@testtoast.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240817_160842_882383_63A95659 X-CRM114-Status: GOOD ( 12.36 ) 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)