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: 73200 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2168884wrt; Tue, 21 Mar 2023 22:20:49 -0700 (PDT) X-Google-Smtp-Source: AK7set/LHP9Wz/kNI+yh5RInX95mjcF7jgIDqnGEDIA5mHQVsLQJDN8ec3plWa7PZ5S2/t6ImWCJ X-Received: by 2002:a17:906:3391:b0:932:748a:f0ea with SMTP id v17-20020a170906339100b00932748af0eamr5894597eja.63.1679462448890; Tue, 21 Mar 2023 22:20:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679462448; cv=pass; d=google.com; s=arc-20160816; b=ydfGeBJJAA5+6diWCcen2sOVLHAoj6v5TyE66feig7Ex4S0N8ooSm1ebsON13NYi4j dDy1oVPr6hRHZ/MMPjphPdbL5nvWBDsUfxt3GNfydjOZu/8a0SUh152LasdZeDVN2r59 rtoZkvK5wRyKu3+8q/Cm67eUmuZS1fn820Ur246C3BQBl7yYdt3pC5kERvGLUuIyoV07 K2MMlfqPjX9uh2BVqpGIPSio9CtR8x4Auzn3p11V5tJPD6TH3NR0mEeaR/UUVCNFw2HR RK8Kftuh1rRmuLhOejri2glh4LdqBTAiiOtMKfTgm73NiIeXG2ZQLWcN3RofOUC8a/Nw /9Iw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rlj9RD2tTi9bXNFXB378vqR8wVFI1TNqBoqCx6xlqu4=; b=j+bIbfM0tIli3kuiDW6+sDZgA/OoYT215rdS5QKFZmS0Uxa8bz4Q0evK/b1oHlaP64 a7nppkzdqSEd7NnWw2vEPPsXovNy84+sVv5HBUghjU7TssTj9eR+d0Z5D6gHduZdpMQZ DwtM5FXDeCJgC4ZsjS7QsK0VnC5gNVsZXkogBH4n9RfJCoVfHLd3V+969TMrF82Dns+X JmYFsMKMnrcTTJdm3dxoDsAjgh9hg3ek9RGgpLZc8TYaTZE7TfbMHzjBg8qPflCu+77Q jvKbGVGkShybvzjv6on/bC9OGdJzqDKAKj4QA+Wj6rhcZgvsSYz/pZlq8pSDjRmYFjGa xqfw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=ijXrgMDZ; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qm11-20020a170907674b00b00926628cc2f3si14444085ejc.853.2023.03.21.22.20.25; Tue, 21 Mar 2023 22:20:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=ijXrgMDZ; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229810AbjCVFNy (ORCPT + 99 others); Wed, 22 Mar 2023 01:13:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbjCVFNv (ORCPT ); Wed, 22 Mar 2023 01:13:51 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2059.outbound.protection.outlook.com [40.107.20.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15B875098D; Tue, 21 Mar 2023 22:13:49 -0700 (PDT) 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-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761044016716883316?= X-GMAIL-MSGID: =?utf-8?q?1761044016716883316?= 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: 73201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2168890wrt; Tue, 21 Mar 2023 22:20:51 -0700 (PDT) X-Google-Smtp-Source: AK7set8tMxS8Bxcgzj3ez5urkyt70rfLgfv8sHBmfL3awvMRXG3Hi1Inro7ngsEDs9p5rDkQxdEj X-Received: by 2002:a17:906:360f:b0:92f:dcf7:9434 with SMTP id q15-20020a170906360f00b0092fdcf79434mr1042360ejb.9.1679462451656; Tue, 21 Mar 2023 22:20:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679462451; cv=pass; d=google.com; s=arc-20160816; b=vV/jeU0lpE40rq0GzxlBlGO80PDLO9trP91GR4Y4VIN2jqX90PUpJylJTjSiabOwkO lkbn60SFHRR2t2zc1w0HGZ28ByI8FMAaSLY8gc6umGH6dt7GLlWOZBW6qYdquA883GzN lpX/aQbwLeyfj/mhh+PtycyaQKVhLab720d75PDtBdKZHwAWaMbErXRHDz+9WEcENYtT JnpUA91A0XZyDKhr+tR6MeN9gIEPWHnmRx0mMno21pk4NxJLTUlTJs9j5sufec4iH4Xw E7uw+LxPG2vlh+lSm8coskoXww3F4UaQKg2Z/GnBMoyuX2l3cM1rDQKqS2pqxDsVdXBB zghg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HaV1IAbypr+7qw1xD0wjbMHN8X3GD4YNlQK9XQbiICc=; b=ScHWyqLyiwNmFGK+tkNXBhed5+4sWkHggo+E5LD1MbyU3xAz6ni+eeuZCuaLuli5on QI224Zy4LMKbFhrZ+uxw4EVsY3C+qKaSVxJxFV8ECL34bi5hi334WvR83gP7GLH6Wlb/ pARqVsNGldifLcCDXTrHGokQOZl4rliJaJbCODaIW02eYHFkV+Pp0C3m/imPZSkJ5Q5J L5SyDNQ62MtX2uVS9RqzRt1NGdsfaIUE7RCczb5gCdXnQViwyoVCWfeFSiGG2mzcB+Gk Un/jx6rR3iSiDA8R29lR492BjNUy8gcf/5P6Zk9VKuFRyGpUB0TmWL7ODgXj0p1KRLs9 fY1A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DDMTy37n; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb6-20020a1709071c8600b0093b053a6655si2015477ejc.34.2023.03.21.22.20.28; Tue, 21 Mar 2023 22:20:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DDMTy37n; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229823AbjCVFN7 (ORCPT + 99 others); Wed, 22 Mar 2023 01:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229668AbjCVFNy (ORCPT ); Wed, 22 Mar 2023 01:13:54 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2057.outbound.protection.outlook.com [40.107.20.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B14A150FBF; Tue, 21 Mar 2023 22:13:52 -0700 (PDT) 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-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761044019464262788?= X-GMAIL-MSGID: =?utf-8?q?1761044019464262788?= 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: 73195 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2167545wrt; Tue, 21 Mar 2023 22:15:26 -0700 (PDT) X-Google-Smtp-Source: AK7set/215sdbrvU9znzdLD8ybhg0TnoOKc5mFX6dlCvHkJ2j+DHX9wmG0w7Q5/jWGrycOg5CxhH X-Received: by 2002:aa7:9798:0:b0:628:4c9:a07 with SMTP id o24-20020aa79798000000b0062804c90a07mr1796582pfp.29.1679462126104; Tue, 21 Mar 2023 22:15:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679462126; cv=pass; d=google.com; s=arc-20160816; b=H9WuE8Fyss5v0CSc36S4G0CUs99Teyx3uqUF/Pp5Es0sWvFRKx3L0JPrPqdyM9duUO 3jK0/l6mG5GsjSfhpIPwFr+mhwUFUFNMetX+PP0HbfxG5K4B+S2xkB+uiV53BBdqS3hR ZZsi8TvwDS+olutk9JgoYKwpiHcSOXFXv0CUr8Y9efb9qYP/TDjDehoFXmk8BAbErtd7 Si+nxydycuHMedB7K7gVC4p2+mqJHP5t+ZORJHGzglKnYeFgW5xkMZpOfRBg+7cnJT/P 4syu07LD4a8oqBFbtLVTns4qgO07NvVb/A97cGLu+N3OntesSEU8YpjzzR46a9pb0ujI fEAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z7cKeN0lTqGsO4nqj7pO/oD9FjZqKyVVa6nQ8BbK5Vg=; b=e6dEz2Jc7/B6pbB6tlKWEo5j3bxXhbrl7zJoVAdKoIXHjGlUK5y33SqqCjh5qtDaeF 1n0o/xAK0w+dLdce5LQop7zD56Sf9KF7zd0pF+Qr/8llAx3fsymLrFvMBmGtTSBdND1X ueyxOhjGX8eGc+mj0ACV2eOFaLelTsA525gBQN9RJVCjXxDYJZOfUmTCQJn0YsVhjWVJ alJRqf1sXKeHa485ZyzT55XoPdeSo2QdkEqG4PnbJvZc8imjG1VTwc210idY/QSGLqOH cPgvmwrzZmA7yb4mYWdBfKdXN7ja9wQv9J24N5FHk4uqLWAbqoabSvlL/gZHHu0lmvRB BLWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DSDnNpPj; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm13-20020a056a00320d00b00627dd2b5309si11322875pfb.251.2023.03.21.22.15.13; Tue, 21 Mar 2023 22:15:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=DSDnNpPj; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbjCVFOF (ORCPT + 99 others); Wed, 22 Mar 2023 01:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbjCVFN6 (ORCPT ); Wed, 22 Mar 2023 01:13:58 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2050.outbound.protection.outlook.com [40.107.20.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4F6651FBE; Tue, 21 Mar 2023 22:13:56 -0700 (PDT) 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-Spam-Status: No, score=1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_RPBL,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761043678377480321?= X-GMAIL-MSGID: =?utf-8?q?1761043678377480321?= 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: 73197 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2168825wrt; Tue, 21 Mar 2023 22:20:35 -0700 (PDT) X-Google-Smtp-Source: AK7set97b4DuHINWCC6ROaP2K3/wkER1acEV/t9FBI/YLo3MyoOKi08/hbLvDLgXmbNK8eUUpMCL X-Received: by 2002:a17:906:8553:b0:928:d4f6:6f77 with SMTP id h19-20020a170906855300b00928d4f66f77mr6328539ejy.29.1679462435829; Tue, 21 Mar 2023 22:20:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679462435; cv=pass; d=google.com; s=arc-20160816; b=ez9ZXaS/HCiN2gOnuqCk+KNOxeV6eM2DUk/yLp7SdKYKmG0huYacx6J72lEUxbbRnJ Ib7+o/qmapFYGmNLUqB39qo2ePfACJjk0ZALYRaGojTO9IguvQxxwljIqOA4tVj1CyMq tthBwt1PjN9lxPTL1n8bwACqXBVMJ21KE0BRome1q1qyEj+PygHXGG0l5See+4Nb2Qlp Bc0GF66eQMs7gurcoYvg/qHEXTw+Vxx1VR0drykuCEpOESpP9ajLzLD4XPE5qr2a7Ykv t2SSiUhYDSs7kxvPYJo8snx1mOxStXPVaYOcOtrqgAejcKLrMcwMVBuFEyhf7ORHS2AE pjjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HzTVOaUGnkWRPu5l+dlYHzF/OoH6UiLH+Wtdh1A2PIs=; b=iY56jfNvvKlYeIx1i0ojJugcMdnupADViteqmI8qLn9WbMZEwut8gqUvFL5i3UnTEC vJ51OAA3S04weYC0FLjFbeubiz2zzfOHBcjbQmpCYw03Bhs2NLhfyyCxqajo8EUeyYH9 AOyaaC5tR6XuGQHoijPOMEdk/Ow8E2745hIMF/8BFU5B5aZr9x6IrirwDQXKuNrbgBKh 86vBcYjzbF1T6WOJAxYNLucvvj3/iJYTEp2qXHdlfDUSiRRx7l5rn7UTKPdo0TJ0lceu ZNS9U3JZ7yTdjC5qCW0/pTSYTmIYJAebDkyCTabWi+a+71tVyL/UgOxl43GUe9e0zaZ8 PiaA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=eW8lVyJh; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs18-20020a170906dc9200b0093388136b11si11260789ejc.233.2023.03.21.22.20.12; Tue, 21 Mar 2023 22:20:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=eW8lVyJh; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229931AbjCVFOT (ORCPT + 99 others); Wed, 22 Mar 2023 01:14:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229825AbjCVFOD (ORCPT ); Wed, 22 Mar 2023 01:14:03 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2070.outbound.protection.outlook.com [40.107.20.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DFC058B6C; Tue, 21 Mar 2023 22:14:00 -0700 (PDT) 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-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761044003009663810?= X-GMAIL-MSGID: =?utf-8?q?1761044003009663810?= 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: 73196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2167729wrt; Tue, 21 Mar 2023 22:16:05 -0700 (PDT) X-Google-Smtp-Source: AK7set8BeTcbuK6hZxnNZ0j84ly9uqomZ0U4NPq0jrXj1ULlPfZWoK6Iy908KU7CZx7SfzOgk9/7 X-Received: by 2002:a05:6a20:7b1b:b0:d6:bad9:9136 with SMTP id s27-20020a056a207b1b00b000d6bad99136mr4235983pzh.27.1679462164958; Tue, 21 Mar 2023 22:16:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679462164; cv=pass; d=google.com; s=arc-20160816; b=Y5wToK2rLEenzWes4BnyX+IrqUVL09UuQAMwCOU4uwuQM4u0XHpGlS17mF46eLuCcj IxzIhB6tggTTOqYbQJJcWSy0IsligfUp1TClFx6AbwKU7UuCflLWYiJLIHxWsbqEl69G V14NePkdveEnkyS7VBd/EzHId8FiskM6xjMVy13Ezqh4FA7BmYEZlaA10LJDBt9D09P/ EvQJmt2N2ORPOxYSH8mDn7NJCi50rXB2c0fwEnenRzDZrt/XT+7NL78Jw5+L/Vmxi3sF NcvceYxaB97+GgwGtprisQCmr8rBiQF86Thyr0IAel0TqFMI9c6OsNdkUBFlqyRR3vTp hgwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RNYYeP2WoEtfwMINmCboSPMspPL38A42Pfs0MlV+L5M=; b=RZLmaG5xJ3ikyIGTSatWYnzPM53o9cAEMsqgv0uf2S3p4ACmibH9KthOEkXl2vtQg1 D8H2ShmG8wmjfwKWe232kn2Ti+qW1nzVN6c1NalC3BL1Q8ohfWo6idVnpdN1BNrUjsWw 9FjSke32UGkFTSopdw0mgOtxzr+iXLOcaddTjKt5kkoRQvDHo7SQ8gltKX/EBlH96MT9 fBURbWf2wQu2vpixF8AT5WbmDddtRYDsD/9e9JhAJPQs4ykOIKQdQh01Z6psXvYe+rTK Pzgh2U3xMCjaZI2ir/P7kpKPgQ4H4AeJymLo8qkfy7Rmfw3JqfA65muS98Q7YoOC4IFe sJhg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=JnRqowug; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f6-20020a655906000000b0050bfc20c795si14039806pgu.279.2023.03.21.22.15.52; Tue, 21 Mar 2023 22:16:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=JnRqowug; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229964AbjCVFO2 (ORCPT + 99 others); Wed, 22 Mar 2023 01:14:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229668AbjCVFOP (ORCPT ); Wed, 22 Mar 2023 01:14:15 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2070.outbound.protection.outlook.com [40.107.20.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC11053735; Tue, 21 Mar 2023 22:14:03 -0700 (PDT) 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-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761043718629033515?= X-GMAIL-MSGID: =?utf-8?q?1761043718629033515?= 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: 73204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2169132wrt; Tue, 21 Mar 2023 22:21:40 -0700 (PDT) X-Google-Smtp-Source: AK7set/LdSZq/Rygq4enksiLgye/rgTHPP8m0pJgxd3RRirgwy8CigMtJSGo7cSl6RvLseX4uJqr X-Received: by 2002:a17:906:c204:b0:930:625d:6a25 with SMTP id d4-20020a170906c20400b00930625d6a25mr5689545ejz.61.1679462499922; Tue, 21 Mar 2023 22:21:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679462499; cv=pass; d=google.com; s=arc-20160816; b=BcZpgBQcl3AdC37A9GjwUTcqa2rZmo0zdLYg2dQlG3J/67kZNId0SgRLogA5WSgEcG Bkh29AXcg59xWG+wMGgXFSQ/jNCrM64sRwnwOTRNLJa01eMXnpIwsg3tie7JzW9+w53S Guy333EIwh7wspfOgZRRJLjeJCwnw0ksYH8Ma1U4+qe7REmGblVt0CimcrHcnmUwrxhi Oit7o/vYRbT9KFKTliK/bYqQGEJj/+3E9DBWh6RxNlSNWMqetQ8MiUTNv63owpaCKjJX izFwAUzpHc3KJ1SbCAIjYvgEAF2brmwUCG14RSqWbgDyZ5TZbUSF3v4a4O0wib3pktHt gIWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bg8E3rFasrAzSgljKXK1Qi0OQIn5iLNLHNqDHkzmrgs=; b=BG6b8S3LUtcTfo/qrNV5wafG7dVaU/MhfFsFOc1ajMpIJNEGzU89fohyrlu2GxOOE3 2/rPYzxNM8SCV2tszQUkUO8O/Vm+24Sd2FjzZG/PuCARNAfWCz+ZFYEt8/kw3eS8PsDo YiGABo57lUYQVoGb86Ox23dyZGuFAMcsBNnOXesQkri6lR0IeuJF0cMptLAPEBKTrRCa i1OfPyFH3ici0XRRNxhPtw/BKbuBnsUlS7LL+ncp1XaM51irQxSDOjir39+HVK8B/Oa1 4anzoi+hYm7LEPTTl988LuG52TB189SOWQMya9kl9I5KR3yy2obWb99GF7oH5wS8hDFV x4iA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="rh/4Crsi"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz18-20020a170906cd1200b00931309c5e79si11878026ejb.312.2023.03.21.22.21.16; Tue, 21 Mar 2023 22:21:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="rh/4Crsi"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229916AbjCVFOw (ORCPT + 99 others); Wed, 22 Mar 2023 01:14:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbjCVFOl (ORCPT ); Wed, 22 Mar 2023 01:14:41 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2070.outbound.protection.outlook.com [40.107.20.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B27D250FA7; Tue, 21 Mar 2023 22:14:12 -0700 (PDT) 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-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761044070243799038?= X-GMAIL-MSGID: =?utf-8?q?1761044070243799038?= 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: 73202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2169011wrt; Tue, 21 Mar 2023 22:21:15 -0700 (PDT) X-Google-Smtp-Source: AK7set/6SPUCyWXKMMxWTmw2gS1rUEA0egr6PDT68GHGV02sKehgZQ57QXbgwmTK/fWMIt2nZVSy X-Received: by 2002:a17:907:7666:b0:931:dcd4:4ff0 with SMTP id kk6-20020a170907766600b00931dcd44ff0mr5475087ejc.75.1679462475753; Tue, 21 Mar 2023 22:21:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679462475; cv=pass; d=google.com; s=arc-20160816; b=M5IBSpp3tICpzJ3HmjMj1stV3VySLo+Ra3VwaalGhy48fvYUX30OApH4zTVEoxHuJV hNnElXJ7Pr+CU+n9PE8dUB8f7Vtm2yJKAjhIZd5NAmcx7jljkwSW4K19pf6SPP9FGNUr GkYNTjPehLTky98i+Xc9YFqJdCA6O3kOvBbyDEc0SQJAE3s5Ta0njFZ346ZAWxNIlD4W lgcVPp0jC+CKfaaNH8pq2XXeHju0swejXOqL24pbXgOAL/YaHgOpqCHoHyR5Y8Npw4ch 5UjdJ4GNJdfhxuTTXVc2Cfg6xlCy6WRTSU2H3C3g5kcdxOZ0Hoqzdw+SaMNIIa+d1gL2 si5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8HtPUGDrL90dDHNDgqSHbRFOdqqqZXS5JUCzQX0fw9o=; b=Xsxf6hBfGlKC89H6yUce+07/YwWEvOtYaS3HbqNXP4Td9p0fRdr+cf7N0K0RLVNCYL HP+pDaa6iBWwtGkNG3yszorGwL7gdHyG77wRZlMJLaiywQ0b2LJREpK8hn4wLiWNcz0q ciO1jWPMVmZ2BfynchUwoTLr9LnvY9YASNtTpm6Q40aE5rSsaMybsGfn6TO6sHbE2kO2 eWecTygOdr0CY/9mLblJWKlwuLA6StJ28nyRqIWA2IUlApaSYMj91FmBu79J+m8zLIDb Y1MuPmQ5LDJIvWslK1YxBv6fxuPSbAzfFVy9aFbHvoBnBa220xH+XojDnLQn8QJdflZg zBpA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=UG0WnjVK; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170906762900b008bf6a0f7ecasi14762142ejn.110.2023.03.21.22.20.52; Tue, 21 Mar 2023 22:21:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=UG0WnjVK; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229846AbjCVFP0 (ORCPT + 99 others); Wed, 22 Mar 2023 01:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229852AbjCVFPT (ORCPT ); Wed, 22 Mar 2023 01:15:19 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2070.outbound.protection.outlook.com [40.107.20.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC78459E63; Tue, 21 Mar 2023 22:14:41 -0700 (PDT) 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-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761044044679700419?= X-GMAIL-MSGID: =?utf-8?q?1761044044679700419?= 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: 73205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2169396wrt; Tue, 21 Mar 2023 22:22:33 -0700 (PDT) X-Google-Smtp-Source: AK7set9qlt6SMEczzukOVbTR+axBoOJakXdt4UUInOej2dtqF02kg6Vs3XlxLX8oHbANgrPyoZ1w X-Received: by 2002:a17:906:68cb:b0:8b1:fc:b06d with SMTP id y11-20020a17090668cb00b008b100fcb06dmr4963729ejr.77.1679462553589; Tue, 21 Mar 2023 22:22:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679462553; cv=pass; d=google.com; s=arc-20160816; b=CK5xOzeW1N48hFFr1MYMTj71Hz1l36DFTZMcghp02QG2Wui18VKHHks+EWUJbghfRx T03qVaRF6ChbRi7NFWeilDsqrcTAYOrBuAz9y+jTpgkQ/UraMjdLnPNLBftCar6FPcuH 5K5W1zmJlx9d4bkuTmPhceEqA+91iwFvJSSYx6G2fcY7TYU+IrPpM1dQZBkkMlaUiCMn ysNYU/BiO1/SaXEvK8tg5rlfsKfNXrtOK9kSA75y0R/qHZRXmKzkLiYG7sPxj7eLmIOs AWll+wxpATfcpfAAQz7IrALadLZlwmIVEgK752J/6Dvbn2UPN4ooCPzpPNNiJN/5b+wE tgtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DWE2v7gcmTZgAjF135o2R8bWHo+YHguXRwe76ddTpZg=; b=Xws4MaL13oRRR/fQ+6t4UcZ8NmpDje3jFHrukrg8bV0PH3co5I2Bon8HBSP0yXALmK h38JAouz1rQMUtZ4TtP7pWlhkibZNCKBVuhfFhpLDFTDVY3fzsOo3tIkQ7LGe4babOnv FbxZUP+8/6Z27uuMWvQ3R2mR0RXLXkSdy00EmrmLjCBRgqHi6czyatFUoDNAij0GkG5t dTVTMd0XwTS7tUoSUkRIf8mKOiVSBsCClbHPtBZrSQUb5IcI0zuPTp+jYbqsa3kh99Uf lD+1atkfdn3GgLO4pRUsVs3hy11MLdSCzCp7AKm39wYFpf35apdT/YaNZ9pBGeubIqOS cb4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=l2ooSACh; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a11-20020a170906244b00b008dffd95e783si13904409ejb.568.2023.03.21.22.22.10; Tue, 21 Mar 2023 22:22:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=l2ooSACh; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229966AbjCVFQZ (ORCPT + 99 others); Wed, 22 Mar 2023 01:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbjCVFQW (ORCPT ); Wed, 22 Mar 2023 01:16:22 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2064.outbound.protection.outlook.com [40.107.20.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A451515F0; Tue, 21 Mar 2023 22:15:44 -0700 (PDT) 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-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761044126258216828?= X-GMAIL-MSGID: =?utf-8?q?1761044126258216828?= 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: 73199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2168861wrt; Tue, 21 Mar 2023 22:20:45 -0700 (PDT) X-Google-Smtp-Source: AK7set+prVSLrMApi/IaM5vJ/185v+3hNkriDvnMv5Jq55cBFeRs0kE317+guAV60ZtY1VgpvXCx X-Received: by 2002:a17:906:4819:b0:8b1:7aaa:4c25 with SMTP id w25-20020a170906481900b008b17aaa4c25mr5353484ejq.29.1679462445373; Tue, 21 Mar 2023 22:20:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679462445; cv=pass; d=google.com; s=arc-20160816; b=HfwmbB9xWuH6sGSsuvcPNw2qESQGyppyrcfpcWRnxqb/q9Lz/tm4jAXbg+P/BJP/Qd /dt4SWfqFBMbLQAx+rnW7x22Hs1SkeFpBfOgawz6lQbHS0NsAiteLgI+Uq5iH5UgGf6A ta0VySnRvrrKoaJ/5jnuuN4YHs2XI+yrI9DQVq/nbXvs89QA97l2vQnwVXzxRYYlSVaS 0AfRlSVpneT97WaPP21FrcjuprSKTtEW2VpZ1N4RfDWlcg/7KkicJTiHojAZleOJ/P+M 9F0WCcdNBBXNMhpFt1i+qSPQ+nDXcKZ+FO+1TTgE0Qlfe43AxDkhpf5A3v9LtfJuoURK dPCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4KQHy4ojmtQF1BduRAXSRUeX6FHJREEZUO4mQRp9hxA=; b=Er8MXdhKrmRjyTTYUV8T6zWQR5+/yKUvHNtyI3fILvpasqsDz4s4dF2Aw5jb48REHk xJG9QGVJUoyb5yBMUPv36K+l0ctXQhMiYDbQKycGQe42sNintVVNLJ74pMuxD4cS/gF2 FVPk5louHWzevY3DILlRtPEn67uictwk2Wl1E+ITq/Rw6T3s1vnWrfOvpA1hluPsr8QU 2PQoB5rFXJUGXjtwiuj3WM54gGh8/SPxFNVB9vNicDaFRb4HCNSDfSHcKw9lLL+bKo51 OPe7ti3rk/k5+nLX1NKHuHyx+/lk945lv7IGR189pNQuW1oLYTmmaBv0N3Z9sotMFgbn 55cg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=GhO+2GOT; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e21-20020a170906845500b0092679d231easi14133868ejy.332.2023.03.21.22.20.21; Tue, 21 Mar 2023 22:20:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=GhO+2GOT; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229544AbjCVFP5 (ORCPT + 99 others); Wed, 22 Mar 2023 01:15:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjCVFPy (ORCPT ); Wed, 22 Mar 2023 01:15:54 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2070.outbound.protection.outlook.com [40.107.20.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 075F058B6B; Tue, 21 Mar 2023 22:15:18 -0700 (PDT) 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-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761044013126664796?= X-GMAIL-MSGID: =?utf-8?q?1761044013126664796?= 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: 73198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2168856wrt; Tue, 21 Mar 2023 22:20:44 -0700 (PDT) X-Google-Smtp-Source: AK7set9GI23Qinaxt4mk7YKAiPg1nvvu960FOVZfOIYYnpLRJPbGhGBVp+uGnoPHTvJrtZzSJIqO X-Received: by 2002:aa7:d14b:0:b0:4fb:2296:30af with SMTP id r11-20020aa7d14b000000b004fb229630afmr5638618edo.20.1679462444462; Tue, 21 Mar 2023 22:20:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679462444; cv=pass; d=google.com; s=arc-20160816; b=c7UTagIwdeM9fTdNM2rQSMR2OuWqhwtPI5RPPTFSQZq49VHDoCQnAFpzfPo3+k8HK+ nEYQ5WoYZSErIJC++1zPU37QrVYvnUHsU21m8CvZBmxHHdriig8GLXTj2nZF14qq177l Tw3QSWmgoqzth4uj1xbCnipDkStIZRPdtxQccgYHovPHG0wJSmmzJlu6OBmQaid2uAPu IUTarsSbXckLDJnt2wqt82dJbTUbmR5u1yxfeYZD3SQL/w7qY8/UmD4+ANuXiPlzcTpw gztM6TmWIkzNhNQaR20m6y8az3gXaGe8Dc6lHDfvbyUKdvNOnm0LidYLR1HOOZLqCKcf 6i9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qCAL8779U4zEgsqncy9scuUL8gibGXjTY42SAMO9ens=; b=l7isXUGe4Dz904I3Jw7UbYpZjnaf7k5u6ATKXw0qE8wZvXXDfswFI1BQcNykxg1LaT fZHKEqKHbuTyYck9iKEklEfMMm9z+0VnniHaST/e7zlFctlcdVi893K13oH4QRVkJ2dl wgtjHopiqpVQRUtPX0hcBSDv8VRTnp64qCDCH00ypaHWb+vWgnpnJd7En7fZQVzEVJ/R nLpACuU5tCIjJp2nSgw3Y9Vv2LIWDeTgbqQT9WBu8vPqEy7am30cYsyf9jog6Rie31U0 AmUa6wMm1bU5Bu4vi4l89ZjcP3ti2Rq0vtrT0r1qNAx9O9BXy1SfTLUzoYRJAXT7cAie LOow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="E/E2qae5"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u16-20020a056402111000b004af515d5657si14194463edv.61.2023.03.21.22.20.20; Tue, 21 Mar 2023 22:20:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="E/E2qae5"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229482AbjCVFQ5 (ORCPT + 99 others); Wed, 22 Mar 2023 01:16:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjCVFQz (ORCPT ); Wed, 22 Mar 2023 01:16:55 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2058.outbound.protection.outlook.com [40.107.20.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C715F5A938; Tue, 21 Mar 2023 22:16:17 -0700 (PDT) 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-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761044011986876293?= X-GMAIL-MSGID: =?utf-8?q?1761044011986876293?= 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);