From patchwork Wed Mar 22 05:13:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183557 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 DDD89C77B60 for ; Wed, 22 Mar 2023 05:15:27 +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=TITFsfyamNtOtzvBvUepJaoQyO7f1KXyUXqZz9VOgls=; b=LNY0kQcLCNjeX1 V+RSaoFk8WGiKaQeQKhR5x0tCXDaQZ/LSXG4bWD5v0iY3ErsbV71mNxeGnbKC16Pbm70tZByry1Cr j5yFJGCQZsG0MFdNVyIu01Kjsxd6xDJLnH9ktbLNGJ++pjGzA81i3HOKsb8cvyD7qVNJvurcbx4JF 9/ui/vcFEvgbLHqLmMYoeiFy21rJRM21fTfCZGUg7+6wv4E0O/e34aS6G/FPzJjEuNTZrb0XfOZ7s 5R4WLNXURBikp/z0jMi5GJk2hdjrIdf3KDh4/cHzKo4Pf9KJXXFZSPHB8RS3ZF7argAdKFBq8HkPU +9vKwvHXgK6PRZOzdkUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peqnO-00Eea3-2q; Wed, 22 Mar 2023 05:13:58 +0000 Received: from mail-db8eur05on20628.outbound.protection.outlook.com ([2a01:111:f400:7e1a::628] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peqnG-00EeUl-0F for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:13:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SsmaRKjxlBTpVGz4btuHUkLZXPDS3Ysb6lK6ivAOrPeF1zl7b0OtK4XGbo6KM/SQGHXC0ZMD8OtjXOSRsE0JmJ6RYyFz6CTCR31DvJOShMUiaAOPI/+8IuHqJAJVf20PTK/KB5YHhqGhpRclLn0XHugW2r2PGn2Cy+hO/bnvvP5ifhwjqHZI9JQZfiKVQbUUSEGQMC4TSC5NxDcfguvbgqA0Z1H7HjoKDSQJZ7EQtTl5LDullDUEyLQXRuFWZcjB0ONiJvrHoDeMyNOWpifwguIF43hae7tXDFunFxRmr9/SLLiaCv3pN9rZSdgbjlIGtJskXO5xXD2dOZ7x6j0Thw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Rlj9RD2tTi9bXNFXB378vqR8wVFI1TNqBoqCx6xlqu4=; b=T2UAo5EYO7ySJAJl5CLarjoaeYhcRcN75kFR/q1wHBPI8NGJGWmFn3xxG6CLLmdgrvG5LYSEDspP3QGYU3P/hJqbZkFq1g+0vQ397Xi1tAvZAYphjpdUQocDA+DQwBsydWwANgsmfq7iU2dEhkEiQLZLJqnctcRPgaT1pTQNIs2/w/lipgAOyhQANb7vTrL+A0oZeDr26sK1EXwWyPbJj3V51jjbGeWKcDaP5dq+IzrffeSKbrRANJShvHtKmrNU6P1O4oA5LWPVoOmJfANMW021r0z4zgub4jNOHBbZw75hQmTCcqwx3FTHbEHBNNWKXLQOCKO+zXDkf7h6Be2+mQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rlj9RD2tTi9bXNFXB378vqR8wVFI1TNqBoqCx6xlqu4=; b=ijXrgMDZHyind38sIv3RgVglLvDCxJI3nEhF3IslzZcYEr+bg75RmXdM2c1fcVKarMiDxVYmC6Kzhwe2oe707VyKLnsQZcNUthe1D32Dglrgf9ZrVnzWZ3VAS4pIvXi7l00UKFLuxRhDlK4k0KgwHIcvKC2rjG97myLmtq9nPOE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:13:46 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:13:46 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 01/10] media: Add P012 and P012M video format Date: Wed, 22 Mar 2023 13:13:04 +0800 Message-Id: <475b9d0584bc9360eea277f39c3fee1837ef232b.1679461709.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: cbef7621-bd28-4be6-5a6e-08db2a9436c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x4iHTOB0vFv8X7OO1Q4Dlz4nXJ5EAv7pTQVSmjaH2ZVFDX1Sl0ma38vHNgy4cVobUJlVj2WRcYIfb7wPinucKkwVEHxqELVNgwMAevVhqdviHthYnDZiG05i9o5ddFj8RfWbaAA9Zk0cHankTLz6xDFFgwsgitRFOlNnvrwJ7QCfl0As9w9BD4DvgzAfMFnj2jUf7QIYQ6lCITWgvD57aM9l1RTV/ShzVEUGflNY+utluwgujnxv5Vj/ms7HD6AqKMM6XDBfU6ttj1Y3VDPZYdCE3fJ9evfc8NLEBKLcxsIjH4nuDpAc92uCz0FsoRvBNGXiPSetLRAM8o0T2YnQgjnzjzWIVJlBm1JCC6UYbdwYGVrtjEdvcNdcaVjhePJEdIzO62yMe+TJ/V3t7FI/+ZXwPw/q94V4S2hn6QNU890xUYFu+XTw7fdtq+T2SjMeUGX1d5be18DhD/Lj8My87viDXegpsw0IPGVtKUxTh6Smv34vftJAthksrZl2Lh39lIO1ta8BXPt7ZFv0RaVmhEFRkg4aXrg/kMYMTZ64Y9o77CN0vxB/wzqbKW7c97GGVJxOf7AMA2c0q6OHUo3MsZa20SbOu7NlXr7ev7YaVREmY5yXIcdECSl1w9e9SDDg0gcgP2uoDScxUoBOj6Ya9oKziuDjC559RGx/1c+kCHclbWyf5JuxDWT4Y+E4hPis2Ues/kep2LsP8pTewR89PA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(6666004)(2616005)(2906002)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3puPMPXUv6/Ez8wNhHSfIsWQ9s/PE7+COw79mXTM1AuMjcNZrVwKD8GoMFAKrTrKVIzExhFGbndO5Xwe39x3Es7/rGq6gVLtXYpVP2M/PVTFk9uGnjJFBsW/QZymH2xcwkBLP0WBaWOpdjpFQlQoOTVvPDqfiJnqsZngXPQKa2UvFxAj86MZdnBsU8/NVI3ADEIvLo7ZYNChxXCEWfcpAbaLVC0qgr6DHDZqy3R02YD6mTaGprFK8hhuxn70IL5BIbsfTQIYftl/49Ft2pEvHKVU3+6aKBjg8bmg206VdrLYoDsmGiN0ONnecYn/cUqtjBHyEOU2cNbMax6KEfV8JEvprjfjjl8Wz8AYnkwOKo+I4u638L8Zh8h0aDHJWhCawhiFoxll6FETEwXqQI1kTiDSuhWlAzSFqKZpqF9Sl23Y0FJREbCCDVSx43QNSq8O0b1O4AsywvGrqIXgxhXnjMxxcBmmkSDJc94L8lpxzKlsf3/YT5ytBAyWcZsUBdgD5xQvWMWkgk+PwyAfNduEjp6JgF+ou29manx508fSCXfsqYCAl2rl3c33oeCHD2nmpmbUWbi0EEkWJGnMZz4CJW20ybdblZng4rGYRZba7F15XBkhnEBP9rPdwJU3voffER+eOtFyD0ATjW7o3F+eR9a9ulQITkpnw/Ysv6UBr4KMvHvz7ZrnNhrNImWr3qMLywxtmaRYOuif3llgj5v3KgyDqz+ub01SBe2BhiwyZ/ocvxN4QgmUBAANu2mqjqs5tBVWgeu7Gk0EmYXBH9NsHESB9TWet8ozwae095J0612TGDEy+i1rc7kIHn5GOto+b1QFuS9LQ5rO+faeQbzM3nFhowuDfnkn7LAZkjvZJ9v7mU5Wq+Nbp78OYjkzDnyJjppNN2B2hpUHe7bOhzLR9IH/dM+pRvmH5EMk9CsQ3a5eKKlsK+rX720y3BraOv6hDcyX643XIDWsTw7K9gbPTD2zSk/JKlyPbGIcMLLJAJ70PuF5yz2CvgZEVEiwuOSsFgj2nOL/GcVNr3FCpOBS65IfJLQ8WlYrSHX6TdvocLRaVRlD8KWD27Td35wyde7C1IXNz95SEzdt5q5JF4Uc7JE0HLcoDDko9hIuxuwjB+sdHM/Wz9vBljJvvD4hvb5gyBWV+jXBriHa6Jnn62nK3d2EMOHMnekfZXfeZfpkFXZtymvCU/x0kSM/AxJmDxXlSg/iq8dmeLuwPfPn81vEMG8OrdzMNP/tlLLD1IEzBCHwwZQ41bRalBARR1/Y8n4hk5z5Vg0ie3cK1/ZFxmjfUCkFla3/qwgfiypNS34i1HDtdd7KvmuMc5PjrRz6PlJoJ6i6ztip+ITFKAMVGgxCIYNsZsiyIdIRswiefi7aUy1NHq34SsMoF7pO92pndYni7NE6KHBmNJAfuQCO7TIXQG2Hglzxb3L4uvrtSeHSSN+FNfKNCqKvU8GfbxRt/1VExcPa/SMo1pZ17fzIaaph3ZxQZuK5A0pKOj4oSuQ4CZDB/892wOLFNuFwBKuOavRXbuAiFGE7sNKR9e6zpcdWd8NraKMNy7bPhgcso18ji/52Aol5b16lpYwo0wgQftvY X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbef7621-bd28-4be6-5a6e-08db2a9436c1 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:13:46.6943 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sp8/jNe8qYPFR1MT8MMY8YqGY/zYoaamJcq8Fj07D4uDNFWqtizLo3MeLBQ0tmXxzUv5jahN0eYdidcCU6S8+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_221350_115435_80FF8135 X-CRM114-Status: GOOD ( 13.21 ) 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 P012 is a YUV format with 12-bits per component with interleaved UV, like NV12, expanded to 16 bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. And P012M has two non contiguous planes. Signed-off-by: Ming Qian --- .../media/v4l/pixfmt-yuv-planar.rst | 94 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 2 + drivers/media/v4l2-core/v4l2-ioctl.c | 2 + include/uapi/linux/videodev2.h | 2 + 4 files changed, 100 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst index f1d5bb7b806d..72324274f20c 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst @@ -123,6 +123,20 @@ All components are stored with the same number of bits per component. - Cb, Cr - Yes - 4x4 tiles + * - V4L2_PIX_FMT_P012 + - 'P012' + - 12 + - 4:2:0 + - Cb, Cr + - Yes + - Linear + * - V4L2_PIX_FMT_P012M + - 'PM12' + - 12 + - 4:2:0 + - Cb, Cr + - No + - Linear * - V4L2_PIX_FMT_NV16 - 'NV16' - 8 @@ -586,6 +600,86 @@ Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian ord - Cb\ :sub:`11` - Cr\ :sub:`11` +.. _V4L2-PIX-FMT-P012: +.. _V4L2-PIX-FMT-P012M: + +P012 and P012M +-------------- + +P012 is like NV12 with 12 bits per component, expanded to 16 bits. +Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. + +.. flat-table:: Sample 4x4 P012 Image + :header-rows: 0 + :stub-columns: 0 + + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 8: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 16: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 24: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 32: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + * - start + 40: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` + +.. flat-table:: Sample 4x4 P012M Image + :header-rows: 0 + :stub-columns: 0 + + * - start0 + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start0 + 8: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start0 + 16: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start0 + 24: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - + * - start1 + 0: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + * - start1 + 8: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` + Fully Planar YUV Formats ======================== diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 40f56e044640..a5e8ba370d33 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -267,6 +267,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_NV24, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_NV42, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_P010, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 2, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_P012, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 }, { .format = V4L2_PIX_FMT_YUV410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 4, .vdiv = 4 }, { .format = V4L2_PIX_FMT_YVU410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 4, .vdiv = 4 }, @@ -292,6 +293,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_NV21M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 2, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, { .format = V4L2_PIX_FMT_NV16M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 2, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_NV61M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 2, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_P012M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 2, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 }, /* Bayer RGB formats */ { .format = V4L2_PIX_FMT_SBGGR8, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 87f163a89c80..6489b67babfa 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1352,6 +1352,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_NV24: descr = "Y/UV 4:4:4"; break; case V4L2_PIX_FMT_NV42: descr = "Y/VU 4:4:4"; break; case V4L2_PIX_FMT_P010: descr = "10-bit Y/UV 4:2:0"; break; + case V4L2_PIX_FMT_P012: descr = "12-bit Y/UV 4:2:0"; break; case V4L2_PIX_FMT_NV12_4L4: descr = "Y/UV 4:2:0 (4x4 Linear)"; break; case V4L2_PIX_FMT_NV12_16L16: descr = "Y/UV 4:2:0 (16x16 Linear)"; break; case V4L2_PIX_FMT_NV12_32L32: descr = "Y/UV 4:2:0 (32x32 Linear)"; break; @@ -1362,6 +1363,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_NV61M: descr = "Y/VU 4:2:2 (N-C)"; break; case V4L2_PIX_FMT_NV12MT: descr = "Y/UV 4:2:0 (64x32 MB, N-C)"; break; case V4L2_PIX_FMT_NV12MT_16X16: descr = "Y/UV 4:2:0 (16x16 MB, N-C)"; break; + case V4L2_PIX_FMT_P012M: descr = "12-bit Y/UV 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YUV420M: descr = "Planar YUV 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YVU420M: descr = "Planar YVU 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YUV422M: descr = "Planar YUV 4:2:2 (N-C)"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 17a9b975177a..f83a9d1210fb 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -637,12 +637,14 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ #define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr 4:2:0 10-bit per component */ +#define V4L2_PIX_FMT_P012 v4l2_fourcc('P', '0', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* two non contiguous planes - one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */ +#define V4L2_PIX_FMT_P012M v4l2_fourcc('P', 'M', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* three planes - Y Cb, Cr */ #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ From patchwork Wed Mar 22 05:13:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183558 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 767AFC7619A for ; Wed, 22 Mar 2023 05:15:27 +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=QaDTc1kdvC9OJqoZn7YysbAxv4ESq0ThKlhtUpJk9oM=; b=oTWDYvJ15xgGbC Yn3S4F8C0oE+ivwHVcCoWvYysoraUXoTVeQ9A/X5Xxr39tADmXetzIMxu9vw0naZYgTKuMYBGrmyM vJxKMJRvKObzvfqvUMJtEv0rlEi815KEQyWMPPpZVy+2t0i1jIIc9zKVG5CSDxV3psuEMKhsn36ka ez08V5IbLIUB9QKac0sr5CvCvUhe87olZgSqwvadtQ5g7+oC8ac7/6GDS2o2FSBmvkbcWrIlSdXN0 z1haP81IUX4zj3mk8WC1Ok4B3iExerE3V1k0/RzE8uZN60+Wspi7P0s4ezaJxqbr1wCgnoBUk9W// 8MjMS/1yoskzUFslffZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peqnP-00EeaZ-33; Wed, 22 Mar 2023 05:13:59 +0000 Received: from mail-db8eur05on20628.outbound.protection.outlook.com ([2a01:111:f400:7e1a::628] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peqnI-00EeUl-0G for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:13:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HLH1XlHmRtJ7AvtFcd8bKycasMaeySw9MtLldrDh9mpsTCUFcN0gYjZWEsRDJYRw4HXES3c6TIYNHNAGwJz9HSeRgC3Zac56fD39cuUQu5ol9cAauN1yD0AWTKk3Eik0NpZ4uIVaazjl+TdmPn0xN852vbqKXjIT/5ogPSweSyPpWQtvN+0pp3ONn1ITFdUqShXrg3bcRgSujxcSf3+PlCKhsni3XZztOqmpJ+yAcNddK8NCB6M6Pj88RTzl5cUnV1jCeyCQ1A/5OGXZvJIsUe8UdtHIZPscEOdOOFSoNSMljY+l3mTYXnZqKqdkM1vIsRUg2ENL2he2/Bp9N0/+Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HaV1IAbypr+7qw1xD0wjbMHN8X3GD4YNlQK9XQbiICc=; b=nJ6NTuFNpixmTlhrDmZr4NYqIoQrdQY6JW0jESwfknQs65O4lNVEjAB5RU7iC19X8MlMscQJ8h9LCXbz0wzWgvzjcK+UfqZPUiIJWKeKsI01jmGvs6V2H5g4/skDTMZQ5lbdTUHgI1O5JRBgyKq/YTTJyMVStUrpNZDkjluO8+FESHCuZZueaSVpeg11rpK3po0zx8kM74OnVcdvNkyEyyX100t2smQRtc5hyV9wLZ/I0MAL1LXRa/HsWxXxXFBBl6RM6a3MfmEyHNZuRrmPrQA3/L+35frORSpAtB6nDg6MayFW+J1zPxKf8o0M/qgPtsE/NwKcmrFVscO3IGlFew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HaV1IAbypr+7qw1xD0wjbMHN8X3GD4YNlQK9XQbiICc=; b=DDMTy37nzuOp6nV5CDiJ1TgGbK8cuGvoIMtXVgBN/z6fMgPOgqN0EfTNV88zum8i6n/QGXJwSQtu9YmMiZVW5Ub7pzvMTW3IhSUT9bhTrHLKEDY8xLQBI1T+gb8oFZhk2TXKi1Jixk8pX3Er/BCFmTke7akdIwtHMekealsYFAQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:13:50 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:13:50 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 02/10] media: Add Y012 video format Date: Wed, 22 Mar 2023 13:13:05 +0800 Message-Id: <25b44caf5b508c099f29019df23f967d41802332.1679461709.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: b5033481-4f87-4fc9-100d-08db2a943907 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wfm5wgm9rTiR9oKuJFQMvHW4njz+OLqYOJzoO//EYEz/PYP2rlkbVKKZJADINXXhwqGOdRmydUKTzmXRS2IYZq7G467jcUY+4AnplSznTRbU2OBLI7R0hp+MyL2g6bDjSNSH1I/QylZh6eRVSmsNtj8mCU8s7WzUrJ/mlL/HpHsuCLNWho94tgVUB4YX1s42Blu7Re0MWRHJX4zE0/AIksGmWzmxV5UEDbnjD4ct0BvOC81XbU6Fqfak/ab4oka+4gScy2ClzaByk+JOc/oEAXEdhxbNkkHse4Z8xNnqpqZR2PRy1AF4sw88/Z8JJVkfxKyY//mJTd3/eiT8jK/Luf6BydpIs4unrONwLux/Cu9MbTIiiEjawK5LiDUjjR2w1qexQXpA4Vv6AMKgXMUp2zOsWQnTK5vl/Y6g5mtd6Icj1PGXftXfmifG46q0j+BCqII5t36EERgvXcgOvOgYC/9VM6xL35ZFI+h7BAEJS/eA0I0tVzOtPgO0krxbaWYpcbfbwn7shiNHLpCTDUiLYFRzOVMNBLmfn0W54rvTlIkQbA/7SUOVVZSslDFpLmmh68iFxzehWlK/qphqwAIsZbGTL06TwXj/1ZmFaD7/N9oHQB3s3phXXDGcplZevOAbZUAVbKTCUV8XqIOQ/i1VMm6tpoL+npRalDg5sHJKkIMDgaT5+NYL53iEgCdeIQswXzS1c324MIWB+xx61i/NVw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(6666004)(2616005)(2906002)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QUQURGCB8353rwDa18utDtdckUQK7HGT30YBU6vONaPseuX6+b/4CVPtMz9Svqx+lMc3S7x2FkrFJt3yWO+Jcdj6LYYN0y03a/6nrBN3/cxm1fkZ04ERHrX4lEBqhFBM3LTo+sR2CZJs14LD9QQcPY1MhC21YfnGLmT2CRH8vk/dsFwzLpK/JNHdqAOqoNgVfW73+azIT0wUqbuk3MtRUQWLyh75e6wRboZnvdj759qFT5vX5pxWIZR0+pflZSNEMhOj/XTJ94BhSglQ6EbPAlCg+jXp4UrE+EBXNAam6Y+dZzGZdhjxcwLkqsDWl++Dlh1D5HqfrnF6TnUA9D+SQAYqOd3yyUJgw3Zj5ZUiCjy+LZVoF0QRXF405vOIwoAGRtHp7mxna9Qph71pu30+2IYUrALRYjCQOQNRr/f5SPX+/BMFamMhcvkTzrnuY3buvGaXT0a0T0cv+rRpVWH77YIB27XRA6Y3wWRU35JMT4l3CiNyi0qP89BCHN06gE5nOIu42CZQuZMOMsjpVYOjsJnEkd70qgHJALWp72WbxpGFKWj7AIXfJqw89d4u2rdg0E3cE4HoQW47AyN2epWiKzjmxCUJO6fzs7EzGYqRNBChaN8H8CETiDIjFSmBkHZiNreHGOl6xlVkktA/xaYgQG0PzO1kO4fz4FzfyVXZPfCXkJyWKW1Mj5xfi35q/BCsynexFAQS/lDB9q1j2v1CueSp015Wb92IsPhGRIP31HScyLbiy5k8nRWZdUe4+MrOjBev00AFtDL4ShtWbxIT1bounB5dDIuK5cUwJ9kLlh4biMvTPoxvuwKnURbMTMkpQlgCUVFdYXqWHv8WMgbgyAoh+5P0aM9AudZV15OA4+8iya0lUelhvaW6wjE6n7Jf2IfEz296OB+lqf/AIbLdtYmTQrjwOIBhkcYIQhXOo/tw2R5yOjS+4rfeI4LVNUOoxsqcjPuhAPKyB4cUxRnfVS/+rxDzuH39eb0thc5VeKUFMFXKIb7AJ/1TnRKMFrNI3WPf0Lcfb/1T9pnRjRVJqPuYJYqyI9TVo+LjIv4SKzENjBBY3yaiikXEVPdUnwdmgWQXG9xSo8/nDzEZi0S803VoF+TWF3978fBY5DG4H3y86B1bv0FcXA0slb0lri5oPbrXWo5Vfi9BS22X83cEc2GQkFUzZkF+IQe5W5B/Dl1K/qzFY4ob6MCs6GlnJBMgNxmvDdwNczU3QiiRdncZbul+UvNkxJiFz6aIzCBzb9xUqFs9mGkUw6Yesg0V7xLJ7PTY9VEVjUJvGNOU/1FbB3cNz/Aw4ieT1zLjpyK2N1gBPMp5h5cX42/iCxuwMLSN6q/v12JGjTgmjzamfW9hZwYLtwvNFwemvFwA8sHQtnyE0TVwwW/w2DmsKsnwKQ4UJ84O8Zichvs2PE6F4Py0vA9rxOw1MwRFMCUndebwoadByHKUEOsEfXXhqEc7WHEgnnYoJmW6+tmYo/0CSYrpVPdhFvROFME2Lfn3W4AlskDSnq1BZIZZYHvXC2yWbcQoXS32hNMr21OIdceNom/i59H0GkrZw3j+F6UNNmS08by5dCihfU14iMuaNdcA+dKG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5033481-4f87-4fc9-100d-08db2a943907 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:13:50.5066 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ViiDt7XNsrUKjHg5hZ+OZTHm5YSk27Q/Xez85eZjdwCNSJJ110bshR8zgDS1O0+KlpDSO7HzLDabqT7Dl83ScA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_221352_136389_5D60FC6E X-CRM114-Status: GOOD ( 12.44 ) 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 Y012 is a luma-only formats with 12-bits per pixel, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../userspace-api/media/v4l/pixfmt-yuv-luma.rst | 15 +++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 17 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst index 62078a01de76..cf8e4dfbfbd4 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst @@ -103,6 +103,17 @@ are often referred to as greyscale formats. - ... - ... + * .. _V4L2-PIX-FMT-Y012: + + - ``V4L2_PIX_FMT_Y012`` + - 'Y012' + + - Y'\ :sub:`0`\ [3:0] `0000` + - Y'\ :sub:`0`\ [11:4] + - ... + - ... + - ... + * .. _V4L2-PIX-FMT-Y14: - ``V4L2_PIX_FMT_Y14`` @@ -146,3 +157,7 @@ are often referred to as greyscale formats. than 16 bits. For example, 10 bits per pixel uses values in the range 0 to 1023. For the IPU3_Y10 format 25 pixels are packed into 32 bytes, which leaves the 6 most significant bits of the last byte padded with 0. + + For Y012 and Y12 formats, Y012 places its data in the 12 high bits, with + padding zeros in the 4 low bits, in contrast to the Y12 format, which has + its padding located in the most significant bits of the 16 bit word. diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 6489b67babfa..be90a9f8c94e 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1307,6 +1307,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; case V4L2_PIX_FMT_Y10: descr = "10-bit Greyscale"; break; case V4L2_PIX_FMT_Y12: descr = "12-bit Greyscale"; break; + case V4L2_PIX_FMT_Y012: descr = "12-bit Greyscale (bits 15-4)"; break; case V4L2_PIX_FMT_Y14: descr = "14-bit Greyscale"; break; case V4L2_PIX_FMT_Y16: descr = "16-bit Greyscale"; break; case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index f83a9d1210fb..db06d4c4f008 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -586,6 +586,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ +#define V4L2_PIX_FMT_Y012 v4l2_fourcc('Y', '0', '1', '2') /* 12 Greyscale */ #define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ') /* 14 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */ From patchwork Wed Mar 22 05:13:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183559 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 410F6C6FD1C for ; Wed, 22 Mar 2023 05:15:43 +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=ps4+Il5Z8yV4xlMZQMahMuQLzQep+iygrxqBxRKByNA=; b=hpABkt02IknM/x bPbY4VWCTrEn+YiLXuWTCsz7JxWeAAJ4KYJjb6XxMY6xj8eN/uSa3kEgBAv6sZ7hFZG5RmE/zFtnv LhA6CgnC0qLR/KdwM4hB9xVuBYWlqKglr8Tb8WAJxAucy+e+VC1I0IOF3XJ9iU8CWfN+ye0LTyydP 6YUqsZch7I+Y8m195M4CbkQYUyqLutVGsiQhW8u5TxHIBO11KfHHfnkeIR2Dj22IbWN5MF4Vxekwk o+HqZluJQwYa5Ketd6Joe4BbINrt6s3k06rIzwKFroitK6lUGfDPbBSIH1qVWulymM7B+7cw2g4Y0 sQUNAhThJQrzjCe3Pi7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peqne-00EehQ-0W; Wed, 22 Mar 2023 05:14:14 +0000 Received: from mail-db8eur05on2060f.outbound.protection.outlook.com ([2a01:111:f400:7e1a::60f] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peqnN-00EeY2-01 for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:13:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G1CbF4fmL2+jR8NsQornTKcbE8j4kI1GpdQe7ZOEk9KX0rp3mooI7XZnbHaDfFke28B19gvBMKXheH9L5lTeJniO4ofp6a2jrJRbEWaTWSZMSOrLTr9LxCEQ3Z59VSLopFWjgGWyK732g6hVraO6De7xm3oIC3BuT0GOMQvwRb/U7EMHc3iKRwDroUVWz8J81KcRF0MYktTX55iRYJAgwtI+8WMQbdtzJPC6jfPVusFpWtQhSKbRhqzq45ZaUUhcZKMJrRQkAtcSV9WWZGQO1xBgQw6ZVRYWs8MlrYXtNM+MYQNOEbYtYYGVIF33pWscrxePHzOqpn5V12Vda2vcJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z7cKeN0lTqGsO4nqj7pO/oD9FjZqKyVVa6nQ8BbK5Vg=; b=Ta4oAAISkgmM8YCKVtOOAPq8vMD/5GTbG/1JB6XbQ+AHucqUyKIKzHcwHCvkqNPIXnKwsGqjzwAd+jvMT0I8Mi1p/X/cdelz+0Io/o9ZghfVkniDHkte7w7xrcSL+pr3twQ+dekQjBodynQ1fv2YdSRSSyiWjvoIZXtFyzBJzIDDNE375DVo2Lnl3uQ0Dk/PYIszxU4E/CkdM8u1M6dOwxTXlLbPa1hn8lwzGfE2XpU5z3CT1K8Mikgj8ZD4dlBVJ5JCx1AVdYZGghBg98ef0LzHNdqW+OuoHzT9PYJ3z2oRYSn2i+cwZ/zbvMKHqJ4L+g5qvLjnSaG3oVl7l/a3zA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z7cKeN0lTqGsO4nqj7pO/oD9FjZqKyVVa6nQ8BbK5Vg=; b=DSDnNpPjb8REBeRflT3A2Ar0lJgZ9a7OIfsChxi7eGyHAcXl0QRaeXTMGD4SSaAsVz0g/1yP0LlkNjpu9ys8u9husBe7L7/ssg6td1g6a/0Yhm2gixtH8Qqhw7yySL13AcB6mqijt6pb5KBVWRqq1l9JkenW5nLS4fcf7182g0E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:13:54 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:13:54 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 03/10] media: Add Y212 v4l2 format info Date: Wed, 22 Mar 2023 13:13:06 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: f8be1dba-1b2e-4474-6350-08db2a943b4a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fgnpsEG3eMJtYK/GIgWB1jD1C3IDnOUBGwwFsWYuI4/2mVxCZzdexnd4hga/FwCHu2mdnesyOcmdITUc1uzgg79OlCkLiXdNBF/DBBYWCzGWRK2X9Kv9qhIj+prWB7zDPsHRmTkiQmTLJezw0mpEcAZPOwQKTuwyrGWLzY14HB2MRVA42w+2MLUPtY67/tAnaC/YX6jWefZQjYpmqPskOEJDxDw1STFp91yh7g3XTSYStny7hjiMVSyRFQejdoYAIEZk4j3ikgFjZWxMfpBz5x+qyZRupqihPbfD7pKjFWMwypQ4JpQOb2+YF4cLwIAlBay+1/3WIjvfo0ud+ndmQysUi96vmJiZVb1qihLkft/YNertc9K817URXsPVnsiXHfGyrZrDYF1fY0lbCoNCxGk1t+qQ3MST4lWbhfnjM5PUTML/Oynd79+XkfJ7g11gFhq5TVCEctoYfA2iC8Nb6vwF8MvqGdVXwR4ZJCzRgKWNi/Hbe5/WYIvBf7+XorzoZux+8qSelxuqDBlPjGCkbE7Y4oTpOQnKy4c3iosyDIfwZDXldshws5sxR7G5N3SZfx4K6hWjCXIsdHIac5hZ/QsyqEn7rgHkVsEN/ee24TKb13tIhxz3dll7MfrBRJPX8MG4rbvmY23DCH+IDYscRrdKUilKZroh5PPTVVQXQZWaRL5MXdA3C1zNiNb99BdtnbKRhsSaTy+APaEMURQjaA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(6666004)(2616005)(2906002)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wymhrKO2tPm+jm0Kg+9KVrssrqAsFc43RWYYzOZNd45F4deD2snxxbgzwjvhQhjZm/CMLxjAJ+83wC1L3P/8bW6RIUfrxbPyZOOPWi6f8SZD2tGMeMFrfCoz1c0uYl82RFVwbaa1467z2zvf6aXUk0ISL1bn2HjSeGxL/Kt78TUiaQJXiAapuhAcLiNN2teBQ1sXE/eVJUyxHgHS7w2qbb5/QHqMAwqkvTYKuLhsRRPoU1+cNGem89a8ejyOzEOngjZyuc3o2a55IpEhKrln4Fcdrt/k1PrFGwJQ89jb3rw0EGmgkkWSK563GuGM3eMzRHktYzBcDFXZbbMdG/27eGIR8flGlg9CC4zT55gMYUIb0JgQxWBN5D6mwerhgKyOCSX7IU6jpfjUV9RmW9eWXbj6XGHqbvU6pZMHAWnchKc/I1f1s9KAoUw3A5xY3dVHt6JyEf2DtKFTkIcPXbKoZNkEBSNIlpr95/k5/FGfBo3p+vKC92ntaaTRVY6hj8p3Um6B0BbmTUWdXyh8QTQGEb+cs1E7YQ/J+atOdoiS/c6sO45mj+N7X1TjJ7XTVp2spPFWSZjooqjWy0Wx3GqtEE/4W38/dd6yxMLxurDGtspe6EirgpujFcxllvaCTCctKTuh6grUEtzMkMjRkE4nh0sxjrBl5uVR7nxe9kbmaj176hYO8mBJnQoHRdll/SI6cXuzxZvCsiZKEjkJuwIrDCy3FCb1iZ65Fu1VipH4Sa62JQhWahFBIjGEEzSv2VL9gxU3MKy24Ukqb5HQ1Ilck8aCx4OiwoY4s+KMYKwFsu31xV1jOiKR87LC6lRNrUXBeYrF9/jZPH6rxsWoGSyXqgD7jHz38iN9apxDpe7KsrQkSmwnpK4RqRug+0CDg/ADIgPuj+tr9n98WR8jTPLC9+Djwbwdwk0OBu0NLgxo+wGctJp94EyPzulL8ljK8WmzoF5WposMCDRNOFM1Pv6TLgUpRmtC0o8eAowgQHm+/L33pKVwFun9F/+Gab2jNB+HOJpJeswCy8Zc0G2kB1DWxWcdTt21p0zqbw0IsdoKtgNV5mPsetUL8s8HmkHO55lImqF2h0WR86oe/1dpEpYJEJC0QFvECXYsl52yKutsigAZSvY0/9KFkeex0MvhH+s/KHyzAFIhWeUFkx9AoLWJcI25sf6X/hzLmmLN0sW0YGxUu/0LkEvy0JRzhTqSjr6gwtSX99jVltJ9tNJo+xVcsUQacBIy6XZccsWB3NX6p9m+ZM/4LNX4xjM+uJAYzCNulkXMsWtRccOJIFZkxB11DLWuFrzESjPhwIhNBhnmVxqo+kw6FN5agEgSujGBPKNIQQmjWxpj3R23nvoDSSgjhM652/W5tqx/J9f7uwEovTZIRVXsXQ2Jl8BNoZnvcfLqrs/Nvao5Gffh/qmjI2vq9QvZSVXwDn/U9QKSqQMzSkOAujhGmSl5XsznkmGTv9RpPyAQPK6tVjZskBwuQhSkIXMGIzHD1sdYGNtpw284+b6eXWdhdb7gkgaJlkG1/Bz64I9FF9aw0DpN6QqplXnWyj4Y6gX1IgzgLnbi2IhyckedzZqbIFcOuTnEplFPe6kI X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8be1dba-1b2e-4474-6350-08db2a943b4a X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:13:54.3345 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: K9KnSpVxMKSwSdmBof0/FxDcGYf4rZTRAY2dM63jlD6zNouJm79UViyt34aO43NOWFD2xr9flIyYPJagbegYNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_221357_046257_3174C97A X-CRM114-Status: UNSURE ( 9.59 ) X-CRM114-Notice: Please train this message. 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 Y212 is a YUV format with 12-bits per component like YUYV, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Add the missing v4l2 foramt info of Y212 Signed-off-by: Ming Qian --- drivers/media/v4l2-core/v4l2-common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index a5e8ba370d33..21ace56fac04 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -258,6 +258,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_YVYU, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_UYVY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_VYUY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_Y212, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, From patchwork Wed Mar 22 05:13:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183561 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 95B05C6FD1C for ; Wed, 22 Mar 2023 05:15: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=lA098hUHTOzOe1NKd2/ExxDk4uVIqxqhV6/9GKe6jXE=; b=TVE0yLXAQxjRek muQRyO1fCmpWoP6ek1qyeB+jgb0iV2OdASZwp/amD09Hj6qN7KPfu3FDJBWNKWSXKC9HYNRBYCZ2Z kLvCwuLlGgKmldSG+v/IOG1YhT+sUjU4GalHKGCacba5OVKWnbgUgnoPaDTpDIhDsZLhB7uNiGYJU Od5UqnH3iKVcMiJiRURxybxmOjpso3To9gOvrJDIAIskDuWBWUaxfWsIe38uN0OwZasgOe6oILBhu BO1z2z2zNnbZqbUuO/2UTPOgNkaUA2H5C2y9a/P0Upb+WQJWXvRA4WP2dewops2vfcv4zcGUu0yHn tt38qTUni+NTHANsh/cw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peqnf-00Eei1-0f; Wed, 22 Mar 2023 05:14:15 +0000 Received: from mail-db8eur05on20618.outbound.protection.outlook.com ([2a01:111:f400:7e1a::618] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peqnQ-00EeaV-2y for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:14:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CIu/s3IeHAT53Rl1PiKTCVaVj0PzjSedc4dAv3vczu0MpNKXICnJJUwLsyDa7hdzzlHCdXVx1ruAGslMZ9EHQ6ZXPDRRsnVf/rj8CUa8jPn9xqgywCrm23aw51OXGo0gbMrzJN9PbUFbPgbyHiQqKwzCoKQ7jYuH1xxVxb5NmMG56Pw8720AdncehSlj9/9Ei060WuoHgpMkydamhh8gg728W34zFg+zgqS1ZnouU7f1goqc0YTyHUZYVEa48eIPHm4QcMePA0CHFhMKIt7R6Z8WI2XSoxiNnI2Rqg7MDj++1FAzQ8R8iagonvNgDlFiVrtvyBPvemONz7imy2iITw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HzTVOaUGnkWRPu5l+dlYHzF/OoH6UiLH+Wtdh1A2PIs=; b=gkEPwstOa6/l/TQeHMSTatejSsjvGBqPU8pAJ0i8+SdhTpiZNJaq40PVA6oQPAcEPQ7LG34rR6ySvUiicdRGkmER2A2cQCno4SCkEAIYSmiOjzLMGBZu4UxLTKADwrLAwKeO7hO1ZIEBNY4CbhEKq23/vvHqsmELix/TATyOq9+chu8B3g+6loMiDY2ItaqU5oNAlfJixbSEaHqs3Fkkae4T1Asag2nw3/Z2S0Ab5P/4rp3GmDfxq/rLOWJxAD9xYq77/L1REKX5pP+6MKLHAXYX6HetGH6ezVnfTVPyM0YgrlBQ21HLgR0dxkWWSHSh4owM4puR9KTOMMQwQcfXcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HzTVOaUGnkWRPu5l+dlYHzF/OoH6UiLH+Wtdh1A2PIs=; b=eW8lVyJh/D7BLwILAqWUEfVdpM9TXHnWpaLuHDTHf2W+nivi3YExg6lIg7Gl5878zvSq9dHYVWRYYN5avaBfCfxuNylRqY9ROZzwk5lyP5CW2D21gmi6BUrWpnM1/HhojnuUzfv3rkdek9UDxM+6Z7DFPF9jsC3J/1B8qOD48ao= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:13:58 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:13:58 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 04/10] media: Add YUV48_12 video format Date: Wed, 22 Mar 2023 13:13:07 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: f1944c1b-02c0-4e52-7b45-08db2a943d92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gC1Thh5GWrTbGohA8CAYUQAyacXSdqPzAUgq7i+aeTjLt9VPI0BDpsqQr6SrHAKLoHuZHewkWYz26cXZ5uP9jXX10Gm77UT+SjMPvtBmNRPm+aDIg0wuBOXNz7WsK7mSBKr7FGPUsRcU6bIbvqqkaMcq7yt7Osbge17OqHFkahTAotUKi62sGUOEMXdEoIbmgUvFaYgSBCRyBnOY3UWC82oQ9xjTbzimrUvb3ufHTDn/TPW4Ozb0u3HBuz48q8f3Y6Nwpcfrx+1jHde6Gz2dF41BXczDuIlfu+iHWDIH0u9c6PCel6fB+aV0/trnbLXsQvFZM42TWFS12fq6hJQ7Ig7YtvANujaIlEA9LMC5B6dVP8H0eQk2Fky0rRVeV2dRxsOSNiX8uIb6nKqjG9z35cIOEj17VUDzjkm/P+qac1kJ2Laezkvq5VJgkaH5KTJ2ozdscnUemJ1ms5Nw/oe1speUtNF3kgH6sUHEURVXBwiPMhU4iA4BBABEOk1TjNrc9TENx26KcmiVxgkTlUkBNQ7YpfLwegUDIyZ/yWbY59uE0w6J/Rr+CN8IsnHWzLiKcDm35A8tiJ6p0UC/hkEHT12ID8vsVDJR5U2DxoxOqFFy7gKe+COYvRa7Dd4KB7FmA4p8zYEFNATcYkzZzVi4QFG7MDOKhdD41HvCopJPVFZbxeoaWXhugX//VXJtbppMsskXqvCoiasd11J+VFVC+w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(6666004)(2616005)(2906002)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 96sCNbxC+MaIz/vv/hUeMwhCWi1AeuiFXh59MFpCGIqe9ALaAKLp9IxPWwwNha54LaztHZn4aG6oRBQEZr6Bf8PVqf4LOfl1r9KPsCQ4Qnqdjvru3t8LU629u5GS6X1vydz4agP542qClKni9Rcp/uZ0DEkaQ11QPpudWnrC+f7rXkIVMIWBb1A5Mmo+byuk56hBfgjcQap1yhGIg/xatTy6xwCKcFr0B74hVpE2OEDVZXguC+Zqn7oE3qTglBhAdjMFrs+YITwLo70IHZe+kGBHf9TofvNnwJVqna0y5HKeVtXCNYBEagMwAr9xbJceSg3/L2JYfLfNIN9vPkSNDCMJZ7vuvN27CJWcUOF2ni6EIoVX9E+tGDZRkk5Vfe86DMPsfuLpmviKY5wFrM2/0jRRI+ZBQiDuOoHaoKVcQ7HW+7DIsPhgNutoudBcfpqAdkvOrBRKKIUQBjh8A7A8BQo0mmV1yy+IYei+X81FBkE/8LhE+4bZv+8Z2dHv4JExSauktubxfDM33RAsCDQtMXq401uJS1DMLWX8tqW+y38Ruu05HQaUKfm/c3AkoYggOuc+G5oZkU/504o2IrEACD8o+UuPlhAiCOxaeZYFj/lI43zMDE48u72jFRehPVH9lz2p6fjY5J2YxsZKqrWlcw7BW5BaCz0mjbTDc9a/FgU5sqDLVeF5qFYc5GMb6QVX60SeSJtt6u0Add+rEotb8qP79AycKy0fyphJit+ddJMQn5RUmTiB06+jzXxHKzHd/cRth2wmvCHLTNqMkm68FX76dgQGT0EcMJVAKQPgjfubyfaajw9YWchVFUbhk23++cIwvnuyg7opVhlSjxTX9p3pZnYVVxRwtdaP2PIJ0EI2AlrbFAFEoMG14MUDq9Xh9PXjoQSrwZ2cIE9oG9lgIEjU1J0schzzPA44gRUGJQwkMdXHY97EPgUtPvwpkgPJ8VgT1QotMBtfPEV8HkIFrY9GAwN3uwsenBDWceXCZ8RYS0fQhD71eq/EO5Ph0nw6aWzzM/i8xIutElry8q6AuqvXe4SvJl7hrLS9gPrUXiewORZ0FcUrxgXi2wWzQaWCzYSdVS4XsDtqsLWQF26OdPgDQwlz6k5SA79OXtLuIFY17+YOfEABpEoJrZDzlGI76M/ZzlxwWR1ceYjP4ZBN7z3InvgCwIPEj8G57XowmI+U/sLwuekRM4lBx0STJP0n6JczCJkXLkBFo5tzL6UIh8+oaNR7XQMa/Gi4Ded9vhqm7dyB8+G7c+sZBk1qtmgcwyMStkyh4jA+sM5uUdVGKmqYX9Ega8xyPkoV3G84kG50vdwYpyvN77el8IzB08s+xDWMWE6x5ubviPDsY1uCojIM+OBOzwH8pBPmO2jCIS52YfWCZGE3NFGeuXJWU9E/kVJG8gGGuM7Q3RlX0bR0cKiamQ0QGU6ijNbJ88AhnO3XVmRb4sBWzHoc/dYXoSkoIYmWhI3MMg42fQedZfzno9lRcNuKDCj6zf0Z30s8s1jfU+Xf+k0fEqCbwGAWdIGFy5dKWflAOsd3FeGZmON74ik2o5mt6zvf/RNrpRaSnDaqmxqE6A7MBB+e8DkMjZfV X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1944c1b-02c0-4e52-7b45-08db2a943d92 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:13:58.1312 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fpEOMXgCVKkeC7AOfU/RoX1ALYp0K67njINoeQulp0bj8KQqj/qEr+ZxvLIDH1BfY7LDtfV1de1FRs4812ilnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_221400_969805_9E08A479 X-CRM114-Status: GOOD ( 14.15 ) 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 YUV48_12 is a YUV format with 12-bits per component like YUV24, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../media/v4l/pixfmt-packed-yuv.rst | 28 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 31 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst index 24a771542059..fd6642f875a8 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst @@ -257,6 +257,34 @@ the second byte and Y'\ :sub:`7-0` in the third byte. - The padding bits contain undefined values that must be ignored by all applications and drivers. +The next table lists the packed YUV 4:4:4 formats with 12 bits per component. +Expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. storing 1 pixel in 6 bytes. + +.. flat-table:: Packed YUV 4:4:4 Image Formats (12bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + + * .. _V4L2-PIX-FMT-YUV48-12: + + - ``V4L2_PIX_FMT_YUV48_12`` + - 'Y312' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Cr\ :sub:`0` + - Y'\ :sub:`1` + - Cb\ :sub:`1` + - Cr\ :sub:`1` 4:2:2 Subsampling ================= diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 21ace56fac04..da313a0637de 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -259,6 +259,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_UYVY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_VYUY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_Y212, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_YUV48_12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index be90a9f8c94e..7225e566c528 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1346,6 +1346,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_YUV420: descr = "Planar YUV 4:2:0"; break; case V4L2_PIX_FMT_HI240: descr = "8-bit Dithered RGB (BTTV)"; break; case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break; + case V4L2_PIX_FMT_YUV48_12: descr = "12-bit YUV 4:4:4 Packed"; break; case V4L2_PIX_FMT_NV12: descr = "Y/UV 4:2:0"; break; case V4L2_PIX_FMT_NV21: descr = "Y/VU 4:2:0"; break; case V4L2_PIX_FMT_NV16: descr = "Y/UV 4:2:2"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index db06d4c4f008..8a6430bc4a00 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -621,6 +621,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A') /* 32 YUVA-8-8-8-8 */ #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X') /* 32 YUVX-8-8-8-8 */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ +#define V4L2_PIX_FMT_YUV48_12 v4l2_fourcc('Y', '3', '1', '2') /* 48 YUV 4:4:4 12-bit per component */ /* * YCbCr packed format. For each Y2xx format, xx bits of valid data occupy the MSBs From patchwork Wed Mar 22 05:13:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183560 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 8E3D7C6FD1F for ; Wed, 22 Mar 2023 05:15:46 +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=YWc19Ej02XRdsKVhgd4/Wt9uSnQy9pHQPE/nWxZmwNA=; b=IWrwHiv8Yvjxia V9iQUTCEMpXGB6tT8dG+M3KmL21RkxvZ9IS8kT8eioOoMAlW2YdpH3m20S/0iCaGEn6ZBbjaeKuBJ dsK6GRzratZsp9OR+hkHAb0OgGcqepO/RRJh9np/5DHtpSQ+QxJksLg0nKAXXn/IkhtqmR4ovNWdF Dsplqz7UdkdJjRinD0vbDzU+zIXAMwNfD6ntbjnnjk2iEqpaewG8m2rvHvl3knhrYtVqyuq4ykX1b xlZC56qUS9r0+aXmD8jQUgf175gzM8GZ4Mi3WjMTfrVLX7Et/budsGn5GSAugkFt33gWQr2CHpJuz M887pHhCmdVLAkZ9gFUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peqng-00Eeid-1Z; Wed, 22 Mar 2023 05:14:16 +0000 Received: from mail-db8eur05on20609.outbound.protection.outlook.com ([2a01:111:f400:7e1a::609] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peqnU-00Eed1-1b for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:14:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eI2bKZBcmP4N0SCrAq7RBKOZ3kHkodOEBZFCQrgLLTLQrZM7jysGGwdOlukl1xE4dvzUGaLFozD5HBx4xx2fdIgliPJpI1ROzWpkiQpfEZCHWHuviqyIY2fPlokfPh9TxYzedOhrbkgffZy2H9RWDDeZbcEnJJW8gUEw0Olp4oqTQCiW/K7+mF0vi2BGORvh0KwEwMOlfQoGU1shtRDNeDiV63Z4bsi2FHtXYkqw6X8UJtKNh6LHD7T924sRHv+FtEKDpvbgD/LRcq04RyTWYlaHBUTO+z6iut5YeWnWaE29SZprmRWQANXBQsZ2NyK1Ng02XgYRVBqiLzoCYCQ5Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RNYYeP2WoEtfwMINmCboSPMspPL38A42Pfs0MlV+L5M=; b=Omz8/IfKa+14A+jhFxf5FVBPz5G08ufYx3t7aGmhr6fvtDSUX1ATgwABYR7R8QKs2Ur4AelhX3AZwuCBp63mOzXbyiNVWRy3Hy0GeMXEQGe0XvPtJEZp6+HT5wRfqOUJ3A26VZPAEvG/9skGj9LN6lhFcaJUrJjZeao15U576TGvWUmciC1YhuoZ/1FC4XqnWR7QgYaOSYXGajYunfhmEk2jpZ4L17RgiYtWQPDlY1HiRe/G+4G6b1RCJE/HRvvEy7/eKp3PFGgWi9v0b+nqzH1DA5C2GrRJJfD1qGHVz3lPCEwq3i7AMMZxCX5q2MeC3o0Ysefsp8oxHuVtHcVKTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RNYYeP2WoEtfwMINmCboSPMspPL38A42Pfs0MlV+L5M=; b=JnRqowug3LOMK5EQCc3Kh/641QaVshxyBMgQmC/TepCoavbsT/Tpvi6ne9d4/MWw0tOkuefsSFqVbIG9x5tsrSXOwGe913qQVRlnMco+9mXeEJCJA1dxPh3uiN0WcOP1WkJKw/5gxTTZyPDvS8D2imViEMY2AFAKWvhm24Rv0hQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:14:02 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:14:01 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 05/10] media: Add BGR48_12 video format Date: Wed, 22 Mar 2023 13:13:08 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: 5fde2a09-7f84-40fd-30dc-08db2a943fd8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yQm9o3+8+AoD4PRp32FgCk48sTIDykk3lc9xpU/pM1Zyhk3H5gbOiR6ogffGqrp+7n5I1dmpWFMpdOGOWqLNX6aymuiNcjXKSkP0ofexWIgunLAtYljLtNfQDgr91FMYDJFxZfd6NUNBQtbGvo4i9fZLcxD1UB/SdNC+KXXNYnsmz5TKjhN7mxMtJ0EZECjrYkZB7NyfoWsHvLXyj9nvCmvbn0eM/4IzqW3YchY3XoJTj35GZR7jrYIOYZQ7FLs6Lbls7esX1fbsmYy7gK2e8r4vr4qiQaFW8LdvgosadMbfXKPtSscxYqDMPy8M8J5wXUlwnhrSsWvEQl1K9yK1gXqUSUOY6h/GunFs00ApP5amUxomKph8uP+A/k8o3L7lBq7y/LeA4TTJWjkka74gDF9u8C+bevQClWQggKXU6iiaOqkKZ4tz+ftGsR4dNaI7JLKaWpVfXkeLe3QEHICPnoz4QI5r2juJyt+vQ1rfQukHlICjuPLa9HWzPoT83l/+oSWC2UBWB7eTUcKUbdZ+pGpoPFGUSQCm9JI+NUiRJUKZk/kiQJRxEcYk91iTeWyHqryg/jNf8eGNN2QHIYQj5pBwpL0sylxEEWxkqbJeO0waZKQbrRJd4p3BrvQV/3USmPwB/JUJoBMyR8vqrEpQWFU45vdoNaBqKrlI6mkwTpPA9dkVjM9H6G0fTEIWXvL/X8pxWX6TF6ZRm+HWQSaA4A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(2616005)(2906002)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KX/9aMnRt+YUwMwwg/9QuNpt98tK/1kz18Eeb/ZgRQ5/Tdg42uufzRU4cooHiuwDOA9eK8TDAKLNJoUZns08EAvR0jhSfds6H8voYA/MmhFANoHKPI3WMWSodhfC7H2zRkaN+xS1F+U6cnQW0SWLeOJaCF4rPxLP6HXHUPa/5Or1C5AH8Mv3kJaCnsIGrrxBozgG2lVttNyb4VE5IBGIbiz5uYOrlrYr43bDiU6w6T43cfqioNG+OfZW0s1HaqiuJMHshEAgZrMEfm+GZkdioDtfeClAFSwsObZoaypH8zq1iT5chrUY+lTzAUpCu17wfg8ahY2zKkdeHes2cg21/Q8GaDuyPK7mgMxTpTY5aWcEvmHRspaCBgavA3tjl4xSO/bhwDmJER8mku3NVDyR16+zS8SiYp/3oek3NS1FNphk5Z5qavkNL61OsUA3R1AwFEYbQwaat9VSzkuK6VCfL4FSrwpl1PPabFYn1dfQ01/oAiRF1yLNzjunumEAgSISD+6RCrKaU3U1i4asSXwGGA+KxMseW+IDoJMUZWgV1+qylM/LcUsfSooat0QSjRNKy290bZAcoiPE0o1Aj3JqBeRUuvMDWo9bS3cgT7H4OT9IONVCXKFYFXh9TPPwVnRDDkMre1jMZoqEGuU0xSbZ2xi7jlhm0HN5UftumjpVxL4OUCLzX7WfQvbSPdeZ/CBfvtcjaiRyLujuSdKeQQAyaDFEiZ2ghmChMamTJ7f1EPwXhcQhF3/gDIjVhWUY6hpuvv1w2ZxzdKRT4dBGll1fBp6+8sZ2fqw9k+yoGMriddj/2cUYUiwTUN84x28x966/D4jr/13Q6qT+ywnyQ9Flise4f9xfxzn9xuR8fLr0xj9LHhTRMMh3NYzsYrcIjOrK5AMhO6FDbbMhgrlqzjOLIj0FLjIkWMjzUJCI7aKOFFnw97nNtxmDr/rbjgGChLu8AhtMtYy6PEuGxalzuYREXoqBpAHkPHZJaodG7JiZES7BZ/n3bsf3h0GTkAZPQnHWv2+KkThCxPO9qzbkTAB3CqjVE8ikth/sKwKP4+KQwo7PZkcTlQrPj5HapX6MVw2ih9lw/9TSCDdLFABNEieNRNoKvSgTgtENTJVyNRvjpT6xgRZAuty46aaudm7y+GcWQ52IdYxbR21ayAFLmt03Q3RaG/e3o6XKLntEfGSrysoE7mXIn/zdRRQqgKyGjqxLCdPY224oVm6EVeB0utX2frlTDdZqmxgx4FBxcEPFuoLrfcXrPfma6orkYItqlwb8GO+Gz/n7CXyWDachyyFFHYiqrRAWoQGlrTcL4WR0iAhZSP689USPhijfdPq0Yh5TsCh1q7nENTNsy7I0JpbQX1jqDNR8+ONomCxCcmOSjCafYDGnW93CjSCJnZHZSa+06u+jS+rLKum6ruy52lPVmdHX6MtihrgcPasNoCO2g8PohdaCqKtJAaD0L93MNpVikI95+4vMOOwu/o4MadL7ZTijCsGNYu3P3PIW5cicHhQ+QTs7Gvut3wKU4gisi2BldCCILBopyGcJmtXrr7IAnncB4ucbi6d+YcCLDZyhvd5D18lhMbL2PBeU+56KTxe2 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5fde2a09-7f84-40fd-30dc-08db2a943fd8 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:14:01.9435 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pKd1Ms+EjE1CdRKJm1wpEPH7e2+9fVgtRK8454//7EGAM4r5lM2d6GVcuu8O6hGnFpmnP1qBtKzDHPMetCaRKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_221404_540000_7A8A9E60 X-CRM114-Status: GOOD ( 12.78 ) 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 BGR48_12 is a reversed RGB format with 12 bits per component like BGR24, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../userspace-api/media/v4l/pixfmt-rgb.rst | 33 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 ++ 4 files changed, 38 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst index d330aeb4d3eb..779f0bdda642 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst @@ -956,6 +956,39 @@ number of bits for each component. \endgroup +12 Bits Per Component +============================== + +These formats store an RGB triplet in six or eight bytes, with 12 bits per component. +Expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. + +.. raw:: latex + + \small + +.. flat-table:: RGB Formats With 12 Bits Per Component + :header-rows: 1 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + * .. _V4L2-PIX-FMT-BGR48-12: + + - ``V4L2_PIX_FMT_BGR48_12`` + - 'B312' + + - B\ :sub:`15-4` + - G\ :sub:`15-4` + - R\ :sub:`15-4` + - + +.. raw:: latex + + \normalsize Deprecated RGB Formats ====================== diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index da313a0637de..16d3c91c7da2 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -252,6 +252,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_RGB565, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_BGR48_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV packed formats */ { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 7225e566c528..3490eb3f42e4 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1302,6 +1302,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_RGBX1010102: descr = "32-bit RGBX 10-10-10-2"; break; case V4L2_PIX_FMT_RGBA1010102: descr = "32-bit RGBA 10-10-10-2"; break; case V4L2_PIX_FMT_ARGB2101010: descr = "32-bit ARGB 2-10-10-10"; break; + case V4L2_PIX_FMT_BGR48_12: descr = "12-bit Depth BGR"; break; case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break; case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break; case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 8a6430bc4a00..3c5acd72606c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -580,6 +580,9 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_RGBA1010102 v4l2_fourcc('R', 'A', '3', '0') /* 32 RGBA-10-10-10-2 */ #define V4L2_PIX_FMT_ARGB2101010 v4l2_fourcc('A', 'R', '3', '0') /* 32 ARGB-2-10-10-10 */ +/* RGB formats (6 or 8 bytes per pixel) */ +#define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ + /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ From patchwork Wed Mar 22 05:13:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183562 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 B584EC6FD1C for ; Wed, 22 Mar 2023 05:16:08 +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=JbW/7R/xeu/I3YEBcpLlYxwjjf/djUmByP0OLXGVoLU=; b=bYExI5M3CagW2o i4ulxawWByRV62UqmaJnb1Zrf71QxUE5+O6QptDyhp2H4nI3mB3fVFTk0ScH4zw6kEJRNiW2iktX7 qxCMbtC3hxCzqT1Rz1n6Xvi5c42nGgdziHsbLNhVBZfvdYMB+eDVYnQ2HJ1GSCFJHurZSChR9Z+Rw DvmHXI4LM8j7aEcdXWh9QgCA2s3NeY8fcMVOH8tfJp2cSR3gS2BW79dPxKTqQVGg5ICvqUt6JTjzY VMj+w9eYU1CHGi82eFZaeBJTFWyij4DPMY1ZhIi/q3332+INSGjKNhTv6OHBuPjIl2f84eJOimI3D JS4KuBbI5pPgMbtb/kWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peqo0-00EesQ-2r; Wed, 22 Mar 2023 05:14:36 +0000 Received: from mail-db8eur05on20624.outbound.protection.outlook.com ([2a01:111:f400:7e1a::624] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peqnY-00Eeen-19 for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:14:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=no4A0juhGJPAqO+Ds7UdKv72uYmEKNnu34ba0yPwPPmMKL4TEfy0fcF2ifoxVRssC2tbgc/5tgto/Xj1hKP5SxBu+otPQ3MtEAS+44TERDLUf3NtRztXSPaYfs2VR7sIzeqyGjGXxNnPplUJrIPnQYVrSLDKCKHWXi8Ru5T9cXX8WkclVXjztjtCXTas5d3IgPwpRX22A/f+I2E54VnWoMnBcvhqtsxyslxDaE/1spOnuftRkUCSHrg4ORbZlB9zSB8skfJZqfM6NOxxGjIxplBmpMPh7K4iDVIYkWD1TrRuR2va+I645cMonowWTRk5RcuJ2rbbDBff0yz+YDc58g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bg8E3rFasrAzSgljKXK1Qi0OQIn5iLNLHNqDHkzmrgs=; b=kcQiJVW1TG7rdUXu7OSlgXD96WcEKRPNezwC7ovdoPQJvI7kekmW2xcjrWgPYs9+wFcQ4LlWlSAccHriY0xTIi8zIovXfyJ/SBcdraDD3A53TcURojyYGG31GwqCn+OdRu3gh8ndf2UMiLlaLDFr9bIGKJcFXSs9c8WlJXlSYNrEY65PsliFXJZuHlTvNtof1fZuYEjFaxcptsTzrR3hOi2FzTg/QzoOlsijI4v2dcHq5es1DHDphtvXOCA2yFb3G+5K6F+Ygl+mwgJJ6E0+38QpoaRMMZ7dO0agJDsxKchPg5+f+59hmGOecpqm6ejZDYRPcbCCR1cJYwsKgfFfRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bg8E3rFasrAzSgljKXK1Qi0OQIn5iLNLHNqDHkzmrgs=; b=rh/4CrsiEAC64VbIJfiwwljkqBCrAHfLVcS3M269vwCQPGfOicS8Il7+9InH8O0+w2PexsN0H46SNWj/PFoGPdoMfZCtFEXttoMCUJjRAaEtOanSgvhXqz1rlbQz+3PHJpkR8zBGgdNYHJlqJmaiGE1uHc3ncfmeK2TPCV4qUTk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:14:05 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:14:05 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 06/10] media: Add ABGR64_12 video format Date: Wed, 22 Mar 2023 13:13:09 +0800 Message-Id: <9c250d2e65405d920d2918521cc86f47c7e78ec3.1679461710.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: 960ff9f4-c4e4-4a57-48b9-08db2a944220 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gi72wmAD8VEeZzyjn8XJJ+iXJUVe5+d6rGO+9R0TwB3epqhyqN6EtVgpaizdwoiTLLBcu9n3xmBqBLpl5/5PJ6tu1E3FybOjMqhjVIrbVBk4lyvz54UeIfuruUJuzFI7lipSeOfwHij0SEM/GPk5AV4+wHz/Qyl85bsoMicYXJLFwUYBTHVb4OK1+eNInV5Bz9f+B/xSfXOIOW74NPqbVx2J2WRxwkhch4wg3DcftwCRCqXbvi1xW/DlMXrGukdoZPcBeUPsaCTBNSXGdl8motkYjfycjZgebx9sC5szs0HfGFcvQRpS7gh05NN67wsxf8Qb9b5szsOdUelsvm9IMvVJXg/ZoNHUnpxqy1Fsk+BkVuId/LvWhuhRR1AmZ+hiZWWmfqw4hn6Ir16Ljl2JI4o7fpiUkp64CRlddK6vri/zEHxT1RmfWwRk6OhVrLLK6h9Mmv1K1kJszStxLfgn46uYVYbfbBbwzf8sKMm5e7tR83z5V/ThftOkFPmUOlFiU1UfE804j9lCm3U5cnBBL69k4on8hLOTBdlTdl92RpeouYM+0DOcK9bmfnVJRrwpJrt3uJe3mtPKkCCe5frKd+pR3H3JHcXeurP5TAyAM1cGa17by9CkQYu5oofGSbevNFL/0IIMuUhIrDYIXXdD3mrPRIAmBcnW8rEyJc4HnCGup/rZqopVbO/j8GbhHVpCWAZk8QsKBfpb4TTNyiQPFA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(2616005)(2906002)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UCBugjvHGnVM2+eNSF7NR5y/3ap/1EGsROTTbAx3yFj+adAgeXAuIBSANs2wpvwuyl+gZYFypiW4ejyJxOwGAcgMiSPD63F45tHiLCKzWEL38iAY+Qo1SfkD6BOMPA2a0xyLW6df2SqpbCedRE21tJkcKVtW1fSozGOLrn6u64eUuRQ3PUU8Gfa6jRZKj0HBlKn7W89JKE/wARLu980WrIfwax300PPESBu28JO5n7RpCBM5zUa2QKyqO6NBVH2l9RXKysBDWNFzxwc8epkq/LWW3wAPtF3Advnp/x/cPgkRwTJ+PgMS4ETC7bIv8kRoW8of3ksZPHzMSwmLxmjuERwT1MuBCI4auDVmuBerCCwuf04xFeqIm8zBz9NbPcG+92Y1qYq3zTOx6SwmQ0WBX/uaTkMiyrQOBlLgvn29fUz8y+tlqRaGojO/YF3VKrbSR1FINyhTrDa9E25WIp4a+l6KyPAcJsB73FFEvIGmLyuUCz7RpzMNEpoRXIwFZ5U1rUKPOw2O4lRUHLVOmZ3Smjlld1EhYsyf616fm+bHcMzEOaPETX+sJZUj1RbdJ/UxVIEOHIGsjyz7BFXm/4vJOYHBMa2PkPoSZeLcEPqQsoMQZ6MFNF/VHk7G+ctNvMuhIGhNaTogjZ5RPRvEXT9X5dAHZSqjy+uThj7JXzYdwXZGhjrO9QqvFrCPaYMVRaIFqHi3akGSL6xBrH+uollKoaQWHyKSB/riOCMRl41T75SaE4YsHtUa3S+K7oiDQBf/bhrHUvD5jih3ko6e9fiFM81JLcykDc0afFqs/2O2T33wpFEgn/Rxi+P6jureOAeRfFgBMlGms630PWexZLfGGcrlgEF0ZqH3gYn3hcN6p7mgV3Ru/yy62JMc5TRZcjifoFI+sMX82WUdr3F4ZI+D2IrJvLTmh9Y5aibJSd3QKZWGMCA2vmBF6w1spHagWTbWa1YL429T9wmszO1ti+/BaJCgtkuaS7+jXzFgkeOjboG+f9oxnJmtT7grKCEojiEP3VJRF7xnXnlAVJyyEMhdR6ALQmspMqnP9pkqKDOmhu0L+gpz2OZwl5zuzZxXeW9qJLCAZByAJ7F1WR41z32HRrXr+CVFSzpk0o16EeylAyGebWKxVvg9r8VnMh/U2Phe33+WXoBG7Ek7NEpu90+uUSgtTpNl6Sil/I+AgTg7G7QtOJROgwkqsF68l+rpMWxAS1w3o+yDhxNM0BrLJRNqlETtNE0EcrEMZh6gMVQS2ThNmBk2zVnP6Ais6RuLd1gE1uoW70+ZGXIXZAsdupefFtj/nSh6zEKzym/JYUVuJb7L+MToE7G5R958+LNQ+2vEwr0TZrXsG27XgSQHOS8Pg3FQbfjVuwv94cYomzmtfu8aYGW07npjmKnPOlfdzDRKUZ3ti1hualVG5zXTF1hiABrvXB9yw07lsGBbPoprZHSGdX8XaA7tB8ms597IbzG8Pb6Zf7P/luaNBRs369PhkjUBTDNpCF67emeRB2eChsmBvLM6O/FtxRQY+B1L6i8mAho1iPfXSvP8dIsBIUZMv8oQ107HXNNvB7lkCmu9JiDF9bQIOn5OdWB5x3JUQrdT X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 960ff9f4-c4e4-4a57-48b9-08db2a944220 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:14:05.7714 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5tNJp0zxgySRtbZrPQT9LOpbLF2uUA2HZSjNy13wfsFtRtKOP+M49ktHgyDddrNeU1u9XS3+PYcZVT2TxXSRtw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_221408_402956_51EC185A X-CRM114-Status: GOOD ( 12.26 ) 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 ABGR64_12 is a reversed RGB format with alpha channel last, 12 bits per component like ABGR32, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- Documentation/userspace-api/media/v4l/pixfmt-rgb.rst | 9 +++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 12 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst index 779f0bdda642..38811025d71b 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst @@ -985,6 +985,15 @@ arranged in little endian order. - G\ :sub:`15-4` - R\ :sub:`15-4` - + * .. _V4L2-PIX-FMT-ABGR64-12: + + - ``V4L2_PIX_FMT_ABGR64_12`` + - 'B412' + + - B\ :sub:`15-4` + - G\ :sub:`15-4` + - R\ :sub:`15-4` + - A\ :sub:`15-4` .. raw:: latex diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 16d3c91c7da2..3c5ab5ecd678 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR48_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_ABGR64_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV packed formats */ { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 3490eb3f42e4..b87c7d24d3bf 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1303,6 +1303,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_RGBA1010102: descr = "32-bit RGBA 10-10-10-2"; break; case V4L2_PIX_FMT_ARGB2101010: descr = "32-bit ARGB 2-10-10-10"; break; case V4L2_PIX_FMT_BGR48_12: descr = "12-bit Depth BGR"; break; + case V4L2_PIX_FMT_ABGR64_12: descr = "12-bit Depth BGRA"; break; case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break; case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break; case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 3c5acd72606c..a6df69ce5cf7 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -582,6 +582,7 @@ struct v4l2_pix_format { /* RGB formats (6 or 8 bytes per pixel) */ #define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ +#define V4L2_PIX_FMT_ABGR64_12 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ From patchwork Wed Mar 22 05:13:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183578 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 C8D51C6FD1F for ; Wed, 22 Mar 2023 05:30:39 +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=rb9UQA2Cm7fRmN9AGCBHFFBcSJnyKxCn7A7Z/lCYOwY=; b=KpoHhRlGkjcvmo 9OrwR8MkIZWn0qQ/qLWyLAC9faqn/8YHsk/MbnQF+8TlfqyxDIuWWsPgu7A0Vig40LHdTeMFFCRn/ rXIF3hhzh/SMwp8XrFLuAmpn7wxvfr7FsYnNNgEyQRj1Q/5ECGsvKUvbmmGWkhbNtVDYpvUL2iM5b CoH4KhFf6spjy+EScV3oowArw7ejqobuBu0JxBlP2Q2Cuyudwy0gIaEWd6uaH8646n8fJzNYjTZlN KDzlIN3YUYJwmWKZhQ5p+oGQDBOdQMpg0NsLDKMi6u/R8fnANpGn34F3M9PNLT1Y8FjXjY2fi1HEV Q+/MLe0Ei4eYkp/gGfLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1per1z-00EiMk-2y; Wed, 22 Mar 2023 05:29:03 +0000 Received: from mail-vi1eur02on20609.outbound.protection.outlook.com ([2a01:111:f400:fe16::609] helo=EUR02-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1per1w-00EiLr-36 for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:29:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XK1P5NY7W7I7LF9/c4BngySiUUTxbeeTGApE06A/9DTSpdFCo+QU1WjkkI0i8OLvmIDziHcUQ1CPW/bGUbu42XMW06TCtDTx8o6Oi2ipPkdDpI78t5S23L/RYwfvbWgXStrZNshN/aBR3V18asMjln3tkk05oNb2srvRresXliDGS7CQVexks/G5bael/6hR8Kt9EyfQ6/0DJvvVXBoUpz7f+5ozfzDbwM5wJx4AVYtrZnV2IP2twZjV0Kg0IHWluWpy4XGfKBYrhF5eTfbQBU9kUaDaap4dDlTNKrlHW1M8I2X2c8pOYfK3VvKtwHo2f34MKViaNXLkF+sjYUrL1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8HtPUGDrL90dDHNDgqSHbRFOdqqqZXS5JUCzQX0fw9o=; b=mgRtP13uEzcG8c48DVHYbeMj4HnCeH+emgodQstn/4+gXU4d82XR3nMekH6Q1mC6jPgd2+sgLIDiVnAYyqt/qNVctwNN46uQhiLBWrDI8RE5yjef0i110Z0VJRJKyJz5g0rF5kPVSi/r4Y1Gk22Q5WD7l1t9p/tLq4qvdIuf+3Ay5yZ9IyTDAF6xic0gRioMZH56stvyIzpHgdpWcmMpiiQ8PKxG9wr1BiYL10T5kJkDhtD0Z4++gJ2R6XfCP6Fb+OitlGP/kzrRtuSS+smWjc46zs55awi5MAyh5O6cPtpffePIDj+Q7fiMwmGcWDWFTgt+mOY5+pa63j0v3OrvBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8HtPUGDrL90dDHNDgqSHbRFOdqqqZXS5JUCzQX0fw9o=; b=UG0WnjVK3ollsitj+b9FnK49ekEKVddWYXysybozD3dlm9MhTyVWi2/pjoV25r1+34hzGaQSkfZaGbR8shZmLDU8EBc1397kN1cS3uCLLVl8ke/Lf0NMF/RL3RyJlwblLOZL+2UVUiTQn7JCOXOODB3uk5yKIwpKY1yt1y4nluI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:14:09 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:14:09 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 07/10] media: imx-jpeg: Refine the function mxc_jpeg_find_format Date: Wed, 22 Mar 2023 13:13:10 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: b6b7a76a-5879-40ab-fe64-08db2a944465 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 42KAB3Z7aMBKBC19/JPyYsODAWKaCRQmyOlTam+kfR38PvWKUyjNeng17aIHDqmnw6IF5o28CD+vMRc6tyZUbXdYfNCibebgLkGomjXapm1IlmBZPe8qZZQICMhlW/F0vCoUTSNdAQ6gKIIE4h5H+WFmNdNcWfw1SIEMrDyNrHBtY4GH1q3o+GWP9P1czkeTdUGA1RbZRx3Wdd4FbIEXI5gKJ7hzNMHPjTI6x97eniDcRIzXxj5BvhZVEUkvQ4fHR8N0Uuv9SH8e82bpf3S/d9bPwzc7i+btAbEexcAZHnLEi01qjmmQEn+DV0j4vTXb2UgXcjYQ1uZ335t9ALjDhPrjCJCiimrYoXrf0lwWju0rQ3KH+YhW9kFyXIVRk2b07TqvEGco+M+KtERl3ndPawzuTId7C+WEz6pYSP5uMe/C6lJbzp3W9RSkRYLf0AqCtIcTK4Qhlyd3rRtRRQ/SC/9oGe9JBSjPgFAENR4Vltd8FuuVxgnyIuUUICN1yxn50fW4dVM2hNJu2Nlz+V5b4H9CoUYX2gncJ2oOQDgOSizF0MAiHd3qRacgeGtEXj+JC0gL6ENvfnfmmRP9bvKljBPyPm+B+1BApXnRCld0H/9HmtKnk8En/poh/yQlOZ6fc3sxhQAqnmP7maQF2QUplEpBCx2PrOJeqCQgzpWzD1FrO8WjSRwLzjySJaMH4iy8NfuIiQQT/8T0Gv0T3qHj9Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(6666004)(2616005)(2906002)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Wrin2dCmIfInAwww+FEYLA0c3FlMviHihPfS6AeL04Lsi1DXFCy5DV41KlNiW6hyN5BPZM82E+iGGi2wmEnbODkiVjZMwFG61CpgtCmQbmeh4lgCCzx4IjIdgf6dj/y+ZBqpl/iypTSv9FGPy7NB+oGwnKWn2lO1tsiK5mWx54Ra379bCPHJ0k1ZB/Xd0etLn4mauX3QeJffzPjT7rZtKzMPv349IZ82evwu8cmS6EG0jisoUZkHfdLC8nubM/wAB4YRBR7E2H/QsX8sRjt2ljIz/V0eF+qiLBNOOADFKMA7kJ9oKiIOSM9XPCCKw0XSTHZdyGKeja/KQfw8nTfDLaFPKj1779aWyy1WVoFbii7Sw7S9KlX4Vj8Ro5YSqY3f/0rbHC6pzPnOW/aUypixJIooImShk1MW3696ZZpLXXoqDEsk7aY5LqjVh0ExXBxTCCUpVHaq6/B9Z2Ld7FLR+Ecd+70Jy5lbQw41OhbovC3+rnwzhQ7nZu3qN/lI11iLw61ZpqAC1ZGwMRTVF/AGScUG5pZ3+pnbNOM1+jacHKNe8/ue2wBWx9MqwF9PeR8qf0OB0nLHzPorQ3vxV+qJFmCJNRk+Zy42Z5W6yt/xO2zOXz8gqFTss9UGVDKVcYb914jR0Wu4SHZi65vdV6L8S5Z8rhFZQQ0sfYvYiWks/tlPzXgrQAuDPbASCNF9XPRQXLLREuzkmlIOvhcGcyt2THI0da+m/WsmapQUNBX3UEv7MOiI5I9BZhNdSwkRTcUC4Sp3k1vFrpXO3OJwJ2om9Yel+MtGf+TFJZa6zGXWA/Rf04YXOnq8pot5yz8vHn9EOVcfyfRGe23EJU2KcK0QTsK7x8anTCtHf0wVegkUwRJchWJ29uhOhnQmZcwk4I0LYK70ZBfacOvHa1JhWqKnAE2DMBsyf8r7PjMb5jKxLyU50B8SI8aFLnhrU3yhmSybjSIgZ0P8dvyhjLrUgvvalhT7dLUAwj8YntyN4OY0+63o4JohdTJ/k6Ub/dqF6BNL9B//G8GsekNLOawSr8I8hX2kIETGjKZyDTfxfR7peGWzZRLEOR5ERGlxgN0DGN7m/28QJVPlU7Agzn2+CyRQyC7eyOhnU3jM/7ovraQMTQyjkTK0sM3wRNFUmQ6xchPsbnMuEXI6pSmy/fGmG8GtBCYgUYxSXiEV0Pz7efi7QhkViWAcw9FJWzNkf1zXJTdFxt//SnbT/aIozYWwHHwpaeUMRahAbkIzkUNuAxx44NsJxYy6RF+yhk9SYgvY8jF+N5vLK1tbEkeBaWs0LRKD+wO0dz9cnVoerdtrskS8VvlwyGLR13fV7XlJbe7AddkQ87yB7Vu7xEdAvAzkS5FNjl7UZI3M/OZvx4WFnO40wMzxTdzMlAqU6P41LEBipkhFIXOiB/ibggOU+h2GcoLvMHaDr0QBMZcD48AL7GvCWgMoZRu/Rqt5Fx+8dra291YbeYMIS0WyJ2gcIH6WHd/1wRmol3iwnTwyd/7ayQoM7ca59qgElIlxF8jRk35a8I8VluiM5/bLem+ycHy6Blpbw+P48lvtHwQB1jRLrvQLRL4QObbwBoOzIPO58OQkSQcz X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6b7a76a-5879-40ab-fe64-08db2a944465 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:14:09.5837 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Yk7DWZKMP1DDuXlghn6tagJcJ1vEFnQB6KYMk8peRERefG745HxLGR7jex311s2gRu/0QJXYNQowMOp1MMIuNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_222900_999804_B2995924 X-CRM114-Status: GOOD ( 13.99 ) 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 remove the unused parameter ctx Signed-off-by: Ming Qian --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index f085f14d676a..70b6eea733e7 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -420,8 +420,7 @@ static int enum_fmt(const struct mxc_jpeg_fmt *mxc_formats, int n, return 0; } -static const struct mxc_jpeg_fmt *mxc_jpeg_find_format(struct mxc_jpeg_ctx *ctx, - u32 pixelformat) +static const struct mxc_jpeg_fmt *mxc_jpeg_find_format(u32 pixelformat) { unsigned int k; @@ -1562,7 +1561,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb) if (fourcc == 0) return -EINVAL; - jpeg_src_buf->fmt = mxc_jpeg_find_format(ctx, fourcc); + jpeg_src_buf->fmt = mxc_jpeg_find_format(fourcc); jpeg_src_buf->w = header.frame.width; jpeg_src_buf->h = header.frame.height; ctx->header_parsed = true; @@ -1702,11 +1701,11 @@ static void mxc_jpeg_set_default_params(struct mxc_jpeg_ctx *ctx) int i; if (ctx->mxc_jpeg->mode == MXC_JPEG_ENCODE) { - out_q->fmt = mxc_jpeg_find_format(ctx, MXC_JPEG_DEFAULT_PFMT); - cap_q->fmt = mxc_jpeg_find_format(ctx, V4L2_PIX_FMT_JPEG); + out_q->fmt = mxc_jpeg_find_format(MXC_JPEG_DEFAULT_PFMT); + cap_q->fmt = mxc_jpeg_find_format(V4L2_PIX_FMT_JPEG); } else { - out_q->fmt = mxc_jpeg_find_format(ctx, V4L2_PIX_FMT_JPEG); - cap_q->fmt = mxc_jpeg_find_format(ctx, MXC_JPEG_DEFAULT_PFMT); + out_q->fmt = mxc_jpeg_find_format(V4L2_PIX_FMT_JPEG); + cap_q->fmt = mxc_jpeg_find_format(MXC_JPEG_DEFAULT_PFMT); } for (i = 0; i < 2; i++) { @@ -1950,7 +1949,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, pix_mp->height : MXC_JPEG_MAX_HEIGHT; int i; - fmt = mxc_jpeg_find_format(ctx, fourcc); + fmt = mxc_jpeg_find_format(fourcc); if (!fmt || fmt->flags != mxc_jpeg_get_fmt_type(ctx, f->type)) { dev_warn(ctx->mxc_jpeg->dev, "Format not supported: %c%c%c%c, use the default.\n", (fourcc & 0xff), @@ -1958,7 +1957,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, (fourcc >> 16) & 0xff, (fourcc >> 24) & 0xff); fourcc = mxc_jpeg_get_default_fourcc(ctx, f->type); - fmt = mxc_jpeg_find_format(ctx, fourcc); + fmt = mxc_jpeg_find_format(fourcc); if (!fmt) return -EINVAL; f->fmt.pix_mp.pixelformat = fourcc; From patchwork Wed Mar 22 05:13:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183579 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 42041C6FD1F for ; Wed, 22 Mar 2023 05:30:59 +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=PFJeiYVeqd6+8+o4cZl0Q5W+5lC5vgARtkDsn+j0/xY=; b=x4f9BQaT1CiKx/ AeP8/hHTSghy1ypIQX9Z8kJvGJHwP43sEM45eSw4toH2pAB4oLifJEuyaQ7fTGwNc2ERx/juayzRk IFV9dz3uvG2wt+Dp6B8VNPVsDS5vYGiD/4GiNX/hydSDx0tSUV31ZP8GR5+GBqoFm3QQNpdpfZ9Dv mwde6b/VOH5gaMRtzi+v+oo5i0nTK16JyPqZjM3AwnywmYXw3ZrI9zFXro3ds9W0KJP+JfcJxwijv bHmeJ8f56uVTQ7JkB+FxfSCYj1rYDjDQyjtFsYvKsW9F0ElHklrVo4nlGXYh8AoYV6SfEBOCeNPzF eWgBA+hamIRFCViJge9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1per2O-00EiRE-0v; Wed, 22 Mar 2023 05:29:28 +0000 Received: from mail-am7eur03on20611.outbound.protection.outlook.com ([2a01:111:f400:7eaf::611] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1per2M-00EiPo-09 for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:29:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OglWgR3IfBSW10yTiRHSBmHpm9/if4BLeNTizbXilxgS9zJtk5ZT9GLrDHuJVZ1FYcjxqvFLBrLZX0k2xjHD3SN106j6MftoxVsCeEZAIJYJhWZQSkB/wKIf/54baVXHWj9xkru7qGc7pbpZnA2JBGOq1NOBdP2TtUv55FhOLKxXYCtbV0Vt1TzkDZxJU9Ov63Gip0+cA94HMNDQByoOncypLo1Bw5NNAg1Uv/EUcxmjli7k/ExOYP1+prXLDyWuVwEXvFxOZrg1AYEzYu42g0CkLVkCTsC9MdB1vK1WzRxc0wN+JlwfgZEwPTnglU1yrRX0kgPfFC0YzmP4BSwrDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DWE2v7gcmTZgAjF135o2R8bWHo+YHguXRwe76ddTpZg=; b=efsL2KsH5CpGbzhi71D6hgAHO/ISmmEzT1IriMLigsHPqi6zGkSpi45SdvgydD/XZwQjZHgdlMuky5s61z+AUG6TqTBkdmZuGuUvuZo4I1xQ1kRLWqKScmPbrrl/H2kzqAj0BD1PLWTShgV4j51B3f2JXN9loWdVkkqIxxLNK04wEjhHvS9AQjCi45yaa6RZw3bdk/K15XWWooT0lkFMrp4ubb/b1z5E/LCjnC9YuJakF/vu/tze3oh2iuN2s/oJZKaAXwWP4epZe4G905N2TwUD7PqSzw6VqrVZCH/TOKKJpUUNg2rdjHbSTBSkw0PSalfQNKsTjJYZriztvXWZOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DWE2v7gcmTZgAjF135o2R8bWHo+YHguXRwe76ddTpZg=; b=l2ooSAChFYUpBftK5jYMIIxAl5bGiISONWtq4d9iPtk/w9pcJDKgm3WHWGlogi5/WEHvZzWACepugcNEHxWDw+i5b/SfoIj2EHFHwTJJRR7edIRUiaD3lw8NmW+U5yUKsay7Fpqiv1NZ3610nph1BVmx4tVzP6EkZMVbRb5ye2U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:14:13 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:14:13 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 08/10] media: imx-jpeg: Clear slot next desc ptr if config error Date: Wed, 22 Mar 2023 13:13:11 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: d8021e41-8ef8-4f6c-78a6-08db2a9446b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mxuIISw4QOahI6PHeg0cdzuiXBkp9h+5I9I5LBVGHZs/B+DBLRcLS+NPgVIcT6YJSyIibRpL+2IEXW2EColsu5RjMelqjVyPXwvSakPepHRcrSkXxNCWC9lV+/YLz/eQlN7HNczGWONzWmxPslD63hW9ciVvcjVbo3ta8kVPeBaLj5mz9aEdnD7ktlqYqVK0O5hSF31cVHHiVEOOwFi6SbFqFY9P9qjn++FBf6fA1UnakFpsMsnW6Rb77nR/aLbxs9aTU49O4D+Uvek41+G8wjHcnavIBfX6Hta6f1CPJHnU3QnA6LTJc/MpTBDYaX/gGlYWrh0h63ysSwky/RQcHz52lZoKL8PJ3OxIjMPAwTT2hrpsiCKFJCmB2KMcjohRxP/S3YXIK7M9tFiIoqrl6gmL1i+UqJSENAqmpj2lBOA7jp3B+hvmWaxDqrSroeFei1bA/dRyF5HY0MQmSoaBvj5Lrrc0pskzFsFI6Ie9AEf0OTjdQnS8jLsPoOI7MQSYJ2I15SfTthPQiBJJtQi9QhYZoBzcRgmuv1CRPerQVnQQV15pzDciT6ej3sQRIwcoySVFvNnZb1g0U7EwaaFq+I9+YrBN9qFjh95ygOmRCdfPfNJawJAQu74/oddfcpEX56E1bxRP7iKTUg8tFO+AcCbY6eIhK7d2XJRn+mmbbL//bP+F5eB7MHRHtiR0rBugktuikfGkND6JRSe1oVFDXA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(2616005)(2906002)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: P5eE67KO8+UKJCf5yMGAr3paQOmVsyFhMW1cFaMpZrbn//hDbK1R2KGR3Dq3Isrp+NO+x0A40cpnPCFrDwnIfmGDmw9ahuzo61NCz3UoRVSeWr1GlcgfCW5bxIivdCbHX1ZrfS47zw07Ut7Q5df7WE2FfM60wQC49R4AjyF7+70uwqsBAzPhw8+acer9PXPMEHfS1/xBJDRbBytrGd3Gpwbu57493WEFcZKIWjhDY6j9PB8cbBK9cjBvGKW/OfzNBYq2iJ5dXP2ZnzME7mNgdE4J/fKf97e7bHn3g0OvFHuJDtXhKg5YCYuFYMkeeGrIXROUpEi9DeaputOSYPLOIPCbdDutm0s2bzP1+4qrTiDJDTD13bDQA1JbxHsy9U1loYmHO6qlS3QP1VoBLJAPbH39lMGuZvS54ErF51MihRENnJIHWlPbyCXxJVm0ZkLul+JEHc/9iA1Yab7xlvopQv/KitbFpVSPsfATkz7ZOgWQhOnLmIDr8T+oiHaiznelZ1lL2qL+ai9SFczJswo/MtLs/UbmpkSHvTh+YaN/WABj0wONQnqcs6CasQeTabs4y8dJRj0YZ2DksOvRLk7k+jPlmaXv2AtY5fJXGCBaLbFpcpzvNcHAGa/lvpWcFdegPHc0fKi5BbmLMDXH9Q0/RICT94VKHXWG0z3VL91E8c/OH28008+j2BdSkDoECkhKcm00Ovm8hIuYOv5xXe9a6hD8OWF3zbd84mAtT94Xt079l/kdBKuFishmyZTZB7ScoNEWeupOQsP939dMObmuLYuuwOlDKdmNpG+ATQC/ErpIPLxf6FbHzXzL5paHokeJ/ctXAoG8iBF+0XaFBBsz1AQKr95hIjy/Z9B5OLSVVNdlD40LfAueONKwLkMbXTDKEoUbCDkB6QpLyl1OdnGhj3Wr/e8Ur5Jfi9cI2F3eSSaIZT8ccknVkY60DnsbJ3SQz73tJnaJFAzIAxZg52vylPiDO8671yL/lC2NmphkLzs7n0jEeYpyCqD9OnngaT+9FNhezSz6GGPPiMbbMFTmUOiz3Mq5cqmFeo1sGBP5HttPBeqSUfH1XTImsmrylSuNuC1kgDHMNmFBipPoUpoCkk5dFH82lwl4anPbWM6ajKT35UzZIrhaYJ5PMuv/Bi4dyDBa6Y5Yge/VVZATzWfHgzSggAjBFVfIuwl86VWfgnYL8dwX8r2ui7eZY0Vu2pB0d5Lor5cgevBHQvclo+lTEPSvBYdmx4zsDKWbwepx7azNhkkcU7z1LYsMeUAvFNR3QQBNwHn4qybDoQ9OZerYhT4kvFmNQm4GWK3JFaagb2wYDcCJNUa6GgghitYXnNtmjGaK9kPTt3S2keY5fH05GXqAVWzsCm3R9VD7dZ0QV6jmUWcsvvlLIAx1am1x9dFBAeRjv04hxT46axJ75AnHzIZkL2gITpJSOZykajNd0pzWdZSTXKYGuPzcWNOE633GjHEhsNubxERsosRvv+Lp2e3XpPly0wiZFmWCsJEgvh37//Shy/1D07UfrqxMVJ8S6CdSH5/JwVWb/3T6q4dyvKavG0acSBDvIlMnHgSESSNkT/JhtxZaIt8p8ElrUPPo X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8021e41-8ef8-4f6c-78a6-08db2a9446b0 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:14:13.5366 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ppsIuXNYxebVKZgEWxBqslZI77BDKgk+rSVv6vPeDeex+6IK96EzIxRWFVP3//MLuh3Pl5xM3Kk+VnccdUMbOA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_222926_088647_27843946 X-CRM114-Status: GOOD ( 12.01 ) 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 clear slot next desc ptr if config error, otherwise codec will report config error interrupt repeatedly, it may led to system hang. Signed-off-by: Ming Qian --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 5 +++++ drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 1 + drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c index ef28122a5ed4..bbd5d6a9fc86 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c @@ -178,3 +178,8 @@ void mxc_jpeg_set_desc(u32 desc, void __iomem *reg, int slot) writel(desc | MXC_NXT_DESCPT_EN, reg + MXC_SLOT_OFFSET(slot, SLOT_NXT_DESCPT_PTR)); } + +void mxc_jpeg_clr_desc(void __iomem *reg, int slot) +{ + writel(0, reg + MXC_SLOT_OFFSET(slot, SLOT_NXT_DESCPT_PTR)); +} diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h index ecf3b6562ba2..8b7cd6526efd 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h @@ -137,6 +137,7 @@ void mxc_jpeg_set_bufsize(struct mxc_jpeg_desc *desc, u32 bufsize); void mxc_jpeg_set_res(struct mxc_jpeg_desc *desc, u16 w, u16 h); void mxc_jpeg_set_line_pitch(struct mxc_jpeg_desc *desc, u32 line_pitch); void mxc_jpeg_set_desc(u32 desc, void __iomem *reg, int slot); +void mxc_jpeg_clr_desc(void __iomem *reg, int slot); void mxc_jpeg_set_regs_from_desc(struct mxc_jpeg_desc *desc, void __iomem *reg); #endif diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index 70b6eea733e7..3f1c9bc4b144 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -692,6 +692,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) u32 ret = readl(reg + CAST_STATUS12); dev_err(dev, "Encoder/decoder error, status=0x%08x", ret); + mxc_jpeg_clr_desc(reg, slot); mxc_jpeg_sw_reset(reg); buf_state = VB2_BUF_STATE_ERROR; goto buffers_done; From patchwork Wed Mar 22 05:13:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183563 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 E637DC6FD1F for ; Wed, 22 Mar 2023 05:16:11 +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=BN/iGBN7bKHLTKS1SHayPCFU+4y3WjZdKkcorf3FmsU=; b=3l0QJ3Rz/kE5BK DTndstH/6aFUr1KG7xDv39I4M80xzs+3hkcOcgRruYShOO9ZVKLk8DsdjCsp5jnE5YUrgngA1x7ms PfzODvxleejaGPqFT9MphDIZxf2aT83e/xcgJfVp4ljUe9A5nYdN1IKxXvIE6RoD3qgkYANVraOoF IUEzdn/iVXdmA6dppR+yCg3YywY8QT6pbC19FZRN4WyY835XfyCYHs4MLryTwKaCfudKs8EbaSjq8 Hewk5wKSddxYttgnbj4jEnRj8fjoS9muQkxFBW/itMmHM9pu4tFWk1EKLID0yCNDCUQwaP3lIyVvq NjaPjLAE5GhleN+inPSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peqo3-00EetX-0A; Wed, 22 Mar 2023 05:14:39 +0000 Received: from mail-db8eur05on2062f.outbound.protection.outlook.com ([2a01:111:f400:7e1a::62f] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peqnk-00Eek8-1T for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:14:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ReheG9/pa3wub4vfJr2rOPyxgMqLgx+1wzCDJ31BO98ry+AfjSZMaIwtUzu+r9IAdO/DZS1y/oGL70BHgTvB3kP29+8mjbF3QkEyJMm8IqQzEqAdSXDVSwe6KtQesihpCRAaaqICPyE3ZMJsHsNTiHMSoYjj3ZQBetknphHqTadPbpccDgTTqRtOIPRUOoc/S6oJPx37WzOKOnyug2uxyDVistAgoJE3ztxEmwiV1JfAXZFdNNzgUDSxFnBR0lNLlwFEBu9Ui98hxPr7kVGaG/8EjFmwe1/UNEMKlwZdhdBqP8h8hAe0raH2nKlxKnWsm26jhDzl97TweIVeDqjwUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4KQHy4ojmtQF1BduRAXSRUeX6FHJREEZUO4mQRp9hxA=; b=kxXFjM+RuiR4ZZHBj0+RVTg7vDCJIfzojPZ1FvoXkyeRNAQZyyhu0LnhH5fLDGpADXAbhv9vKTy2NQk7A9h4IONV8FkeWxuuFWpNCppYqVpav/JiPFiNNzD1Co3fiBGponKX9GbkbSHaiU/WJcpBA/4r3KtsuTO+X9iPY+t5O1u62aqcToa7c4U9HXvT6g8dLXuqxez6+Nv6zLRF61zMThbB7KdpBFKmSzBsHVz8/xUqxzBW1PzXWZShg1SNUm0naTolrNFWVbXQbkP+cZGa07kO3lG4xOx3x3K0O6cpr8lPM6brjEUmKWXjiSf5iVBUd2+wd4ojsdtTrs/rqVgBTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4KQHy4ojmtQF1BduRAXSRUeX6FHJREEZUO4mQRp9hxA=; b=GhO+2GOT8byskifRPPqRkCs9Pa1dBIcPwvWAwN2feGCHtjZIloIALkRdDIxFs+Q78ypwnjUsedMddCRIlPDuapdnMe76klRnSD7gLkEt+M/wq0T4MSL1NKDngdVhzw/YSj5JJm8MWnscY5z0OeaInqmB0gBVDB3JbYjJkDriFh8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:14:17 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:14:17 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 09/10] media: imx-jpeg: Decoder add support for 12bit jpeg Date: Wed, 22 Mar 2023 13:13:12 +0800 Message-Id: <9bfff536b5a7f952faee311cf689a1f5b79a47ef.1679461710.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: dcadd56a-9b33-4343-7c0d-08db2a944904 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2sOTBGc+veMuD7Cidpq/HSsj520/AG668l8bzbKshawL693zcSkTGbcQf90ycC10mwGg4az+IOaSWiz2+KyLy8l1NdbCYfY0POhoBeMm2KSxWIPbOsjaI/dOh37CyqgE1zrD9KXA23SI/X0BDIorZwfyYksW31a5dO9G9RzFTNEIdebOzn1VEL0cyA4HIFMUsgHv6MsHEYTlz8JUgTUIwvYoxTgNMd2r1UpSw/zqWgJjHqDfqf32QMmMp6TKblv3rmyK8B17PpAIrPDr9fGaLoDh12NTJ6BjyZHH+BK11hSdJ+QWI/G5mmdf6LOhAanRjC99FOgVu4PB7w/od+pVCZqBWz5YmYwWypscmO3ezN+/yPPGnvvjMRcHD+SYCJnJEv5XDQcsbl9AxBzeDUb3veMVXOI/jmqD+I2GSUH0Ik/N132x/BjvqWXz/t5R1ApTSmy59yqN4SQPoVGDx5U2Y9AGZzGiR82VpCyFgbL0dXEPAcwMGt8iML+/Cd7uPVKIaSrf/aaTi0JUAOkOwXTFYb5rxFl4S2l2o8Mf+G/gpq4FxSlGlZ1fRt4sHjrtRvQYWJfD3W4ekWZP6d6Wer5t+bRNOO1gmGjTDN9gAZ592n5yOUnGIaOUN6XXgNu3NVpXVBHdLKFS5uEiJqEmQ/PYctnsngeH9X51i3UQucY9gsM3qAXBQODNsRu6cXhKAg2MOOrL2bhJKeReC8qwFjEy5w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(6666004)(2616005)(2906002)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZOa4Z0XDm75Rscb4sjJfQYOyYyHDaoMgKLSLo+2MWro8u5KPN+XNS7Ga/Cd5n4vmwzQaa3Fk2tYuNHW9xc9qyBlJk+cz4Kp8etmD3lcTab+IRP8NjY4Suk+BE70c4JFq0yj99lQE0tNSzZ6hswPeMJQ893WMUm/nZ3Y0sClYWf98Jcwd9SzCvuoxVXUndHkqmM/xfoujdYEMgUHY/TwKVIMuo2sgSVh1JTc0gUyIkKuUcAIe6ngcimqFg6qTkK2DvrlKFXKSe68MnWiPQ3h0pNYNakYCz3SD1h2f6n2aImLlTIbSMxgjtUM1H1M2oTEpz+wdiUq0z0uWIA6Lj3PWhYefaf1KfqYnPjJD2WVmXozvOTzCtBf2VlOyWZKGMtq0CN6iPq6mgdhfNFfZmWSHGnAEwmQwdA+BECd7GzOBLQP+ztoMJdXWQef/rOl632ijKJBgYki6MvW1ESyH6ousWZo/0pFXEyzsvGak4iaENGmqt0C/m6NOTScLklqZy9hxY70FK6YXHtrfxbzg1kDloH5WWHA9mpjm5LRiftTCVRAnvmJUczzPJnv/a0Yyo4s4dVPYA9WQmYjuq92meW/GCUFtX2O/zOdtaXpQUzUUpAguoJz5xjjW2owOI20nJ5dP8dnOix5KfrRTH1DEluptiGT1BS2GeWQT8jbrtqQsPNBV38cSHduUaJhz5uVxMYB5mKxgJerD3TgETtDC/CC+C+nx57QoC+TP7ZB3D2nF/zpbvbNlgu/0HI7O7It6QsHMbcfvfIKexTe4qZzmwMwEOwX53NnGUrIsG3V96eUkGOEz9VnFx9uNoaj4mAq60G8oqpb4pF5HCcRxzEODiHF3P9gP3eRnuqnHEiAL2pjSufO5hEm05rQpJcj88tt1bV6vnAFq+9CmRapQhzp1C5ogR7D1HbnFtlVU0adVKce1J9iaS4n/mbFNqIWg56BoDlmX5di1Dhl2HslcCjxMFDlRkbxDu39p2iqfsRjK74Fn1awwTTN946qeBFBnB03hzkV31xRcdLQgrfAzrAFlBbzsdcLhTzHlAhRtz82XRCWsYNJjXh2lLXLpFwhNqj4QdOQLPWpRgx1CnTAZkh6kf8Xf9ptyq5USNZ0T/+PcqQigGOIrhcggqZw1Ds3lwdDflMN+gw28DOLDbTeqoyxZ0BTpZO7ZFxvJj8rriXgv493xCjlbGwMJAuzaFSrwmYRWRtm2s386NOvAgkS7zkG8h1We+OHZA+sX/E41uDEGfF+DDIrURqzU1Kz7hy/I+eXjGhKtyg4EKtaxb5D6snTZ2WZxnx18j+kLpG67bbrw1fBImb2Z/Tpy63XvVxF8iX0ROn8g4atJt+C2ygUMiHEGlueW7tysfKi+l25hkx6yNkf00O4vKKR45ibvHiQPDyCJzjfCrUswqCOaCoivLhsK+2Bk1a/MQ3VWhU/rdo7Yijuf0jDvdAy9kXcLWoTPO6c92POWBLH9Q/qgoKRAqHrig2uIVQprOW+8RwBpDVBhPZ6EyT+T7qjEb1Bok234dSX0KBOF9IfAVHIVThpCf1V+gGtOMsyWw6Y8Zet8OFd35DLTnEqzsdPQ9ZwgylmnXjbq5Lzw X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dcadd56a-9b33-4343-7c0d-08db2a944904 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:14:17.3489 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0wZGwwxXPdndx3wmS2dhfg+eujvCGTM1ByIA+wdizqYKj+aw/Cs+fyFPVXh3jdgegnOY7dEIlWQ/CKDKFDzhtg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_221420_628512_CB7CE11D X-CRM114-Status: GOOD ( 17.41 ) 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 enable decoding 12-bit extended jpeg Signed-off-by: Ming Qian --- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 136 +++++++++++++++++- 1 file changed, 134 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index 3f1c9bc4b144..74ecc5415aa6 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -87,6 +87,20 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .precision = 8, .is_rgb = 1, }, + { + .name = "BGR 12bit", /*12-bit BGR packed format*/ + .fourcc = V4L2_PIX_FMT_BGR48_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 3, + .depth = 36, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + .is_rgb = 1, + }, { .name = "ABGR", /* ABGR packed format */ .fourcc = V4L2_PIX_FMT_ABGR32, @@ -101,6 +115,20 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .precision = 8, .is_rgb = 1, }, + { + .name = "ABGR 12bit", /* 12-bit ABGR packed format */ + .fourcc = V4L2_PIX_FMT_ABGR64_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 4, + .depth = 48, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + .is_rgb = 1, + }, { .name = "YUV420", /* 1st plane = Y, 2nd plane = UV */ .fourcc = V4L2_PIX_FMT_NV12M, @@ -127,6 +155,32 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV420 12bit", /* 1st plane = Y, 2nd plane = UV */ + .fourcc = V4L2_PIX_FMT_P012M, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_420, + .nc = 3, + .depth = 18, /* 6 x 12 bits (4Y + UV) for 4 pixels */ + .mem_planes = 2, + .comp_planes = 2, /* 1 plane Y, 1 plane UV interleaved */ + .h_align = 4, + .v_align = 4, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, + { + .name = "YUV420 12bit", /* 1st plane = Y, 2nd plane = UV */ + .fourcc = V4L2_PIX_FMT_P012, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_420, + .nc = 3, + .depth = 18, /* 6 x 12 bits (4Y + UV) for 4 pixels */ + .mem_planes = 1, + .comp_planes = 2, /* 1 plane Y, 1 plane UV interleaved */ + .h_align = 4, + .v_align = 4, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "YUV422", /* YUYV */ .fourcc = V4L2_PIX_FMT_YUYV, @@ -140,6 +194,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV422 12bit", /* YUYV */ + .fourcc = V4L2_PIX_FMT_Y212, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_422, + .nc = 3, + .depth = 24, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 4, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "YUV444", /* YUVYUV */ .fourcc = V4L2_PIX_FMT_YUV24, @@ -153,6 +220,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV444 12bit", /* YUVYUV */ + .fourcc = V4L2_PIX_FMT_YUV48_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 3, + .depth = 36, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "Gray", /* Gray (Y8/Y12) or Single Comp */ .fourcc = V4L2_PIX_FMT_GREY, @@ -166,6 +246,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "Gray 12bit", /* Gray (Y8/Y12) or Single Comp */ + .fourcc = V4L2_PIX_FMT_Y012, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY, + .nc = 1, + .depth = 12, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, }; #define MXC_JPEG_NUM_FORMATS ARRAY_SIZE(mxc_formats) @@ -437,17 +530,24 @@ static enum mxc_jpeg_image_format mxc_jpeg_fourcc_to_imgfmt(u32 fourcc) { switch (fourcc) { case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y012: return MXC_JPEG_GRAY; case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_Y212: return MXC_JPEG_YUV422; case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12M: + case V4L2_PIX_FMT_P012: + case V4L2_PIX_FMT_P012M: return MXC_JPEG_YUV420; case V4L2_PIX_FMT_YUV24: + case V4L2_PIX_FMT_YUV48_12: return MXC_JPEG_YUV444; case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR48_12: return MXC_JPEG_BGR; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR64_12: return MXC_JPEG_ABGR; default: return MXC_JPEG_INVALID; @@ -483,6 +583,17 @@ static void mxc_jpeg_addrs(struct mxc_jpeg_desc *desc, offset; } +static bool mxc_jpeg_is_extended_sequential(const struct mxc_jpeg_fmt *fmt) +{ + if (!fmt || !(fmt->flags & MXC_JPEG_FMT_TYPE_RAW)) + return false; + + if (fmt->precision > 8) + return true; + + return false; +} + static void notify_eos(struct mxc_jpeg_ctx *ctx) { const struct v4l2_event ev = { @@ -767,24 +878,31 @@ static int mxc_jpeg_fixup_sof(struct mxc_jpeg_sof *sof, switch (fourcc) { case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12M: + case V4L2_PIX_FMT_P012: + case V4L2_PIX_FMT_P012M: sof->components_no = 3; sof->comp[0].v = 0x2; sof->comp[0].h = 0x2; break; case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_Y212: sof->components_no = 3; sof->comp[0].v = 0x1; sof->comp[0].h = 0x2; break; case V4L2_PIX_FMT_YUV24: + case V4L2_PIX_FMT_YUV48_12: case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR48_12: default: sof->components_no = 3; break; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR64_12: sof->components_no = 4; break; case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y012: sof->components_no = 1; break; } @@ -804,20 +922,27 @@ static int mxc_jpeg_fixup_sos(struct mxc_jpeg_sos *sos, switch (fourcc) { case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12M: + case V4L2_PIX_FMT_P012: + case V4L2_PIX_FMT_P012M: sos->components_no = 3; break; case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_Y212: sos->components_no = 3; break; case V4L2_PIX_FMT_YUV24: + case V4L2_PIX_FMT_YUV48_12: case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR48_12: default: sos->components_no = 3; break; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR64_12: sos->components_no = 4; break; case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y012: sos->components_no = 1; break; } @@ -847,12 +972,15 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cfg_stream_vaddr, u8 *cfg = (u8 *)cfg_stream_vaddr; struct mxc_jpeg_sof *sof; struct mxc_jpeg_sos *sos; + const struct mxc_jpeg_fmt *fmt = mxc_jpeg_find_format(fourcc); + + if (!fmt) + return 0; memcpy(cfg + offset, jpeg_soi, ARRAY_SIZE(jpeg_soi)); offset += ARRAY_SIZE(jpeg_soi); - if (fourcc == V4L2_PIX_FMT_BGR24 || - fourcc == V4L2_PIX_FMT_ABGR32) { + if (fmt->is_rgb) { memcpy(cfg + offset, jpeg_app14, sizeof(jpeg_app14)); offset += sizeof(jpeg_app14); } else { @@ -918,6 +1046,10 @@ static void mxc_jpeg_config_dec_desc(struct vb2_buffer *out_buf, desc->stm_ctrl &= ~STM_CTRL_IMAGE_FORMAT(0xF); /* clear image format */ desc->stm_ctrl |= STM_CTRL_IMAGE_FORMAT(img_fmt); desc->stm_ctrl |= STM_CTRL_BITBUF_PTR_CLR(1); + if (mxc_jpeg_is_extended_sequential(jpeg_src_buf->fmt)) + desc->stm_ctrl |= STM_CTRL_PIXEL_PRECISION; + else + desc->stm_ctrl &= ~STM_CTRL_PIXEL_PRECISION; desc->line_pitch = q_data_cap->bytesperline[0]; mxc_jpeg_addrs(desc, dst_buf, src_buf, 0); mxc_jpeg_set_bufsize(desc, ALIGN(vb2_plane_size(src_buf, 0), 1024)); From patchwork Wed Mar 22 05:13:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183564 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 A7516C6FD1C for ; Wed, 22 Mar 2023 05:16:13 +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=qliYuYP+GqZjx4hAOIsyEzS3ZKV2s3Ph64FVf8YJksE=; b=xmuRKdvIUbCJl2 dPBhST2yf4yyvTTJsh8kGRbY6JM0nrcmW3TsffM0Lo7ENNhh/uXjZ8TDR+2gJ5D53v+f9+MJhOFah s6tjt2AtuX6R6MBYtI5DD2VaGWkRCS2URPZjSlh+2wIcVi4vwLvVAnJ32K6k/q+8KByY+Jq5I6glB 9tH3N52rt3xHLTtZAclFF6/MLHsAOKQD/8S/oJSyxqye5rOEmEgphbbYmC4de/WThRSrzpbNebud9 0fuRG4NMsVif7uVbPirP6cwa+oDqeRqoa+K/Z9GX+fMuCQa5ztf3suR7LecjFhpI0WgusNR/eedmM /PQKNOZGoIpEEnaNoouA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peqo5-00EeuM-0R; Wed, 22 Mar 2023 05:14:41 +0000 Received: from mail-db8eur05on2062d.outbound.protection.outlook.com ([2a01:111:f400:7e1a::62d] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peqno-00Eemf-1D for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:14:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H7CsSF1yZVHuVbLbZRMD2eHmzAEj/19kGn55qks0KWhRnReGdVaYGVo7SgWXZf0kHtuzBlkFcXS6H4xjIlOzjyXiOKjxP22UDPINyrW48g474v3bmdlHMFCOr+B+LWZ7njT/IFtOQTrBwwCPWWsawmS+3JLfJ9UgjFT8YN3tsSqPuiKJhtYk/zi2TpDzNfv3+6e2bKyPa+5ZZW76psC+klTh/jufdysNGGKGlO/7KtJKeN9aTAquMbiyAPpRlHPs72Pcy7f6Ne4BZ1epWYHccwEaQ14i725d0w8YahuWt9nI5t2i2YWdHw0BKuHZbjlZkWjkkKZxj6I7EMTgvHK+FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qCAL8779U4zEgsqncy9scuUL8gibGXjTY42SAMO9ens=; b=WQDQs96ZR4MxheiSTSOapwSzV7Tw6DBu6ZZbA2y/DELAMGHhs7KdPUD4wR1L+neDBT5Mm5cWcVkZs2xGCps9zQ+fHZtZo0YpSD0Uadu7z9AA7AWxBqcOLbKkwbznY59X2jqG2oNieUfVnR92PHxJPWsJVDvTY0eLXdOtt/Ag1JTvlB7aHb++DFreI1UQ56h6CcubdnZRKe8dne/qfAdp9aNEl8eg4tDO0czZvNGwRrbHADmBrO3auSls8uFwX9Gzqm4UUn6dm9mBN4NzAr9WZt2RvFoSiEp6aQdcHomTvVDrMyO1z4to3HWvsGxaTfsfW8RzSB5E8fyniFhVO5B/aQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qCAL8779U4zEgsqncy9scuUL8gibGXjTY42SAMO9ens=; b=E/E2qae5T10nHaQZxAky4OeFcyNgVoT1mHyn8x61yg0PY6NqxeMtiuX2GDU8VaO/I/TUhSjYOavPEzG0Q4HZ8yn5/bnJSz87EWwi9cfzGVbUzSE7AQgwwpj/K59U93Y+BUtLJOur45FfNeSJfWlSFoyU3qDQqUcnWmdM/tMZhsU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:14:21 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:14:21 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 10/10] media: imx-jpeg: Encoder add support for 12bit jpeg Date: Wed, 22 Mar 2023 13:13:13 +0800 Message-Id: <9cb966e5514e01ae826cb70fe1db9c8794b9c1b9.1679461710.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: e94b15f4-0d7d-4d2b-6949-08db2a944b83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HWno1SZ+2Tks3DxlrkV6offRY4Ed/FwCQ2ucINIH9e/g5HUrxg+eIXGyIujKcO+2BlNfqE10TuHx+W4QxrdAu/8h/nrz2Po0yRD2F6jwL5tiIJ+W4fMtb1W1ITDZVD/Fnpxn78T/K8XNSdxX4s5S49y9GXPy7lpvT1YsdUzuO6/hSo3pBfOM1AKD8WH2sfv1U+52uch1CY6zBw7foqdV38A3nhrry+Yb/c+KfN+7gyA5w4H4FZ9eCck9IiObi/tEnTOjaeH44liAQxXF22RIa38ohdJJUrfHTByS0pOMMUboGPvgY1edyqcos937Ki2lyOxJ9BglqjpvtNBLkJki8UV66LVpUYDGnTIkFB9o+IeZBfynNQ2Toz+FvOMyiev3F0m5I+3+rqjQmb2Eq9OH6Yd6E7VS6m3knkEOD1hxBY7u0EuJcr+fUWZQi2LIjPVE5iUYWoGR4mmlfPSLxxApxh55XQiVYq/44lJPoDVsQgwnmkMIqfZRPysYR1CEnYn1pXlTqBjt6pYuOAzly7oJQ1g1VQkmoowvWTTswStT62sRKfcAcLlUCiMJeQA2BSTZGqnfCqJmdHSrleo6BJkpgfJ5JgWBorsOwgQ9Qb6n8CSmZEpRyl+2VpaV9TC4zdCb1Vk+MiwcWOYsXbC6F9RcwYUT4Fi5fgVnrSHLjR/1rfhoxthSJeitYxNbdjeVlYEZaLGjQ1OBK241Z4Ec0aWcpg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(30864003)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(6666004)(2616005)(2906002)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: s8tTgYW7ACZuB+nMpqRruLNZ8WOI+C06AinzINzTYuHBiWi+kVvQmLFtsntDez2exT5QJ904x05KRWWOPNBfKVfAGJsRPDCEO1yeFkmhf6UD7bXSs/SdBOyzJfAhhIwXsfnQpP+F7Eh8LBAe/C2w/ZVePORNhhJ+zz8Gp9ZMZMg9olWo3ph2Cck/amKrXd3MBz7FW2sLKeE79v9yh23fiJ7w3U0sHBa6+tM4c1UV3QgsCyfN2fxby43qemp+PdHDD3FJVL55WemVtlolEF0drt9xCqLnMfWrYUwLhv9MZfFgZU9Pujn3wjp5aVkTB2wfxItjHk5bwGtepIyZIGm3NutaxFWHy28S2KcpR5uU/ELh3Ql8U8zmcYWiJE3d1ubNP5vPEEC6nVVq8K7X8zcukIEV0ojczSqUzKsqTKGJr9pH2IFg1cBInCMdoBS44PpCQTUEBTl8OKYtQIww8XtnnINC0JWN9VIphGhHFXHptnKFeCYMhVMQgI8E+A6ZQ39jvt0LIj+42zHSMaRFm6eXuNBkP9t9CTqpMj4mgOLkB1NA8szoXNyV/alqqnoXacEBEVwuEuvQnO5glMMxcxRRP8FVM8u+LzvMYqQt/P4uQ+oLbDva6trx4hVA7zNqncoANN1lnK0PzZdVstd7ArWeLvgoVoONPUhKo+dOLeRBUDIAmiEOhlwoeHwx+hSats97zihiZv9GinJ0K8hXYWswSjF+uU8mlJrxSjOQIh7CnSCoufM0MEm1bcux+i7xbctCKFVbWT0dXSHf+AQpOPlYqOjmZ49s1YStSSVqExXCTe4Vy4WCfUy0CbNUfP2P4UJqC6Ri2uVSNbBN+trEQFI4JSZbPnJ7v19NB89B/iBGIGHtLjBv+pPKbbj6Cbuljpgp9BqZrpoSGt6yg1kbJxPzDpfqltkvykaiDoqPUYfWtw3FcYug/cSc5FBZTC1zQexfbx3wi/EGy7iJy0cmixutDXAsfUVwW9ICjEYxqdcJTb9Gzhx3ND6EO7+/w06JJCdZov8y9+5byEtHbZSLIGnWcq+NbEZsB4vAwhlrWhkRY/BtlztAp7qscPs8VVRfOx8dicP/4FzTwxDb2ZyCfx3p2wHtNdqQvDJSR0D4RYHQF5mqzt/8XZeqKtnoD7HUo8zuezeq4NpcFT2LJyKS1ZCMW7a+nPAd87VUzE1aSfbDv0LUNLTZw8aOogeoHQxirhQENyN7mOdCny0CiBa4jDbzCf9kFbNA7oYoAk/79N2fZgwAValt5RtXZMTsFFOu3vGx9HNHZ0hP4wkjuVWFYUxGVrMNk/hvXqib3sICVLF4qf1HluzPXt0qTa/yRl8f+vBpUWg7XxI2GQ+XFwq4ZBu5SqFRMfjagWgRjhNQCXcwAMib4+zKQN+B7lMZhF+lnt3675T0csXBYN0oRMJc6KsoZ0bwUHsu7KPT/1GVfhaEtdUsFW5lhhFoKOM4xH+LFD7d9shpRar+2I9qrC59CFbiXrPa0hQDxl6uROBdZCn9JxKU9+w+KPykA8C2lbAEUFHUKpNbKbaBFM5M5m+EiXJcEc3rY7Ca7J28eoBPLxhpDf5C8INWC+yiFu2VJqawdsdI X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e94b15f4-0d7d-4d2b-6949-08db2a944b83 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:14:21.6143 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eDKQZ1hH227bIPdakYl8/wjYHHRdYzxh/JXZ2TIkKBLhKLyblbdDPxVPHPNPpQA9tD0lQFjq6xK0U1EXRDxCEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_221424_604138_1350CE32 X-CRM114-Status: GOOD ( 11.71 ) 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 enable encoding 12-bit extended jpeg Signed-off-by: Ming Qian --- .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 14 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 4 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 172 +++++++++++++++++- 3 files changed, 175 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c index bbd5d6a9fc86..9a6e8b332e12 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c @@ -97,25 +97,31 @@ void mxc_jpeg_sw_reset(void __iomem *reg) writel(GLB_CTRL_SFT_RST, reg + GLB_CTRL); } -void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg) +void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg, u8 extseq) { dev_dbg(dev, "CAST Encoder CONFIG...\n"); /* * "Config_Mode" enabled, "Config_Mode auto clear enabled", */ - writel(0xa0, reg + CAST_MODE); + if (extseq) + writel(0xb0, reg + CAST_MODE); + else + writel(0xa0, reg + CAST_MODE); /* all markers and segments */ writel(0x3ff, reg + CAST_CFG_MODE); } -void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg) +void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg, u8 extseq) { dev_dbg(dev, "CAST Encoder GO...\n"); /* * "GO" enabled, "GO bit auto clear" enabled */ - writel(0x140, reg + CAST_MODE); + if (extseq) + writel(0x150, reg + CAST_MODE); + else + writel(0x140, reg + CAST_MODE); } void mxc_jpeg_enc_set_quality(struct device *dev, void __iomem *reg, u8 quality) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h index 8b7cd6526efd..ed15ea348f97 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h @@ -117,8 +117,8 @@ void print_wrapper_info(struct device *dev, void __iomem *reg); void mxc_jpeg_sw_reset(void __iomem *reg); int mxc_jpeg_enable(void __iomem *reg); void wait_frmdone(struct device *dev, void __iomem *reg); -void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg); -void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg); +void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg, u8 extseq); +void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg, u8 extseq); void mxc_jpeg_enc_set_quality(struct device *dev, void __iomem *reg, u8 quality); void mxc_jpeg_dec_mode_go(struct device *dev, void __iomem *reg); int mxc_jpeg_get_slot(void __iomem *reg); diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index 74ecc5415aa6..1bf24bf3257d 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -322,6 +322,45 @@ static const unsigned char jpeg_dqt[] = { 0x63, 0x63, 0x63, 0x63, 0x63, 0x63 }; +static const unsigned char jpeg_dqt_extseq[] = { + 0xFF, 0xDB, + 0x01, 0x04, + 0x10, + 0x00, 0x80, 0x00, 0x58, 0x00, 0x60, 0x00, 0x70, + 0x00, 0x60, 0x00, 0x50, 0x00, 0x80, 0x00, 0x70, + 0x00, 0x68, 0x00, 0x70, 0x00, 0x90, 0x00, 0x88, + 0x00, 0x80, 0x00, 0x98, 0x00, 0xC0, 0x01, 0x40, + 0x00, 0xD0, 0x00, 0xC0, 0x00, 0xB0, 0x00, 0xB0, + 0x00, 0xC0, 0x01, 0x88, 0x01, 0x18, 0x01, 0x28, + 0x00, 0xE8, 0x01, 0x40, 0x01, 0xD0, 0x01, 0x98, + 0x01, 0xE8, 0x01, 0xE0, 0x01, 0xC8, 0x01, 0x98, + 0x01, 0xC0, 0x01, 0xB8, 0x02, 0x00, 0x02, 0x40, + 0x02, 0xE0, 0x02, 0x70, 0x02, 0x00, 0x02, 0x20, + 0x02, 0xB8, 0x02, 0x28, 0x01, 0xB8, 0x01, 0xC0, + 0x02, 0x80, 0x03, 0x68, 0x02, 0x88, 0x02, 0xB8, + 0x02, 0xF8, 0x03, 0x10, 0x03, 0x38, 0x03, 0x40, + 0x03, 0x38, 0x01, 0xF0, 0x02, 0x68, 0x03, 0x88, + 0x03, 0xC8, 0x03, 0x80, 0x03, 0x20, 0x03, 0xC0, + 0x02, 0xE0, 0x03, 0x28, 0x03, 0x38, 0x03, 0x18, + 0x11, + 0x00, 0x88, 0x00, 0x90, 0x00, 0x90, 0x00, 0xC0, + 0x00, 0xA8, 0x00, 0xC0, 0x01, 0x78, 0x00, 0xD0, + 0x00, 0xD0, 0x01, 0x78, 0x03, 0x18, 0x02, 0x10, + 0x01, 0xC0, 0x02, 0x10, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, +}; + static const unsigned char jpeg_sof_maximal[] = { 0xFF, 0xC0, 0x00, 0x14, 0x08, 0x00, 0x40, 0x00, 0x40, @@ -329,6 +368,13 @@ static const unsigned char jpeg_sof_maximal[] = { 0x03, 0x11, 0x01, 0x04, 0x11, 0x01 }; +static const unsigned char jpeg_sof_extseq[] = { + 0xFF, 0xC1, + 0x00, 0x14, 0x08, 0x00, 0x40, 0x00, 0x40, + 0x04, 0x01, 0x11, 0x00, 0x02, 0x11, 0x01, + 0x03, 0x11, 0x01, 0x04, 0x11, 0x01 +}; + static const unsigned char jpeg_dht[] = { 0xFF, 0xC4, 0x01, 0xA2, 0x00, 0x00, 0x01, 0x05, 0x01, @@ -393,6 +439,90 @@ static const unsigned char jpeg_dht[] = { 0xF6, 0xF7, 0xF8, 0xF9, 0xFA }; +static const unsigned char jpeg_dht_extseq[] = { + 0xFF, 0xC4, + 0x02, 0x2a, 0x00, 0x00, 0x01, 0x05, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, + 0x04, 0x03, 0x05, 0x05, 0x02, 0x03, 0x02, + 0x00, 0x00, 0xbf, 0x01, 0x02, 0x03, 0x00, + 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, + 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, + 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x23, + 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, + 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x34, 0x35, 0x36, + 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, + 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, + 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, + 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, + 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, + 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, + 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, + 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, + 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, + 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, + 0xf7, 0xf8, 0xf9, 0xfa, 0x0b, 0x0c, 0x0d, + 0x0e, 0x1b, 0x1c, 0x1d, 0x1e, 0x2b, 0x2c, + 0x2d, 0x2e, 0x3b, 0x3c, 0x3d, 0x3e, 0x4b, + 0x4c, 0x4d, 0x4e, 0x5b, 0x5c, 0x5d, 0x5e, + 0x6b, 0x6c, 0x6d, 0x6e, 0x7b, 0x7c, 0x7d, + 0x7e, 0x8b, 0x8c, 0x8d, 0x8e, 0x9b, 0x9c, + 0x9d, 0x9e, 0xab, 0xac, 0xad, 0xae, 0xbb, + 0xbc, 0xbd, 0xbe, 0xcb, 0xcc, 0xcd, 0xce, + 0xdb, 0xdc, 0xdd, 0xde, 0xeb, 0xec, 0xed, + 0xee, 0xfb, 0xfc, 0xfd, 0xfe, 0x01, 0x00, + 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, + 0x0d, 0x0e, 0x0f, 0x11, 0x00, 0x02, 0x01, + 0x03, 0x03, 0x02, 0x04, 0x03, 0x05, 0x05, + 0x02, 0x03, 0x02, 0x00, 0x00, 0xbf, 0x01, + 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, + 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, + 0xa1, 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, + 0x52, 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72, + 0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, + 0x1a, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, + 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, + 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, + 0x77, 0x78, 0x79, 0x7a, 0x83, 0x84, 0x85, + 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, + 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, + 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, + 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, + 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, + 0xda, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, + 0xe7, 0xe8, 0xe9, 0xea, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, + 0x0b, 0x0c, 0x0d, 0x0e, 0x1b, 0x1c, 0x1d, + 0x1e, 0x2b, 0x2c, 0x2d, 0x2e, 0x3b, 0x3c, + 0x3d, 0x3e, 0x4b, 0x4c, 0x4d, 0x4e, 0x5b, + 0x5c, 0x5d, 0x5e, 0x6b, 0x6c, 0x6d, 0x6e, + 0x7b, 0x7c, 0x7d, 0x7e, 0x8b, 0x8c, 0x8d, + 0x8e, 0x9b, 0x9c, 0x9d, 0x9e, 0xab, 0xac, + 0xad, 0xae, 0xbb, 0xbc, 0xbd, 0xbe, 0xcb, + 0xcc, 0xcd, 0xce, 0xdb, 0xdc, 0xdd, 0xde, + 0xeb, 0xec, 0xed, 0xee, 0xfb, 0xfc, 0xfd, + 0xfe, +}; + static const unsigned char jpeg_dri[] = { 0xFF, 0xDD, 0x00, 0x04, 0x00, 0x20 @@ -802,7 +932,8 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) if (dec_ret & SLOT_STATUS_ENC_CONFIG_ERR) { u32 ret = readl(reg + CAST_STATUS12); - dev_err(dev, "Encoder/decoder error, status=0x%08x", ret); + dev_err(dev, "Encoder/decoder error, dec_ret = 0x%08x, status=0x%08x", + dec_ret, ret); mxc_jpeg_clr_desc(reg, slot); mxc_jpeg_sw_reset(reg); buf_state = VB2_BUF_STATE_ERROR; @@ -814,10 +945,11 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) if (jpeg->mode == MXC_JPEG_ENCODE && ctx->enc_state == MXC_JPEG_ENC_CONF) { + q_data = mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); ctx->enc_state = MXC_JPEG_ENCODING; dev_dbg(dev, "Encoder config finished. Start encoding...\n"); mxc_jpeg_enc_set_quality(dev, reg, ctx->jpeg_quality); - mxc_jpeg_enc_mode_go(dev, reg); + mxc_jpeg_enc_mode_go(dev, reg, mxc_jpeg_is_extended_sequential(q_data->fmt)); goto job_unlock; } if (jpeg->mode == MXC_JPEG_DECODE && jpeg_src_buf->dht_needed) { @@ -868,8 +1000,12 @@ static int mxc_jpeg_fixup_sof(struct mxc_jpeg_sof *sof, u16 w, u16 h) { int sof_length; + const struct mxc_jpeg_fmt *fmt = mxc_jpeg_find_format(fourcc); - sof->precision = 8; /* TODO allow 8/12 bit precision*/ + if (fmt) + sof->precision = fmt->precision; + else + sof->precision = 8; /* TODO allow 8/12 bit precision*/ sof->height = h; _bswap16(&sof->height); sof->width = w; @@ -988,16 +1124,28 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cfg_stream_vaddr, offset += sizeof(jpeg_app0); } - memcpy(cfg + offset, jpeg_dqt, sizeof(jpeg_dqt)); - offset += sizeof(jpeg_dqt); + if (mxc_jpeg_is_extended_sequential(fmt)) { + memcpy(cfg + offset, jpeg_dqt_extseq, sizeof(jpeg_dqt_extseq)); + offset += sizeof(jpeg_dqt_extseq); + + memcpy(cfg + offset, jpeg_sof_extseq, sizeof(jpeg_sof_extseq)); + } else { + memcpy(cfg + offset, jpeg_dqt, sizeof(jpeg_dqt)); + offset += sizeof(jpeg_dqt); - memcpy(cfg + offset, jpeg_sof_maximal, sizeof(jpeg_sof_maximal)); + memcpy(cfg + offset, jpeg_sof_maximal, sizeof(jpeg_sof_maximal)); + } offset += 2; /* skip marker ID */ sof = (struct mxc_jpeg_sof *)(cfg + offset); offset += mxc_jpeg_fixup_sof(sof, fourcc, w, h); - memcpy(cfg + offset, jpeg_dht, sizeof(jpeg_dht)); - offset += sizeof(jpeg_dht); + if (mxc_jpeg_is_extended_sequential(fmt)) { + memcpy(cfg + offset, jpeg_dht_extseq, sizeof(jpeg_dht_extseq)); + offset += sizeof(jpeg_dht_extseq); + } else { + memcpy(cfg + offset, jpeg_dht, sizeof(jpeg_dht)); + offset += sizeof(jpeg_dht); + } memcpy(cfg + offset, jpeg_dri, sizeof(jpeg_dri)); offset += sizeof(jpeg_dri); @@ -1138,6 +1286,10 @@ static void mxc_jpeg_config_enc_desc(struct vb2_buffer *out_buf, desc->stm_ctrl = STM_CTRL_CONFIG_MOD(0) | STM_CTRL_IMAGE_FORMAT(img_fmt); desc->stm_ctrl |= STM_CTRL_BITBUF_PTR_CLR(1); + if (mxc_jpeg_is_extended_sequential(q_data->fmt)) + desc->stm_ctrl |= STM_CTRL_PIXEL_PRECISION; + else + desc->stm_ctrl &= ~STM_CTRL_PIXEL_PRECISION; mxc_jpeg_addrs(desc, src_buf, dst_buf, 0); dev_dbg(jpeg->dev, "cfg_desc:\n"); print_descriptor_info(jpeg->dev, cfg_desc); @@ -1338,7 +1490,9 @@ static void mxc_jpeg_device_run(void *priv) ctx->enc_state = MXC_JPEG_ENC_CONF; mxc_jpeg_config_enc_desc(&dst_buf->vb2_buf, ctx, &src_buf->vb2_buf, &dst_buf->vb2_buf); - mxc_jpeg_enc_mode_conf(dev, reg); /* start config phase */ + /* start config phase */ + mxc_jpeg_enc_mode_conf(dev, reg, + mxc_jpeg_is_extended_sequential(q_data_out->fmt)); } else { dev_dbg(dev, "Decoding on slot %d\n", ctx->slot); print_mxc_buf(jpeg, &src_buf->vb2_buf, 0);