From patchwork Tue Dec 20 03:11:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 34880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2747418wrn; Mon, 19 Dec 2022 19:13:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXs5l6YcN0ankcs4hepHQSA39twJ5nJO4epZP3xJLQ63A4umhwvv8enpD+CmaDZKaPHj41j4 X-Received: by 2002:a05:6a20:c519:b0:af:c871:bf4a with SMTP id gm25-20020a056a20c51900b000afc871bf4amr16579163pzb.44.1671506034329; Mon, 19 Dec 2022 19:13:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671506034; cv=pass; d=google.com; s=arc-20160816; b=LfEAG2jurH70Aim2o8H+x0q8Uy+l5pVTHRIFU7eF+6rjykZ5ATY5fc5VQXIp+DOULm /w7y9MXV6BDxsyq/ED8iA7Qv5pPcNb5UMdrnOwJK1qypZbLoQNhmfAjkqj0wcf5dzT88 o9rpIVd54nU3D68kkuknKuCZn3osHJXBTjb7NfNz/gglS/phpwOX9eFx/3Xv6tDVymBz QKEHoUj/aHdfScqBAXLzwxRn6DO/ERIb3MNwVv0RMc5Gm8+lAJz+c5uKZ/QkMeljSDP0 BEJ9woFILVDMXZVy/4EusW64+6loMOfmpr+irkCNu5pMuKLRonBu0v6JgHTJ2vU3pxKn mdHg== 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=miYxDbfwNBWe1KNc4EwmJT97nAHpFZhA3X+bNK+LYGc=; b=rSefJHlTd3fWpLTXTSsCzJ7KKkGnS1nrdy2edLQbeNFmJeGxpPZR+VxvAEniUQOLow ZFm6tbDyfkU/i+UChmySGqvWjoKWn+qfmFd2uBvdWJruwv7PviIEDaTG71avhuYZHBbR g3dy5oAqkAGk69AAL59h7dbO6A3zu5QA9iuhvG+dL7OVzT8knwqtirmV+iN7yMhskft0 msZqehbSTJHIzjb0XPCrZNDGAPyMDP5mH8YrfDnq5P70uHiysR/cv0RkCMkz4B+NpQXc rMOaT4iefnvC7En9jD98h6VKDE7p99PCV+UqwN6XzWi13LX58lVyWnVUZojw+ervuxL+ 629w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=KI+SD36F; 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 on6-20020a17090b1d0600b002199a16366csi12770215pjb.173.2022.12.19.19.13.41; Mon, 19 Dec 2022 19:13:54 -0800 (PST) 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=KI+SD36F; 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 S232966AbiLTDMc (ORCPT + 99 others); Mon, 19 Dec 2022 22:12:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232921AbiLTDM1 (ORCPT ); Mon, 19 Dec 2022 22:12:27 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2040.outbound.protection.outlook.com [40.107.15.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E609538AC; Mon, 19 Dec 2022 19:12:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SOmVkCpKJy0IKE6Ucd1ixAZf7ukTBPUVYb8KWxijL3kbSKgTNopGpkiCZtHhJSm+20gBZPq6FlZrsLYpG+vdpA2QYjZjAdjCpNpME1Y0y4Z5zsywWnkKtDIAropdodRy86F/KrFnM6ivB99Ygwtwp2gS48C508UVO4BtgWML1VHdwhbHS6tJw3qW0ZS91NQyqd9CQtB9gzW27hvodtQ2MFX4UknGOhu20xVrc03b66PUroG2ppNVGU3WxBQBwQWGsusN+62py/c5otq75H7dtZAbPGXtbbYm8y3BBNIjd7JdseFKqBXAjYz3HTuUN+VaXSUE+BJ79uPU+qMw16Ec8A== 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=miYxDbfwNBWe1KNc4EwmJT97nAHpFZhA3X+bNK+LYGc=; b=nQWuVxMLh73tZvp/wls8udG1rgu7rbwq2RiHYFYQ+Txy1rUflfupqSyE6GOinJhJhPq2pTGROzgN3ZJvt70pDHI1luM2O3cehwiAd5vSAQj84BAZi4CEyl213ESr1EcsvVBgUhsQ8vDV28xkMYAyFQgeUQ2RnOy8yQ00eieZyKuIVWV1VGhK08abhCVmjzSbpkxa6PiYsqEZyGU9jRlqkJMHWngBFDLGib4ZEwX7ohc5Uk3Ifc+iqihF/V1t19yfNddzhKGvbOKnAKKzFQDMyHw9bHQZLnPQa6WsLmTmL5zQ+T3B7dnNIedI99fKexUJKUhqoV16YUQIBXsZf8OckA== 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=miYxDbfwNBWe1KNc4EwmJT97nAHpFZhA3X+bNK+LYGc=; b=KI+SD36FDUPc2Z+yfACfOZBxUyFi24X78zBugJkNWaULTCPcaIiD43GkYbBDMvTSm2tGPHP31NNpP6lhOYe2H1QsiFH/zCFY2RTp+LF7HEH58UbVrk//dMrwBZR3a6AQbvESzhCjNdojpVn5BHFcgK7seiJXxM6G+c7zWgUe0fo= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:22 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:22 +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 01/10] media: Add P012 and P012M video format Date: Tue, 20 Dec 2022 11:11:31 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: b330ff6d-1d37-440a-fa31-08dae2380181 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UsNDU6TWXDTeS/vsoZS4wmGfatGyUjWsQXL31fxF13wcIk/m7QcQvlmHHvr0eBsJqyt/QnQ/uPWXfCf0lI/GYiDvj7cqoWtKYjEZIIR9o+kaI/38BUmdh7LArXGJbJmg8mJF8Ydc0y3H7Of4jz5yslyNG4hyGQZsMW3JVNwUggu4ikxCqXX2TgtzIA4vnYFubA9CECFLGjpvzn2km/VnkXTDtIdXhJPTkjyXuKRYh6h5nE7C1y33bIEHEM+0b9VqJyyxunElTjZ8l1YQBXhuBY2SGPqaRFNoui36010SRyx72AOON+u40x4toajwZVE6S39uSzyG9/ngKsqaChjpOVIbHTtbCgyQXlfvpffG0He23Eo7SB2YbO6ZiFlSFN2W+QjxnHOcltyxmU52/9ZltbI+QDXi6d6UgfBzVhPDIUHlb/5T0E4bHo9ez4/3Ym4U5jiBTW+raYpAqCTXuXhB8sITLCX745WZ7TsRM+P53zvGzLcf2K8P+J5LlhhAJRXO3/vakrdUa6tVkrju8WXZkRALOSwn5YwUe7ATACuKfBQwdK0WYDwZXMOr2H7zia95AZjBUKoUmXiO9KflNjGElduy4I3U7AIgxb4picXCrAfJk1gtaFmY2jTUfpKFeiRw7JuCIz+u/Hh2fY85v8jtlXgFVotrZGfRO3nyyboqinkR4sN5VQh7398lgJYNFyNhyIOrUWR7465++7XuZCfJlw== 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VijHsFX9NQZOf51vJdY1ptlcsoTnZFhutIo4F2+C8i4AXsFxNtcY7rtVIKwjrbaC9Ge8oBUJhQwi7za9gEi3JQMcwqzfEmvC0HYGD9waUwBujh+eOsATnCAp2UhHwLMqFqVsZU/r2r0rGkuy9KE/d8n7fNKOwQN+g0yi/hyGoGFxUTVT5uz9oMhcbMetz5b07YTPdrc2SkRHwhJRdcIWlH7XVXRfhBuPuM91OYx4nxKByvHWKaC/uDBPJt/2KwCgzkR1IJwm7di/G1spw4ynxPJSMaLctJmFYSUcdxqKpcQhEmUXQhCG9mwMFi7WosKTpO2l61OJT1IyFD4WMN/XkgjoEiXZwzTlIfbnNOpG5bdDqpxbruqhdk7GzYg0upG6qSwYlYY1Krbs18JPArwfGotnWnOlazH5HsrVa1+p/qOw50vbc0Rjpg3U2P5sHwnz91VN9ZQ3+AE3ctkmhBNqWiZJn1LyGsvJuykQgxoRg45szqT/kbCDzYz9s4Z8/H1GovnKZtaiKEVSoF1Fy4gwR+DmASXE8zDQDEk76jOJ2b3Wp7IPtSUMW9FQX3Ck5MNAkEq1Dj/TlzJFG4g/yNwIstYmf9PheiwFGXkvbxHuOD8CHxBH+Q1H/aID05GZQYq/T9C9zPa46xJ2zjkk01D0mFBo+RTVmImAfOnDXER7phWdRkmrMHF1qtNqVjkVQQPspvqR5Rb+NVZ6tNiFB+3b5jHsYUOejNQlyl6Q9nO6HPC7aoPjwcjrDwLqdBhBU/EnhdS3/u56Pl7xcYbb9WVJ7iGDILmvb4MNXROJZk+mhkvxEibKn6aHjkKIkz77j98c8Xeb41odnTxndh1Xm8EwNyyGx2u3NwvCGd+SljdbAVhUNtlysdNUESMR9yMm+pN7pqL4SnlAacvTeWc8aFU2dufKdRYyBoO8HlPtQ2HiczW8OEvmUkPxZrwTLQG4QDSMT1/o8ZYaugOrYi2lPbp2+ohjQjq6VICNSjyiR6p8viGTJ9D1UGJxUJmd3tASqqhYURrUeQ/5jsaobuf6WlLgQDA5pub2sFaJ1x38aJdMjFuscjKOk9d7ZecLu67nzJ90T1WQlptV5Gzq69R30IkWODv7Lz3rjAIaBkxjpGGA7Y4gkfapxcQ6gWfyPC/bAsy6EWNFYCcou4w+yiDUVacjUnYGINGwIjQ1SV/pTC6Yz+ABXdnBAI5osiFtwzzyldFp97sw2GlvuXrEoMMyL0UAl3erosKu2HslrOJww3DQK2mDQS6OLydkyUwU8/U35OvtDTooNDk2txJwPQ724SRge8jOJXEKpqLu8ioN9UnDirOLDUg8h2d4yPbYGU5R0CUOkRV8tJObymMGyYLKQb1951clQjs2f57gFsyebAdDCXPZc9Z3No2sFJUpZqWCfeHKEIiu1QVhgxrtbl5jCSkNHhlJTXH57h0FV53cEIMbDmdrzXgh2RzqTZ1Pjae0iO9Gw93g+bY7HNrnShJXuJMWsUtCF57vpKlWyZIkBwjvHH1gIr8gWOBuSvAiHMChJVMa5owOpBZdU8B4lIo31ikpmOgIROnp56S/QkZRnj+1pYMjUSPLk/HQpEjFgsSOMdDF X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b330ff6d-1d37-440a-fa31-08dae2380181 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:19.9562 (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: xHBtnIavkliyUvk3r64HrBqm+AC3ie3vwQZnMZBa9Nz6YyOzkdVBowkENiXIB9Ak2TZKf/eL3WvB58P53P8d/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1752701111793500319?= X-GMAIL-MSGID: =?utf-8?q?1752701111793500319?= 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..aa37c3de8808 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 + - Yes + - 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 8e0a0ff62a70..067dbdd0a9ef 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1348,6 +1348,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; @@ -1358,6 +1359,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 1befd181a4cc..5448aa3b7858 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -626,12 +626,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 Tue Dec 20 03:11:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 34881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2747463wrn; Mon, 19 Dec 2022 19:14:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXv17qjYfIfIOi4fuVQUauW3Kews6j9wUJOky0y1xesku+0wIgqeRePFW3iGsQN/CZLN9Lg7 X-Received: by 2002:a05:6a00:300d:b0:577:b52:4ec3 with SMTP id ay13-20020a056a00300d00b005770b524ec3mr10833575pfb.22.1671506043566; Mon, 19 Dec 2022 19:14:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671506043; cv=pass; d=google.com; s=arc-20160816; b=CblF4srghiS8UWYU1XJwat1sZo/mXI7AGSBqIg/tY2FrOwJ1uwEve18pBBa+JgdM4f pIMnf+lFqC2/lxie4FGsHMNfhx1JGdqoakYEF2ocQmkeVbg1OIkPuYGyG5oxk0FLQVRD AmmYP+4Qm/AThUPB2MK6tfIsPTfIvpJqwNIdU61TqeSdfceOOFy6l7L6uBxnGgoywzpO FWqPCRB28CcbPV3mKOhccg2R/Zm56CrTEUIY4b1OOyu8Fe+nZCu/nMY2XOiUqAtKUmdD mDQaIvh1EUA2Ksnmu9YJNKabGex129gs5sER7uAnu2QJG/Vs4GpI0D+O/o3/nB4i344a VTQA== 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=d2Yx21b0j1MK0Ce6cSenyGIaB1kBCSsck2Aem2dw9Nc=; b=Wxhxey2rt/7X/rf/T+hhiQAUfvPzdzQO4mCS0rkLtE4LuxXsP9VfuV3PvUKCfYOyc5 J71+dBCgZ4d7U92PcPgW91apwNjckzK6ZraFieuzd8B/IX2nh8iw8Ikbyy5G5ZbFTw0C 3L0KOIbZkjAmMRbClZntX5Uey9GT3b0R4JMHYmGlEJIoQqjBfvt2v9iTr9ru5LPvXKid 9TXnovkZFKH0ifJSVESd7xR3iNailklUiCpjbst6BYiA6EKytwuiug9c0G/BIZjq9Br1 2M1vXrQ8rT10fH1Upx3w2+fXQBpUwn7En6kBAb2wMK9j8GFa4qd9/m5/zWVqgUUvrYVi MJ7g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=N1Evrkcw; 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 k4-20020aa79d04000000b0056be3585c3asi11682589pfp.266.2022.12.19.19.13.50; Mon, 19 Dec 2022 19:14:03 -0800 (PST) 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=N1Evrkcw; 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 S232473AbiLTDMh (ORCPT + 99 others); Mon, 19 Dec 2022 22:12:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiLTDM3 (ORCPT ); Mon, 19 Dec 2022 22:12:29 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2040.outbound.protection.outlook.com [40.107.15.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CDB92DC0; Mon, 19 Dec 2022 19:12:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VdjuRl1F+8O2CemU+vYtqwnrR7/oj0msCCbkAfxViqAs+nmFUACuPnGrs2Us1TPIw4M8FUJd9EMBHsTpXX3EZNOhhApz4dEFn/NjSDiiarn8eMeahINs9z4lw5ZNsk1i9iL/7XzCLyDXHDjGvag34iE1l53s636QwZ7egIAzrR6IQcEYEg+0MhR9VZd95c3e22tSWvKKuc0buDfVhxgBLDtxnMgFbFd+6sGIcI/EpO/VWbmQQi7at/KhZsaxI3UQLoKcjVIXHSoPxFTjXqTWgt0iJcvwZbJ9Zi701HattxqwWsc6AmevGoFh/M/F9+8DAvJ9G+T6bAA4D4S+/DEvMQ== 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=d2Yx21b0j1MK0Ce6cSenyGIaB1kBCSsck2Aem2dw9Nc=; b=Q8OT2/2Na+ayz+cam14usmAV1GpqnvjhJ0hPyQhR0jUCpbOl5hyb84JXK3K/uRsSlWzDeDrzboSZ8LwIw98G99v94YVfyFCfwkKT+6xuBwmuw+z3gtVCSsaoGJQL1lNbr/FmYbV6Tl8B3bXsfbXgJQfRtaMrXGbMSz4Wz9MdKPhKNmHXAOgr7hC6a71AyC1kR1NnJg3cr3IbdpphY6Ah8ymeEe21F5IhTzhndiX1mbiJoW6RKiPvpjSpFWW7JIy0bSg9QIkAkRfSJCjaU3STVbhNTj/f3rrBRO3PloPeYCocYhGBwhXtr6zJwZOGSYUWKkiO9EiW4WW+t2O46DtHbw== 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=d2Yx21b0j1MK0Ce6cSenyGIaB1kBCSsck2Aem2dw9Nc=; b=N1Evrkcwj1fWAM0uYMwuCY8upnYoh/7jEzt+lXu3A0ey7LZyzqWxwDAa9ALr0apb8Yox0wuqwE+lzQhgrR+HGIIlEEMn3GVaPhryWkqvDYIfzWVE02eVCJXYIHCVYbFE7TUBEbqS7eODp+s31pTn3HEakXO1/VDaF+JNBn2K47k= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:24 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:24 +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 02/10] media: Add Y012 video format Date: Tue, 20 Dec 2022 11:11:32 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 7edcfb57-657b-45b8-24b9-08dae23803dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xG/hly2z2jD3b2Vhx4jnLkQn6jSVdmT2CKAFy/ww6YgWMDhRXrfcmIN+JduRFQD7NVmWiOoLirPEhvHYIHUUrEElQO+7vcFekmh6ZrlxPYa+Ro/C2Q6qHajnUWofCTqK+vPPKIkp55y7q9XKhZnYtLJfSfjIHVWfnVa/cJS1L5eQ7ipo7WU3GhHOqOKiNCh1yN4IkVyRa4azn8msnC0UWXRAa/3uCjwhoixW/iKeI3Z51Rka0uE4BXciAgJj289QZP0/UInp4Dkww8hL45T/5r15m7q0chIp3cIpd21+1j4rxBh15AEOgyyPqQsx6LNnMTlykFo6brMv1kuuCbMBkHklzY2o75lGxpWRfttpa7H+CgnhkohStrSU3azTOpx+7hW897KtF12mUh0rZpJy6ywfCvxlobWWel1ICB2QK7ahUGVpo+2XKsufv9IeVf4QjnKOKmyqVii6gR5c+uangNkGOJjZLIeT3e38jqrtZt9deClqnR7uNhEySc75uU0T5utAwuW832CzUcp1jktFrUHsyjCLFkauCzPhAfy3GE4pgfuuzF0CoalAHIvXX09wLKdP5z/s8YQ9elEzOL6Ch9XFR0jr21OPJQ0C3BmXAqxhwvxSgpkbInzabcAgrkC3pKa3w9H6XMZBWENjAs9XGuIH10siUwTVM25iHQOC5FqFUHSxf2UBUGj1LSc91b3N/G4LZCtxc7aRt1NLRdIlSA== 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QQ82qs5rSZC5+R7iSi5Ys2puFXjkGRjIRri+tsHp2hCY/axjkjYJYhgY/ELEuI4K9Aw+F+UpbH8f7DU2pUwMUgDyn854bkYLvpKQqo36OsIxEOqQb+rMch8l3drOJi6LPeeXpsI3gzGZsjbWsXc4l8mgNftFuuS9Hbt7oc1ryV9KzTFSREBZLX4Hm3E816SycHOSAqDiQytTDkq0t14/CC9OLSExCAwKHvnZKH5T04njTe/XudBNF3Lxa0HuEdhtQddNDj49/94sH8mK0DmU+Q0unKWmXXMImQ4S01xji6mkrnsIbQ9w2OumCAnNj5BwKqgWNeO05AYAyB8kNk2SLapHX+mseaPFRaSJZDJ60opoGq5ypMa4+mCIvWeCs5UsqsXEIxXZx6tTyu+M9sHDFJJL+OhowbELDu86t0cDUx9bWA0r4DjypJ4NzMTDNYI33swAXZCTxQV8TaBes44H6vNkDVEaTUxZ062uzaF7/HpuaWwvN/5ED/yAmLaT6hFFPVJnQo8hBmBnpNVb0D0nwl0ygyY8uiIMl2ubr/LTxdc8a/jNOST2dhFGvlauDUHOpSeitFoP19C4LhYoFV40tVf/K2nQmxRl7/Auprn2SwukMQTSpsrMqNrQZ0RlUob1Mim7qlDDPgXy/2DuUeeaVEjB0eXqVVzLZ+3NXCMQj3CQqj2+31H5MlOvGvDD9jAD/gD0cQMffacVYlsfa11MMEdAmA0vRYKjcL3iTwy/Fy1VhbUpfPovM0KmOwJpRflSPBpjqi/MnzfFETqcpRFpFA9iPK8CZAwqZ4f0wTr/qMafdcxmICRLwYFGqTRMtisoOAkjUTE3wcPTNQl+4s4N9dCE6omeryVqOyTby92TQsA55OsXQ1T20rjita5K+Op4ws5zEhOQ04maLTwevYEOJTt/PfBAmBNOjjtIlnlBBSt/7sJKztHNdJ8/+Q/Xicc6LKqFkMM5tnPa2DnhZ4CLlAmfbLnyzX+xl0KaWVw6rbCsTukLe97ihNEBK0LpQ8z88nZas6p+EhbCM71hJTQVSshRKDL/So3iSRpumjRJUrt4GwZ6izFtqvpTJF6sXVQ7il1ScDlhJ24q48O7RbcN2qR7NGjZzfCpAO/gRgWJynGlGVL7GckFo/CFWs6R76rWoP34F2rW3gG6AqZIj8ILJL13G1eH7z9mvRWwq8+hCpql7zLzAGbhyFdXoPS/NijhWVaGX1PH0gI7rCC5lqKClkDxj6vqmkMXEGNk/ogIOnx4gxCczgR1Mra35LTYO9R9xwqz6876ZmClfoyOCuwNjQPbzNfE0YXR5g9Q2Fz9SClrNMpQO6uYh2RTQSaWeEEPlhnm1gClccNCjLwdh9jr0X0PF9C/cWKZuMOTTMwRO6NOpGs7BMof/hgvzp4kkKPoXNEqUnwgQyC3UZVKgZLgen5n79Ijo/yIBGO5CmC/+85Qc2Nm/6dwLu+wX+Pob8jYKajOmDFfiY+0FWq4FuOoranOgBZuLMNYCNQ6qOlIyYQl/ofFP6wEwHYZQjY46D5bN1lWMlD/NVRHMhG817SlTNSdlmEYoWq34EUoYFxnVKlJ6Zm448cre8jp8qtXrxKd X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7edcfb57-657b-45b8-24b9-08dae23803dd X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:24.0029 (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: gK7ZbvyyoUXUnZeK1Hygv+ke0Xv88PMoT1n8U9FI+2e0vxYN+nPdOHkTGgnjxG/ZWMQl0iA8OGhLdAxgF7708Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1752701121452066891?= X-GMAIL-MSGID: =?utf-8?q?1752701121452066891?= 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 | 11 +++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 13 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst index 6a387f9df3ba..3ffa29000238 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`` diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 067dbdd0a9ef..0ee730aa6cc7 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_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"; 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 5448aa3b7858..3d8f89bff33c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -583,6 +583,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 Tue Dec 20 03:11:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 34882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2747537wrn; Mon, 19 Dec 2022 19:14:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf5IxKfubDaiqYTyRV1BRMUqs0wC0jc3qYc5bvgd7nQSj3UE3VTa4BrDoLCmB92f1HVFIShr X-Received: by 2002:a17:902:a416:b0:189:3fcc:f996 with SMTP id p22-20020a170902a41600b001893fccf996mr46139845plq.21.1671506058859; Mon, 19 Dec 2022 19:14:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671506058; cv=pass; d=google.com; s=arc-20160816; b=ZEc7rLOlmVGZ0hRJDIxjA21J6obLjeFOKhdaC/T3zM1yZsxvHo2CTxkYVYt7DKS6BH Cs3imjLOrSHigiAUi/EOv7aRzfXVLy533xq5sn0QvSaXS1T/ghPl6zQz4qFYwSoEWXVi cpfP5M4UnhzJpJ5cBAU6JGeyXj/rRrmUvoXy0gZVDW02oQWRa9wsvfdIF1YW23+sfmBV QZTpWjUtRoW9p4mm35UdGcwRMXzVe7Og0puiEwTFsRWfHvK/P7lWPwYUcllIhWvZHSb4 G3x5ETiKp9+co06Jyv2wdV58JCOKNfWlnr0feERJmy+AvXDoOjSVlRBhRE39YLNtfis+ I5Iw== 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=j1u/CtgyVahT0gjIMbS8n7n0jcnPnAKWt2rMh7vAtAE=; b=ASAqkp4KRul334/d8jy0hI0eS2PhWj//vCgsoJK48W8s+LJiOpanv6kGVKzxuJ+i6M /2WSUed0tL1C9BZBCHh/vGQKEkopM/6F4u5w2l0vvhGvsaCb+ktlxVmaaDwTr05X4hA8 qiztC5AJNvBBTKwYsJ7TDQeUCejtgMBjJLbjdQSV1h+bGjxFO1nz34zisG1jtlkp23D6 e8IgftSpbuP+hFU+y5P9z1bUHXf+x6aYQ8HsHLj0CjMGxRe+1pxw60PXK8/LoejvrrNM Rq+07K73l0CMZuE4O6xwXAFGdUcYDZefRSdffo2kyOEvW3XRqUY6KpzbKnvtS4YbiPkP EjNA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=lFRsbhUF; 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 c11-20020a170902d48b00b00178380f525bsi10370900plg.547.2022.12.19.19.14.05; Mon, 19 Dec 2022 19:14:18 -0800 (PST) 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=lFRsbhUF; 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 S232921AbiLTDMm (ORCPT + 99 others); Mon, 19 Dec 2022 22:12:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232935AbiLTDMa (ORCPT ); Mon, 19 Dec 2022 22:12:30 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2040.outbound.protection.outlook.com [40.107.15.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBEB25F44; Mon, 19 Dec 2022 19:12:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DXAnC2+WATAJH7gsaijFxSFj3wLC9XZqoABq2GlNmy3bgONJbJ+EjRdPjif9WkvtiPOyYIkLRi9jj+5PES0+mOPC6tCBAhe0VXAo99pSIuTTYOy90dgxyyW1oqeL9oapEeidT5rfGDNVkKDM1P8njs8gj2X+o3VQU6nDaY3W6ZKNEXpX+l/eWlSZkTjXIBCGJsgMHsQhtClOhrBb+G0xLExk5RwpjoipUHYzdbxI7/Zctfg/1qALa838j77OkRxIEobS1EVokPzPROdKDfX/6r0dyOLForroljumWjs1xPtjX12PzeTzdv7brnvfU75UXgJy/gFWzJTwuN3WpWBEIw== 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=j1u/CtgyVahT0gjIMbS8n7n0jcnPnAKWt2rMh7vAtAE=; b=d5b20DGZVdW686Vmnozqm7C5ZqwE1xwhGswXKKyGH+XCqejTgGF6QoiD0bGrmilMsaSczlelAnMAUknlNaDhrJTH5hy1YwDfleA3GU+++sCy4mvsyf9ZwQp3noD/PfL6Ug+TMJRjoKNRhY7SRIyP2WaKAZZMCj6GnPwzw7Nfe6YRpmBI6Rdse/y9x12dJN5jZ1DnVwCSjOZWygPymXb0Cj411XQ3OIMGaz2QZT2hJ2ZunOEfUo6tStmJ8SlFt80bh+qnYD79TZa6nQ80OGxQ79uICrOheFHGzrDFgqmiFp5sJ6iB0jqSwgj1b9T8jZeFOBv2vRPR/WtNN+deJiyzwg== 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=j1u/CtgyVahT0gjIMbS8n7n0jcnPnAKWt2rMh7vAtAE=; b=lFRsbhUFrDnbHVUkcjAK4mZQd6pklywak7f8GXWfDtH+XaFT5VEL95P2QVFtF9ROgVzkRxP/htrJD+5Whqmh8GDpIrM4bilrEVd3UFkzhL61AzH5LP4xv4Z0RQ/fF36b1mpxAGIVTYucotFpmgK9dqCzgvOxwBDO75yRLZE99Hs= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:28 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:28 +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 03/10] media: Add Y212 video format Date: Tue, 20 Dec 2022 11:11:33 +0800 Message-Id: <9aa51224d2c37cca5f1283532cb99f3c8251b120.1671071730.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 7711a01d-6501-417f-ff79-08dae2380648 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yU8bR/rgoZVSltYs3FlavW4Ug83177D7SaWxuNFHBbtNFdrJ+z9c7f5M8tOfd5dc7p+1NDQInfY23IEygHiCJP0DU7bE+DpAYjeeHY/WYImZaJpSfBABJyTtuo3KsMI8tTPNkCQk/WVhqnuh/YivIec9eICBAHBk7DpEuvMbe3Teeg5lqPZYX5AdAVgBbiLlmlzXcfL3VF4pvOFqLDQ20hKWlA11G7EQKRTNcGXWFvgFyZLF0ZX3nKKMzH88XiK2RI1m8CAfsS0AzGwISUZMNohwxI3LOtwHs9HktgvSfYexqeMq9m6Anqxx3Pff0s9XnwExzLuociJaOMVBqfQLvf1FA9SXL/5D8w7jDFBX8W1PP5+s7W0VvM1dRkbmu0nkA4GBHxWnmyaazHaPPCpWQqmckkFC0YSJxyakiWtYESGVUcItSrUIsSqhg9fgK0NFXyV/41qXY94pPiHR3XQ/gNaBryOkXSrgW8xA2WzW7HC6GgJ4+zAVRMmvptCnIumEzdTWs/Pqq4PzJmXh5nDtWbNLd4CBhn8I4INPj58UBr4T5fUDA/TV9qzIFkHqCnYEJtEuFQDc9dd8KRMUAhdXmEz8oJxzLTjNrqur/WTkuyTUmmV49xv+tAa7nAabpE7lC453EWhMv/DGCoU3DgnKRTw9d9nMl3McNHP8tSO9743vkuglUtx/235risNmeIgp 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L3j/hr7XY15z/NcD4DC5i5T5voRGIrlZVAr5ix/gJx7p6c14AeAoDrK3l1k7X4zIBWMHVRZB0P/il00Ec8Kg2E33pJ8AglVnRV2EzX36C5ztX33L7sk14PcEqUxOnSE4I9ePu131x+Kr5EEYui5Z90xktSs3iNbKfjsG9wgRrIEB4yvFDaMpIz/xVaYzz7fNdMjeJAoaArgYb5RELD69eI8xbn21qlzkdlYRXYPRrZ9cpzEy9mcROoEOThdvK7Mu3jn/w0RJfIxUuo9uGgTAHnJ7c0EI+EVd46Juqy8mit/3Egm93zHqro6z8lNFDK200g3VQreWv7jYpayyx49Dmm5v56DZwPRotTeiQQPpSaCqDxwVztFi0lHWKzeoAsp54p4WEeFGITzezC/uo9OGrXi636W+6zFLjg0Nm4S2rwwezq2sZtODkf8UOIzBSCRvNKcres/I/7vqeKx2OIGEzQbSSv3f9m4365dTLlxW/Oi4uWMSJTR3ws3zkaeEbJNFJP7QEVXsg8ZomiB0ID82jVJ2ioR8/XD9xoPi3OuN5AIYL6AJ/V379UNKvzGkQXqhL2kJc+DkmfWVGd4gAiAMgYtvKyLkso4cyojlRufxxcIYXyH4wMoVxTJfiUBxWsPEiD4u9Xwc0eV5vVSArFL2WotI9CH0lF6R/kTcM/gybRWIaLIqftfxa3QaVx+jya17N2fAwiCXEQtwCopmwqjkv3wUO3PijSQw26PzsoJ9QJw441enSDCH48KSXxboyrGHncfH4Fn3GThKIl0eDvWBqUNKpbFU34/LezLvA9m8h9YzPbrNUzS557br3TZjv+0xZWrAz/F3w6JLpRa6jX4m8jESvdBk9Budrx8zRFJkcqUUPWf91HJ1uwh40yWH1sZMqLDYzzhHFHulvi+HxzHVTAqKyxUbPGw7ByS3TgOWXp9JHNVp3WfUIxS9SSvoOhEN8aKmzva0N4/LniOSpK4jLao9K0pqQr4KDXn8iZAofCS+jO/8V4s/igPd0NoMnLZ1z+oQPj+QVcIYjRRQ+YfRjUSq2rClRW5pRbx7ZYImW193dwACWHuDYtgwmM2nSrfsLJC+Jnt+TvqTEDBE/ejcsgB1d6chbHkgPhDOXBfqrXe1jRIWCH21Xhh1vBZn8oyUxgKRgZfxvidSNezlSxp/0Z0A6k2+8EI7OUea4Nczgh4VMAcrnbEenpRSH64wU+55vrd6QrlSyaOiUv46RUPjB7wEA/jH5hHSDH8HcRmJ2Jw0s/hCgagzuC9OTzsAU8KC1h/6K32glVNBGzLDFY1xGnNIzHEIt4N0vZWrH1lE3FNNdVriBN1uGPLAo+PEkXclodWYUdYu/P0Wqd6D/bpbhRTVQjaoHHXMimCAHxiRwhsTtL6A2hFoIJ5Hc+PQ9TPyQoLineP869L3H5gvQ3U+Dzch0qwp1NlcDeLmOnlG/QLxtPSRYQZqgi9223u5oPMshTOC3iBLndvGrOtLM3T20dYYNhnANAhpLALuR0D1F9FErUBN31hCW+zLtFqtStZkl/JPyc/som4dEZLyE9hLUEsdqcXByUbYnSLjUISsUfTxeRdNdleruVdRf2zZ9Pil X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7711a01d-6501-417f-ff79-08dae2380648 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:27.9870 (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: DDQ2cUueE98FKIn8KXj4MC8B7BgIqty21EpftyF8/erZyZCAlCf/f5dmYnuFHcjG3n1ZIpkEh+2xUNxtPTnJeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1752701137234064798?= X-GMAIL-MSGID: =?utf-8?q?1752701137234064798?= 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. Signed-off-by: Ming Qian --- .../media/v4l/pixfmt-packed-yuv.rst | 42 +++++++++++++++++++ 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, 45 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst index bf283a1b5581..39ded0b1e65c 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst @@ -341,6 +341,48 @@ components horizontally by 2, storing 2 pixels in 4 bytes. \normalsize +The next lists the packed YUV 4:2:2 formats with more than 8 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 2 pixels in 8 bytes. + +.. raw:: latex + + \footnotesize + +.. tabularcolumns:: |p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}| + +.. flat-table:: Packed YUV 4:2:2 Formats (more than 8bpc) + :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 + - Byte 13-12 + - Byte 15-14 + * .. _V4L2-PIX-FMT-Y212: + + - ``V4L2_PIX_FMT_Y212`` + - 'Y212' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Y'\ :sub:`1` + - Cr\ :sub:`0` + - Y'\ :sub:`2` + - Cb\ :sub:`2` + - Y'\ :sub:`3` + - Cr\ :sub:`2` + +.. raw:: latex + + \normalsize + **Color Sample Location:** Chroma samples are :ref:`interstitially sited` horizontally. 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 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 0ee730aa6cc7..4d5f722b674a 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1342,6 +1342,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_Y212: descr = "12-bit Depth YUYV 4:2:2"; 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 3d8f89bff33c..b8a501dccfa4 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -618,6 +618,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_Y212 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 12-bit per component */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ From patchwork Tue Dec 20 03:11:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 34883 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2747597wrn; Mon, 19 Dec 2022 19:14:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf4tVHvdv3XoWhX7eGWpT/Tek4IwgHfQLK9WqI1B1H106T3rRR8/yoQ7vFoXQNHlNEBwp7AL X-Received: by 2002:a05:6a20:d046:b0:af:7762:4c0b with SMTP id hv6-20020a056a20d04600b000af77624c0bmr29043948pzb.34.1671506069846; Mon, 19 Dec 2022 19:14:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671506069; cv=pass; d=google.com; s=arc-20160816; b=Ni9bqlEdN7JH7OfYW5TirBV0Y+bFmcRYyzwVIlp9nQzUCIbvpSyHh+KLKB9IkDZ5Jj oNJzM9D7lBL0xDM8+WvyAJwjRXhKltzDOBQVN/Uk42ZEKQsqYdXSIH/ZOfU/TbhLVaZo y3fftST6jAXRzTRBiCduEIhVNhzocW/35ujvAm7EPfnSMCALiWMq1zWmoJ13iU4vKaQM KglLNIAjF5zsuHs9OM/9HOr26hC4pokNf59Q1hMpdLpDlr/jvaaXZhmnQceyLRNpbLLQ BzsFuuFu11H2Ol0+j2SpUlRsVont2/CyktEmxNSaQDISuJHjZBHWquM4FIUcAF8R+G0k Tq2A== 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=/UIH+RRI67kjol9AqivPlGAMCEzoyQR92GRQaOICDhQ=; b=Mitj6JbIZYngBizd1hlDcV99BqXi0wxK1KWE6YGMAl+sLKVEZTHydq4aykT6wZ2tvy h/MN4qEBzJuNQMLbebKkID2NQIkRZyaBBtXUWEc/x8Kc31IRmPpiEPxE7IyYNkYIpqdl XVvjRJ+yULFJVrjTxce0HPAWkisyf34LPovMO+9q+vny3IzxtAbFU3VZee8HYvPsoMPF CuAihQI1CxIu3W45kDCDcwFtPlKWu5k8zFsyBXohcnyWe0H6rjsImwHQBjX6cbIpfRii lYX1uRsNcR6wmpkPgQ/yrIw01+sScflOlUnYRfevhcSYbz917cI0QEvwlifBrjFBPGo9 qYnQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=QCDncQ+a; 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 v37-20020a631525000000b0047712cb3fe3si12782776pgl.590.2022.12.19.19.14.17; Mon, 19 Dec 2022 19:14:29 -0800 (PST) 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=QCDncQ+a; 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 S229527AbiLTDM7 (ORCPT + 99 others); Mon, 19 Dec 2022 22:12:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233007AbiLTDMv (ORCPT ); Mon, 19 Dec 2022 22:12:51 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2049.outbound.protection.outlook.com [40.107.15.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEA7613D1C; Mon, 19 Dec 2022 19:12:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U5YKTnaijjJHvzQbKtAKmfL1aqMD5xNLPVozRD6bKSDDzzgbf555hyZj5niqjtbjza1/EuM/wVF55Arh4HmhjyTcuUhkzbMuIoMMV26NnTryYPa3qPhFGysVTr1p3Q7cZPN2VyRuvQPfgy5XITnPH0h4VUmnadZxHJs9JDaec4XgXvaFfH++wok5A6cu5hog5ewdBdiFGVmcZGXcKJZnpAZT4qHx/79O8KFwoMq6oQZ8smiaxL/URXqAUpWoYIflLa0lX0fH2ZSmL0sVEoaQNQCqPxtEeCSuvrRddZRpcXMVbwX7s2kbtb4FpFXyeqpzOoxiBAiwoaaxMdiNdwFVEA== 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=/UIH+RRI67kjol9AqivPlGAMCEzoyQR92GRQaOICDhQ=; b=QGuUiew8JVvW+W9TGBMwH0s3w9kS3p0SLD5R9lG8nc5hAmwl2ZudyjUW3uWxHZCmJ8wxJioauJXEzbHq+xGUNHSzCIRrVuQSYCPdof8wC2vK3QvwbXyQAE9u+rD5g8/vcVgA0GhSZFN2BQmswvxuN1Q7XiFkh2yEClA7XndUoomICvJC7cl09Q4wKiU/XyH+WwPHLy50+7OmFXKK13ghUE0p71pbcGXSwIRNZ/np4dg/LOyT2E8u/dGlznzCzUmGUlZzZ1inojhMdR9mm141ojfib4VsB4fL8WN29WcGVBrGZQfGMI5wwehjppjwXQ1pBdPE4jEl1YMrf4xAxjpw7A== 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=/UIH+RRI67kjol9AqivPlGAMCEzoyQR92GRQaOICDhQ=; b=QCDncQ+a2+MML84yv0HJFfaBT6bitEZXvb9gRTKZfq/qszqigMhrFYs3QMLw4iMeExZZEF75X1M8VeWEfEmE55l0yOcQ0lNl72Eil2YW70uG7SzUIivZoYgef80HuuKjv+tCBnTKnkTxtAfk1IWz+o/FSEPeu9E9j5YOYHfcbjA= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:32 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:32 +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 04/10] media: Add Y312 video format Date: Tue, 20 Dec 2022 11:11:34 +0800 Message-Id: <4eb46df4bb84da00560c6c757cd661a1d00e76fb.1671071730.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b521f06-af78-47ba-77ef-08dae23808b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qkEaV+rhwwFMmhbvZ/uYURT/O7mZ0qzpq1E1tYWCxZy7HVPRUNY+h5sEqp9nwNuPzkpoOHX42pU1KCEiBDOF+3PGFxQIORbNf9m/6FWQx0NhWDVdaotlluSQA8uchI2NMpTkwpicmsIMYGC92xMYctZiA7kGzfVBCWZCc6wdqwQBv1TxIYsq9dWp/FwwAA0XtFFVdtcilWa3GHFA+WTRMOhiw8rmCralDgd3b3XUCW5KrTCLevPaGQSqFK2qcnyxh9J2KHhPAXgdYPsBVPHWFIW53b9b7uZmUKdOPgIHFSRgLYZFXrZeqsKnXdKzkVuvcRs7uzL/oNpoiBRCeDyj1jIOqF9nf9WyglYKE2/BSoe7MgNZCVL9UNtpq1bpGxzNcoGXfs4W0gJVY433qo3BMfgIvmcfumPnNKHoVPf+2kjv/qBqYc8lQ1EKq62B0wJDeQbQ+gNqu8hyudx3KOnn9VNq3qh98MOgxQ0oDJncNfBmAaMdyxbgnLa7/tUrxh3y0kUPp19x0tuQib3WPYUTP1tHdSnyNSRJrLzyGccjY/q0iopR5s6ZHaImsQ/3/4LFGq0bFXZRJgxgVERFGYLqwW2fI9sQdfO9qvBFrDRWFoc5+VHW4RdD68siC9bwjxij2KbZqFDLtqT7E2VFF/3pEJ9Fko2DoGcPCEFXl1MdDY5rG+VK9pkyoog6r7dpixoB 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KnAuoOLLSJmw/2un7rTK0SNhz90LZnauOCZQEZGzp/qFIWzoga2ypUJGMpqtZh535Vk6c7JEm3T4xrEIxeKvAjZ1MwQyWAwd9XzLCQAUXio6OicslZFnmmB0wrU99UXcuPvmp4w9kb2yqs6hfSdelZ2xeETlDDGz0bmCATrHivfDFC5gkUnsoJ4Xd1iB6tv5I20R391N/OvXaoU2ypuA0bZe6AVJ/due6A6fICKgPXEo9z2rCplH6joD+R/1nniHaY4CDLcTABkQwdQfk1W8/Ng8Wr7az5UNOxRMrVThNPEpmBza2SDp7KgydJaIsXFuJ7Nzz76Gv0zpLTOcnTubfwWpvRcRCXTfzW689RcW0SD1oad0qqikRSGndcdIhX8frlWntunaqOhQUGZ2KJTQE5nrBmHoVd7xPGus68wjDEE1fHpNP+rlXlbXYjsPSW7FqqFIvl3hf6U255AsmaaFC8ZQGp05bJL+4416ghBCHZNx75wNCxdZNJXc8NVxsMb6zLS9Sq8EaIZXo6YDi/I18I20EvyVMv9WMoEANnZvaneuBUMde2g2m5NLRNLy+Vz3xksvy/XDvU1CS3bPVBvkb7ZUeSoFUFP0COg32EzDEzL8yG8BCDW8cKn86ks3RVoXMySWp1kKZgy+94joI+J7VygHtyJ6bj1oiDgXA7AdD3QVWTC7q44yEjZUXe88opv/nfCp00LFvZqMee5RvT8uXGbJqsR4wde5svJxdPvQ1nu/qZC+9lYYXkM0CdtEu9vEubAHlsrsr+su2aLCOXhlaB8EIKxrisYbNmDZm+rxTzp8B0AWTJkdX6ZgTNwc7jmHiq71ICgCdKBmbQAIQB2x/7z5WmABW9Qxh9iW1S4g7PtLi2QWOCn7+YrjkAqBiIVIYeihTX6pbh/LZBnf1ui33w/qHqQbLLg6emzgvLiTihEc/MIsuT0J3uA21lEvsb0B/T01LCKxvdc74OkFqHfIPrTCZwce8RlrNMXpz39wBcH9MShy/esUW+5eWHG1hB7XU/vQpRpeNHu/38/Sa46K8D2ic+YOeWu1h6DYXZfzQR6pMcOko0o7id2QBa1DJ07glxU+4XDb2YyMTk6yWdxia8BSvwrRJXJYIHHe3NMRFdW2Ep7UQi/uAvBeLpYHuIHeyw3GKhOmTSoQNIXhS7/H2MbmRIx3dvJbyeCtJxKp9tPj+sPOjsBw8x+/Lk6YjKLZ5UJrhe7alcXatO8lP8Iqwt6AYmopM1sWxzkHdE4QQ+k+g9/3GsFRaMqxgCxYXB6GPYtRJjrtPi6EGRoh4Miulw4EKKndeiQcl7f3SzNP/ZW+9k+DBN/8Ba1mnIs3mxHiqZB5m2E7olKLwLwhCMCZTP1RhAQaYWryt3KfNVVrihxTSjLpwFdNDIswO/1lVLU7yg/VZGiYRdz+1CBwLYi0cWg8ApgTBuWY+TDFFd3Q79WVD0xGZ52RCvlT2o5PpNRsRjWCJ0XMBst59b26jffCBEfSk8r2uzGYrnDfrxCwmFzH0Fy5b3UQz54eTT560kqyuMNnQjmM4pDyxXRemISsJJTmb3VMYnLo+LKb7goovqHWy7Y6OQXXV/3YAfz+WRqa X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b521f06-af78-47ba-77ef-08dae23808b2 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:31.9868 (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: IoCDAY/i5fvN+Rc7D9Gr0NqY1xZyVoMyNhzG4l4KzpslG9Iypa20O2fUckDItmjy9oxyXwLOS95GcYB1QN5YcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1752701148797983845?= X-GMAIL-MSGID: =?utf-8?q?1752701148797983845?= Y312 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 39ded0b1e65c..a91c30ba6b73 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 lists the packed YUV 4:4:4 formats with more than 8 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 pixels in 6 bytes. + +.. flat-table:: Packed YUV 4:4:4 Image Formats (more than 8bpc) + :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-Y312: + + - ``V4L2_PIX_FMT_Y312`` + - '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..332d4b11bc1b 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_Y312, .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 4d5f722b674a..5b97d7e5dbbf 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1343,6 +1343,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) 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_Y212: descr = "12-bit Depth YUYV 4:2:2"; break; + case V4L2_PIX_FMT_Y312: descr = "12-bit Depth YUV 4:4:4"; 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 b8a501dccfa4..3475331737af 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -619,6 +619,7 @@ struct v4l2_pix_format { #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_Y212 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 12-bit per component */ +#define V4L2_PIX_FMT_Y312 v4l2_fourcc('Y', '3', '1', '2') /* 48 YUV 4:4:4 12-bit per component */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ From patchwork Tue Dec 20 03:11:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 34884 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2747612wrn; Mon, 19 Dec 2022 19:14:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf5IF++GaESmw47ym1RNbJ1nSdEJ5oTVK5DidC7WzbRqmIPPhCEblY4UsGXOi9vs3LsA1ZMJ X-Received: by 2002:a17:903:2652:b0:189:eadb:45c7 with SMTP id je18-20020a170903265200b00189eadb45c7mr44147938plb.37.1671506072738; Mon, 19 Dec 2022 19:14:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671506072; cv=pass; d=google.com; s=arc-20160816; b=Vvy5n61R2vconNIHdRTiqFA0l1bhuQBFboW27XO9MAUzwGtN2pdZ+gAfWLiP7Dst+t 3pxVElGQ1tDWT1NaaZ08vtGKxQkQoTL/SWMO8fSckzyBFsfE5R4CAnI1En4qjSWv42XR pxLYNTVEWE8z6GlECzXuAB8DrhtrVMVL6ixZZDWHHcAZPxNEmXHcF3ACZZ2jr18wJz4I rDS5qSfuASrfsPKNT6esXNG+QJ5fNOicyYpqZOgLBnnDhcboQ++fQpP+/zXhBgl9Gmbd TPXxRx03UJgE5A16l2xgzHrqUw5+3VAN8AJQ6X9TT6I6YcFzur5kUqEMPwuLIZ6ehApq otww== 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=y5EcEWx+58L+wG2ipe/BlV2BSRVp6Bv8Ai9LEw9dMAg=; b=XsTEvHyyiljgJIqCwZm4T40yIQuPo829LVUjlrolzZLtwo/w2G3Su97C5S+8h0cFK6 EslUmqrqRQwQ2FJPwbuj21iunoSDKZ2OGI0r6E+DeNF6gvAlLJaoltgWyIBLgFrne6ej s4w5M9gcuaeaQIcjvQz7UHk3S828H3eF3qaLxykjHNyfWjMquKU7gCabdjjGglQzV/uH uPgN5fauaSNl+u+jYP/BFybPBwuZuwRv/6OVwmOW4eVYmP1TbshMVh8tXvoUbd9ica8Z mHxJgpjow/GYAYAc0DQ+Gw+K21w/sZUZhpxD4nHrWwX0Ge7lE2eD5+xUPIz+uUh9ySoj QL4Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=F3utPRgy; 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 u5-20020a170903124500b00188a7401d89si6181890plh.481.2022.12.19.19.14.20; Mon, 19 Dec 2022 19:14:32 -0800 (PST) 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=F3utPRgy; 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 S233054AbiLTDNT (ORCPT + 99 others); Mon, 19 Dec 2022 22:13:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbiLTDM5 (ORCPT ); Mon, 19 Dec 2022 22:12:57 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E1114029; Mon, 19 Dec 2022 19:12:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wj06yuuK7kOhtlHwm2hO2nlnA7Qzy326xJ1prgFG5WgNVv5FZcLzDADlLFZpD3q7gnfWlG0HOI8tyEemk+Xbk00cwAjFnVjHFtmDon/i2WjvhpLLwSbYClV0rlMuBKfsI2ssntsWLh6twSYkG3IR7uA5+8vbQBCP59H2kxbiXXaNfKzOXM69OwDGmJkS7bA6cLTI++UicX+tnvC84C+irngpXAfqISZZxBqBp1wipaND0MaIEHVpnMObnkD79OqujaVEi7pyidSvUnaryuO2xBY7FE5eoBTTwI2lXgMocdHqulgQNwOnewRd04f9W7ddlh0zwAPK1f/y9q49rVA1pg== 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=y5EcEWx+58L+wG2ipe/BlV2BSRVp6Bv8Ai9LEw9dMAg=; b=PoeaedfCVQ6qurghj6b105NpCwUciqu092jeBNNkQbJgZKohhAjsPU4ORUj35w0VeaQdn9GUC/35/l52WGYsiG93JVtFRs9SVE2oBrWNFzlrV/sXYH8znOLgnPG1QF47kR+/4wjfJNjpU86vz7NsLvS4jp0ViTEgf/uBsmdI1IA13QbL9U1tOhQN0nvVAXg1ZMsdo+7pqcs6QlpjW/SDdZ0r4VIqifsHFiQJp9/WsD8hKmMMvkzDjNdRLe8b+C2wmOAT8rC671w44cE0IcFKRtYtKixBXE3gxgmo7Mn15f4JLo/g3gqjhzMXzsAetDj4nS8IT/25E22IxY8KcXB9dg== 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=y5EcEWx+58L+wG2ipe/BlV2BSRVp6Bv8Ai9LEw9dMAg=; b=F3utPRgyDroXt4T8oxVaaA/OacfBBUNsZd7z/hrIc2wGIxcLAy28gzmMAI4B8dzH7yaL9ajt2vEGJ+OvDhtBxJnbMMZ7yTpwgoLdt7+gVzNpmHiIxJuT+muBIaqzRkY9QwMSuPEOxaMg8A1DXSzEBCfJHNCL9NCFV6zTEYsos9U= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:36 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:36 +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 05/10] media: Add B312 video format Date: Tue, 20 Dec 2022 11:11:35 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 345d7bb0-c469-4602-4025-08dae2380b0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FMi5Cf7fBc+MI+QqFHyKqrHjxOJ86edkaHcSLUlL+Db3zXg8wisFGsyxwSbEJZCFzewGse0RuCzft7Ekr1PWda5tPeZOB0ZP8fArOGzmpXp8VDSYjBVUCE3ubX8urq+UOQYUHgF65tjWuog61ohaSK0O4VdJihriu43NWcAne4GYCI0TV2YYCKYJQu7hJrYnCbiWMNn8fQbkU2BB4ToLy22MBjkmxqriS6HH10R2UitYySI33k3mw9k7GK+467JDfct9GrAjiF5oHmNNUtoHr4SZCFebSGx/yq2QQ1HfAZTbDYosHMAhkamui3BE/bpzUUqdUcNFmnNRHyRyUflg77H7n2n/gjbUCAzbWQTFsnOILt+ez3sqzR+OwV9HsQTJT8smKXyK2g1WXGrpKGV/FYUn44WMrvi2odxvi1zrtPNbm6lRa4LtoqwjB/uJiUAbLJj8icuJYvuSZ6mcmP5SdC9SnbiVJH+Gku4aPvQKJ3hYRYMsx+7729rMkVqxlK79/jmwpl1nRoZgQkSg/r/bNrMLT9/gqtqs1ZpMBS7VwfeGbtPkBqf5mH51wACmy3SW+HbbbhMul9ICNYqfNyR/PnE9kbIGQ1t35e23RDgF/JJF1ufwpIU0DvuWkjredHS9k6u2/LF7pre+4He3hFPfkmTj3zvtCEaxzNUiXvYQqzj2lzJNS1AodWV3f97nJK1nQ9G94libdstLhRmQxNdl3w== 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FJ6gJQQJV/HHUNhVl0xl7FgbJ3mHBk/v3AluAvncmweP3s8BsMeuj3Vnv/4nldo+XZqPhNaXbksYzVNFBo7/PJhwqLEKyLnjqXO8t+URNSB//rkecLd4W46bVm6qmC/SkNl9Ibmr6voJ12ifuwIPqdwdf34pGsEHk4ualV0iHyKqndq45sdUq6COWA9qd6W/jZwdsj6m54rNDMyDNcmgM1Ud95cP81HBbkF9T64Xz6MObUNqW+XPZe1LCrtTYyXSH3A+kTdcQyVTQXBPA+HAmDTTtflm6mzpibvwbjKTCQv3ZCXIIC6HDgQK6CZYVLXXgKYai/w8fJmLj6oy0qmztjAQNmkxBrNn1/FanoUCndKI+MhVYGlKElzdbfBrUDKNuBupoAhWSIikwHJCuCEh1I391txzPQ+xZw91hmAB39G0KY/gQcULJDvC65nkl62lpz7I12L+/cv0kDllF8dvjeil8sm/hRPSKIlimKhYEsdET27kpY6FZAX0sPOsINikIGKfBHEuLBpXh/qEGelCAzjCM/ALsxdot5dzzibQg4asnivd/0PJe2mc0b2K+AE5On3jRXmPX+n3P7CZX07rB5eDWR/pcQ8yOVJC2I1yB/b5LOlknr+0UxiXdqWoj86IE8dw49AW+f0GqqtQ/aJnkpi0cveZrq+AKCdIzMuY+VlQc55jUykrqhEJW1ObAHt4oEehEX70PTn+HbFhUr/ayvNibrOA2kOtnzNmM6+QjTILsiIDAmGuq5YNzBuByvOUlza4YypOmOSxeM6MCYwEcXwwrikZOUuJ1kPEx3vbD7DyPtP/sgchDLco5lnxZ+xWCAKDd6WwsMqrv608yV2rwTk8bdpWLmFI6//YoepQ6pgCCJkhn6L9oqgkTObtEC9WO4NUnxXecQ2MKXiq+tNr13xQxa8V48qgvVmXOvUS78S6EQ9pO8ipnc4xoCKWZRDU6PHUS/cFqN6+Vr/fUS+qZofRsjRMdS1Q4kSTOa/DxtOW1Cz3exh6NIVIx48GTaqBP5tVjo5eedMjPn30OtaODnE7Tf3EIQfrBLfSzSFFUwuuBLsKZaNUr7ozEbjwciea7gkXw8ZHrpodf2pgid04MH0SNj9BwwYLKuAruXPFaQzmMYtkn3+U2hqkqqoly1aGzfLWmd251pNjCz6hrieuqODMRyvV+9xW9Gw0yabUpXUl92h0dAzOn5KK7v0ke9hb1HxhflFHwPJgh/DKgo7dAq0m2cwLajScjqyw/8MKbAe82FyMigfETBUBkOgX1EuW2NUHHa4/hxcYqkA/MN46Hd/sIL0k+gsMvOUPce83qA9Gt9oQxG/B5HlBul8PkB8yzUwBBDd1kLTdgW3SSP1wF0O4e5Y1l35RG7AYaZ0iFWLB+YtROb0isjpF4kQ6XIqvVpSUA3GeFIPNHmxv4QNPBrsJLQxhCpv9G+NYGt3TX1f5Rn0RzyhxCYFNfh8HrKvR9RghRcpCwZUzTVf+VKJbuxjw70/4Ih1KhkhcK1PL5Tfif4a9EspqshAcxDRris9d9fFYeulPb0TaY5RvUJ8Vbbj/9XwSg3S6Yphm6jpWsJ8xsFX0ccAPsoRUZCOOBtcq X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 345d7bb0-c469-4602-4025-08dae2380b0b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:36.0022 (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: kZyj0k0QlehAW1RoNg8r5bSc4VEOJG7QN0zudh+cKWjN9kSHuz+A1Okt54RGY7C1mhoEsepBC9pVdLSLYiEV0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1752701151953680493?= X-GMAIL-MSGID: =?utf-8?q?1752701151953680493?= B312 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 | 35 +++++++++++++++++++ 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, 40 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst index 30f51cd33f99..f7785c93292a 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst @@ -763,6 +763,41 @@ nomenclature that instead use the order of components as seen in a 24- or \normalsize +More Than 8 Bits Per Component +============================== + +These formats store an RGB triplet in six or eighth bytes, with more than 8 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 More Than 8 Bits Per Component + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + * .. _V4L2-PIX-FMT-B312: + + - ``V4L2_PIX_FMT_B312`` + - '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 332d4b11bc1b..0cc58abae562 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_B312, .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 5b97d7e5dbbf..8c3d40d3acf5 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1298,6 +1298,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_BGRX32: descr = "32-bit XBGR 8-8-8-8"; break; case V4L2_PIX_FMT_RGBA32: descr = "32-bit RGBA 8-8-8-8"; break; case V4L2_PIX_FMT_RGBX32: descr = "32-bit RGBX 8-8-8-8"; break; + case V4L2_PIX_FMT_B312: 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 3475331737af..c67f895210de 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -577,6 +577,9 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4') /* 32 ARGB-8-8-8-8 */ #define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */ +/* RGB formats (6 or 8 bytes per pixel) */ +#define V4L2_PIX_FMT_B312 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 Tue Dec 20 03:11:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 34885 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2747632wrn; Mon, 19 Dec 2022 19:14:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf5kswnWvfJ7BRQZbid3zA/gjOXHIjKRKQc+5AfavfIWRlAYNXX504h95YUX4neAcPjgt8Pd X-Received: by 2002:a62:fb11:0:b0:56c:3696:ad68 with SMTP id x17-20020a62fb11000000b0056c3696ad68mr45436034pfm.8.1671506077292; Mon, 19 Dec 2022 19:14:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671506077; cv=pass; d=google.com; s=arc-20160816; b=aax/FtPOPJubcGDlCcgMSlSpSiws9RdOehLn9g2yxDhqHYGJR/t8NoYTgqIjTJpwv7 f/5iAZdg64WngtLD8hPpRrgL6pCR30giQWdW5WCGsnAeYd0cAfhcpjT25TZbgZRAFenp 9wLdQpSvZp3O+ErLTzBD7aoDRXTAWHWiwJfMPmxEDXL23Sufvm+rlq0YGEu/FcqZZb7I uXl/LHvp2ZmLVEGo81a5A6rISAO5t31UHpFF7b07y36/mv0y/8VZd72Y6MV6bs8pymOT 5mZmDV8XH7sIWrps1DA8IWDbUTHB5H1o+SRenyX2J3yOz1lrwmviSwGie9rr/s0Iwu2v fkaA== 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=/WnNYiad6tygjPwmw3EFwqU6eGmAf/6+8ZRHrgjUCc0=; b=q98jQsZ0UNJTzxrbXyeEuN64/CDaHF8ZAAs+jK1kKhytTgmyNZ2HTYzbyJcgrkQCPJ 4nt7DfZYkpcUR4N6GbmaxJGLGtCEHv/vRsIq9cnVgIa4rp/C+QZRTJrLUE+4AehuM19+ lsmlDLMNYrHEpNpzgcZpSWSznW+rSHROAw+8yo/rHlnPL7CYlmV1wTx6f9itymqbRZYl 5Y7UV7SZhdhCf3q3DQV/lKTVhJf9UhRzEBlOWTW3GbXKcJ51KZ4dlE5UUhcQsfvBhlqg o1pWb+TPcLG/20doJ/gdpHRSJVspCNb6m7BjgLpXg4cbWLmBUDlBoyJdT5KYCo6h3pWh NZzA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=WomW4RqX; 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 f18-20020a056a0022d200b00571a5c5eaa5si12470150pfj.150.2022.12.19.19.14.24; Mon, 19 Dec 2022 19:14:37 -0800 (PST) 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=WomW4RqX; 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 S233143AbiLTDNm (ORCPT + 99 others); Mon, 19 Dec 2022 22:13:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233126AbiLTDNS (ORCPT ); Mon, 19 Dec 2022 22:13:18 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B05BE15807; Mon, 19 Dec 2022 19:12:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=digdfR0kSEC+yqpZdV3hLaPsfdZ2GK3jZyGWJkbLRUlsz2tgCjL/7pyK0RdJ93Qy8cAE9ZV0X46wt0UsG63MgcXLhn/GrDW7EdYdfg0ehR223/ha2BbIfZOQd0qrfvo1lY6USPeAv1afh4sNYnE0Pk5x8Xw6KM5+YrkPzsoHM87miI5V3l6wSevcEftF60ZPqUJvMvZLE0MgSRcM+eqaqaYx8upg/3bp+n54tp+TcWrkJiesklrjpDjj9Azc2TLkr0x+D3WuXHJ2D7+Qrklm444bR5AG0TjyuJSPeSwWrLfb/kIsHoxZSdzGzjwNEcpjZpPYF64wBYLZIA4wmQnaVg== 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=/WnNYiad6tygjPwmw3EFwqU6eGmAf/6+8ZRHrgjUCc0=; b=cMTI3VHWwgp06HmRPcn/s8vwAusdgqMTKXfBfb7oDoraTP1qU/UhFcHSpWIhgEEf3aJPheSme1XkP0vlQ9PcMqyZQPIqz8to4OcybGEiCl2E2svrvinzxZtmAozR4lqO7n9J+RoGXbEbywgEKBNmiJJIujbuUSvUHXJb5Ckj6iixInJ8K6a7HLZjZrJ7WY0fqSKC/SaiTkYynAIatfb4YuCmPREdSurzqloZJvYxGY4jWKGQ22OI/lN0HhmYcUDDAIamFOiBWqn2p/7BaPKtuBX2JjBfmRq3O7NyP4CePSbXlDdLUEmbLhrBX/HQSntam2HH5aSmZPo1EZiAQS8j2g== 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=/WnNYiad6tygjPwmw3EFwqU6eGmAf/6+8ZRHrgjUCc0=; b=WomW4RqXXu8ZWxOIKoSVYRb6QckUzROP1SlJfEbIjdjok56eYHag8ewvY8nGr/vFmIB6RmWS58AkiKqPywpb/sk7GSfayLDHyZkz6ycgt9pRNuzzKqLGw7zUDQY0rgaI3pa07Y3euAMGK+er1T8K5M6WHrmmwi3OyuQMrKABaa4= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:40 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:40 +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 06/10] media: Add B412 video format Date: Tue, 20 Dec 2022 11:11:36 +0800 Message-Id: <86983e95cfd05ba9b3b4688e25b58e96ab23d185.1671071730.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 924bbe90-35ef-4fdd-9198-08dae2380d6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ueYEZTp1dnATx+210r+1x5bIA6en9cAELuCrlScDH68PJYxDLvXAZdk4obK7LY757iXCjllJ6a59Ar4ishHRkiwL9QBxYBW1gCxD59IH2Q36safvKDqHFwc027ftiTtyEWlzztQbuc4apvmoLI6eOb4oHGj/e1FhDfcH5UsJjIUrX9Au0u5Mwf+zRjsbxIBL1v8/HWbJRPeV/y71bhC6rWkvaWLcEsPLhksBlUN5yFgUlIFHfcNGvqmRq7nSlGbRyCujTe1DQGeJO/aTlHWggkdOxHEYimutAzKsIjr0XgDi/vbCpy8JXzhHmUWhBB/ndgxnMKPYALZI5walbl8gsOIygPty7qiW+q3uZ/z1gYRWhVt344PkvILsS75lEm/Ew0b6O8weJotrEUSZ5h8KVhKLrWXdL8h//DUXWIeTIGZlJqJCq/GOfNBVM+ayk5J5bClGHD/tzDh75MFyi+juYosdjpwIO63u7441mVvvE4R+3p4Kg18p0wuyRmA6KgNRdervJ8/wKlMdRfX680oRB4agzSgAI+m+7NMVA/82pthgy+1m7TFS/rmnRwQl6B/1pGYgouUcCUsr+g/tfgMIUfeiQ66GwcSwkhK2NxHRxc2j/1MhMSm1hU68NODwSJnp6OpSVruiMgmrqZTk2EBaxPn6XEcZAhJMlz7i6Zk3mQ9TYB0srtHc3RotGpJMQWBRueNXt+1ojjkAqlI3FjL0lg== 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Rh49TpMVSxzDvW3KY+wkJoUC4HQgiBVuEXfkn3fW8izzUPxEI3c8q01Z3CAouavLf714EW943NFOoS36cQVgBSvmHq2BxpExXzG6TnBGultDyxim8MqybfiBZhri05OM7mhDP9/j9c7G3X17lHPmv22wRF0XF87XWXWIXWoDhft/SNXs/Y7FfVjBaJ9KlhWxA9lL1VSvP5cdbaw1FZNQFs+nlXtnz7ojjndUEw1MU0yhwF2pn+ERJuMV9huTpbIJsPHspAK6epavHG0jv4Z0QfmXe7a/XAtmrhER4eRjoEFAw7wtB6ufC3uiN/U/hC6PHYhpQPHedgcTE8vv/7uwbR5M88+Y5Xi+1fLqzFjFEpFNhS815FS+d0fKSA8r16AIn666R3VwHQ3NipQwZFc0cBIY7/Y7kEFEbyXrLyCXRo/PAqHWJXA/GcYxr9ziJgnN6/je/jHs/Y+6XRZVfuFNWOqu/LCavWGsgB3+znfLHi9nUlISG2VrU88hwMd7ersrB2nSw8+6nE6v9Za+c5eiHavQTFsnZymPDgU8t2UVh5fy2FQWYdIAy84mbtgsZfbU2U4WX0cqK0T0ISoJrsRMSUB5vzMW/BsfMWtwWEQqaPDY+AQSiqBY3Pmn2bahiyLlpsFqponDhsCDMXp5nAOsDQjgf7VdFqhyqWPPSon1Vakmx8NR6vFRg7WbLYnSlS6EsvkRQYXlip4OAm+tMMztn5vEFw3BeQIGbkoIsfxsXqlRK8N0DyGL0WC4U35XtAJqztTABGYW8Ly8w9eCIOtyt5SybZUpN16R4NAnV8DEGcWdP/aH1uIddI4GEvFyAHZh92EPg++bIgBMGIcK+VxNrWM26urY2O6b3Uc5jpcJckPFkJEugDSKHdp5Z6VcO0wKEyDwUh0eoiJOdM75PEOp3jVwuGRZlfQZ+rGeuGEHY+Y2a+TUZ4Mx2hvcP0e+8HHSOJdRy92taMSeb3IxBFp6aLHxC3tpLsQTNqMNSqUWu5EzFfgnu2+erE8HIp7L79ghkk3rRRMVl5Wux5BEptxoBzs0hVJPxPf+jVmhVFbFGUnv05qI3RGHGex3lsymzv02inBusXq3uM94POVi+LZkzOFRWoyGAZpa6xd3OvvhnbnhVgvZeIKF4QkB1ysK29WtI2o584Ff0d0zWqR+fNemypMz3CXLeZExNixQ0Ihy/JDqBI6hJ94tJTLFI0mtUd9V6iAlOwvgiGX4wxthDWpKfMkNFGD4acNJfWI3TWqX3SMLH/ovcAcPxX0T2nQD9IzV6X5fig6v+0o4/F+5g9VmEK1hnAQj122skiqHOS7LKeNO13+K/Ear3I7SzI9aEZHw4TOvknD9wxu8qgLG06o2ucQ1nFBAAbJ+v3xukSwHE9vX5kAWegl9XbzlGDz1FJhVCFT0o9BLdVAGrbkv8jqlG/kjs0VgvVuvaLUJKIKiYZowogzRNBC+KypKdGzZlSm7wmZVPkAIbl8Sr8I6VzGwN/zOeEEnfpRaOWc88wPHiCuPnApmYu8ZVr7faDOir44EYie2ghiHBtDeofmo4QANMz6m8xLaYdxYbPIuP5bpYF3hAU4ndln2N8H52cjuw7+7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 924bbe90-35ef-4fdd-9198-08dae2380d6d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:39.9551 (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: FgqChrCwb+YUy5kWq4Z5UmFsrOOMj5/AbyQUWqhF7gQooPsgv/GhSXB2C5nztT8yvReun9c5urHEuVv95R/ZNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1752701156468392114?= X-GMAIL-MSGID: =?utf-8?q?1752701156468392114?= B412 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 f7785c93292a..b9d1e48c0224 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst @@ -793,6 +793,15 @@ arranged in little endian order. - G\ :sub:`15-4` - R\ :sub:`15-4` - + * .. _V4L2-PIX-FMT-B412: + + - ``V4L2_PIX_FMT_B412`` + - '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 0cc58abae562..5384648903a9 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_B312, .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_B412, .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 8c3d40d3acf5..8cb21024bd96 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1299,6 +1299,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_RGBA32: descr = "32-bit RGBA 8-8-8-8"; break; case V4L2_PIX_FMT_RGBX32: descr = "32-bit RGBX 8-8-8-8"; break; case V4L2_PIX_FMT_B312: descr = "12-bit Depth BGR"; break; + case V4L2_PIX_FMT_B412: 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 c67f895210de..a26ff16a52c8 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -579,6 +579,7 @@ struct v4l2_pix_format { /* RGB formats (6 or 8 bytes per pixel) */ #define V4L2_PIX_FMT_B312 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ +#define V4L2_PIX_FMT_B412 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 Tue Dec 20 03:11:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 34886 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2747737wrn; Mon, 19 Dec 2022 19:14:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ahfYWfopTPrIc8E6wjvqVVz5jBI4r9oWypdZckTJLWah91gmiuj8uNuRky9p0n/y1Tp5K X-Received: by 2002:a05:6a20:a588:b0:af:757d:a8b0 with SMTP id bc8-20020a056a20a58800b000af757da8b0mr23060055pzb.9.1671506097562; Mon, 19 Dec 2022 19:14:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671506097; cv=pass; d=google.com; s=arc-20160816; b=MrrqEXEmiPTiNTCuQq2tv2e7IQY4857K9/askyR5CdG1neOdxa2T+jFyA9/c04dCpv psce2o/GYc6CIJpn60RmYK8QRmTjw9NtxVuk8h4DNsskzirWbzSz8ruTX5LXEDGFDVOj 5JE0QT/vTw2j3o46YDWggfmp/uqC2AyNybSDdegjOsDKcGq2mlWnikNWGeSe/Q/Ofg/J DIVecnABX3C/9etswIl79T1CmN60gFsNE+5VY2yELOu6WnEukwCCp4rxotkuhLbDdy1B 67nApx+h3atR08kq7gEc8Vdz4/O687/RJbIQrZnsKqV/wHjkvOY9MgDpbCB1ED+n2D4d +6/Q== 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=zbIcPoq9RrGMWVbDtmtLrCDuucGY+RLJ/fv0HBuvT00=; b=ycqTX54EYoFBp0ykbWq/yU/GEFaOyanvAfGWAEHXW0AtNcM18RGyMd7St+fayvZPDU EeALHmStJQqOFv1T200fKMDLUYkwGPeXxSsiI6MJ4Txr4vKKb0Do6QWuKbmf84h1fezc HnLn+O2dPSZzruK2zYvyY+SUzpeApe9GLNpDUDf8tbBn9wiWfzRpKD3U6N7CW+7aMO8y 8kRqbU+kS+l5H2mdb4TUHN/yVYYCfbKefGIUReK2dq80ZUYU/U9IdSUkbyJciITT93Ow 3nw6DYnfqE123rbuvuds7zMMOdRSJFnfoIzAgDB2XGE7+C3qe7OQqrOKRz/FNl4Z63Qf Et3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=s7d5c+RU; 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 c3-20020a633503000000b0047715beb2a5si13028521pga.150.2022.12.19.19.14.45; Mon, 19 Dec 2022 19:14:57 -0800 (PST) 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=s7d5c+RU; 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 S233180AbiLTDOG (ORCPT + 99 others); Mon, 19 Dec 2022 22:14:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233102AbiLTDNg (ORCPT ); Mon, 19 Dec 2022 22:13:36 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05BB115A3B; Mon, 19 Dec 2022 19:13:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ST8sWCtc3VC0En/NDOinaPW7Kuc/XJM6cF3/W/gXFXvQ9YwxCvjpgC2zNVsKEB9zeVLH3925AcyZhdNE41Yyq1+E+1OzCvOiHbi3+RNSKaeKg1v2azANTi4xUvDjd/UERAUh1ndxb6u6GE3KJ+RW/9o5Liksm95N+VsXkqFILTQtRfLAGnH0AtA/vY7wvfJqJrQ0htqe6ikFko1x91I+rjBfR4HRozzXThf61GJejx+MyhlaEXVCC/HX4ZsAKu8AOZj9KtCFizC2lHkI7F78ejblahUFjZDmzQWyQU4tYLQY3jzK7M9yBOk8G0fBj2ktZoCIyDlrN3eZgNn5y/dWvw== 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=zbIcPoq9RrGMWVbDtmtLrCDuucGY+RLJ/fv0HBuvT00=; b=lMP6On115SxhNNIdLwlEhAsNTWYrADfSdcKbK7zxoHpyufo15/jEpuyqBhePKTCbtJJwuQjJv/EGt06DEUlPQD3bEMB6tNaJOgQpbTuzWO6InEwpt19vVFrrlhsNmDMZO5jj+j3/j2RPjDHs29+Cmomm+g+RE0YsaYL4QGcDTEGR88VC98b0a+1dLHTvX/9AZIk/Rm+pQt+MmpWczcFxbpkyDU+2yXOUHPRzz1+cR6/J4l07QvEap9quZVrgL3L9niD4vThg11OrVuWHOqPGOK8r2gK0KIlE2Ld+nvJnfdI7tPhh+t0eThmaTAKKVvSMK4qHw8sY+shV9+t7Mzketg== 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=zbIcPoq9RrGMWVbDtmtLrCDuucGY+RLJ/fv0HBuvT00=; b=s7d5c+RUm/NwaK2lyYKP/rV6u8pNkhxNrGKP7y8RRFsU49hYiK+cCoKYUMAo2IQeR4VG3u3Jjvi5RMGB8CYfKytwbjA0UTv1xd+DilDVrDt8W874HXyoR1wdfDBTtWTUgZIoFWg3jKTNy164xQtE5Ml6QCxDJ0sCQkhtAr/hYyY= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:44 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:43 +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 07/10] media: imx-jpeg: Refine the function mxc_jpeg_find_format Date: Tue, 20 Dec 2022 11:11:37 +0800 Message-Id: <2aab9e89d5e0ef398fd6e218e11db6ad47f0082b.1671071730.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b0975b0-59e0-46ff-80bf-08dae2380fcd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RGBPo9dqkZwNGlVctwgiaGglrBA7kyo3p5AhjLvzEHiJ/IImQkMpXhTBxJWaNd0G00dtYMQEsFTbh4tZF0MkGEqp+PSs9H0N3a5DC3+50vnZY27Py2ORi/qvaICiih2v2prn3hZ/tJ9hnsxbZygWgAflYFz70LRtfgjaH1kj/E77rBxvO71UM9EQoAy5OyAj7RjNidL74gtjFMxTjIllccK4Ao7jE3htsZxntnyI2jd4/TgCbOiVDFewQeAjlJWetAMQR7XVNRjcS75v+xQ3ek8dYD31MuiMMONtCHgOCHhjaEsnJq98TRTgDDexzWCt4+obrWJFiMbd70qzZG1OuYCONkqYkg95UmIWFDXPq9AHw23UPdGCn3w2Mk0ahDcZFOsXgA1qW+9xVZgk2YWT3MUsqbkwLhw3N/WbcA7k5Lyl5B3rkbT5mdKMSA2uKC3fq8o0vu29ejeQjMlruLOKzqdpaoX0QWOMNPV+H5GtZsWD+EYULwHSAxPIY+3mgqQHjRfyHUN+Yea9O+TNjfY+Aa01dkiu/h9/BubULrz1VFKSykhtUBVwIk8tktglC0/WH9GmdhnWJNWL+pQ7MeQF6q6jdb76fCvSdN84ZyYT2GlsoMA6Je7FCyUjBm61wPPkVPtxuR/9Bl0W12pCKXB1aE0YvD/BIyj0qGa5e3yLew8vVsPtBJJrMjhygwUamZEMtBW8jTcEb4xrMK9DGB163w== 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4f2VWHFLHoONDzYmA/fV0Ew3M1whoVNZS6ser8kDs2ESmTHM0h9f1pZVw/35h1GKJBO7scX5q3WAd54SvFqbJ5AYLdwAuSLoipRNX3quqr3Be+Ie+6kaQ5sgikctXC6jDhKxJU8TtGWUkCNeWsHCxIvVDdb1cbL/+gK1RYzFXWV9nb/Csbqf9/ELFxsUkwQOzc+EYhP39ldfYNfCSmAjyEHBXokLxGiwiSU2WJngNHlpjdsA2c2G25dgxWxe9iZiStEgKaxfl3CXF+5uaJeRXdeJBcbsdj23P3XUOv7nrTI8m3EfsOiuZMzIkjKjQZ/sZdXQr3/kygyPT76K7LiOdEXNEu8ObW5ADqgxLzrn3d5b0vfM69/shJcHTYMDER7WT3ZJWQV0VFnp3fSBvDqTTkmpvExAdTGdqN/3qfFSoUbSkIJ1M0bBVyfTklHUeIfM7+mqXoYWzqpgQbZVs6tfI599oDsurO3gHI3cx1F3MfawBVM88sHR3KxRfEcDeB1WlAxd/SMhPwe3MkEQycGCaSydCTl/QPD6THIgNEJfbDQs9YLp9X6CPkgFg8yksshMhYGJjaHpVzr3tblhorQXtstiYdFxgYOsfZYu0rsXXIzZQfPO8tw8PtVXgjcj6vFeGOnJRqI3998RUn4PRQXFSIXmxVf60UVVdQqwpNFhA23/CGZVszaW9Mi3+CQs9EybRQPfljj6xUgIM2BeFvr75w8mEmz7PIRvLjNFViy9p1Ul86/FIZabxpzNt24wYEf3+8YXPDG6CawpfK6M+tvH8uqTPHGOUjPOMp28UQGXfxXV8I02k3kg3iywMK7Jy5IFHtKlURqfbijQZqh0Sjs77D8bHHVcvnCw+NJrGvO2QNFx0mpQ8kLVc0KqIk0QXyJGHSSVG+ddcXShRZhhm39N9tUWBUNtuCR5q4O4LBQI3VkNQ0h1bSG9ohp0Zngg9cxWfGtW5OXo4iHBe6fSdG3xighFXzh3CEwSpXZ1PgAlP+HEDa5r9loFXsw1F9D+tRG+dsRipZ1A0AtFomwMeVNhIsrZkZXiqJ9fUCiBlMG9X4xApmUJPBe4RxS2nblv3tAC8/751xefXiz18bN5le2577Wl1KvUo+vcXyxcwlmezcsHf1xnCRSQsZtWVGB8tJJ2hIapC8EhRSqUizzNGIRJ3ztsGq0vV38A4OuqaMPepzTS0ZsrPxzp0PzEkO4T8WW8eM9kHXJjrYjBib0PtdL9NKF7yhCXpIYgwdqlvHg9QW6IZrK+0aVYP7c8emFAfN3PehxJR87s3zwEVfmPX1LYA2zkUTciNEMibbqX5efDBluOb9Suz2jaOhWGB3+IRMcDSde2bm9QtE+X/gBd35iZRuATXmmIOk4HK3ldxQBJd8GeTb09/7zPSRjXLFYWSgLdkixzT+gR1mtifsCARsa4tw9BE56HtBNqeAKO9E+3MkUneHM/lauVmvKJNcPEYQR4AM8qhyDT4jjCCSZ/1xo/3b2es9+YZi9QSrTgsNi6hopCTakEqeEyv6nV3dnOwnJ+bsAmPNZnPsSorkDb+Gbv0RiOOOUfStk8PRWfx3h0Ju8Se7JAbCvLRxxiecuOLzjE X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b0975b0-59e0-46ff-80bf-08dae2380fcd X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:43.9237 (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: oUwXiKcDy4NPsqIduKejRMN/0RGTWlj5ka3x2LLIotTiUE2qVyFx+bXCM9xX9gPUIVv3RsX3LdgTawdv3jVTgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1752701177453179878?= X-GMAIL-MSGID: =?utf-8?q?1752701177453179878?= 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 6cd015a35f7c..97e61e28c649 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 Tue Dec 20 03:11:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 34887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2747861wrn; Mon, 19 Dec 2022 19:15:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf4W8w7ogPcM2szRezB7tiBcpxoHHo+A4qeiNuOUcZOcWaSwANwAuAArC515SRJg5pTNc+Wz X-Received: by 2002:a05:6a00:1c9f:b0:578:144f:ad59 with SMTP id y31-20020a056a001c9f00b00578144fad59mr40466274pfw.9.1671506122075; Mon, 19 Dec 2022 19:15:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671506122; cv=pass; d=google.com; s=arc-20160816; b=g6hU4q8VRvO9YqxNzb42VuN3l26Cx484EM0zyF9dBlBY9pKPS8X9K7Bh5WA2AIUvLV DIUma0a46ab9AjaSVLSCvax2iDRHLgs1v+LnPzwcILgMm2TJdZjGHdeGRmFxe2KuI3Ll CsyNn1mK7II9j4fSNXEx5TLxGDD2DQ5zlwtK7tBXQCwotEuBYsYqgL1q8oCkaHOSZKE+ dALX6JINZkWv09A+091wh2BAt/hHcDUMNMpkEPGpgKpQj9+/AbIEQA+I/1CUZ7KnkNUJ ME7EI+fuyRZstfCWYd0DEIE5FQ4TJINGlLDbnelIpvR+SI+wmixqXcmnnDYkOhx8H2cL hiLQ== 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=9h8uKZQTfzm8jvmCuYuAAtG0YH8HMxtyA0Tm6yFmwWk=; b=g1RoD8+1KSQt2IT1m/6DdBd53SEvnCxoDh6dTVATgH/uzNzv0O3UkRjbZrfs5sestI dWtAEg9t22wxdZPingMXFSfMsPofIz7jOxD3rTa4/zRuCgxUBQoVvJSOi0cC6NCcP86L oRAmbT8V+BOn5RwVSD46jqZrKpWuaBiPtPyilc/6tEO6VM83AD0QRqQFLdII67x25N/J OW8aIUOI+PJ3NtM3R7vErumQPczQ9/3EQbK2/o9y7kQRWFRe8VdYr9vKXDftES5Zki5c JfFolb00TiZHTabSgBMKUkafegMzR2OAjzk2aXEq6R3R/SOCwT1T98JB9BMWoQjwUW3r LguQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=XPwA9VPL; 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 k198-20020a6284cf000000b00572ef957b35si11550092pfd.210.2022.12.19.19.15.09; Mon, 19 Dec 2022 19:15:22 -0800 (PST) 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=XPwA9VPL; 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 S233188AbiLTDOW (ORCPT + 99 others); Mon, 19 Dec 2022 22:14:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233033AbiLTDN4 (ORCPT ); Mon, 19 Dec 2022 22:13:56 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57839140FA; Mon, 19 Dec 2022 19:13:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dje3pO7Ux749KirwSq03wfZLA+DO0xyTjm222+CicYINSmvkGnQuNZE/eI4cF7Xocs7sarcg7ukY4KViQi/vs9XLeEv/88LoGngY7TRNrxPCTayWRQH/v7+Z5bzi4a5bastwChu8nyhty5ogDP+8MFW4CtJaxwOmcvE65AIVFi7xiaZEaNnBjFZnt+HB/U/pb/r2r3gYQ3IpRZ9v8J7FHXfDcL5KR0u0CuIQ7NvtQZZwaeaG+88McJtamKih4t7amUG6aXtCfvoRPn3yKfG49mfwu8J6awbC7kjz7hPA0V02N6hek2gZiXT7/SSK9mFecKpgJDo82S6K06WUFyFZOw== 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=9h8uKZQTfzm8jvmCuYuAAtG0YH8HMxtyA0Tm6yFmwWk=; b=ZqL9bI5GlD760PiPuzBHxTkN+5TieOKLaqkZkacIFO1s2eT6EOpyUCTsn6mjv02wiVeOLoOv7IzcYwh0vVC4DeMQ4qdSzKPgUyfINYXZeo3Ym7yhuexO+WWZ6mD5fzt+p5wNtv0sJxVw2C3jPmnBkZCR+Wwm8Y27btobFbnQwL5x1oRC0QCAjUb0j65u2TfPtH75i2wla8krYg2Z30OB8ZLC4bR4cY3W3lljig5H8/fi1IX++yfKOUijvlkSmy/ZZgWx+3zwHoOK/i8/XzmjxKAHcS37+UBBB85hLH+R9tWMeUal4GYCnmGN4iJBRbClW/Ww+jYIp7WOW45iFz/zUQ== 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=9h8uKZQTfzm8jvmCuYuAAtG0YH8HMxtyA0Tm6yFmwWk=; b=XPwA9VPLi8A+4HxQV871BMcZw5t50HFDPQ9Xpl6SmBdMNRpWYkJqBFYsi5J4gukqi6f+DgB+8BUIonUtTfdj/44FE0Qzacds89s5AivyUOyeBlzwKrz05sm+DCEOANDz0WrIxqsaATulZNCxdqqZZ86hI1A2cJpewoCfxgHrEJ4= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:48 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:48 +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 08/10] media: imx-jpeg: Clear slot next desc ptr if config error Date: Tue, 20 Dec 2022 11:11:38 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: f237a628-5683-481e-ab50-08dae2381228 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rh9P4ULE6snb25bnfwZgB3GoIMADpG+1KJceAnr8GI1gLsGEE3f7VCcc3CcSUlvT7bfdhboFr/XEgRmiU23L1XdgafHDEXLpLHUw1TEutAfUWQAWmjYSOnZHzuA0HTc4TUWVeQMo869V+VWK4GKRnxMOED7b9+xNTt5AUX4KzqN+K2sD6aBtE8BAn+JfWYJX/OoWUO98hQOHVd3nta+tL3+tYWyZ+JbyqLXXpkvfWikdsO2720owEOlkili2bKava8tGrS6ZUoOl4wnkJ/29sd9Vbhm3u8ODieeQUWiwmetT9xyaGn35XfkATDWZF5ImDfhL/zjHqwysBNfkrR+rwnOgJ+H2SnxMxRuF835LzfBpVfVWula0/lCBbaaaM9mx+ZMg0wIeA99d/n6PbodriXlxNkyzZn6UR1PISKyHmq37dueDvv0QTBxm4dhp1YwKfSiVFEJUG8KEqv5wkfP0qtsz3R7/09DuuKOZQcgRh/1oymFcB4NsGpirPlGexQ3gbdOTiP4HBxkDI62Nkwnod7IAmyig0f+ETtULl0S/tSX+N6bCjGnpw1yxZGnX+uiZMWT2ou6Y5vN5Dr6ukwE9fkBQw8K3uYAw8ijTDlI1WAF/lxUvZzYP9+Ra54WWDNZFX6KD0YFqnOEp8CBqp6daYUTlIRYYFMxuP3gD9RcK7cD/hdhiXHWdoypZnKkJkunA6ZgUyPyCloRh5+FQjiT7qw== 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2TuSKkFiqMULsHju4dekT8KZydnTkSPsp7H4ZNVI5BL52MHu/6z9SCjn5ksNx0M28oj7poKi4kg9hb66Kyn+f10SuJsoltc5+OotDC59nT3+8SnSrnTRTuYreHS1v4NbgHOY8FgSc+dR1EHfbWjNYIRE6hQbi5WWU7FdYcXxSCIPNejk8XYZ1sO5AKO7bPUGKPU0xzpfW1vP1urEe4IYSFcGICzHpxAdSgbR8uiHJJWQYky3hwbgEVn8mEFIhPNQWM/rPupWK9XwhZDrCtnmDv91/iojH8T3++i29dsg8oTkHzzHVy2x6o/SKl3yqeXOuafY5bGbepuRmKhVVzxiufp5tU8gnXkpgUn+lcMGekU4EIumiw90v+nZx0kdP9u4AXzV8ZHMYtu+M69bDZP1t8qRxG9M+jJhaMH3ETtMyZXRlEA2I1Nx+yy44oz1RXFjlManBjVaf1W9hJANMGp9rUrpiV/5OqGia5HGPxFCO8sDzB5rESE70WNh8ugvLQzUA7FUB63lzxQ6IsQfTQgUwdKDPTPPC1sJKPbjNz2JM9OZlLk3wHESAimQqDSKE0k6KDA04n63rHpmQJBKKApoTyU7YgVkgA5zrnn7+0D99//3ycC8hbQ0m6NbzMcl8GF+3hMY8ooWFu7M6mcjZ+wOvX/rRP+oOVaidbVEgS+tng7Tcx/KNbSZOPDJPYFtZIU72oTq3yELt5IDeZ55h8y1Sxxks8jQz0Vd0zTesmJTEcMGhNzqIDdsM/x23iAK6FBuY5s6y01AXbutvQeqEB0vsg1q3z2nk5+IxwWhXzsGHBwhOkekgNgLhl5gcnAarfoZcQePcAalzsbEQVvKyICS76EfAKMVbE8+mYi9MVd4bh54YKwXRAvVuvwoRVuhvgmZDistzqu51GCBSXTEliLBtjac97YVMLb8OO6fXf1zcUCuEg+4+QWLMdHh0KWmwns2Ash4ZsaOIMQwW75gsd2vkbzlqYJG32SRpS9YC/UAc/0P+uCnHDaweylG7EayUhZd4kaPEB7d/q8HoiJRn15/BDaBhd59vJVeIqNIqdOeaALa2gwkUQt34VSckzS5KltSRhus40eNf23B+Cvdrdmt/mY27hPAHjsiiyWLdHsYnfbozB9G+pAD28NhxW4QHNlQiNBG57Wf3RwVDW0EEI/Wen2TyLuuBTmsfs5UHddWq7ibv6igMjBFQIOtzPY5ZHNYWDBww1zYTDAMFQBw/3HZ/teWAcRfLVAZGUXFGP4zFHSQTPyUaUVKK6FM//tqAX8A0XMOySA9UT2VV0EjsVFpdzmEEBCBNQOBHZ93B78u4YgKy5EX9oxmp1ClPB1zH+XB5aKDgor2Z+UM2jk3U717XuN5I2IILWqtuI2je72OkMGIk6akqklALAABtb/P16aBIf04Ng+Lp8YqYyMuvawgi7ud+CyMJ6mCKO15mw5ZnzPwWfb27+/VH1qwPWj1O1YOZz4GJvvSGa4T3IisQlsRc9Fd+H9en0fS/1NdeHANzGiiTg88+6uIrafv5qbNgzQSvEZ9qRVq7FIzApwg+26faKfXd1RyQ2BCe+h8Uto3BKPY20EMeihlTaJA2TC9lNW7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f237a628-5683-481e-ab50-08dae2381228 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:48.0484 (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: YnmjyCfisowG5MJY9HMrjqHWmuSLBEDRDhMsseGd8rW06p2XMd9GzO/O6tCiRNrawzpO2amNGMoa8bsDJhxjzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1752701203600270085?= X-GMAIL-MSGID: =?utf-8?q?1752701203600270085?= 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 97e61e28c649..7c3ad1ee4769 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 Tue Dec 20 03:11:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 34888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2747967wrn; Mon, 19 Dec 2022 19:15:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXtc8cwVyvN27A2xQgLNRtta/PJuBvTW6+d7xHJOTNoCvm0HrdFvpzRIU/QO4ePlEe7u9oBb X-Received: by 2002:a05:6a20:d385:b0:b0:3318:ab59 with SMTP id iq5-20020a056a20d38500b000b03318ab59mr9506496pzb.14.1671506145272; Mon, 19 Dec 2022 19:15:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671506145; cv=pass; d=google.com; s=arc-20160816; b=HRmx+G2LXLcincAnDkhr+sPVRCU+ip4UdvlsSm3OsgyRFE8Kb4R1IrJ9HDgcIjJ4Wq ibcNl/Rlk3X8eYDUuGQ//hT1onAbn/+7/1WV4EPlo7it11A9Sce2rVLAzLxOMO2ax60e MPmu01HAtiG3o9bh5/I06YnagndxtHJRc3Vdiq3tYPuZadQ2QkGPpCw0am27/VBUsOQq fnoGFvCYFFB6+Nm48/aZ6sEfPvoexAYDW+v8XU6+S6AstBVT+HWcHd5mf/C5buBKmmq5 nFKbazw5Ar6Gkr5DH5q5U1K08IVbOB8UAjIdvs21bsKsys3ZNpLSzYGs1yIV9JaSE2qL +2NQ== 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=2tRRcYWM2F4NhBPurQ8+lVOE3PstoxyoMGzAGY1Gjnw=; b=ZvpxR+5D0E8gUMt7onHR7UPOlKT/h3GgT2IdUMmA6q+FAkrGOnXq6aIK2PVCNtCjMc /zFljW8WfaoDhWDQaKyAzAN8LGXZ5nDoljrmZHlzOc14o5/f6XtvmmpsUpuk7uKcCAr1 45sVNKl2XuRyDAJ6lwSljTQJP+IAbs/4JLdNZhFv8kVk7y+Zfh1JdFC3rXrK7g1T4pbC 8bxXcS8lHnvnAp8GLiNpJlVrDU3GRNpxyzn1iEccPJCaqRgP6Fs0JKaHi0uUlODu8U8v /lomcVjGiXwH1WvKLx3/wGOL/cXfKSabIPf6+CugdqBVodduzoDo1XdteCqwN60dQIrn cE/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=oswAB+2C; 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 y66-20020a636445000000b0045466821a09si13028762pgb.371.2022.12.19.19.15.32; Mon, 19 Dec 2022 19:15:45 -0800 (PST) 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=oswAB+2C; 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 S233119AbiLTDOo (ORCPT + 99 others); Mon, 19 Dec 2022 22:14:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233179AbiLTDOF (ORCPT ); Mon, 19 Dec 2022 22:14:05 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB72215724; Mon, 19 Dec 2022 19:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LLRQgh0kuLQW9ZBpPeu59o6G04ZJT+KeaCIbWw0pJbMjQJe+STOPWZW1jh0S1D5sXBOjjUWx8n4kJ2HL7qhjF0wM4at+tMP4vhgYeCNeYnIf5KZzvnI9AMyosq9DOI40LBd9+/eIPPeSL7OJ+RT4TDBD2Q/FCGhxBzlc3AktZxhg94FybDuz4M1r+C/fjpEyBOxm7q6uyE0NBaVU+2yXDKddgSWJm1up9csOz4AYfdox5JkPc5SZ5i/3XpJOeDM0xDUsyqeWs3K0TDDZWItqUKWqZevKPZPXadgQ5nTxLkFBmXyBs/SHdJfft4WTDJFzIUMjyDpHJmpnEa96iGS0JQ== 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=2tRRcYWM2F4NhBPurQ8+lVOE3PstoxyoMGzAGY1Gjnw=; b=aRxTXxvX47UXhvyBFHmt694yUTq2kyS9htu4tt64EZB9rVcpym9QzLsY9PdizZLuxuRIUGsJoNo4eJAvrCNl92GufzpUHzqCtL7UuE1mm1zDhZiN0o2QczAbySRp0fUrdWgXlZfyvCoa3JlSLMZChK4Xt0H6rBOjgVSURCVnjHszEe7mzCIir4eMK3ydQ/JabiBFByIwIbkxdgA6viuRHQY3tU+SWKrMcic92PT53zXRWf5ir0FfPkYWd95AjbcW4eH2cdbX6YLFqsGezzN5f/7xWEA2tayJXpGsqBDZS2aGpHR1uy04FBNVy/mGucCMiezTaO2mhb4l3rH7w/s0Cw== 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=2tRRcYWM2F4NhBPurQ8+lVOE3PstoxyoMGzAGY1Gjnw=; b=oswAB+2CqFaWnDR8k1Ph/7CdAd6yICqXjlRfvNPWlTG1mXP3j95CyNN4DZocnmzmALNgU1DJJPZreCYDwiJKgUj4fWfi/U1/uiB0m7+7L7opgixnH7ztNfnlaFmb4RnKkM35YExIbC0wmrApvXIpuNf78HC73OVPC76dimOtrXw= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:52 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:52 +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 09/10] media: imx-jpeg: Decoder add support for 12bit jpeg Date: Tue, 20 Dec 2022 11:11:39 +0800 Message-Id: <6dedc442a17062f4fe4083edf47839cf9cbadc2e.1671071730.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 72bda074-b3cb-411c-fae1-08dae23814a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k57BybuyNlmaFGr4T3BkjM9gIq+sdPv/MuL0Ho2/36UcUQz2Su+CEfFsgCUJ1YFKG1+9MRL6UDeiy/TlsXBG8K+2CXuMdP0/VoLCcJVmGySLoucPQfJ3lU+J22JnFVZLvkP4CxWuyeBFyuUNHNkffpXJfF34pLZcvfHfitfLKa6ojt2uDMJs/2F1jDhVloxU4qaWoERAGbRDM12DKtbdXnzM/9mI/bTNPaWzygG4I6LYa0oF/DsHvMmXQZofzAj5vbQm+Lzaavttb4IOimRszccU5gTd/gES/UBPiE4R7KusfCTaiLav2feHGud0ZwM7pCutYFL9aggWzBdcI4zbemc0UlIYU0BsJv6V9WYuqbi8MRtsxKUKhAViK+QymqMbFtdZ0z1QNsn3tdF6eUSFdqEKZFciJYAjFslvSpsi5O/4WLniuL6GSNgV3blPJBmf+kKHi5SyUWWD2VL8FvRMlVL2fgAyeja+foB3kyZDcI/Vi/QiMYkNjznwOH0q86sgYmZKgUwmgGGcKGVU77LD3lXo/dDyAZbmLy4VlmZfdForqa9tRxsrRkyz+Pd/NMByzbMZKZZwil56cKsdv7hwwW4TbFZbr0fxUE9tzMs8lrc/d+VCEZ6wsUzlnwustR4VnCzVYLmCX+a83YmKGzAyhn5rVoVaGawxb0vty8oN3ogva3KShAU2im35iEOkPWffZxwL+ie5bUA5ik0G7u847w== 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZEVGdQoNQr2TKseV78LE0l8QFhmtEvyBgwydINz7Gd8r8f1ym5sgoYwRqfWMZQDsJsYlgxlRX82KLH8XCka7EI93aDnrdPf67OhnjeCVRY9ecWrZp4KKI0OPbfFm/xyKNCrPFSH99zS26RqqUojkZykydsZRjytig8/5u5RhHIByqkfu+WshW+o9rWGQA6J34kDb3KwYbiZjoSDj4FG2Dd6KonIG11HXZzqeRpI+6dYxn6ZzLzQMj2BEEruSNmXBE9xHbzN9NYg7N0vZWGa/rVDBrSST15LoV94nKrSRE1aibwgrp/LCGxvWxgpNXW0chXYKCZ41sVtvJMLs3bVrv9mztslucfAgruv47VrKgVwAhe0rG/kMehr2mmiBYTF74TjvkUjywcZf3oEkEVV+BWyKS9jjI2E+dsxokrGwfmZ6a0TigcKAWSPW2bOBEG5FK+UkposufqFsnE+kncgPOQ3LGmf7kpaOSV0FH9yLZSgV7yXhfGsRoNVb6/X2I1or1h1lqvXkxyHu9v7JkCmT3Kdmu+p3BPXXNA44xdZxtFa/C30iz2p4daLMB78CGSZL6gzjFouAPjiMrWk7mC/OLvSyO2OvIiw0X931+KwO14rFkluVA1ENAsyUlrTUVIQhg507PK7pDLbKKMe6SrJsOm6h2TFteg3aEQ5t0tZ/znFBP295VmzUVafFtT/0zcnGOoUUi41lGn64CAF59mshE5JdtnTDlGbwLb1QmpnFj5H0M+Hd0IkInDUo7hZk5+mYMTY/vd1rGgPCfIRL9QEU6St6yIq/LOQ06fOdN7JNf9mBQ+I91XfTnXn9kBnv9Okc9j3Ub4Q1kGmt0/gmZh8B/E018FAe+nrpahviLx6FJthsjZsg3slxf5UukZAy3e8QwoM00t4W/3dEnVfj9VJZ7OEAoJTkJ7RCSRxegCP8EeClNLq7JIVyTvHti6dXoGMH+on7+VwmzqQRXrAzys6AtyqCqegNAWm4A4Pf9OmFeC6v+YISsAOELlK0C5UIpzIfaMPsCSSYAu35cjmDMrJ4SPriRXAiFkUgumC0f3OEikuT48Tg4hoKYMPORQ3oUapUTaJsVj6+DxX1TZciNbV7pGDitYzajKuC9Yvw7zB8ttkyy+NP9cB5MmPA6pKNXnu4clcK0Tca9KOIsRIeM7Om7Xar92seiSOkHHRiVdlQxjJxcOMOm47mBopeQ48psSoHtJ131rybl6BXvaWgVXwApOpIHPpMxeNAf87TodudnaQcYDoqIZqVTYXqK3NJeSa3ju2Esm86IgU0bKwDvBwIOXiv/q04uE+rYfyHORyi1IFfNPz0mATZMXe2JIatHjz26gSRW7VHc8oJPezl6ZcDygniU7gOGjuZ9lT36cCiqYYM3sUHqw3yHNqnlnAcYlAakAIvvDbvRk7B3eLnFekCniyqC+uQHyYhUw0pDymZHGD9hDss1WaSoFTDrJOCZcJq2wVuKGw1g9Ef3Lp24fmePPi/ysFXnckwvkdPOdcU2YwIBlNMuAq3n8Cx3R5JoLtLVyTBme9tCqNNhd2a30pgv8rqUhS/GY6xjUbN4kNgoaegUr74YomfYaYfMYhRniCK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72bda074-b3cb-411c-fae1-08dae23814a9 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:52.0639 (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: H7MWaS0FP308LOxlgdeLCznu7+AHmfid6MexF/S9pIN1Cw2gYo88AUG/DfpH0zD/OrFEsky0jUj/rrcRCdVj6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1752701227525998158?= X-GMAIL-MSGID: =?utf-8?q?1752701227525998158?= 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 7c3ad1ee4769..2dd52d593764 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_B312, + .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_B412, + .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_Y312, + .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_Y312: return MXC_JPEG_YUV444; case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_B312: return MXC_JPEG_BGR; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_B412: 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_Y312: case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_B312: default: sof->components_no = 3; break; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_B412: 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_Y312: case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_B312: default: sos->components_no = 3; break; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_B412: 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 Tue Dec 20 03:11:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 34889 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2748283wrn; Mon, 19 Dec 2022 19:16:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf5t/wZteFtxWIc1B9HR3nufkOLuQ/Quv95OG1qMTq6xf5OqpZAeP3SFEVYgnoETtcHSdUvx X-Received: by 2002:a05:6a20:5495:b0:ad:d182:cd50 with SMTP id i21-20020a056a20549500b000add182cd50mr40688134pzk.36.1671506207464; Mon, 19 Dec 2022 19:16:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671506207; cv=pass; d=google.com; s=arc-20160816; b=lb7kqF1BaTS98ywQ+tbIp8G3ikZc/ty8DWA74MVONGgam65tzREFWssNMcbvvOZbfa UDW1fCLJXdabBy3XDKQbl8ykCqExCxqBxrAYJBLWDOPxgGEd7MI1OUYWKpRhz6cPwGQS ezGwAqFhzw4nEXXaqgt816uQmPcrSu+AznpAuFTjCTqhN1If3yGxF2FR3Oc3+dByt49T xeKvQ5K3yJqYOozeqXcebEBiikvwM+hE1dVryUaB5TrXsNF5vv/DBDi55H7I4JQdVYC1 uQv4/PR/D3krzT+Ma2F0JxvAs7S0CwB4HxwQhW8vTxUrxklpy1+hNFYLg7YbCqDDmJti yddg== 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=fXsCemDqwU/BGmmJxJFcHJwkpFGICbPOawFu8XCOI0Q=; b=dJF/E01lY/hqTdkSX3PQlSJaPRF4+zsSRGV4MFclnx5e1rY+ptu5iBGhdXkAigosEn W3XkIj+U5Etsr7w6JyrNLmzrlLHbf9NcZflGxibbcXzev0IS2nYblgCuYHAlWXdOmtfZ i4VJQP7s44oA0L6S+nSvnHPCHYOtiP1uQKuxFlqGA5aGuop12BIt2nExyvOx4ivzugUP st4AHa13raa64SfloYN4NEUTosb/JeEg7TCtmZwYJHaI6EDFIhRTbc21ci/9YF8VtirB h0kLEfqd442vJSXV0JgimkQv88bOOBC6kmrMGHc3BTwdc11BgXAVSXv/v5unHTRAka8H S3lA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Xk9aqCmI; 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 135-20020a63018d000000b00489a4cba34fsi7019845pgb.21.2022.12.19.19.16.34; Mon, 19 Dec 2022 19:16:47 -0800 (PST) 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=Xk9aqCmI; 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 S233208AbiLTDOy (ORCPT + 99 others); Mon, 19 Dec 2022 22:14:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbiLTDOP (ORCPT ); Mon, 19 Dec 2022 22:14:15 -0500 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2078.outbound.protection.outlook.com [40.107.15.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B3D13F3A; Mon, 19 Dec 2022 19:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dCN9geygqwDJH7S5iqlTF0Zs0E5KG5itLScOoaRYpz1q97CCBaY4SK1XsF2klCXUH6V6Dh9rCIZNt9kinZ+EORndu7Ew4KzIZJ5oS1RxQkfwlJfPeFCSs06b7moikhMnMDAXBjkE7rdrrX9oCh9oosYAoW86dbYabGeMO8NhbxVuLwRNDWgN56iJHpvfJLZLlT26jegqtpzy6yUZvyiVl5fXKHleJfVtFS4If1VFq6tNjKA6YLsALv30rWUKtcbxiLRiatMXtqIRLd1uEVQrnDytgZByAPO4EBKYqWyRnsLmO5C7iG3Q1tTrZZO+TPAG63aXl4d/pM8EG2MAIatMUQ== 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=fXsCemDqwU/BGmmJxJFcHJwkpFGICbPOawFu8XCOI0Q=; b=DJYEtyenD+8IWTFglCjRSbkqF0BuX3jKCEWIXI0guI/9ygIo9l9cxuynUmDrjP/IGnePfDkqiuG1H6pwagXop6XMOFBGs8FaS4iWxW2oMnqYWW5465MCTYXCX4DgSv6zAz23MY2W8woJkCqnOq24HKEVv/OnuSSzxV4+RiufJVY6EC+nsbZFAJWfEYjTTO4OJNQxZ9HhOvQ4cZHLTl+YtztqG5Y/qSkiC89wx8ah1R2GSxNnxhRybn26/OYJAq9PPxfrjT5PlHdCFGmj80bz9nf39r0pi00O7/sAAt7+fVyEENPRNyu0aATq3MU63pIYhhKKRpbA2nCspo2T4obLzw== 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=fXsCemDqwU/BGmmJxJFcHJwkpFGICbPOawFu8XCOI0Q=; b=Xk9aqCmInH56jyfxJnr0zQ6L739AB0j2xQKJlgwtanowlhJlee1PQB+nbe5Of9IGhpCAumd8cWgNKfi61ySMIHLk3hBo5Ctp6dBmZs8mpKiONd31E7mNvz29YV+rwknPOxmBvFW72JHL6u7BRv2abyEPB9RSDiwbfwRc4YsLcvw= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:56 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:56 +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 10/10] media: imx-jpeg: Encoder add support for 12bit jpeg Date: Tue, 20 Dec 2022 11:11:40 +0800 Message-Id: <70d70246c065448766bb8d9a8e11d7e66497a042.1671071730.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 0aeca902-d792-4bb8-c314-08dae2381702 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j605DDJf98UcJQHJlhCUnm0ebrTC21sSgXLAtSrZsJAGrSbnyMbX48+kHZKxAsroUuwP5BCJfFc/275G86TC3Qa59juFtMhTOF3a9mWht0UfgNd7zViiip9h0JdbFbz8dywrSbgfiTNg8yC55sJsgQWA/mn8sPbJJDLxw6lv1y77yD1t/XEbuL/YEkRlDnNZdOlHRknifDP524cp/cskU4dGSYIFK/av5rDHRN0eJ2HmmvWH9gy0V+MNiCT/Et31WoIUc11Q8ErtPA3AE4z6+XjstdgwhQ7IIgKL7vglfc594K3s/SqzlLt8VHhWvGaFpHPGhGFruzkyLrlmk+gzgqGIKLCob0JQwVmVKOIgt4ygX62fQ0pLVhgWmyjenPX1QchqBjbfvvO3Np1qAhg3mxDZDiQSlssmcbVNRxhLIP1gcJvMF9ZBjK3HC5vqGLT/R5mNyvlGYfvcDcBf++8jd/7GWNlTxy5ThpIglZimVbqLx7tmE+rwSCjIobaj4N9ER9eDSQF8d9TtCOyctdAh/9424+zh7+yPnGtRypb93okG8jBaY2nMPwR4k09WoA+hqxDe116qhX6KwJDXImPQ1I77m/c+uawHECCkZmHoClwSxniFMs1ShXwcN6VICi7JPsXyQ4wgBoZW4NGWlDdNk/w3mM7Qvd+Fpv3R/LzPH+FlCvJ36h661YBfmqx9Ughuzp3cWSJb3I00GabHz1VKVA== 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(30864003)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DermT1WU/1uxo9pk2Oz8QcPA+k8C/BBL4bikC9YIj2/ImAsS2ZWtnH6MyAcrotRSvK9XeHaYGLX2osA71Zobaudzvpz2Zo6OekzHbLIZuZ2cajuYELFgjxnwOBz0xk5tuLsRhmX6xTyCzEZdovca+WaIxMDlqeWAY7fRo9gDay8xCuyxZoE311IW/fwsWLva9rVfdZYRHYj8tottezhlWEy6VgKXvc+MYxPAsH7mV6B8hU6/rJXCZJE26kvCI4TTgxsNGvw1voCsN7he8ofJeDORzg5/JNpPEb34Dam9Ci+oNSdpdfAOXFPQscO9X1Ja12fF7lXjTi/uhwLqR2qwrY3UWUd9h/uTg1UccWr+NI2oFKPX6UuSM7ov/EOg8mqO0d40UuzOt/Nykz1bTPl6yq3pRDpz5W3dKBvo84uyqVAyOLP664d3oj6WjiQrX86RpbgUqQbxvUefJguHNKs1JRbCHZsrtOdEHE87venhr2rl2QtZaGh3eLCl0MBM10XPiBpezylomrawugDl5UwBfNYPXCGPXOKBo89KiavWfXLimtyqW22JZdqPD899Jv55tqfB14TnP8gbAOnaR1x0WnbvlXNAfkPkU5VU/S+uqvtJHcF5Pq3YYh5LAONBJCfz8gTP0dkiq65DIXDnrsYCVjWVn0xTpyjuLvfFjTuCjgCuLzvW3HCJUv7OfrqYv2D9pa4WVoUNtkWstlz/JFKDLvz7CEM/s2F/dr5d4lEFQ4QPX9zOnhuEd4NPRBzst4heAxuAItQPSegxRpZFlWDJSvfIeXsz6KXgDthOUKE5jCkKDXMPAnwqdFGah3VEt+Dfl6iRiRz9sLfiB8NmsSzXNk8zX+m/n9a54sQkc2vuKXMRjSqgYR05Ub5cfTiXJSyN+RNOR4stKviuY33BBnZLNCNCjFad3oGmuwZvYCeBybzNnKKzXZPDuNk+/Pup8RnU+7Eyq8Hnpr0o0qfZZGXKX+t2m78VD3ywz5LocTpWNibhsCCTE3x0u6HuGGXgjXoLJDq6WO8HNNCMIHi/JoLXmHpDJJV2fhpxzT/AyHS5VUUIPDnO46UFMImOkje/09CrHCcz+J68jwlYCdbt80Ois9exLNh1UV5fYtFi86w3nLYUCrmOjy3V/HNZIxEZCnbaUapoGLr73iDHhyaoXUIv+DgOsclqKtU7a4dmVLkteK2g2/6YbAyafBZzNjiUQUiEjcYNTeF17Zozu4vNnFt2CF6KpiO4JX4D2yMJthgdx9PRDb5f/dM+ZGuz6AfIUHikBgmiSJmiAMO8vEBa3rk6TZSCuBRBbI48BCMaduegjU/SE1af+Dg7sjPpwpHb4D7fpFgBml9dJfXRVqeuBnFZEUODYw9i52AsuGcuv/JnXY+kkHKu9WUMImynvyl9GIU4keknbi7OoO/bqT4Xp/BAIt1sgzDQnu55X7Hjqu9tHt83gEbe8aTlZ4beM1s2053wFzIYtMRIs5Fpjxp3RqCyDSHdlKa1iowSGyTcLAtWTFc6l10syZCWG58HUQHDtMGZIOdqtvzdH1MVNGya5Hmrx+geIELCM1U0fZDbHcFos/3+Ar669CPP/SxDgdp5aFuC X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0aeca902-d792-4bb8-c314-08dae2381702 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:56.0793 (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: ZQFjiHUbbRgaSacJ47A7Xr3LRjEp93PNktrKfKWL3H9mxNqKRePZj0FWWbDCHM9z6PmaLshOw1BGOrFVwIQrBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1752701292900519666?= X-GMAIL-MSGID: =?utf-8?q?1752701292900519666?= 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 2dd52d593764..f6f87970a6c9 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);