From patchwork Wed Jul 31 16:44:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Link Mauve X-Patchwork-Id: 13748961 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 DA9BEC3DA64 for ; Wed, 31 Jul 2024 16:45:40 +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=uexf3FR7DtpDNygWRl3mED3CWcrCfN4QJUuoS9L8p7c=; b=q3YijAUGUOhiKaEy5JV7EupTJ6 Y6qX3nnjoK+x2iSH7//2ewRfHeesWoK+suUT3EHh2+4X7uilSlusRE6HMj+KDB2nxys853jMIU5ZR iCuMiS/8INkQmYM7/oA1ajNurTxBLlxp9MI6BKpomsAarE0qEOMPKlLMDUJZTfBZPJw2DlJwlcRRo GixnOtYd9n80ozbE8ZszgQGUVxwbufZc6kNnetSlId5U+2QMoLFyZPuJKAjdhslYab3x+QYvY+bUJ eAmxbqTInL1/QAEx5k3KPxGgY1hj1JrAwcq69uvZ9zlPeYHEM0+S/wmrrgQYT/z1gEnKvawOsW4DL ul5UFkwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZCS9-00000001tjf-11E2; Wed, 31 Jul 2024 16:45:29 +0000 Received: from [2a01:e0a:828:c7c0:e2d5:5eff:fe2d:8e8] (helo=luna.linkmauve.fr) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZCRE-00000001tTJ-1HFY for linux-arm-kernel@lists.infradead.org; Wed, 31 Jul 2024 16:44:34 +0000 Received: by luna.linkmauve.fr (Postfix, from userid 1000) id 9673914649D8; Wed, 31 Jul 2024 18:44:27 +0200 (CEST) From: Emmanuel Gil Peyrot To: linux-sunxi@lists.linux.dev Cc: Jernej Skrabec , Maxime Ripard , Paul Kocialkowski , Mauro Carvalho Chehab , Greg Kroah-Hartman , Chen-Yu Tsai , Samuel Holland , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/4] media: cedrus: Setup secondary output formats Date: Wed, 31 Jul 2024 18:44:11 +0200 Message-ID: <20240731164422.206503-2-linkmauve@linkmauve.fr> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240731164422.206503-1-linkmauve@linkmauve.fr> References: <20240731164422.206503-1-linkmauve@linkmauve.fr> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240731_094432_507664_97DF4B19 X-CRM114-Status: GOOD ( 11.19 ) 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 It's needed for JPEG codec, since engine outputs to it for some reason. Signed-off-by: Jernej Skrabec --- drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 12 +++++++++--- drivers/staging/media/sunxi/cedrus/cedrus_regs.h | 9 +++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c index 32af0e96e762..582b6cb796ea 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c @@ -88,15 +88,21 @@ void cedrus_dst_format_set(struct cedrus_dev *dev, case V4L2_PIX_FMT_NV12: chroma_size = ALIGN(width, 16) * ALIGN(height, 16) / 2; - reg = VE_PRIMARY_OUT_FMT_NV12; + reg = VE_PRIMARY_OUT_FMT_NV12 | VE_SECONDARY_OUT_FMT_EXT_NV12; cedrus_write(dev, VE_PRIMARY_OUT_FMT, reg); reg = chroma_size / 2; cedrus_write(dev, VE_PRIMARY_CHROMA_BUF_LEN, reg); - reg = VE_PRIMARY_FB_LINE_STRIDE_LUMA(ALIGN(width, 16)) | - VE_PRIMARY_FB_LINE_STRIDE_CHROMA(ALIGN(width, 16) / 2); + reg = VE_CHROMA_BUF_LEN_SDRT(chroma_size / 2) | + VE_CHROMA_WIDTH_ALIGN_8 | + VE_SECONDARY_OUT_FMT_EXT; + cedrus_write(dev, VE_CHROMA_BUF_LEN, reg); + + reg = VE_FB_LINE_STRIDE_LUMA(ALIGN(width, 16)) | + VE_FB_LINE_STRIDE_CHROMA(ALIGN(width, 16) / 2); cedrus_write(dev, VE_PRIMARY_FB_LINE_STRIDE, reg); + cedrus_write(dev, VE_SECONDARY_FB_LINE_STRIDE, reg); break; case V4L2_PIX_FMT_NV12_32L32: diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h index 05e6cbc548ab..3acc05e0fb54 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h +++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h @@ -59,9 +59,10 @@ #define VE_INTRAPRED_DRAM_BUF_ADDR 0x58 #define VE_PRIMARY_CHROMA_BUF_LEN 0xc4 #define VE_PRIMARY_FB_LINE_STRIDE 0xc8 +#define VE_SECONDARY_FB_LINE_STRIDE 0xcc -#define VE_PRIMARY_FB_LINE_STRIDE_CHROMA(s) SHIFT_AND_MASK_BITS(s, 31, 16) -#define VE_PRIMARY_FB_LINE_STRIDE_LUMA(s) SHIFT_AND_MASK_BITS(s, 15, 0) +#define VE_FB_LINE_STRIDE_CHROMA(s) SHIFT_AND_MASK_BITS(s, 31, 16) +#define VE_FB_LINE_STRIDE_LUMA(s) SHIFT_AND_MASK_BITS(s, 15, 0) #define VE_CHROMA_BUF_LEN 0xe8 @@ -69,6 +70,10 @@ #define VE_SECONDARY_OUT_FMT_EXT (0x01 << 30) #define VE_SECONDARY_OUT_FMT_YU12 (0x02 << 30) #define VE_SECONDARY_OUT_FMT_YV12 (0x03 << 30) +#define VE_CHROMA_WIDTH_ALIGN_16 (0x00 << 29) +#define VE_CHROMA_WIDTH_ALIGN_8 (0x01 << 29) +#define VE_LUMA_WIDTH_ALIGN_16 (0x00 << 28) +#define VE_LUMA_WIDTH_ALIGN_32 (0x01 << 28) #define VE_CHROMA_BUF_LEN_SDRT(l) SHIFT_AND_MASK_BITS(l, 27, 0) #define VE_PRIMARY_OUT_FMT 0xec