From patchwork Tue Mar 14 10:08:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13173968 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FEC8C74A44 for ; Tue, 14 Mar 2023 10:10:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230089AbjCNKKd (ORCPT ); Tue, 14 Mar 2023 06:10:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbjCNKKb (ORCPT ); Tue, 14 Mar 2023 06:10:31 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2058.outbound.protection.outlook.com [40.107.8.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D42690B60; Tue, 14 Mar 2023 03:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y6l++yAe2opTeePfaGjGslyRoyKJ/6gXViL1C9uXfCCkTgm1Hq7lN3ktCBUnX2F9KtNBP6FhauF+INQQgm2WXcCKdU3e3Y67Sp5NjA3fGd8jsbt9tG+W68Qha62vdFM8Gp4vml+C18WjtK51pRZ7+uGXYpdKuopXcUtvDshovT4UdwKfbP7uSl4sAIqWhHEBuR6/en2X9jL67wMgSM4APc/pMdQGrBfhiXyJIMgTudTvrwiBtlthq2gGiUu4sPpfySc2aWfn99ttIyGRUiiTgaaKE10ikXa/tQkV/XobGMB+ad9y/pp7LyLxBGPVNkz9URgtQJwpbmeFXUOaR6atWw== 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=q1qeezMggQrS6VABFD/LN4woKCcPMlArIcccd/ztvnU=; b=VII5upQx7V2n89jfBX7t/FoNhqZ5F+4FSKZP63koV91MVnyzD8S7eoNCen11aYoEFeMkcJ6naoKOXiOXwb3TqQCn/eCpPgT8O5+ZeQTRRq4dJBDiMfhO0nZ4Rmz9VzCTI/JLyJ88bumnr4hCaIlD+fF4aghx+BlWDaXTcnxepkASFdUiSRKdBDNfgwDDlC2sFscv2z5++cyeOMnZR8Phz/K0iv4GxzQLQpLoE5K34rd/VvQWrf3gaPxWsBQoCDTnf1Ho818nkmlg3EjTZ733sV0Som7Fpp71Xlw8Uobxnh4MMYJqOIJPTOQKUs3QOnCEvtsT/lPYTLgb0uWGbmtvpQ== 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=q1qeezMggQrS6VABFD/LN4woKCcPMlArIcccd/ztvnU=; b=KMJaT9kbw+pHvcSnOROz+A6WRSZvT1UXqwSGOqzvOUDwObOJN/D0DpwQOTlFmsHJ8FH7Qt8nW+h3vlO4jXNaRhv59E+z2LBhicA9jgLDmIre6AIrwkM70B7W9ZjRPMg8C3FK7C7p4eTXtzPqtZG10JoDDFGYwoKOdlCv+5SkRhA= 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 DU0PR04MB9346.eurprd04.prod.outlook.com (2603:10a6:10:356::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Tue, 14 Mar 2023 10:10:02 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 10:10:02 +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 v4 01/10] media: Add P012 and P012M video format Date: Tue, 14 Mar 2023 18:08:44 +0800 Message-Id: <42a8e54f01ae62a36ca51eeb6652cee91baf20f3.1678788305.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DU0PR04MB9346:EE_ X-MS-Office365-Filtering-Correlation-Id: 928062c0-6185-4b6d-890f-08db2474467d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vpEHNTPU4HQF0mzIyFdWm5kBAChqgCMsJtbyDq1+0MEORBFnFETgIClvd1ai3lYbdWzDYFpx3K1zaCfdXk4sZNANiMXIDbXVfrQEZyQCDa1wOts40KoSrbYmQTZViNAO8Ee89FPRBpbU+EqCWvo2YSm1gD11WbAXPL08uhXXNFMNP/fpxn3rhe+l0OubkBIYxWwhlSn6baaVcQlCSYLbHX5GGI29dpkEHmtExJ7cfFGbjDsRHmhBoifCZ2gWE94sOCYJv3yr6H/GTfKmJXpKZkwBieWvegqJ6So2tlAq5BurBx6bLl+UOGiS+hq5otzuNp6CioSQo+btNoz1YmmnsQ9GLAINEIC8RIwmy1E7uqCTJEjt/LwepJARIvSzJIADtOTqCTtZIKtqGd6+IFTxHIPuyy93PKMzhRxnTyO50/BWQgjaaWI4GJ5q8tPoag43RwBD2KrEfZJvhSeuEglbbZVdeC/pYXTxYBTOaOj8WMLDlbFI7LunkfRxmkaImrC4D6ravOUkzFyHAXQrsV2TKE5AJfTntvN+aqlR7NDO6wLK8+rkBto8ycaV7ppK19rI6Ga9infDb4DWmpwNl5d4KuPMQMjtBqH+DP0TpgO+n+BYDgHFIvTRteC4xmWq3dFxNsFJcMem/49BZ5FYuAnBltBqZGraJsM5dGoAQp4MsKEcoBpXi6pmRRKgeAcmPIlsTxvH0JkpdCI3RwtY8HO4hw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(396003)(376002)(39860400002)(366004)(346002)(451199018)(2906002)(41300700001)(83380400001)(36756003)(5660300002)(7416002)(44832011)(66946007)(8676002)(66556008)(38350700002)(4326008)(66476007)(86362001)(38100700002)(316002)(8936002)(186003)(2616005)(26005)(6512007)(52116002)(478600001)(6506007)(6486002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Xjxd7BB7ov8e5M70GN2fKOwYtuG1YIG3JxR4Pp3xKPriuWpEIr2xVuhXDdPFmy5HqMTfWkXQIebG8W7gfwl5jeGk2msqXk5PYLav6TTEnya/1c0geME1txelbP/mN5VgoNvS0gAJCyI/EQ1Vp+DXXpn3gA81dgVPkptqyVMIp2cBXGCaByoLJ0XAb19tmt5ZgmOrGzqexiESNizGgGDZXChvXW853dEjlgv6Um0OmGcsPHygjg+VEKVCjQySdmOOvx0+OnTDuClf0yx7PPeox/LYQuZakBS05uvDQrIJ3i5JjSuxpj1wdcu3+T2wEMezJDKu/4KsQaUhKKKrN2cBllXErzKYqfu6RUt7NexNeQV8GRgNadnDHCJ+4r5odtwKN3dKRULVZzUu2N4hYeKBQGABpE3Nihaa2IDSP0y6OfQgp+TgSZtd/L3m9RA3ohXW+o0zbN+XEA4SU54hiLInURbM3fQyNUhTXedsuCOIqO4iQ+pxzAMFqYqN3A8L8wHZT4xdx5uMrJCpblueuWyUqY/d17LHA7zA0L6SROjJoJbjJSGZvmsjE0mLDugrWeIpSR/HQLEFmJltClO9+SufrwLZa9GKszV6R8Wg/VM3JKeIdiNwXLnoAV0wP2/CYNvRWkgFvy6QMVssnr0zLdEway0amZ+3f7v9fUMmesvEQzbSKUHcbEZR3hregucFM24tbpeUh4VBljNNgTLU4wmScCDLoudw/ylJVC5z7jpF9/+3WyZnDsWiAkzwMbs8j2s0dgQilGTtKPHDkqaGBGFN70bg57LX346yCAwJZymMIXPGN1QSxtXsH/6Fe0PwZhetW8iPn31GFtRxVLLjotMk9htKDPL9eLf2EzDqbywYwI9SVWVvjjRMfL/+vPbcmTYPSJrQlxOw0+wepjLWVOLVJ5mbhBOUnsKT2S2IrPjYqcoZ/TCUb9Oc62yD2RmaUV8Vf2wrtUNxYOeLuMsA2/84s4SG9ThpYZP+rb5AQA6565I3mG7JtHMKsfPF3q63DgnoqCclPqeJvTQPH4W2NoNptNBtOF7BS0Y4BZHfrrvAYfQmCWMf5D7yzrAOoIRHsY+C54JhmKQzVD9q8cNyIvCKy5/S7wsj0isc6jSYhEtNunb/BrVDzzFsarTvWjfUex+SsVBLW8Xl50k4NIRkYFANn4K9v4vF3Z7W+jlk3qKBAgMGqEcbV/lFCG8b3YxXP2NNP9qjS3KnkfpRtyg4pAur8lhZvXpB00lpi5LP5Ji046Zh7CjxMLQXr7SQ41ZqzAYndlRjMbeBKCjAq3/74pXnNDGqmkXgeoMusnPfUtAmygbQXloTH/cF3PntMdJcfCA/HQAkgHjTh8u/lPe3fY5yggjn6jkpc7MOxt08lNJKNSDqtwy/hCZqtDUWrQRDTSJ/vjLZNMQEagr9zXKsjeZhdFC+bzcdr/AL5+4DXxSvtoTVDs39hL30HJ893Nqx5RbZnIn1t88xEyQqLHbyxG5RsZOfZ4IWUHeIT/sJUl/FkrDItWe4ruGcuBkgH6EXCPgds2hJd1MoWWoAhzU2tyxAorixksJhmpJLyOHnDnPHFSs2Y2nSHpJhbWG/m0iZDUQS X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 928062c0-6185-4b6d-890f-08db2474467d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 10:10:02.2683 (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: 9Skuxw37XbfJ2jngkbzqho5Wg4+POjSaaHsIB2LNodctw4EeTVpQ9MOUQui1jdlYY85r6wc1FYkDlKCY+NMsAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9346 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org P012 is a YUV format with 12-bits per component with interleaved UV, like NV12, expanded to 16 bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. And P012M has two non contiguous planes. Signed-off-by: Ming Qian --- .../media/v4l/pixfmt-yuv-planar.rst | 94 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 2 + drivers/media/v4l2-core/v4l2-ioctl.c | 2 + include/uapi/linux/videodev2.h | 2 + 4 files changed, 100 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst index f1d5bb7b806d..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 87f163a89c80..6489b67babfa 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1352,6 +1352,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_NV24: descr = "Y/UV 4:4:4"; break; case V4L2_PIX_FMT_NV42: descr = "Y/VU 4:4:4"; break; case V4L2_PIX_FMT_P010: descr = "10-bit Y/UV 4:2:0"; break; + case V4L2_PIX_FMT_P012: descr = "12-bit Y/UV 4:2:0"; break; case V4L2_PIX_FMT_NV12_4L4: descr = "Y/UV 4:2:0 (4x4 Linear)"; break; case V4L2_PIX_FMT_NV12_16L16: descr = "Y/UV 4:2:0 (16x16 Linear)"; break; case V4L2_PIX_FMT_NV12_32L32: descr = "Y/UV 4:2:0 (32x32 Linear)"; break; @@ -1362,6 +1363,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_NV61M: descr = "Y/VU 4:2:2 (N-C)"; break; case V4L2_PIX_FMT_NV12MT: descr = "Y/UV 4:2:0 (64x32 MB, N-C)"; break; case V4L2_PIX_FMT_NV12MT_16X16: descr = "Y/UV 4:2:0 (16x16 MB, N-C)"; break; + case V4L2_PIX_FMT_P012M: descr = "12-bit Y/UV 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YUV420M: descr = "Planar YUV 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YVU420M: descr = "Planar YVU 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YUV422M: descr = "Planar YUV 4:2:2 (N-C)"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 17a9b975177a..f83a9d1210fb 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -637,12 +637,14 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ #define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr 4:2:0 10-bit per component */ +#define V4L2_PIX_FMT_P012 v4l2_fourcc('P', '0', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* two non contiguous planes - one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */ +#define V4L2_PIX_FMT_P012M v4l2_fourcc('P', 'M', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* three planes - Y Cb, Cr */ #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ From patchwork Tue Mar 14 10:08:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13173970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B7D7C74A44 for ; Tue, 14 Mar 2023 10:11:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230215AbjCNKLK (ORCPT ); Tue, 14 Mar 2023 06:11:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230141AbjCNKKs (ORCPT ); Tue, 14 Mar 2023 06:10:48 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2058.outbound.protection.outlook.com [40.107.8.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 664609926C; Tue, 14 Mar 2023 03:10:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dQrNKCvX0PERvx5SjbgZr0vDAx98UXLUtAwUVgAhyUEGtDQE/WOsHSerC1LIHYPDDqQ9HZpDMwjKnrkuf/vmOG1NeLZzhvcACN9tZbgCYSF7zVo7/Rt6vVLq1G41N8lNbxmkj+j6kpiS+Y08mAdh247HhsPC1Bb/VfvO0tJ5J3j9Ph/BSVtjYvnJmQE14NihpfOSAspKtZqWpYNvQ5gbgO30bY3ahb7KbB0b7zc/Apuh/b29b4JC0RIZ96NjVEz0vSuIibuQVWceWS2swyvMurmqPKFL+ezbOullKyLxbNlDN7RLIuLx1C5oMQV41mJFxpJ4FmmFrBy1y/pzJGvEUw== 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=HrCBHE/Vo1gQsJNT1K4+pi9GaKVG9/ECTcSLZP8Gt2E=; b=eNf/BqNAB7j4qysTaTzLFJuf/Uz7aoQFsa/z/qmUqgwVvrYYAN72/VS13RJlIpbV5M+ZslbnhFC1Q0PsQZqWm7Lyw2Dsa8tsROCVamFni8hnM0Usf79Z9h7+x9P+b7dJd8pW4cfnx1rVZGQykToHW9JrUdypGPh5MWNRw3vmpy9QkCNRRCBbofcrcUcGS7/sxUX/Wy9Ur9OOj3DvvXcIN/QxPCMgvPny+SeJkSfkzbjm0qDV+hfYFY5Pzt7f+f39xUkn5BKVdACTGPWWTmx819ISOuDhREXhSXxEquX6zqm+ly5J4wqZn34XC/RcHsoPcF6LpjG7iDcV843k6mDbJQ== 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=HrCBHE/Vo1gQsJNT1K4+pi9GaKVG9/ECTcSLZP8Gt2E=; b=Fy4qs7NNEJt2KCVUBnIPxhhYrL+KOsz6UuKzuJTHuXcSbSlWuz55mUPfRF9Wxg7/BeNfIgQOInUYwgUMY66BnsAQoKWWiBgePbRUW/wScUXI04stD39tkyieefQ70gKpPpIBuPSxF2WyJ+tOKkzRSHAs3no9xmMuTaTSbZ53zyM= 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 DU0PR04MB9346.eurprd04.prod.outlook.com (2603:10a6:10:356::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Tue, 14 Mar 2023 10:10:06 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 10:10:06 +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 v4 02/10] media: Add Y012 video format Date: Tue, 14 Mar 2023 18:08:45 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DU0PR04MB9346:EE_ X-MS-Office365-Filtering-Correlation-Id: 04f4570e-a256-4939-4d72-08db24744914 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4hwiunJkfAxhTDyn/j41yHNwMeX1Vo33h9MZll+jXQL3gCEcHukBRHXzypknwhO83TwPNdAnu+YYTcKvD4cNnAMfZajA2OXtCUyK8PFQCN9nWSHNs4lKqvJwUBNllaNAeHcEiyNwqYhy9nUsP2PFW5tBMvyd9cCMZ00hHxmDgPdl/mq+R5EKKN0KL7b6uvm7yFzfd9TGLtkJCakM4D8G1gu06BJ03NmzvJf1U1eKfnRVdw19Qh0IGPpLf7kdA8D4oCzbJKABq3gMLizaKwJBUSx+8rohvPnMD7BNRSyyp11xSuAZ/BJjOSG7aI0DEB6rd/NdDP/ExvSrzGo9N3Qon+J3XDjknXMdkJgly6CAqxKj0Okj8HRzdhn5TmhMeZ56Z1ojzj5rvGyxzT7bvloc0RtCNbZjgkvZ1Vbq1yqZ5Qo+AXjmIKXPptJPA3Bg4kLR3DJ20V1dsS7X7329oi2Jqi4QBrwi0k3uCT2Th0eW1ps/dZL8CAvZ6P0Zkw9Ii4kVmke4bi9Wx80AvvMF9jjhHfHEAugk3TZLwv4FIL86Om8PxORYn8donAsftkfjxZPnDZ3yNnLsjCGwHzNKP+PmAnPMqZ7V3mIGEYj2YzmEawjZEoiivEFCqu2mI6vmIykkttaHGzynxe5uB46bgqBV292ClPYzmNbcXF/ECjw4IkaSUDRm6pPefyY1hWY67oejnpISjF826lxQaqRzbs2/OQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(396003)(376002)(39860400002)(366004)(346002)(451199018)(2906002)(41300700001)(83380400001)(36756003)(5660300002)(7416002)(44832011)(66946007)(8676002)(66556008)(38350700002)(4326008)(66476007)(86362001)(38100700002)(316002)(8936002)(186003)(2616005)(26005)(6512007)(52116002)(478600001)(6506007)(6486002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MqzedhYl1R/QqMwT0hMWuhoimEUu4d4eZD84towf0FJcBa1W4nv86ipxRZ5lw7TYsizZ5/f4piYIi4VrXfXlQ8ixtIi/NiNhjukQ/JgsoqMFHw8YcjsGCGiL6ufFpTrYjzaZMtqB0ozBP/pdARQrrR2ATXkov++wOTUQANJz9YsD4c6RT+6NxMYdBFixC15HGnfnY2juljfgeIWbYswfJ0yUc5FMREB2i0MhHf3FWx0LzLRBlpeIi7oI42YLUHSDoUeuey2LhAWdT4XTvwKtBiiPhPj+InNluWdWDJzEG2iYQsx4zQ0O0ge29XrJclDkOH9AZUtD5p3+A9nG+/fArQTEJT7W7kPFbTArrdAaEa0sfJUM/XE8Z2t5ZYgB1+up8+Hw9s8D6wfmhQLsnVFTrDz1bNryz//SIySxWbu0rwzlr5qtsjt56W2tUD0We2tw7zlZnVzNCeujqnh6BdDlA7sPZnhbitv9PjcqWePgOUqkXmMEYhzql1OeWa5AZdd6d9gU0JaLQSdPBTA/2ndX7CrdrI0kJIP1bgnY1C8kCp3nGDzbAG+7/vsCY4MXObcPC1ldJIGTONT7KJBMkjHjP5EHRnhbXHnEu6ys4KZCkNUe6a5GEteN9uhZ5ZMCw55/X6mKEBr6a0pfsrOZ9DfOaGlgnkxqLQI0Mg2Uh+RqWaTs7FaLDccMjglYy3Gm55APz/x4ZCE9zHEZppvEsh+gt6Kstk0V9LSzLi3YeGAoNsEiC7Jj3dBDFYHWldKyr+ZEkTbhvT1SkotGQmA8uJJUfzJmn/x45+XmzmHkpuZSaz0Y/4+aprIx0lwTceMD+snvZvb/nhqArnpVSK+vIUPD7EJe911o23lThaOCIEmskBfXkOdwVHantj2AkQQt1vH12UKshw2En62OqUN/1ai6Wry6FgTtWyqBtWN+QSBGsskANBGkC2ZaWfXsAtKi7r03bTTMZlUAkgx57B4XhM7y4Cdtjd/KALJ075BywhssxyWMNcjeAF9VkJDhOQU0bWsnNG95maYCDDmisIUlaGtV56rDR/yYmQ+LEFuLMM8IaIydVth5dPTUupA0PXUUk4aC5RxeKpJFVL15BkkwBXNFnElFNuRw4VgC94Kgz1HLmDBb8mTHX7M8hywM86MpynVFuDXl7sXLC/iPa+WLu6ziqkiA2kUgf1Jm7cSXDO+ctZAkzk3lpDpYxpqDfllx55D1GoM8T/blcApNKXEpa6OQjKHi/O9IQLocw8AovpvLzNmiO4VfqF9S9eAZyyHuJjqlbSqIPeu14THGSDZBA6U4am1/Q6o3SwK/pg0alKBN+ykxVvIEvz7hCOW04ZTPbxIbaey2wZB0o73DZk3LKH4JZ7Rd8B0D9jciEuTo0QqOpQgyl/IDrgNE5BOQhtYNcHyIroGL8cvAcU1tllGMDuIXmoT67MXdcaX1xPfGEHjCYdYx22m8YY8vwgL+S2jBiXYTy4yY6vUZZMTXpSjNFPqopVHH+exJFhjB0kCDmcv0/Gba0Vyk7a2OTSv84sswSm/SHSurMNgCFhO7ri/DcUUwmqtYbDoDEmfRZv03yP54jwyxY+lCIRNuGiH3ruTAX2mB X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04f4570e-a256-4939-4d72-08db24744914 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 10:10:06.6586 (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: 4auQeJcWiEzdHoQa5UFbRJZ0nv+AoE6w6oVB8kTkmZWxmkLm4fGO+wQS5xB7zC22Ftqmz9eeCgEZyfx/wHT2IA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9346 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Y012 is a luma-only formats with 12-bits per pixel, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../userspace-api/media/v4l/pixfmt-yuv-luma.rst | 15 +++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 17 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst index 62078a01de76..7888151f2cd4 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst @@ -103,6 +103,17 @@ are often referred to as greyscale formats. - ... - ... + * .. _V4L2-PIX-FMT-Y012: + + - ``V4L2_PIX_FMT_Y012`` + - 'Y012' + + - Y'\ :sub:`0`\ [3:0] `0000` + - Y'\ :sub:`0`\ [11:4] + - ... + - ... + - ... + * .. _V4L2-PIX-FMT-Y14: - ``V4L2_PIX_FMT_Y14`` @@ -146,3 +157,7 @@ are often referred to as greyscale formats. than 16 bits. For example, 10 bits per pixel uses values in the range 0 to 1023. For the IPU3_Y10 format 25 pixels are packed into 32 bytes, which leaves the 6 most significant bits of the last byte padded with 0. + + For Y012 and Y12 formats, Y012 place its data in the 12 high bits, with + padding zeros in the 4 low bits, in contrast to Y12 format, which have + its padding located in the most significant bits of the 16 bit word. diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 6489b67babfa..2cb485643562 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1307,6 +1307,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; case V4L2_PIX_FMT_Y10: descr = "10-bit Greyscale"; break; case V4L2_PIX_FMT_Y12: descr = "12-bit Greyscale"; break; + case V4L2_PIX_FMT_Y012: descr = "12-bit Greyscale"; break; case V4L2_PIX_FMT_Y14: descr = "14-bit Greyscale"; break; case V4L2_PIX_FMT_Y16: descr = "16-bit Greyscale"; break; case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index f83a9d1210fb..db06d4c4f008 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -586,6 +586,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ +#define V4L2_PIX_FMT_Y012 v4l2_fourcc('Y', '0', '1', '2') /* 12 Greyscale */ #define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ') /* 14 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */ From patchwork Tue Mar 14 10:08:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13173972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2F6BC6FD1C for ; Tue, 14 Mar 2023 10:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbjCNKLo (ORCPT ); Tue, 14 Mar 2023 06:11:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbjCNKLZ (ORCPT ); Tue, 14 Mar 2023 06:11:25 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2058.outbound.protection.outlook.com [40.107.8.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CFE097B44; Tue, 14 Mar 2023 03:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZuvkWnompa8Ay8RbbGW+aUMHeArGyTn4XwNn67/lSlPFIRtaMQ1szrQhXFAR2JQqQwNzX1KzQ1qgH0977MY3Vm5UC9Z9K1JkskEke/agSAG6iMI243PQywq3PMLXl84KxONHsTTzEH0VIHA2Dpuv+k/GCtKi0mJHNfCiVihwxEmMyG05LChkMiEwoAjDFEMcfw0OJ7+K+goOHQwNekY1Q0wptpMlELLfvrd9Kuyv03F0CZRWO4l0ghds5UFsFtkbGOAnPSqO4AnVgnhvgq3gJBn+ncdfC37OJlRWUQS3WD09CFpOLuW87V6X8joRiChUO2Mf2lL5JxAG2wDcgPbSmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z7cKeN0lTqGsO4nqj7pO/oD9FjZqKyVVa6nQ8BbK5Vg=; b=TdFm+c3lCldOEZfb5LW48/4mbWsnBNm0QQtzBzT618rxW1dXA3JGJFvGl39dxT/Wlbja8+ZNiq5xfdNmYTfPJTWPJjKjKU6QKacz6Tj6S/sm4qNvm90TJS99muvw7qPOQExGNYMazNndAnthLkY0rW7BIRdAAihEDU62ECt+kQSed9c+7/uO30pr8pB8yAm3Ke6VrouvgQlJDplriZxDu8P9A7FLdmYyqYNfM/HB0ritwupuwko98uBFiE44AOCgMI9zAXJ5zhW8WAOs7An0w3ZVOdvrMFW23iHQtQ+uNPbM35FFD2o27M6zKY1mC+RdSxQsbUI0KZb0awlte1UTOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z7cKeN0lTqGsO4nqj7pO/oD9FjZqKyVVa6nQ8BbK5Vg=; b=Fqlt9VjDdjWTADuIM7kyWAR+WkO2GQsqGapiajPXMwX6UYpLdvDG10XZv5k7PmsMuB4AmZHjjhA1B/djvH7g7G1XhlvbMFe+kQWS5RhXQ3bLqzgM/ExK8X4KF0A+ZioAK1wZ+LsEzDB/G3ayrupAw1/2hAnrQjO/QWkZcd+TJoE= 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 DU0PR04MB9346.eurprd04.prod.outlook.com (2603:10a6:10:356::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Tue, 14 Mar 2023 10:10:10 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 10:10:10 +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 v4 03/10] media: Add Y212 v4l2 format info Date: Tue, 14 Mar 2023 18:08:46 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DU0PR04MB9346:EE_ X-MS-Office365-Filtering-Correlation-Id: 33d128c9-c340-4472-da3c-08db24744b71 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZYbQohUSQMnx66XddbQH5IZnMoZmAg8Dn/xbkBhfJbkP9noLL22r2coJRhE+ThkcfYt1b0s+e9EgbPldETWhMMpA+9CF93QsPmT5IbvNxxDjDi7R4XFv+CpmDRAd0PIzHM+sZd9XBnpEa8D3M4T2pT1q7QPJugCvDrLxmflNJIKV6GQ/MCZ3Qk20+jFzVqXmK7euh/DkpyOa8Q77zRL3qsgvEue3rFyKDc1V02P0/Y5u48Me9fTmOev93pCa2PBptYTD4BeDWVJUeqH4BzgUCGN/X2pN757hJXeUXyNS3k+R9KN7dvTM786PayQsph2pPyYQcCFd74LepwJUNc+Oa7oUcfkxLflan2eMvwezRjDWFV9DK/3cfMOF1LJ4/VkUgbOrPGJXfjoKGP9PY4swlBhlD755HPEkEBY4qLKw52Z60lOZmmjM1VFUJL8DwRYliBrU7M0mIjgv4mZZzgLF/Xz2nnnfxbGk9yoH15pWJvSBLJc4Fpaqhj1pt4LidRO13hi85eXKAyNhxpDlsQo84EOOko8jCG7SYosHcWOgKG2vbyWnjzBK4e4Kj/d5MTwlffZEWjsZir/FhESh9fL0lOblrGN9olBX3OpHrchnSyPzDzeklS5zHaCasZVeLSDsPK4FTAMuKqGM+3ccKF/j8iBVrGEc1z+RB98HO1MqtzmHo3WYPU8D+5JpRK/tHdclE70n/btFUM0qJ6J+lObV2Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(396003)(376002)(39860400002)(366004)(346002)(451199018)(2906002)(41300700001)(83380400001)(36756003)(5660300002)(7416002)(44832011)(66946007)(8676002)(66556008)(38350700002)(4326008)(66476007)(86362001)(38100700002)(316002)(8936002)(186003)(2616005)(26005)(6512007)(52116002)(478600001)(6506007)(6486002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L+zvwxBDYbCJltFciFRcU1Xe8PTIFtoU6LaTz9OPkKI7lXkZVQdOIJAFpp7rudS9eF/ARRN6R/HvZrCfvgmszcl/Xh+hMU9KmrtbzAD12ummx6EENg+bNwz5gPAMvYuvBpeEwcGDwJbcKWr1RoAXicOZAELPh1tE47KTnKjXPg+dF8YWfySwMH11/MczlNlyXUG0rftKhVSN7bVLNVz5/29X965DxujxGE2iVuWbB7yYI2IvR77ATDctZueyybL6NUGefniRbQWYaSf0m2amAc41M4sbNU7lCk/Lq/SQPJI2WILsbSKy86YeU1wgV+1nHYrluvu/GS9mid7b9zve9WXd1b4juOVDJNeOy86qaLjU4NOu78L6qUSl+WMqSkABILN5k0EIhcpnwA49YH98gOECMmHFVez8iQBPzPrXN6qrEyVjDCdvFRpOafDCLMrbkBsA5Vjqh9DlkE37ysuB9JXizO7HrJNHT82r2udCMDu8SltQzxBE1J0hipVY/M0BAM4k9EMhQltyY+aZwQrn+kejk62WyEiP0EePReuV1X+HqZO0hdzI1Buo49/x9RgVYs8QT006Hr8eTc5t+6hGnxrKCbpm6hLoZ8kttG4n8JPmXF8OwR2yc9ttHxj8Zzi0ABK860qfVAS8Lpl7rMaFR8i05iCLcTZVvrdn4q3IoifeBLnjfkoanHFToGpnMZ5Q1hrDvtT+EqrcN25uiP84SqZnyMh6rvi3+ycp87msgvU4VUoAOrmXdwtyd1Pu1XTj4674IPPdOrLJTbMP8IBgXaHlk7GQ1WZ8QlD4TYEroCY+jHH5dc4KdRhYWwiMdKynOI4/pFjVbhrREn82AV93bKFSXe6np2iU22gntj1/TslGNyF35vcXXDXmH8guJEQrGhVn8S3EOtYiKgFvKaeeCG+X3FBzW1L1ywPCqE6OM/ObVqC5nue16CWQvfmk9WMT28NJleEIcs44fDn/sG50OrAIXotKPQvpqlw4F63k8OYK+pUfYIKOHDe2wy1sdZeCY61UJxvLURYD4rxThzvrj7tHE/Tda36vDu/SyYSImeyYj4K47c4mlwki5bEpzWa+nJYs+i0wuriSzQDBgiap5uFQWvBkB0bebIYFSgGQ9pmxNg1Jk0BvThgd6wbPCSASN7WRnh8y7xwdVSjPq6a2jfk7jGfBVEom7N8qBw/TUgcvgMG4fdZ2LEwh5QBVq+hocScdJ7z9yJZud+7oamFNn1hrgmJyDllq9T5e0qnKBb2s4KwTVjFlcfCAOoIalvqHP5J5vRR7zJsGxnyevehyCCURoJ3IjZ08yPMQea3G14u0z7ZNEe/LmCmeAKRInO2moYXDJUoP3jC/kGnfT4OrzC8E04s2wI7PTw1B1njiJsoGZLeRDJEAa0gRKj5L4wD4kssXTnDv8Icm8Y8G0sFHFUId5FNQTydyCYckiouJNqott1SKvdc6ZnbdAFLEy9OYfETmyz5yjdjya8OzI/SXf4yBzcNEsVObFAWHB2gXuJnt6ydBDQ1PIq/+/9LV9gFg0UczjV9N7w4fPBJNMm8wyMBPMR/Yx3QX1Zu5Drs8TMsdHAFjirOwxA5iTndGp5AK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33d128c9-c340-4472-da3c-08db24744b71 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 10:10:10.5647 (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: IsG/hclJWuEDqUP2nfvTDOP6VodMFhGygEk4utroKaGs6Nz0Tkm5bG0KscTJNin6IwV8K91tl43UzujjdQoKMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9346 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Y212 is a YUV format with 12-bits per component like YUYV, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Add the missing v4l2 foramt info of Y212 Signed-off-by: Ming Qian --- drivers/media/v4l2-core/v4l2-common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index a5e8ba370d33..21ace56fac04 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -258,6 +258,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_YVYU, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_UYVY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_VYUY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_Y212, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, From patchwork Tue Mar 14 10:08:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13173976 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FEC9C6FD1C for ; Tue, 14 Mar 2023 10:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230320AbjCNKMg (ORCPT ); Tue, 14 Mar 2023 06:12:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjCNKMX (ORCPT ); Tue, 14 Mar 2023 06:12:23 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on0603.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::603]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEA0999D7F; Tue, 14 Mar 2023 03:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dK7RQbX0rEQlg2sCqDXZhLMWyd2Htff5g9s0tCSfi7R0P4gS44TzZ94aDqiFFW5L2AGgex/8tye5jg7QQD1ko8qPMSuydbU8vYuBVrtc8GdCsGUDzM2TqpODON6DgXgUIL8LfN81Nqwuju0eHaAag/XOTskcGYKnmu5gw8PgQ4NXUWjerh7T1aDVSy0DMqq9wWVPyBzjxElRP6JUlfZkyTUNB85RsoQvj5bKj36jqW9m/0gN+/055D4I/o9QLH8F+zgX1xlMBjFpJ0M58WCoUtM6pBWaAPMpHUxsFm85CpfYHu6JIGUGjSYVTZqj97OJQxdSFjdnSiJ/TIIKp838xA== 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=q0OywNSR58/8/Ip9EQ7IOUPZsp8jHhQekHxiCQTr9eg=; b=A8oa0ohct2TrCP/G3+upIfD1tLnq+qHq0tQEGVBlC3/sI1ljzBy2PvNer/tH838wPEP9Te2lKgkq8PjZmSaIyS+tCqb6SUNTs++pqhS5Dx40toiS3uMuXThtcbBOqv6QMVSK/EVm5FevdGW1x5Ah/Xq3nEMRs/WVZnUYB9WRoIXowgxH57fRnk5589qmsb6kWeJ2fw+mL2B+2zuO2OjccKfN/Owi89maiiF4NvB+GTcxP6aExgrUygd1jTMYFcCZ2jxgdNZLjorJ9q1EubUw4P4bE7uwBjwKzA7KvbT6zVLHA4vQvmV9EyFQvDUE5qZ7N892USJONIdlZm2aZx++bg== 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=q0OywNSR58/8/Ip9EQ7IOUPZsp8jHhQekHxiCQTr9eg=; b=qDfFZMLEZEeAzk18pfXPVUV4fjPce1fsfsOvCYzm0p8CBvbYuGyN44dY3TETdoC6i8TQwTKsm21AQyUTd8qE4m1HCc6AgLVqaLpXsICKNEptYEVqUA5T4n9BUwEG7h5y5pEVb+pKGV7FDzw6xvLb9t3N/wqM3B4TJKVOolhV49Q= 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 DU0PR04MB9346.eurprd04.prod.outlook.com (2603:10a6:10:356::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Tue, 14 Mar 2023 10:10:14 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 10:10:14 +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 v4 04/10] media: Add YUV48_12 video format Date: Tue, 14 Mar 2023 18:08:47 +0800 Message-Id: <44bfcc0f57f0eae6d2a94914e40a902556f6eb02.1678788305.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DU0PR04MB9346:EE_ X-MS-Office365-Filtering-Correlation-Id: 9da7cf42-fbe8-48af-5293-08db24744ddb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n2fMGC5OGkubmxJMrnghlh+MQBIhRKJxO70FHOoV8lNfQy+Ym3pRUQWbiwCSD4KiBOye/Ag0WNe6tuvi/NQgbO+PSnXWA5DJX/AyzjVKCm0Ms/5dJ3VDBeoguk61UBWmg+s+DYtjFgEtzvsLRN23k4czMU+7W1RpyZomQj4ManDHPBxDRsPavHKGRChEsH5TnLTvnR3l6TMMWp63yN3kscRKUgVomt0WHwmI8haMh69CLCKmwoj9a4OEeTL7h9Y8SpgDC8wfQ/jeLc24KGwzzYrZ6B4fPSDB1sFR1vPiDSvBLDn0TM1/WN+R7MqbE5Ajtp3X1C5gBBVl4XfAhWEJ0CIr3v09dOBBDcRvQrCLwDQ3bn7zSo9HBAEGK5k7yzl+zWhaTutGo/uTBx/9cawJZDFasoPcsM83aqe9vUUjddENhxnmhbtzFBOdEWJo9POaKotbBLlVBidIdV3t9O2gKWB0FTb+MLL7LJsnNnxo09I5KnC/aoHkLlEgs+R33UmfsRgCUGsn4ooQEZXbXzLyw3DZ2PUgeOvsXyQDodZRmJiKb/OlyLp5d45tKcSbB+gx+tHeSWJsyNf9nf9BY+/IGlji8+/K4GkBzYPiyDQnlPP6TA0RWJ1IgcZoQQTytup9lRaEeRlzxhFu92kuTcn6izTVsUW1iGB0kh15aX0T+ftB7ilYCQ4XyZGSl2a3Zhesv3pUNaToSKDilv0hH9vAgQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(396003)(376002)(39860400002)(366004)(346002)(451199018)(2906002)(41300700001)(83380400001)(36756003)(5660300002)(7416002)(44832011)(66946007)(8676002)(66556008)(38350700002)(4326008)(66476007)(86362001)(38100700002)(316002)(8936002)(186003)(2616005)(26005)(6512007)(52116002)(478600001)(6506007)(6486002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Pe4WMoNZjV0YQgWpyYzZrNPt3VbuW8fnR0OtUcSjHzSw3r9tpdw5sJTZCWzMDHI5hoKhOICQ8zJBY0xl1CwEjn6KvTM3OeJktI35iYSglPD7myJ1HBpRhT3ql6bX6wgkfaFS7lH9Dy/s24zgwbfyZEM2S5jR8WWVA2PWkn+iDaHqySq99dzHDNPA+3I/9Gz/lM7eJw266LjgtU4Z5l38DJZzzHvLmSV9WKsAwubTHpk+M8U4K0bsHe9SNhOMCEW+mSO6exZsBb7GthIef6jg6j0lbvyf05+c5WQWCBm70ySf7s4YrD+jr4S6HEfoXEPeCyGHESI0F6EKBzv+HYz6PMMYG3f6DK1ugHti1VkW1lA4bj5Fnk0EkS52F20hGQPbbOQTi7t9sh13LVG6zUib5FxsiiQV8fiRpfordr5ugI1IsDhdqq7m273PDxZMlOchewNKRVaM3d2GpfZJ/3RCMIoLuZPCzFFto9k7fvQQcpCehvAQM5DY2/6B0Y2A6IAU6BI7wQFHiHgI4dzvIvifat9PuUAjRUfmZNEv4nVskrAGyX9fcZvY034Hwc4Dw+gWFtYaF7v+Y/1OLvxedq6SS/Jf7m/OOd43n1tM0F+bdIbdColVqfjIHuYNJcQ0zRdSxy4/sZytdkVKp7exYCdmTfaqcfUAKhxsCq09NjRtmYJvtfoDfJw5yonzU+wuyqhzIEFR95GbPo2QvwHtOVy8xqzEzbU5T8tRkUpGQVJrph31l2t7e4T1VoZdBa9KnFiFAg8Zu9YxVUFhjdMWm368T8DTZkx/+ARSwzX9ep44qc+zpCP+1aUm+1NTo4lSbc+eQSL5UYUw8aROk7AXYsMhUqReeXeOnLsoFYa7wDz+AbyYXxVabXH3kyYR/qX5rymXsuF3PV1JmLb/q016KW4WhqQ+VEU2reu0oqniO4KcrIcIUzveD+bfUhbLFFCCFTJlnOiMmx1JLqOCSY04EFzLkaKXJZkbYIEZP9ab+EpSxS93CSZEzMjr1HpTNfMk4SG68rqUmc8ATAC9g7IhgsaQ0NpF8g2FjGkcHHc5a7ZaMl9sRoGMXAZhF1TE7F67yR9N9JbiB6H78/k3gSmeMnO46xWxw61EPf2jjBhQvZv4TNFWc5D/p3btMf0P4ZYyRjPsIgpmReJGwAInOcmNuuOXn0wDb0pVJjr9/ZNNxHf4GXB9tGVtggCD9a8eGtDzRNN1x9xuIQh7it6CAUUEubqto8iYcM25lIgfJn50cBdK1QWbD0T1tGoDuIGuhLxLK/bKfOZIBTszgNNlYoWEqNDFmnAVI5BzTSwPW7DmJ056Lp2JpGjsfOeDkV9ayqaBLb/unsapIpRUBIRZWSBIMsjJOBAXuw38fEQhEtS6H4vVtTis07KV9ZmaG33bv06unmxyiRTUajf5tTx59VvOj/9gXk5kWVwykscyiG9N8i9KetEz/2tllrt1kgpK+pJgQgg24eoi64SJ4kFS5qpupzaa6SPazBKZXfTlkg97WtTga7naOuD+FFbFtvXkpua+XCb05OVh+iMD/2SwTey3nuK9RQdCQmc/tXFeQ6XV5YM9MsUzboXP6wj5BAPX99iZLoCC X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9da7cf42-fbe8-48af-5293-08db24744ddb X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 10:10:14.5957 (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: pyJz3VTyE2S1bkRRVhvda6kRjDW6cr0dXmPlLCUfCKrBdq9XkDTS1mCLQfsMVQc0aIyn91lX/w139CPAaAtgsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9346 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org YUV48_12 is a YUV format with 12-bits per component like YUV24, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../media/v4l/pixfmt-packed-yuv.rst | 28 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 31 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst index 24a771542059..ed998d8341ff 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 12 bits per component. +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. storing 1 pixels in 6 bytes. + +.. flat-table:: Packed YUV 4:4:4 Image Formats (12bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + + * .. _V4L2-PIX-FMT-YUV48-12: + + - ``V4L2_PIX_FMT_YUV48_12`` + - 'Y312' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Cr\ :sub:`0` + - Y'\ :sub:`1` + - Cb\ :sub:`1` + - Cr\ :sub:`1` 4:2:2 Subsampling ================= diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 21ace56fac04..da313a0637de 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -259,6 +259,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_UYVY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_VYUY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, { .format = V4L2_PIX_FMT_Y212, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_YUV48_12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 2cb485643562..6543cda5815f 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1346,6 +1346,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_YUV420: descr = "Planar YUV 4:2:0"; break; case V4L2_PIX_FMT_HI240: descr = "8-bit Dithered RGB (BTTV)"; break; case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break; + case V4L2_PIX_FMT_YUV48_12: descr = "12-bit 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 db06d4c4f008..8a6430bc4a00 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -621,6 +621,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A') /* 32 YUVA-8-8-8-8 */ #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X') /* 32 YUVX-8-8-8-8 */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ +#define V4L2_PIX_FMT_YUV48_12 v4l2_fourcc('Y', '3', '1', '2') /* 48 YUV 4:4:4 12-bit per component */ /* * YCbCr packed format. For each Y2xx format, xx bits of valid data occupy the MSBs From patchwork Tue Mar 14 10:08:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13173974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 149F2C6FD1C for ; Tue, 14 Mar 2023 10:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230077AbjCNKMN (ORCPT ); Tue, 14 Mar 2023 06:12:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbjCNKLy (ORCPT ); Tue, 14 Mar 2023 06:11:54 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2058.outbound.protection.outlook.com [40.107.8.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79B8099C26; Tue, 14 Mar 2023 03:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n5bJUYuCx54P4WV+iKgE8tlLAgjBpp8lcOko/mo832N/KnOH2iHDyMhSE3tpKxwZcYg9CQCP/AnWuMIkRcODP1HS4UIybQ860lKYHD/mbcG5lYXEq0Ld3Wqtlu3gWbwHPEGjkeP98p9EBBLV99QcOYgpuZ6ioQ4x/SI8JqNvqsmTDXwCFxWOobjGS3u7bUZ+1xmzkPp0bh9j7v0bsIVhHm+iZiktokNhngtMvx1D8GfmUbuYPio51GsGQdpphN8LFaANX+TUoZvdwcL+phtQ99Hxs/hS9wdGaGLqU4Q5WNZOSvorq/iYC6RgqC/grsnH1KBx3eUhsCkCtGreAUqLOg== 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=lrCCkSbdN1I0P9qdCM3YoSQ4HPlDb++Simk14IaHDOY=; b=H3v8OUsreu17B01jF9fSQWnyU4UHujXWZH5PZ0Tx6TQQnX3DNVKo1Zd6p5uVVTLvjBVsto1T10XPMuYV6g1pUfc4JvL3aC18BvUkWfsRQjD4MHYj/tHRHgfiNRsdyyD7QKCFIfjXIPkg6BGYXO1ngt5pFvD3K95q937/qbeve4Kflr/je3fOQPZbbESF6yQRIAPZvfzW6CAOiElOQxgzd70wXJhOl7o11v9zrbiKZ/CHbERsR73PSciu3lVf7Jk7qxzp6Y517pmrwZurQEX7f/2QBB6+qpE9T2Kzcm0icWRTz5g66HXL7nIofST6zxQRrYA40BJGx5SDx7FV1MDsXw== 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=lrCCkSbdN1I0P9qdCM3YoSQ4HPlDb++Simk14IaHDOY=; b=p7T4KogjnZ/KvVKJlSRcMfkpTcdmbGgxxX3GswDOYzFHqsO8HQ+RiJbRDICfGB6Oqd0dHOHuFjzip/ldJTLK0We/LuJIuLE+kZk6iKX7bg+4peih2qMgUerniXKEfa8LLRmVQaYXqkhv0uTb6VjEhXDVBj9VbEt7ee9PNHcRo04= 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 DU0PR04MB9346.eurprd04.prod.outlook.com (2603:10a6:10:356::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Tue, 14 Mar 2023 10:10:18 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 10:10:18 +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 v4 05/10] media: Add BGR48_12 video format Date: Tue, 14 Mar 2023 18:08:48 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DU0PR04MB9346:EE_ X-MS-Office365-Filtering-Correlation-Id: 986c829d-867b-44a4-1ab4-08db24745034 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: svLv1yZU6923YZQ7NhUooRXFSlezLCGQ+WNsyXlV5Ju/ilxYdZkBlYxS+F+auNpvIywir0doPRAbStoZtp+PrMfXI6V7BQ7hvQPPRPy6+sQLP8foqLq5nMPmCZ6VIPNRgGnqSz+m4OZ46FrKV2gtQUR+HNg2b0R+A8czojnuZt4a4JPOyMauEaRe6Wydz8OwSPO7jfjQ6E7YZjIlYWtpeAc6QJb42Jy0+sf/t5iA51ofK+dS1kMI/JW4AgefQGG0ptNtLaj5ih52s4flPu1BEGf+uVXDdUJ3jH+2XGUeE6U5U5Vg0g1q0KlaSoXmxyAHsPxoj2rTSwhhKuzPZ+2FK98z+zRFaLdSs2w3oxKzzD7dwMb9OmTXyAMCONU6YRdSlJAzk1BNfPiyWFSV4W3U4dJp5BM1nrdCc+5C50qFd2mVpiNKSb8v0z0qDqdERrL3BDjIs0cbe85F4HjbINr7yK2WDyJlpKqavS1DaktozeG3ax4qvnReV1mTt1e+nz5ikOuQe8Kihua4KxSDcrwsaLGfsldvt8Es3AKDLSlZemI3cgdfRYgm3zbIZoFMNICQ8GKSugYKa7gveiG/B7aPZu2MNIseVlXBWq2+TJvQhvBD1E+1vC3l2PKKK2XOLaF6+rv9xxy1ZMYgB01/mMfBFL/f3GNZVTQtp9C9au3xHZtmaBbyLY9iReQXWpaH50E/+NZn+GQ7gpaZBf4NlRyBWw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(396003)(376002)(39860400002)(366004)(346002)(451199018)(2906002)(41300700001)(83380400001)(36756003)(5660300002)(7416002)(44832011)(66946007)(8676002)(66556008)(38350700002)(4326008)(66476007)(86362001)(38100700002)(316002)(8936002)(186003)(2616005)(26005)(6512007)(52116002)(478600001)(6506007)(6486002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZqWDEyc1hspqTeYg4l2qGWpb+7GSg62L6EcwnKU93kIcMwvCo0xhDzzDsLLdPDik1xYHzDH5JT1pS5v/KgR7vUXelDutDNvVz9Orbp6wc8JIzgl6jHhtow/4LiEgUwY9RdlrENF1a5fotcUxcs44WBW9wt7sjWcYGwC1k5OdlJGaajHvejbXSlGCA21GVkwZZP+kNPbDHHWPTSJkdP49hQHFqHGHSlAn4BGIPQEHeXFaBS5m9cVH+121fX0WK4BPiVJHglzyizbi/cyXRpR6Y/UEDFOmSWVlCBlKD9QvTmG8lV+zylOqUJPf7cZV/3277znMolJVKumUtVOX7FukMOeaV81ok5kUQurpJ3cQUsjXn0EeX8EXJ30Xe6CLrpo4IncU0ALGm8UJzGTdxngAoYxCfwxidp6vjUEmUikmt4sH8oCSTazv9SX8V5DqFihv59AlnuVQIRocGVr7NUISms+UpG4FUvs+4i3L5fvFTX8D+I0xxWxL7VeZ6RCtYZqeDSX6iL+yu7wiRwQ/tfl9yRchI13mfTIkI5DUNViYvDqxUbSxCE5/TRcQq75zhRUWfdh8IMZpbMxkqicguhyp2QI+oiqCFFxJpUAu7rHgZYmYLZ2JGLvFt7c4ch3iqeOHZpDIswhG7sMto47JAMS4x+NxS/JzHkgOIke+VKdk3BikOPWYVCMt4VuVSExJbIWfVLLfYnDQlD2bgZkpJpLbIuxdkSlKJOJkOxCBXG41OUsLkqbyATOTxuYk1aDzyTqbIYjiljMAGf44NJPTfAvSXvaDAECxHnig2s1I9FersWvIpEnwJf6VM/wYwgKof2/vtRxq/Q/xg/SmwtVY7B3G8ZpWCkj4E14Yw93VPpfC6Zvy3qrK0bjHglo0Ntv+bKUhYSu62usdNBWY2tt8ie1uG7UJst+uP2fB+9yGsWIlItMru/NsibC1rbURBrIQNl/qU5DrmVH2omLyY739dkiSkW+dF3QYWDwxPFIVMELFcXsw/U8/RqxdkQX0sdylgWGav61+0GFPh57pD0BRwm8oRKX2WaBuJSe/oRDvqUikwr+JJLG7l6XLXzBNfoe2puTqZaRljrx+E89vGSqsh6YO5eERAQNDd5pECk/ben8qUILhOdiaYPyx7zfR6pHqO/YZ4NdGTVQ7sPWv+wBSleprtd7holEUmcWReLbeytJbLNnCFBR3DXt53nImGpmVP6aJPQp5sU80yFCPz/aewTFkcSZmelQzc27tdVHDmtKBe/Xj8Oq3fFWr1oThlVSdjBxqcvx0KTggw+GS/sYjCzYEodBmLwhauZHXMeJJ4rheFz0hoi2vr3ThTs95DWrgxcC+ftTXqjPJLFfHEKcYnDprSwF1rymp/H3KkMDqX6GB2tde8bdgxDHftr80WbrBcvAC3sPw3bqAoR4V1y3n1Gt3Dhn/GY6bXdUfws02vcqxPVzbHnEahs8aSXDDn7xIbm+vW74RLmR4kpI0IQk+qfh2RDoENA08f8StBEWHvlSgcQvJu0oQSOKYsR6fO38FWVRKP8OC/Nus54ATaWn+/Oocf9b4H8f2Dh4bb41THVc8cIOolJQ14HOCPdqlb8NpZZgP X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 986c829d-867b-44a4-1ab4-08db24745034 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 10:10:18.8298 (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: KxYrY+ZGg5+fkevV/RwyQquRajx9dNgdLtUaAbfAUK4LWuYZSnK0ImkNdShlHlldSNLghUyENNHV+fTk1FdMEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9346 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org BGR48_12 is a reversed RGB format with 12 bits per component like BGR24, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../userspace-api/media/v4l/pixfmt-rgb.rst | 33 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 ++ 4 files changed, 38 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst index d330aeb4d3eb..fc98a10991f1 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst @@ -956,6 +956,39 @@ number of bits for each component. \endgroup +12 Bits Per Component +============================== + +These formats store an RGB triplet in six or eighth bytes, with 12 bits per component. +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. + +.. raw:: latex + + \small + +.. flat-table:: RGB Formats With 12 Bits Per Component + :header-rows: 1 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + * .. _V4L2-PIX-FMT-BGR48-12: + + - ``V4L2_PIX_FMT_BGR48_12`` + - 'B312' + + - B\ :sub:`15-4` + - G\ :sub:`15-4` + - R\ :sub:`15-4` + - + +.. raw:: latex + + \normalsize Deprecated RGB Formats ====================== diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index da313a0637de..16d3c91c7da2 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -252,6 +252,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_RGB565, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_BGR48_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV packed formats */ { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 6543cda5815f..6d9599391d7b 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1302,6 +1302,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_RGBX1010102: descr = "32-bit RGBX 10-10-10-2"; break; case V4L2_PIX_FMT_RGBA1010102: descr = "32-bit RGBA 10-10-10-2"; break; case V4L2_PIX_FMT_ARGB2101010: descr = "32-bit ARGB 2-10-10-10"; break; + case V4L2_PIX_FMT_BGR48_12: descr = "12-bit Depth BGR"; break; case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break; case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break; case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 8a6430bc4a00..3c5acd72606c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -580,6 +580,9 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_RGBA1010102 v4l2_fourcc('R', 'A', '3', '0') /* 32 RGBA-10-10-10-2 */ #define V4L2_PIX_FMT_ARGB2101010 v4l2_fourcc('A', 'R', '3', '0') /* 32 ARGB-2-10-10-10 */ +/* RGB formats (6 or 8 bytes per pixel) */ +#define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ + /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ From patchwork Tue Mar 14 10:08:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13173969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2003C6FD1C for ; Tue, 14 Mar 2023 10:10:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230162AbjCNKKq (ORCPT ); Tue, 14 Mar 2023 06:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230156AbjCNKKh (ORCPT ); Tue, 14 Mar 2023 06:10:37 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2080.outbound.protection.outlook.com [40.107.21.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52E2D231C2; Tue, 14 Mar 2023 03:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BfVxGebQQgAY/PYsZmg6bVAw0ZBMGcyQqA0A1vV7JPawgPvILLlQ5NvZC6GEX4Eqln/1FLriHJWNcF0eHnu5UUq4bstxWKdkFbr8GAtZ2E6JcWKLgwX93AOCuPnQD3eCCpIhKjpkwZXCarfnHjABMlufHnASobDrmIfEko0CSuOAud/WRiGRot8nf3KNxxZwZEFMsFuUkY4RrC6wVHBV0GMhM/WNY0NJKD1UQZSpCysFzGO8p6jTyBXLJz9hwXRtHplvW3P85QOrIbtgD3wKe9FHXHV4PekjKve2thjMHkJyhAIKL0dRryOnSoyeBrkRlTYEieRxVwJV+TutPnuU9g== 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=/8H4+vWP7BA+UfxXwkEHLwMGKN3NFs+oVfPrEZ+GNJk=; b=BBQPhbKttzGCF/zcZqnppZjABb5eGwAZhS3ntRwlTYXY6pPkXgvaMsBU/i+W0+qYjmPHlK4d3zdtUhZyIJ78eCXHodia0E/C9wGxn2cdgDj5wCK9FxN9VN78Pea30nd8DQY16QWf4HHNKyCV1FGKmJ7WD2WNSZpaP+SgymaRH75ivJBxnimZsJyT1i9CpRqIw7zozScslkdUWN0mjHFbvnqMTnvk2yI/cWwPe1WGOGu7luDukPUw5tNYL6XcQFMsoVeUhfxgG3zpRWcyCUIy0Vtnmfa5A+nILOCKA7fweZcdfgUbZv9w6kM1wYzQGJYzTeGMSl0LvBg0+Bo3Qpbf3w== 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=/8H4+vWP7BA+UfxXwkEHLwMGKN3NFs+oVfPrEZ+GNJk=; b=hwZJtlKmJDqosCwK0qNpvWKVVNHi1c+if9n28MV75Ja3jiyr00IObstTwQ/rwDdkRyrvWv7NVDJIVt3g4M8/yvqpQMRTlzkoOLxN532RsRZrQhGJR3SHlyVDCs8q9Tilda4spOShUTc8ErHxwqUUiRF//Qdsxhp3vHp0shRcMzI= 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 AM8PR04MB7841.eurprd04.prod.outlook.com (2603:10a6:20b:244::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.26; Tue, 14 Mar 2023 10:10:22 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 10:10: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 v4 06/10] media: Add ABGR64_12 video format Date: Tue, 14 Mar 2023 18:08:49 +0800 Message-Id: <381112ea3503ec1a49a5130a0bcee777ce58391a.1678788305.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM8PR04MB7841:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e463075-8c31-4f10-f391-08db247452be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wpRLJQSsgub6m8+pw/e4bfj29U3B7pYI0L67/xRRxEXWvyxOXYnasyYM6JypcSOgfQ/VGxyxEU7MkqE2lTrdVBpmpDi54uoFuS2n1JmrC9EyjlfQwOZkKmuj/3c1OIIt6/Oa0IugZfLT51c3YDKGdo0j/5w/nIGBwlU0gRVIFHk6mSmURg5YxWAsJFeqPkUU3qu9GQ3jf9a//uDP4D5aYWb/AvqUhyndOdywPtUcoz7qsMRSfdGJKvmm3pV60a2vB5h5CnfuIrayAdpl1GEq11CQL/C+bQRo4EPO0FMAeUxomHJtVuuZjejH+HVBAbzuLeflI2R7n5AYYgUj/tr2KN1p9brClH3MdwYw+sP9EwKCK/o+g23wLEdDu+vKrSV7R8QpGnY6QR/fJzEfbcmba2WSAJmuDlts6XcZF7YjaLwGYPSEmK51/XvX0qnNYzjM5l2zxkAoQKfjx2JjC0cWMD+WwuCJLuO+WhrWo+9azI7qWpxbtIHfE9/C/StQ3oeH7ck8HQYe5Q8/KGIusDRdaOCGbBrUOWyj+X57gs+LTVVe922OrM+WFbkPfKxxw3QbeuZdGIVzMXPz4tA42Onb6ggkIiDB9B7z+geyMHt7LexUnq4Sv+HhDTKk2f2RUGue0Tks5LfcVUCOoC5kaSHZCbimb63MGFivdGHKTIpSBH3c5eNNs35zbFIFzfUtZqD8Fxf2iy3rjW5RenoGhh0FBw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(396003)(346002)(39860400002)(366004)(376002)(136003)(451199018)(7416002)(5660300002)(8936002)(2906002)(44832011)(38350700002)(38100700002)(86362001)(36756003)(41300700001)(478600001)(66946007)(66556008)(66476007)(8676002)(6486002)(6666004)(4326008)(52116002)(83380400001)(316002)(186003)(26005)(6506007)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Hv6PztDOXhVPVpozuJ3kv57GO5m9rnIusxkbrpJ4WBKcvkHbtJ3LXCuc+sXAFJ5TWRWcYS6Hbp+gw648tOx2QY/T7/vIX21GNW1lXlByBA+EuhEi3DWAYmmrNyxBSkKlNUEjch6ZO0wfR5l0VkhNGmPDAkJDjtUiB6KAtkQoSj/je+GgXhHsdDjyvD0mBphsMRL3cIwHmrcFrlBfN6hXviXvhwLwg+ZgfTqAgoGijPV3FRAvV6hVU75DDOG7XkohupMuk7X1n7VMCvBelVdOO509C9I2AxT2jWXt2GBjwmHjDLv52XrEdzEs1GUMKgRpqefZ0C2lGcC//YhQ1tRAhXEIiuBHdHBmpGy1YHCjpqSmjLZj4UK6ifc+tbCNt2EE2mlhEx7u+9xG58KAB1LFT90xbwqWvFITXQoyseWNCQE6U1EJBSmv6IyKS0I6jnORBAEF+3sj1q6NTeJxmIzObvDyPTTqhquIPHCYcvkV5ICxGvBA4z3I9NYiIUPMwjG561X/7exUaHVHTqUvPYHG1nnet646rNjfxmOMwfoLIas/nnJmOnYlo8zMS0xNj/J5VWW+ApS50+urTkxllBjlhHmHU42/V4OtgY+6dfSWjKzHVBEDBHvi6ENRJIjpdNnCmhOseFC/sdklCLXHp/FvIAMJjyjbFU4XvZjNKEj/NJbcuV2VaPiLgCtZ/NkyAWW3uKbWXodfht4YiyL9zBq+Xi8Aj9dp0TxmYL5fKep4K70fbDj5w2PfQK+5jBDgms9ZqW2L7OtwT1R56nhcvafkaTOhoaNMSaJVQCDO3dk0ezGGQO89lS4H1/WXxuK6SElugCwbMB0UY3iwPrppQCcPlKVvAIiyxSB7+xdDicK1Q4eKs/YakhHV4MNZzcLVdqyOzO9JB5Vz2WrPp7659JSwCDDlbqllJZq83goYvHgLSK9c/4oTRVT63l3ehgIfv2fvI7K9k/2aIim4822GRqmTEj/NkqCK7onVt0qIc8MRZnF+7IkrNeY+K/1guupxtfPxlk4qInJmk1+RnYtrJyqFml6yxjVAXH3jKR13tjFMYdC3hlDi5bt/f8wxbhfShWqHjJepX3sf8Si09qXG88GeyW7ig2SjH3UYfYpjb10KHISTM3Ct/LDyxNgkCCiA4tLvV+a3fl+/Fyh6PyXiOWRmdn6RBv9qHm+TKvc2FUCYMIUmAyb8JOiPQnf7jdhdZiZGohQvCBITZ9Qu78QKkjxubktnAPef+jK0Kvw4lWxJFephbb7NVVSLUvl3oxtWDptX+uJYblAi4uAwLL+7Nq3QIL5YJjWZ3Tx2LhBA2F/YmEi26XbTL7jwDU+EeOyNFdGLh7EQVV9fBCYKljy+TVgY5vs+G3ANnh1YJHiBgxtBA3tnMtMttKlya15MHoVMh1eGY5qmrVZ+clYzn0RmLb9bZ1nb3IdAFx9Iq5HqfNBx5S7LD1NpV025HjqPeDCgf3DOj8TYfJUTHq0BTY9ZZTuRt8KdbGgQA1KDolwlBSFLFrmz/B0mpk/qlJqg3Z60vlJG6oZzugmM8LJjeVJFgIBZEdWL/j4dRtmgVzabQjQ+Wx8/8Uz4jb1Olb+ZV5N//fY/ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e463075-8c31-4f10-f391-08db247452be X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 10:10:22.7984 (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: MWeAcBsIzHcBjQDs2GetMdSCU6AEeS6eQkjpdds2nRgt2bg21SMektF5+JiRXfjv5E4lkiRBrOXtnpi+Prq4NQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7841 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org ABGR64_12 is a reversed RGB format with alpha channel last, 12 bits per component like ABGR32, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- Documentation/userspace-api/media/v4l/pixfmt-rgb.rst | 9 +++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 12 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst index fc98a10991f1..c97eab59a6dc 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst @@ -985,6 +985,15 @@ arranged in little endian order. - G\ :sub:`15-4` - R\ :sub:`15-4` - + * .. _V4L2-PIX-FMT-ABGR64-12: + + - ``V4L2_PIX_FMT_ABGR64_12`` + - 'B412' + + - B\ :sub:`15-4` + - G\ :sub:`15-4` + - R\ :sub:`15-4` + - A\ :sub:`15-4` .. raw:: latex diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 16d3c91c7da2..3c5ab5ecd678 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR48_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_ABGR64_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV packed formats */ { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 6d9599391d7b..768e1bad4eb2 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1303,6 +1303,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_RGBA1010102: descr = "32-bit RGBA 10-10-10-2"; break; case V4L2_PIX_FMT_ARGB2101010: descr = "32-bit ARGB 2-10-10-10"; break; case V4L2_PIX_FMT_BGR48_12: descr = "12-bit Depth BGR"; break; + case V4L2_PIX_FMT_ABGR64_12: descr = "12-bit Depth BGRA"; break; case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break; case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break; case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 3c5acd72606c..a6df69ce5cf7 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -582,6 +582,7 @@ struct v4l2_pix_format { /* RGB formats (6 or 8 bytes per pixel) */ #define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ +#define V4L2_PIX_FMT_ABGR64_12 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ From patchwork Tue Mar 14 10:08:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13173971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AAB0C6FD1C for ; Tue, 14 Mar 2023 10:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230242AbjCNKL2 (ORCPT ); Tue, 14 Mar 2023 06:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjCNKLH (ORCPT ); Tue, 14 Mar 2023 06:11:07 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2080.outbound.protection.outlook.com [40.107.21.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E58199D7E; Tue, 14 Mar 2023 03:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MbfTqEFid/QHWoH7JEDA/kgkhlGwdpj5rFOuScdzC5Z0RA3qWf5rhBcZgEVQXSe6GKoQH6OvC2TZJPYdJYeXWvRqWkAgrbOdwTrNsmpEgTT2htIM0e7t6FCtlpOciXfKji5omTx2km6oi55P6Kz923JyPQM9wrOQ54LwML/E9utpPofuz5bZstJqqp6Escm1BptahHrgQVtNcleX3OjHBz22gHNzAe7Ins0XxU4U3euKBcEopyuvcaJ3Cv2aj8Z7z27WRb13t9bLaSyH4ZED5jXa24GMDFc4+UWQ9sqeLcZanXYA3CKkC6lJdlvJ7Rhy1vEhbGQp6MVHwpSMgHQBAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8HtPUGDrL90dDHNDgqSHbRFOdqqqZXS5JUCzQX0fw9o=; b=Ojf5PZj6rDRX83DkaoDQraRCZmSBBo9zg0tswtD7zpM+NAACUSr3+CeNSaNf9UWzd468Jrq4+u+iWikfPHChHVdr4kXRzqJIMpXePK4F9JETsome1QEuhb8yuIcIKVn35SDa5y+zoZcMToLis/HgwvfrP5cZgcsnPAvNqlmVfgqsgXt8XqQCRoCJNtuEgHehi0xqzeTlKD6l9spiPk/LQmZAu0xZiF9DMTLClwpCirg74V1dW2zdk9CQCRQ69Hh40kkUTSxWQahEftL+Y9zB67Iu6O2N8MPWuZqe/fqHX1cMU3ySN6MQZcE+C21ChWqh933D4l2Bsjq5eZ2C5sEiEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8HtPUGDrL90dDHNDgqSHbRFOdqqqZXS5JUCzQX0fw9o=; b=nPLphcCfSJkuUki5HrgWClGpNLDjkjGFzqkfGaJDuvrzfPAp1WAefZ8JNZY7HSoPCPIRMiIuV1Tfj6OkxVJZr8OM2D7Sb+u5ccPoG7ZZUWwK7YmD630cksbOo/FF5ev7N1kTkf9rCipUVMESu90YNR3FmJk/Fm8ICURgNtH/LL0= 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 AM8PR04MB7841.eurprd04.prod.outlook.com (2603:10a6:20b:244::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.26; Tue, 14 Mar 2023 10:10:26 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 10:10:26 +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 v4 07/10] media: imx-jpeg: Refine the function mxc_jpeg_find_format Date: Tue, 14 Mar 2023 18:08:50 +0800 Message-Id: <58cbaa978ccb4d9c96b169dd268bb06f17816e2f.1678788305.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM8PR04MB7841:EE_ X-MS-Office365-Filtering-Correlation-Id: bb2f2559-a9e5-41f7-3265-08db2474550e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eA9uyWBo7NUiwW708lIb0yQ8RR3zj7e7kEylukJ/OPQc3N3gju+fhawtU87PCk8XBT5+SUxiqSyXSRHpo2YYivr/jT6yMs6WkxD4kpvdduvyD0HsYzBadxjjXVS6Qb1V4oCuugCCYjD3YoZmnSBEtp2+aVX3Y4BveqbQnZQz8tUwbUZHl5+WcxJjuxkVTfEdmh1ZsaZcpMipgBgpW7iUJJ7k7kjHhzVMg6Si2trzfq+lMqRY2jGTZ9a147xVr5cpZSs6RS0AzrzvvMMhK1/Ue+XMnyzUNeId2pIXKiRFkMi4ST2WjwxQuu2dSZBc1MvYlYlLLJTjaWjw7im3aCJfjwfrIVxVsmlpV0Brv6Aozy5idM00ozdg/dk3tcAxBiN16j6KpaeoXLkEjrA5EkzRAK9VunLlN5jZ4vLPi5OnLH/ZGbCGGQrmadBIajhnJYtBCES3IEiNI4GAy9U3XeE9UGP9qu0+wkk9IW/Bow0oqf72Nd4LnfNu5F6klWuGmsPV9WbrrfxUMYI3Sq++HB9h3hqYyk70Z5U58e/gPF2cjLu9nIsEjys/D3yBTo1MfS08LdgaZkO9d50CZgvmHgP5IkpCdOwxBLvLmFiK6xX85qTNo+ynqIQC7F/ptTn2UCkrkH/+h4jVjZN6vzQ43T9L52VOLMsyR/9JmyZdrtQyJFc2vM91jE7tyQeTiwRbMwyY3p3QJw3/IflOIQ5GP/2pbg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(396003)(346002)(39860400002)(366004)(376002)(136003)(451199018)(7416002)(5660300002)(8936002)(2906002)(44832011)(38350700002)(38100700002)(86362001)(36756003)(41300700001)(478600001)(66946007)(66556008)(66476007)(8676002)(6486002)(6666004)(4326008)(52116002)(83380400001)(316002)(186003)(26005)(6506007)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NNgur0fSIMbLvW5GPfTH0jmErDq0aLD7uSTWIhQVkYX/XiY5FoNKh++Ur37ut1NT7sYMKG/dAqC7OK3ZmXuDUfstt98/T97RjNxczBfQ3s4xPGj24XZg8zVD8KLOb5CcWSdQYXUZ5PqkZ1BzvPJWGEARBtt4MtNc8JdEv/VGxrQA9VRGNiwcsk3iSFROZCQAEUt2aIU8kdvFBTBH0xHAcJNwQhWsbb+2R3nAJwsHtVjdOAilPRJ6UEXKjpe9IsinZHhoVnE03zqjlGp7EoCFrUD5mV0Q9tG20Jy2xE1bDum660eTZNqUV+yX7ZznRwdQnQOexXxwHuCT0gzg4gJMeaqvm3Kj5kEhZk67KVlhAsjOUv70C0NVL+df7GN+AGv8OylJA6OSvGTnDq+ji/jKai8i0cVi9Tpo99hEZEWIkf68RwrSd30SG+MmzSZtMtJ/TA0agUX2VrUHcmzTfgU8g9DCN3lCDMs1I+VCBN6YNaAD+Q5VJqS9G4i07Iw3UMG6frU3RLRaevabdfwibC+O/xdYjLiNedNIr10q9G07JIOMJz6BDO9SkLwV17qCoOnavfkaS2/i2llKzqvYTWsqAcRrVUjbe8ArxwtVfXHuJae2TwOp04PNrKvn2vb0rFgcXWfHXjJlV51z9Ex0GvB7tw3+RIyxqJ+9yhxH33urir3pvRc1mtujzLDzY7FWYCNB6UMIqpFbxt5Z2a4S6kBnexThXMDVQoheTyaar7fm1pru8UCQEdq34GXZkKAzAoc8GWCKpxG2DqFmv19CegB9VojujAD9sAqrOnjtURtvac2bjh+6d6lpc8Ch3VOTB8evGklNZBpqo5Us9Il8K96MHQsJKix0T34D0d9+hh9qNra1WpvhPHr7MhBuVVgG/W0rSW5DyZapBo2x786b8NFmhiYkcyhrpTaw9DhWvuBxoMHjWO10SqrlHoKztPAanHvT9qJCoNgbY8QclYDRfwABkvKojtXZ+Jb1O8p3AVi+BhewKaMYoagv9i2iNB9D61hYTxPrbxtWU7yypzvMMh3nW56tQvn/EzYgAWhgfLzUrIPQFtep1V1aqsyOR9sLFGQ2HzaruV/J+FJkPnbenEtYzR183/IkFx6CAggC3vgtl9HWtbZhtxpq7CrpH7GVSSwFzOGqcfBE/r7u1iXUbA/YjK9GSnVQzXbNapBJNjSnksme8zrbJWNnUCnnf2/p0g7zaGAGC3k+4MBBPgBD9BphtAzJ0JtNHtAdEcUXXASBdGQ7uyKwdKQgHWOwjLpwexbq7ylvy+/ISK7lSd7s9Boko8WiLXJJXrKnE2LukGVctfgk3kUjQrzLCSrxncv6IyNA5rFf7rnHSr/srxwpHKTtQ6U/os8eF7a0mWl1Sn8LJxW4AxNVjQ0FK+J9wcuog0FXEpHj6BIzrs358uxMt0rhajlWnHAQpxP0D+oJ5qESH/EbZyf3jU+pSllBc6aV3wthzZDkzlNKxwhWWbDxo5leEYIYQzBKnZCW7GldhSM+Jhkw6r6XcecjrxsIGQCYD+NJtWSaCNXFv6ok7W2uj1OHVjaV6fcSuf72nde7xYnFFw+iMQsNOVtITjkDd9q3+nJy X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb2f2559-a9e5-41f7-3265-08db2474550e X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 10:10:26.6732 (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: bzWptyUeA+rYTg3lxk9XO+ybZ5atmzFkaSOujboia7updFDIZ4Eg3XZw3nrn0dk1Kzy6oDfyUrD69ldxCIgBPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7841 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org remove the unused parameter ctx Signed-off-by: Ming Qian --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index f085f14d676a..70b6eea733e7 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -420,8 +420,7 @@ static int enum_fmt(const struct mxc_jpeg_fmt *mxc_formats, int n, return 0; } -static const struct mxc_jpeg_fmt *mxc_jpeg_find_format(struct mxc_jpeg_ctx *ctx, - u32 pixelformat) +static const struct mxc_jpeg_fmt *mxc_jpeg_find_format(u32 pixelformat) { unsigned int k; @@ -1562,7 +1561,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb) if (fourcc == 0) return -EINVAL; - jpeg_src_buf->fmt = mxc_jpeg_find_format(ctx, fourcc); + jpeg_src_buf->fmt = mxc_jpeg_find_format(fourcc); jpeg_src_buf->w = header.frame.width; jpeg_src_buf->h = header.frame.height; ctx->header_parsed = true; @@ -1702,11 +1701,11 @@ static void mxc_jpeg_set_default_params(struct mxc_jpeg_ctx *ctx) int i; if (ctx->mxc_jpeg->mode == MXC_JPEG_ENCODE) { - out_q->fmt = mxc_jpeg_find_format(ctx, MXC_JPEG_DEFAULT_PFMT); - cap_q->fmt = mxc_jpeg_find_format(ctx, V4L2_PIX_FMT_JPEG); + out_q->fmt = mxc_jpeg_find_format(MXC_JPEG_DEFAULT_PFMT); + cap_q->fmt = mxc_jpeg_find_format(V4L2_PIX_FMT_JPEG); } else { - out_q->fmt = mxc_jpeg_find_format(ctx, V4L2_PIX_FMT_JPEG); - cap_q->fmt = mxc_jpeg_find_format(ctx, MXC_JPEG_DEFAULT_PFMT); + out_q->fmt = mxc_jpeg_find_format(V4L2_PIX_FMT_JPEG); + cap_q->fmt = mxc_jpeg_find_format(MXC_JPEG_DEFAULT_PFMT); } for (i = 0; i < 2; i++) { @@ -1950,7 +1949,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, pix_mp->height : MXC_JPEG_MAX_HEIGHT; int i; - fmt = mxc_jpeg_find_format(ctx, fourcc); + fmt = mxc_jpeg_find_format(fourcc); if (!fmt || fmt->flags != mxc_jpeg_get_fmt_type(ctx, f->type)) { dev_warn(ctx->mxc_jpeg->dev, "Format not supported: %c%c%c%c, use the default.\n", (fourcc & 0xff), @@ -1958,7 +1957,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, (fourcc >> 16) & 0xff, (fourcc >> 24) & 0xff); fourcc = mxc_jpeg_get_default_fourcc(ctx, f->type); - fmt = mxc_jpeg_find_format(ctx, fourcc); + fmt = mxc_jpeg_find_format(fourcc); if (!fmt) return -EINVAL; f->fmt.pix_mp.pixelformat = fourcc; From patchwork Tue Mar 14 10:08:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13173973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96A0FC6FD1D for ; Tue, 14 Mar 2023 10:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230125AbjCNKLz (ORCPT ); Tue, 14 Mar 2023 06:11:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230281AbjCNKLf (ORCPT ); Tue, 14 Mar 2023 06:11:35 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2080.outbound.protection.outlook.com [40.107.21.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FA3499D54; Tue, 14 Mar 2023 03:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h1EEcL/9tjr9jZyCQq5TdJaMQ8UDN9jgQvOMhw1cPGQn1eWGdvfVhJA0rYSj0kZBuPQSABJA+ntp3aHSJEgHAI/AERZYATb6/NxXhGGLlJN8zzxuHQAgvDAm5YwJEyN2A+TVa38FoFDezmERsnQeaeoYVm/jerBWiO/2dYGr7NSnclW9evVI90cKMDYbu7fd2mRWGZAL3TCtG4IsJZmpSpdrCeHu95SOOTT7VrDOhFBbOWDu+ZZtjDoXTGblyPeAWDmWO5DzFCMG29GvR3bAB0JUo2ZMy7k3OesjZI0rZMvhoJsRFTWv4I/9E1AXCV1GvFkyavxOJwdvbjJP+g/W8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DWE2v7gcmTZgAjF135o2R8bWHo+YHguXRwe76ddTpZg=; b=Uk2eDZgYhidkyFFnmvjRDP4YByREJhZuWscP5ZVWqAGKPewFqyRq30XUGNjZQxZU7dFomYE8O68NEluOOmYFzIEy3qn1kq9PX9GfYyUcRE4HcWIVU34dxC0eh0FzzI+vAjpOkEgHjnua9pU1GWYcD5fEHSBIReCqzjBSCkmwo/qoR2vSTnlwLroXrh6u/lSuWgkL3T179k6dTkM6K3r8i8SfRX9D0UoSnCpcaLm+Qnx9IyVyrLXPFgxScvXhvnbRZMvDLV2hCkxM3QSw7QL33KIGcc9+VzMPolHgr7goQNON2O4wtFFDsrcPts5ScNuhIAkZ/FKVgPkwbNPWUgrCWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DWE2v7gcmTZgAjF135o2R8bWHo+YHguXRwe76ddTpZg=; b=mYT2cu1muHd2/4kPNOnMWb8zg3G852QW/eYJVRutscwnILa9h0dlGUeYvQT1V432GVsTeu4qg0ny8Rikoq6jJq1Ns5gMMOurZAZ2ESJO+ipNaM+8YSRi+IhoMpkh3j9TCAeN95Q2BVDt8rgXszBcfC3mSOvqjGBDt0j7pI1aPZY= 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 AM8PR04MB7841.eurprd04.prod.outlook.com (2603:10a6:20b:244::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.26; Tue, 14 Mar 2023 10:10:30 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 10:10:30 +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 v4 08/10] media: imx-jpeg: Clear slot next desc ptr if config error Date: Tue, 14 Mar 2023 18:08:51 +0800 Message-Id: <5541277a3c93fd141e35a7fef0bd87047afdb532.1678788305.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM8PR04MB7841:EE_ X-MS-Office365-Filtering-Correlation-Id: 576f03e4-873a-454b-0ee2-08db2474575b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OZ3gAOjUS7tWO49M7DmYF0CHcQVugL3JPSmhr1oFB2SPjnUSLyBJfH7F0QjQR4lEJqapL+dlx4uf9vekV43bLBzKMOYQXJHptXP74Rxwf0D//x/foN5A8+FFQMqTUU64z3TmDRW1PYmvA2KJ04AA0AlW2buYN2nGcpkmfRLLtHihbWdzYREZAGW//TKbJeEOfKx01pPbVvrNrzFkfYMbvXAF6sY9FR0YaOZAtmvyzVRXDosnZE9XYsI7Jc3ikr0Z2elpyWnFS+4md64v9ffxzQUpVJz7L8CHBkQXA0xGLGQvf9lzmFQoEMfRoH8+V+biIz42fc8LmgWAXJH9lbq5TGOF9q2LRBxAxQTQiSuY/nQYdBBq9oAq71msco3CmozoJp9ah7wizxo7gusIxfw8aBtiOppgbQnDm/PQAC/Iij88v0V3HVt0U/WeMaVenY+5cz7x1lORouKRUY1wvc4ePvwbKlAs9MxzKTmzTgPTeO8j8yCs3PzJqHgBYMxxypKZphDj7pf5qh6WnYmLhKTUOW5hnkOK3mkJINDvnpitL3lCPTDncNIlj+p9+C7vEyq/1+TAHMLloBetP503OcUaPdtfBJ/buPXdICRBGJwzkiJXpFoaDcLSDoEv9hDG8ohr9cbsBpDvQO1FwT6UsfE5EUAg/oVzbfA+rxPwvoRORc2Kd0nAj2BydX3zUU6tc710Tmm4y7zTjx2yXhvzRuAqJg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(396003)(346002)(39860400002)(366004)(376002)(136003)(451199018)(7416002)(5660300002)(8936002)(2906002)(44832011)(38350700002)(38100700002)(86362001)(36756003)(41300700001)(478600001)(66946007)(66556008)(66476007)(8676002)(6486002)(6666004)(4326008)(52116002)(316002)(186003)(26005)(6506007)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +UaPdT+G2xzAxaWnTBztwORH0iqBvYzU+lJW/BY0HuB1KyHxq5V6rYfX1J+wGWHVO3Zn+4VrXxHW4xQ5u8U0w+GA/+aSe6ZpWeLp/3ROROISbfxo8ODv87vZTtcDReFa0Fae6VwW6No3G8PfyEvUQ9ee17MDe1Oh/PFSt76ZeKTu5Uc2bDbVhYBRv5EmZZkVUWJiGLKmXeYFTSOmPWVLLQx4mQS4J4+3SAv5bKzJpVq6IqI8zhfn/gVHlFMeUj6Pd2BuV3U/xry/Q7yhleTeFshkkHF+jGVrIlz7ThbTC/iwfQNh/UNtjUM02X+98vQXhP9nAMOCZh3fJ95zp7aIWRE+MAm4sHG/OvWxOZjLVk4z7ctrxJ43ModZQ6DD/J8SxptsJk8sd4xiPqIrLpbUIUOK/3laK88WpeJOQlukHpC7eypZnHAwTeWZcH5IJEt21aSkXdrHe+sS92JeNjmnMspxDbcGN+/K2d0HZLA5NbIdbvOF0E9eEXfsGri640Tg/Q/U09JU3eOG69IoZIvA15T5CELo5JYHKpVIunrMlnth0gwU3ZOyOfZGcpsRVo9/bW+OmBPsfQ1V3lBs9qlYbvXgJlhY09Zlr8ek8BCl+dd7HL1TiAGIzPFXUZqsZfMUtaMpOJ/X5t8URKNijXGp4UI37WUalwG9UBByAALTF0uT07jdtprc0g85ruax1DpTdbipM2nZoIT4CyFgF2BgOq1BDYBUiHbSVCvgbIflF3AxH2T8FX8A5fZyMXfATY5duMRC7BZx4fZ+hO7VLptimL9xhC+eJM3BVTccl01K9zSKAIyFFezukqZYb/pA1troxuR3U0EL2M2LpJjaL3FewWZW34PrKNtWV2IBdo14Nf2uMvCvV5axNDBqpAG3GtrYStpa1V6cMmyzw874NkdWe8FK3Y2UOX5edsSeEjc5nz8kBexpPmKBrNJjSkz+SnUSd74PYdzA7+BYnpJMnwi3W6psOiYvSim2kLptqCjLBa5yfGSbTaRl3K2136ge8qpjkxW3eyiltS3jQqAjNTRoJLin8HQKd5GACMKHq1Dfx6OOkts+Vz+0uMA8ONxifabN/CNmqKxcBh3KGQF7zNa6sjzg9L3Z7evfGKq7yEM2fTNLSAxVRFXZz8k3F/1S8RVk5BXUVd1/NY/dQVRSS/g2Vh8nkXnv58II/81QIuK/akL0NrdbSYybTqBe4s+itFNZMPCHzbhNDKYGPFM2V91pnOeJZrm3VnFZ5UYSZH15/4P0GuihBkPd49xR5OuHw2ehh8JNOuXkxG2QFlGEuha4ws0axyvS9DFGOjVLcg/zLWD7RaFqzjPxafHII2Dk7fdRXPNjgdjILwl/MiypA6FtoplpFq1NLhsoifcKmVOTu58wtoDT/KB1SfJfMiYhhuPxEzo33/KqVPvUBsIa7wnVr0VwqyitTLM9Xs8zd8O9yQ+aVJVLYeuV9QchGYpspnpoZ4bYxBrPTY8C05fRpxSDFlzJBBxmNsBT+zCp21TVpoVJrr/mAmnjAwE+n3Wez0a+zddoQG00JE13bMYJK1GA07eOcyMJG7BSpWyJBUYhMcEghN5Cp8NAKRy36IGtZIom X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 576f03e4-873a-454b-0ee2-08db2474575b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 10:10:30.5479 (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: hbjgtHp9RIJfbiun0HK5zh7nBTfaeaAmDzaq1m1luj7jIfJAidoRSZ+cExPUAMLG5yna9BApzPJWYMsQfb+lXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7841 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org clear slot next desc ptr if config error, otherwise codec will report config error interrupt repeatedly, it may led to system hang. Signed-off-by: Ming Qian --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 5 +++++ drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 1 + drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c index ef28122a5ed4..bbd5d6a9fc86 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c @@ -178,3 +178,8 @@ void mxc_jpeg_set_desc(u32 desc, void __iomem *reg, int slot) writel(desc | MXC_NXT_DESCPT_EN, reg + MXC_SLOT_OFFSET(slot, SLOT_NXT_DESCPT_PTR)); } + +void mxc_jpeg_clr_desc(void __iomem *reg, int slot) +{ + writel(0, reg + MXC_SLOT_OFFSET(slot, SLOT_NXT_DESCPT_PTR)); +} diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h index ecf3b6562ba2..8b7cd6526efd 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h @@ -137,6 +137,7 @@ void mxc_jpeg_set_bufsize(struct mxc_jpeg_desc *desc, u32 bufsize); void mxc_jpeg_set_res(struct mxc_jpeg_desc *desc, u16 w, u16 h); void mxc_jpeg_set_line_pitch(struct mxc_jpeg_desc *desc, u32 line_pitch); void mxc_jpeg_set_desc(u32 desc, void __iomem *reg, int slot); +void mxc_jpeg_clr_desc(void __iomem *reg, int slot); void mxc_jpeg_set_regs_from_desc(struct mxc_jpeg_desc *desc, void __iomem *reg); #endif diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index 70b6eea733e7..3f1c9bc4b144 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -692,6 +692,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) u32 ret = readl(reg + CAST_STATUS12); dev_err(dev, "Encoder/decoder error, status=0x%08x", ret); + mxc_jpeg_clr_desc(reg, slot); mxc_jpeg_sw_reset(reg); buf_state = VB2_BUF_STATE_ERROR; goto buffers_done; From patchwork Tue Mar 14 10:08:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13173975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52FDFC74A44 for ; Tue, 14 Mar 2023 10:12:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230313AbjCNKMR (ORCPT ); Tue, 14 Mar 2023 06:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjCNKME (ORCPT ); Tue, 14 Mar 2023 06:12:04 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2080.outbound.protection.outlook.com [40.107.21.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAA409AA02; Tue, 14 Mar 2023 03:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BPFCgR9AoGZHmZW8s7dFlC3pTSSE36pt5AgqBAzVhQfUL3YjsZRK4wdEGpar0XIxkdHNgS6Bj8DT13iUTyiWJ317ObvwXPPgVwPuiRLGSGvS+ckIg8z16VADFY3On3h01jFhBe5biSm+RxsC5dmCKit3lWXmyHPm739uE01/OMVaxJhNjoiDar3g1kFEEvQXmkGLmuVdkLUyVUaFaCzRA92M2yJHowXinjjXzm0kcpuyjS74QPrC6h8lGQvRUTkWpZ8WKLEP54kgNP1iEf8j/FSZnG4H7UT0V4XNQIRkfXk5zJ+dpYmJc4TPlLeK7nTon84U7wik/895Xn9NSIGKeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4KQHy4ojmtQF1BduRAXSRUeX6FHJREEZUO4mQRp9hxA=; b=Rg7Tq8U4K+7gl1TxTbBh9j6rBhStgevonKbDYr/X9NJjf4ahAEW3r+vSxnAFdUSCr60JCzsO3/HMNsCYJk0yynSI0f0F13616AhSQOw+M2CjTUqJ8xow77vHumBegxzlVbZyio6O0GWrw0+Gs2yHQE0AULUI/nrwHOdh4StfE/uRuqGRM0igiaW+VWe0QxnO+lCXDiWH48pFYbpnggLVZ2PgDMcE3TsZvLN9y+56ucJVLaGzPXApJ3VPOHFNbP7N5OiXiV4JXuZqD8Zr26YO79eQpelzfqX/zZTfTyPqjfKc6dfG8nI6IrXsdt4aK1CjQ+xGb40UXMzjO02iBmL8Og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4KQHy4ojmtQF1BduRAXSRUeX6FHJREEZUO4mQRp9hxA=; b=dDfOytYaXdYJ2/p4qICMICChR8oLbAb/zNFREkQYT1cfABBuP6KNc4KljkDW1wIf0UmNufq1826jvTD4nmEPjcX14oNEYVqqGNzIOHxr5+sXmhFbM6w8eSX82E3aZubLScQDw9q8lPNMzaheMMUclGKdBoR8nt0qRm7RDrKw+pM= 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 AM8PR04MB7841.eurprd04.prod.outlook.com (2603:10a6:20b:244::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.26; Tue, 14 Mar 2023 10:10:34 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 10:10:34 +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 v4 09/10] media: imx-jpeg: Decoder add support for 12bit jpeg Date: Tue, 14 Mar 2023 18:08:52 +0800 Message-Id: <69bd4bbc12b167d84fce97979257081eec281a67.1678788305.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM8PR04MB7841:EE_ X-MS-Office365-Filtering-Correlation-Id: c7424708-70c0-42cd-74ba-08db247459b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bUBLTdUaP177q/36sbPYu7vlmmppO9WRTvP2PghtuUrb/gdeeaRNqNJt2ES/IidNQwGG3HWM6i4mfCuak/txCWDq4DYKL26dyxrA0d0MXWQ6obiQAVJ7sMulwzeOud7cLIyPjPrHPSyNvtPJm60Vphj+ZTKYh/AdQX2tI8dkWYvKY9osHjo0aIzjCQLvR0y35bfkkKDaw+THuNgLLsjxrmQh6EH20oyVMOjuee7ciEfmwJzMIznkb0LA1zM3tlI2N0kVuBe92+r38nTkSZN5WDlPEvPcdQXxYxlX+b4ColQJ4/vt6q8BrQwzgJOxi2Srsi7F5yCmWqwc0IKmCZJSS+k4Xx9K7QN597krG0YV9+a2sB95/vVxcFHvTJBYKu/atn4zIXqfLlIr6Lb1P/PmssgZh6ghIvPaMWNxhtyOZuiP0mB1GJZ56i0cSZBDgD58NtEMBaWaIX3ShY/7CoMH+NH8vdE5Goa5DWQVj3yQaz/OX9O01OPz1qxFWe4TLMBg1xu9gkc+bODv9KVIdvXda4Zh0fuC2eqDf2AoiUVgYOzGLXiUTyOBNn6EdJVsKOhbPClJm/Ou2LM1OFFXsmUurTICEturK8wcp7gl4ywarBHZVV2+EOSnkc7ThB7a8j2jIiWJOOHzycLwHejTX6vSmyGfTPManKCumOhCa6P8N0IuLL3Y8ycQkJkZnIZnSZEmJfH70MRncqERGAba9me2fw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(396003)(346002)(39860400002)(366004)(376002)(136003)(451199018)(7416002)(5660300002)(8936002)(2906002)(44832011)(38350700002)(38100700002)(86362001)(36756003)(41300700001)(478600001)(66946007)(66556008)(66476007)(8676002)(6486002)(6666004)(4326008)(52116002)(83380400001)(316002)(186003)(26005)(6506007)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: v56h01PXKfxiO1xuhnYP6scxqrWTBIRKgw3ZwF4jXnWtEiB+uHeKxQELmZq38h7RV8kBkJ/wmEMwZe1LshryaBdCvtYggzZlUF4YoOM0rn+hRVsN2TXNY4B7GjGceh7ARPy8+CHsg4niS0KSdNNnlkQfgHMUrPYKLkB8cSQ3Rtel4hCYFihE8RrfBtNnsz+wHxZ02NJDO//PTtIHOHfQ7A2Zf0bz7Lu4m2O+OT8lym2In2O1uu7lu7Y4x1uiuJfrkgxdUr64tLVeYszgNf9khtUsNT+G/S2uooZcpGw8jIsC+csAg6iSUuYi3E5njHOaFIxsPZX1znNgpfHDg3PS5IscurlyqNsJAnhDBm4Diwdv9D2HmqKBBpU/4+LAoLQSxrmxp3dDmxZWeV4GUJqm+jGL1syvG+KDWQHIWs2LTuUbb8ASb+HQ1AKJHhrIkqW32e7cKpvd+Ypo9fLFaXyiZRB//OkC5Hz7yhol7CUf9SBC7fGXkqCTSMpxUz2+bYMSQwk+C8FjCqNWM30UexGj8lNdUxA+NqMMyLXZBgWnCTk/sN8/KOkhvp4/G6g4H2yqNQnQr9Hk3zm8gsjhmPa5ODAQqcTu0ivoOQ4DJHdsg40x8ho/hRnBOh6ye3mi0PKaI1k12Kz0UluWgB6bewdudl61Rpt+par0HAuwRL6Ey8b5AXNIjw3F+f1T6J/asFCFtRVWmwSz8L1I9eUMT0WiMjhFCl1dntGyQM2HsuDbSqme0JjNHFvmM5OPj3/crZJdphpbuGMRLc6o1QyRHmeyYqrOYIlKEKW4bBSuIwnvjqZ7ILsNWGoN8n1ykSZpZnJK8NR7BeIXFBAmxrfB8UCmpYyiImS+AR7bzNIU163faCj8IzS7ufD+8s9XBy/RuxC8MT5PmYYMcolXJXbmwigdNaVTvZzYoJ+Q8Lyp3l0sKcsMGrHYVDylxgKUrRa+J4WEyhjS1qyLEngoXLFeMNdE/p1cWqsTCNPa8LfVw4/V7RnC251wIUZYu+eB+uOppYZtLofDW+eEejQynFXRNpW/pu0keTovYpno8dSydBvDqgbTbxtxIzX2Z92jAczECi3H+rbmlTZFzH4T1jaqXdD6UbH0vaothue/nZLR7d745VRnYq7t78noyH7UFgtmffzd1AJFwAnRCrUvuGYyjsFF7PuPdsQfJ/Ps/sU+OuTxNS4jtXyVzZY508BEyRbYzOYIfuYz8TSKSLoA31OVLpaHsZMAsaO0TbV9MdEdKeTme0hH+rCPdaN11v393a/StGiZbYun1vIp3g1K+pTBZK9CUNs8IRfE/ispIlVUErH/HAMzAJjM0fAK/4TgoxWcTkXlxTfnAiQdwmM9nO3YU6lsj1q6eeehciJ91m59habBkiH24C9aq8HHiKA8YiCJ/kHYskHYGRXEeDpnPbbMhPpKFSYqEqatguwo4rAlNe8tn6YCnSjJuy2A8zrA7tYRiu3PpdlfVpXlXlU6nElVjzrhqH1SLInuDFtM1FXg92G64gAoGzfQFI9enj9kxcWM5uAw8eQy7ZuOuGu+/tGYiV8kKjXHslXoVajeSk95qnBW94wx6nsXRED3ebJgu2/74XKR X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7424708-70c0-42cd-74ba-08db247459b1 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 10:10:34.4384 (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: HOiI8+T9pIm4fOGdPVMDhILzC/RWlul6MhCxlkIn4wZ7PiYtzaETmFlmnX5VeRrm7nVrI13rLJJxjsxPKDUVuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7841 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org enable decoding 12-bit extended jpeg Signed-off-by: Ming Qian --- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 136 +++++++++++++++++- 1 file changed, 134 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index 3f1c9bc4b144..74ecc5415aa6 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -87,6 +87,20 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .precision = 8, .is_rgb = 1, }, + { + .name = "BGR 12bit", /*12-bit BGR packed format*/ + .fourcc = V4L2_PIX_FMT_BGR48_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 3, + .depth = 36, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + .is_rgb = 1, + }, { .name = "ABGR", /* ABGR packed format */ .fourcc = V4L2_PIX_FMT_ABGR32, @@ -101,6 +115,20 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .precision = 8, .is_rgb = 1, }, + { + .name = "ABGR 12bit", /* 12-bit ABGR packed format */ + .fourcc = V4L2_PIX_FMT_ABGR64_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 4, + .depth = 48, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + .is_rgb = 1, + }, { .name = "YUV420", /* 1st plane = Y, 2nd plane = UV */ .fourcc = V4L2_PIX_FMT_NV12M, @@ -127,6 +155,32 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV420 12bit", /* 1st plane = Y, 2nd plane = UV */ + .fourcc = V4L2_PIX_FMT_P012M, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_420, + .nc = 3, + .depth = 18, /* 6 x 12 bits (4Y + UV) for 4 pixels */ + .mem_planes = 2, + .comp_planes = 2, /* 1 plane Y, 1 plane UV interleaved */ + .h_align = 4, + .v_align = 4, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, + { + .name = "YUV420 12bit", /* 1st plane = Y, 2nd plane = UV */ + .fourcc = V4L2_PIX_FMT_P012, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_420, + .nc = 3, + .depth = 18, /* 6 x 12 bits (4Y + UV) for 4 pixels */ + .mem_planes = 1, + .comp_planes = 2, /* 1 plane Y, 1 plane UV interleaved */ + .h_align = 4, + .v_align = 4, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "YUV422", /* YUYV */ .fourcc = V4L2_PIX_FMT_YUYV, @@ -140,6 +194,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV422 12bit", /* YUYV */ + .fourcc = V4L2_PIX_FMT_Y212, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_422, + .nc = 3, + .depth = 24, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 4, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "YUV444", /* YUVYUV */ .fourcc = V4L2_PIX_FMT_YUV24, @@ -153,6 +220,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV444 12bit", /* YUVYUV */ + .fourcc = V4L2_PIX_FMT_YUV48_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 3, + .depth = 36, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "Gray", /* Gray (Y8/Y12) or Single Comp */ .fourcc = V4L2_PIX_FMT_GREY, @@ -166,6 +246,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "Gray 12bit", /* Gray (Y8/Y12) or Single Comp */ + .fourcc = V4L2_PIX_FMT_Y012, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY, + .nc = 1, + .depth = 12, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, }; #define MXC_JPEG_NUM_FORMATS ARRAY_SIZE(mxc_formats) @@ -437,17 +530,24 @@ static enum mxc_jpeg_image_format mxc_jpeg_fourcc_to_imgfmt(u32 fourcc) { switch (fourcc) { case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y012: return MXC_JPEG_GRAY; case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_Y212: return MXC_JPEG_YUV422; case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12M: + case V4L2_PIX_FMT_P012: + case V4L2_PIX_FMT_P012M: return MXC_JPEG_YUV420; case V4L2_PIX_FMT_YUV24: + case V4L2_PIX_FMT_YUV48_12: return MXC_JPEG_YUV444; case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR48_12: return MXC_JPEG_BGR; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR64_12: return MXC_JPEG_ABGR; default: return MXC_JPEG_INVALID; @@ -483,6 +583,17 @@ static void mxc_jpeg_addrs(struct mxc_jpeg_desc *desc, offset; } +static bool mxc_jpeg_is_extended_sequential(const struct mxc_jpeg_fmt *fmt) +{ + if (!fmt || !(fmt->flags & MXC_JPEG_FMT_TYPE_RAW)) + return false; + + if (fmt->precision > 8) + return true; + + return false; +} + static void notify_eos(struct mxc_jpeg_ctx *ctx) { const struct v4l2_event ev = { @@ -767,24 +878,31 @@ static int mxc_jpeg_fixup_sof(struct mxc_jpeg_sof *sof, switch (fourcc) { case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12M: + case V4L2_PIX_FMT_P012: + case V4L2_PIX_FMT_P012M: sof->components_no = 3; sof->comp[0].v = 0x2; sof->comp[0].h = 0x2; break; case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_Y212: sof->components_no = 3; sof->comp[0].v = 0x1; sof->comp[0].h = 0x2; break; case V4L2_PIX_FMT_YUV24: + case V4L2_PIX_FMT_YUV48_12: case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR48_12: default: sof->components_no = 3; break; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR64_12: sof->components_no = 4; break; case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y012: sof->components_no = 1; break; } @@ -804,20 +922,27 @@ static int mxc_jpeg_fixup_sos(struct mxc_jpeg_sos *sos, switch (fourcc) { case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12M: + case V4L2_PIX_FMT_P012: + case V4L2_PIX_FMT_P012M: sos->components_no = 3; break; case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_Y212: sos->components_no = 3; break; case V4L2_PIX_FMT_YUV24: + case V4L2_PIX_FMT_YUV48_12: case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR48_12: default: sos->components_no = 3; break; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR64_12: sos->components_no = 4; break; case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y012: sos->components_no = 1; break; } @@ -847,12 +972,15 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cfg_stream_vaddr, u8 *cfg = (u8 *)cfg_stream_vaddr; struct mxc_jpeg_sof *sof; struct mxc_jpeg_sos *sos; + const struct mxc_jpeg_fmt *fmt = mxc_jpeg_find_format(fourcc); + + if (!fmt) + return 0; memcpy(cfg + offset, jpeg_soi, ARRAY_SIZE(jpeg_soi)); offset += ARRAY_SIZE(jpeg_soi); - if (fourcc == V4L2_PIX_FMT_BGR24 || - fourcc == V4L2_PIX_FMT_ABGR32) { + if (fmt->is_rgb) { memcpy(cfg + offset, jpeg_app14, sizeof(jpeg_app14)); offset += sizeof(jpeg_app14); } else { @@ -918,6 +1046,10 @@ static void mxc_jpeg_config_dec_desc(struct vb2_buffer *out_buf, desc->stm_ctrl &= ~STM_CTRL_IMAGE_FORMAT(0xF); /* clear image format */ desc->stm_ctrl |= STM_CTRL_IMAGE_FORMAT(img_fmt); desc->stm_ctrl |= STM_CTRL_BITBUF_PTR_CLR(1); + if (mxc_jpeg_is_extended_sequential(jpeg_src_buf->fmt)) + desc->stm_ctrl |= STM_CTRL_PIXEL_PRECISION; + else + desc->stm_ctrl &= ~STM_CTRL_PIXEL_PRECISION; desc->line_pitch = q_data_cap->bytesperline[0]; mxc_jpeg_addrs(desc, dst_buf, src_buf, 0); mxc_jpeg_set_bufsize(desc, ALIGN(vb2_plane_size(src_buf, 0), 1024)); From patchwork Tue Mar 14 10:08:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13173977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E812C74A44 for ; Tue, 14 Mar 2023 10:12:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230254AbjCNKM4 (ORCPT ); Tue, 14 Mar 2023 06:12:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230123AbjCNKMp (ORCPT ); Tue, 14 Mar 2023 06:12:45 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2080.outbound.protection.outlook.com [40.107.21.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B51C199BEE; Tue, 14 Mar 2023 03:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SMz7A6qeZI0gDImST8+vYmJgNTwqdM+/hi1BZeDvMuUMjEafTIS4n3bCiEZkMdy5wStFKo021xWJcXBy+FGqpyjgNo6Nfik4Kkkt07acEBq/EvTIzWbeHCLiRN1qygPmEUj0/O33Y7oriKyg+/5LazR9WvDMh0rJ/P5ipXXXwxiPi57dsnfGyPmwr6bdS/aG9Lh1UV9E8dNUAMkeONBFgXruPoW1Y07ATWYy9SpitrXvoDCYFlB+m1LF2WcPEdfyxd77INHQdPEA0i8EiTr0QWUu2UEp0NbDINlYFe242d/VpjEVSb8sKYOPRY4IaFfpg/qbaANqq6IeAonU6N4IAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qCAL8779U4zEgsqncy9scuUL8gibGXjTY42SAMO9ens=; b=AyngtXbeo0IKZxNFO4pJDf/A6IxqorDlfszhJ5ijg0SsUbB1c6wBDm/ueFSi8rHxT2WSZm7UEs31eBIh4vyjcT2Cu6/3j8YAxpDNhiXhf5VFuz4xvg4XY430UOditfw6DRSmvrG1DXkPikWjxLGKtl3lFncajilYZXTyV/u2ficKgzjZOfpxtmjJaAVPaZHXIIspThGjMUl43lcllBIBjiIJ3cN5gCm6saSoc0g7wJqAxsstbL1KLYBGyVEk8F+ig4n47udg2JRcmWjjY9ZjAN6BHZUvI8OL81zeZ2e73KOA0Ud7zWsm5G/HBt6PPxZChfAqKj5qr1VCqX6ixwEB7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qCAL8779U4zEgsqncy9scuUL8gibGXjTY42SAMO9ens=; b=jMl10IG2/1xVghzyhY+CL/xWN8VsXSOiW51h4mm4EECv39QHchkg7MHiDR+z5zUeZ12yGVe1JKiIC8FKkoQdDWYnP6dE0yw0IFmOg0lwBZTYsppjyKHhNTRzLhvkKSSS7QBvqtdn3r5qkPaeHgj04Yy51IRKqN05mXkAkbMWrQ4= 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 AM8PR04MB7841.eurprd04.prod.outlook.com (2603:10a6:20b:244::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.26; Tue, 14 Mar 2023 10:10:38 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.024; Tue, 14 Mar 2023 10:10:38 +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 v4 10/10] media: imx-jpeg: Encoder add support for 12bit jpeg Date: Tue, 14 Mar 2023 18:08:53 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:1f4::6) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM8PR04MB7841:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ac5b80d-ef4a-4066-7485-08db24745c43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kI74PbbL7nyySy0uCm0P6EFv9iK8kjUASC1SXeXrAumG3CEJUndMJHn5qLRU8hlq6L6Hns7xTcxI8pyIS38s4PMlwXVNvWt6rv9ITfLMBHqf2MNvN8ejZUuEjKZYMfGdsfYd7ta3colEqTmdCwhF1P/+fju6uPJ9jNWmiTiKqr4hzNav4eivFR44FRy9TdYfo7DceioF+AziOqjRXwAXaMITt/HmJTLEhaxq/rMGsRLVHcVqxUJf5/zaEjKtBMouOY4K80R+xLf5YSVtdZKzCed9WrhuKh//feAgaFwMCgBHXJRHJBDOGzvyN6HD0IHj8HH94l5KqnS3QbqghkTFYIY8vNwEo9SqZCWApmOAX9XB7KOGhY3TcI0LBPjlpGCA+EhNgTsTY9um9w4Aze5Yz/27UmyCILglna8va1lzkocMJGAwOHQWLZucl7fPvp2eTxU+/SSn1SlSdeUcJRI445bJTsjGkdm1NzQ4mPgAHU+xlJC3P/QSajJG/fkJ8MtfMCe25Ij5t22NbL9ipcBLfrS4b4gcX/n1UJeULPNicP+TrhiaCWkuVvN7AIaQgWHSxAjdtiMdE8qFZcD6onh42jmZTzLP+Keecov3w0xeLEXbz1CgzUS8CF+7shVAQf9muwCuQ2XUYnkXXwCsT04WNqGryJeTLBL056Rp/37YbRaM/Ocs62wxgDb9vJ/i8trMCuRt86mQJDLl+mxKH2iFsA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(396003)(346002)(39860400002)(366004)(376002)(136003)(451199018)(7416002)(5660300002)(30864003)(8936002)(2906002)(44832011)(38350700002)(38100700002)(86362001)(36756003)(41300700001)(478600001)(66946007)(66556008)(66476007)(8676002)(6486002)(6666004)(4326008)(52116002)(83380400001)(316002)(186003)(26005)(6506007)(2616005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ARWasc0gq/++sR2xbwLLxc4mnCLZbgamHFfxxlwxZU3WNXRtfUJFM01mOF8JqJV+MhNnnlxo846TEVkMfz5iH5cek4haTwbNYt2lmqd8U+cyw6upJ+OGAPG9+PNgF85vmGo6ONjOIVgAVoYtDY62ns8nAuFrUC6qJNqANoauHjID6QB6zPC6gW5W0uYiJN4cgiyOdy1U7hdG+YYof/+p3fsGeZ2BDTjeUTZGFy4isBQrV2GTsU993avvnC9opf7TX5QKutG0nDqWiRPITOcRHdAqFGn1acMbowZ4bt4fDN9DjdPGM4cNSG3F77C3Ix7iEZ7TpN57DmFpbdd1scsoU/kDTzQMuP/QF1irsjpDGHWirsKD3hLgYjbGY1QGcC9li58cVelO/U3uXAcr0o9VGCGH0ncsdrT628suurERhDb0e8wWuPwQezqsncLuNBVTbJhrOOrcCT2dio/mZXCebyIgepBov0nNPBXyvZHVI1ggpx7qZkb87UlmV6rfZpjyFEMiP1LRrl+xsJj9OyKhC6qTp6XFoSPbnfYY8DRk4ENP97hM9KMrHDJ+D1qZd+eMLMe2nMKDEzDEErqTWeNKfYKvO+PTv1jQpw3vH07jooy/ZuH2pWk43zGQQ4WVBUu/Q2EAeKpB5TpK1+KKs4/O897gEZYwvp1zHMwXtGd000LT4pRYFWiCQ1Kq25oPWpA3oJtfVRxye2a6bZg+/sjkvrEumT5BBUXipYAaL9+uaI5VlC63mMqVRKG/F/D4DxPk0wpo4V2PA2zK4HQNmNd1UK2U0grkf15Mtmy3c5ZNnN8xr1PzLN3G+cVf2tJbGQ2TA7FyWoCC3JPTfjAgddifLDWFQ65joIG9p0tV/shwmZVrDEkJY5sIgBFIqyz/i4+Lrla9J+nRHiHtxlnRDfWuw6dp2OJofpxBo2l2eSmNvEbGwmaEDvhq6+OnMQKaXRN8wo+rWo/RSdApzJ7dZFpgZ/92CEFNDpdcPQ/5BiMbtTqfzVgQ+w13o1cNg1lJci015RdL7QDWZ/XMnHJHuVbM5M3DKth6Ou/1GZhnltD6it19j2pRQY6wclsmOQbagWuS0s82ZLS/F+0Zy5e52noa6/8aqmUZNKW/ESsFDhN1oV/EFRjQYhtdEc+VQNvNqcLLesSFvdyEsNOxaewhmRBICc6aRHfLdscN7XIEY5M4Vftgslvi+OhoC13yZ6g8h3I86BCRZaO7j+N5lEyIQZUkiGIwuWkL02ni8itvPHd9ZybG8yB+KFhSCy1Eo7Y5/Xk884wHBcPvlioO7dnLCBF3tuAs2M1a1hP+YxBcz9RrtucI+qMbiVTBEkAPSLz7Hi9b21OihmPfqlpcRKCxnrnGWVVD3DD3zXsFHASbXvB+Yx1V1/NxCL89/aG3L9MU3F7KM3ErM67TpU5smCKudLeUwG2BSsuCw7IOpFGp7JGYHVJt/JfVfCMtyNYEX6RZzkczA/Xs7Vi5bnl1Od7S51M5+2C1SAkKYqVxE1DhalA+DAJ690fw+unZiBYpca/nrmQZBDM9SFJLHHUfnXhlI4wdAOAvYz2BVjXzE2QqDy0WBNqTBhDLkxTOMsSar71qwPNX X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ac5b80d-ef4a-4066-7485-08db24745c43 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2023 10:10:38.8444 (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: bew7Unotvncgu23kz1Pms0Nm5LNpBrNyLaVzT+l4UO4Zf/AL5b7QZUH/zdUjEQJwzmOjnBl43Yi0sjD8s0fQ+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7841 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org enable encoding 12-bit extended jpeg Signed-off-by: Ming Qian --- .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 14 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 4 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 172 +++++++++++++++++- 3 files changed, 175 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c index bbd5d6a9fc86..9a6e8b332e12 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c @@ -97,25 +97,31 @@ void mxc_jpeg_sw_reset(void __iomem *reg) writel(GLB_CTRL_SFT_RST, reg + GLB_CTRL); } -void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg) +void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg, u8 extseq) { dev_dbg(dev, "CAST Encoder CONFIG...\n"); /* * "Config_Mode" enabled, "Config_Mode auto clear enabled", */ - writel(0xa0, reg + CAST_MODE); + if (extseq) + writel(0xb0, reg + CAST_MODE); + else + writel(0xa0, reg + CAST_MODE); /* all markers and segments */ writel(0x3ff, reg + CAST_CFG_MODE); } -void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg) +void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg, u8 extseq) { dev_dbg(dev, "CAST Encoder GO...\n"); /* * "GO" enabled, "GO bit auto clear" enabled */ - writel(0x140, reg + CAST_MODE); + if (extseq) + writel(0x150, reg + CAST_MODE); + else + writel(0x140, reg + CAST_MODE); } void mxc_jpeg_enc_set_quality(struct device *dev, void __iomem *reg, u8 quality) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h index 8b7cd6526efd..ed15ea348f97 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h @@ -117,8 +117,8 @@ void print_wrapper_info(struct device *dev, void __iomem *reg); void mxc_jpeg_sw_reset(void __iomem *reg); int mxc_jpeg_enable(void __iomem *reg); void wait_frmdone(struct device *dev, void __iomem *reg); -void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg); -void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg); +void mxc_jpeg_enc_mode_conf(struct device *dev, void __iomem *reg, u8 extseq); +void mxc_jpeg_enc_mode_go(struct device *dev, void __iomem *reg, u8 extseq); void mxc_jpeg_enc_set_quality(struct device *dev, void __iomem *reg, u8 quality); void mxc_jpeg_dec_mode_go(struct device *dev, void __iomem *reg); int mxc_jpeg_get_slot(void __iomem *reg); diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index 74ecc5415aa6..1bf24bf3257d 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -322,6 +322,45 @@ static const unsigned char jpeg_dqt[] = { 0x63, 0x63, 0x63, 0x63, 0x63, 0x63 }; +static const unsigned char jpeg_dqt_extseq[] = { + 0xFF, 0xDB, + 0x01, 0x04, + 0x10, + 0x00, 0x80, 0x00, 0x58, 0x00, 0x60, 0x00, 0x70, + 0x00, 0x60, 0x00, 0x50, 0x00, 0x80, 0x00, 0x70, + 0x00, 0x68, 0x00, 0x70, 0x00, 0x90, 0x00, 0x88, + 0x00, 0x80, 0x00, 0x98, 0x00, 0xC0, 0x01, 0x40, + 0x00, 0xD0, 0x00, 0xC0, 0x00, 0xB0, 0x00, 0xB0, + 0x00, 0xC0, 0x01, 0x88, 0x01, 0x18, 0x01, 0x28, + 0x00, 0xE8, 0x01, 0x40, 0x01, 0xD0, 0x01, 0x98, + 0x01, 0xE8, 0x01, 0xE0, 0x01, 0xC8, 0x01, 0x98, + 0x01, 0xC0, 0x01, 0xB8, 0x02, 0x00, 0x02, 0x40, + 0x02, 0xE0, 0x02, 0x70, 0x02, 0x00, 0x02, 0x20, + 0x02, 0xB8, 0x02, 0x28, 0x01, 0xB8, 0x01, 0xC0, + 0x02, 0x80, 0x03, 0x68, 0x02, 0x88, 0x02, 0xB8, + 0x02, 0xF8, 0x03, 0x10, 0x03, 0x38, 0x03, 0x40, + 0x03, 0x38, 0x01, 0xF0, 0x02, 0x68, 0x03, 0x88, + 0x03, 0xC8, 0x03, 0x80, 0x03, 0x20, 0x03, 0xC0, + 0x02, 0xE0, 0x03, 0x28, 0x03, 0x38, 0x03, 0x18, + 0x11, + 0x00, 0x88, 0x00, 0x90, 0x00, 0x90, 0x00, 0xC0, + 0x00, 0xA8, 0x00, 0xC0, 0x01, 0x78, 0x00, 0xD0, + 0x00, 0xD0, 0x01, 0x78, 0x03, 0x18, 0x02, 0x10, + 0x01, 0xC0, 0x02, 0x10, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, + 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, 0x03, 0x18, +}; + static const unsigned char jpeg_sof_maximal[] = { 0xFF, 0xC0, 0x00, 0x14, 0x08, 0x00, 0x40, 0x00, 0x40, @@ -329,6 +368,13 @@ static const unsigned char jpeg_sof_maximal[] = { 0x03, 0x11, 0x01, 0x04, 0x11, 0x01 }; +static const unsigned char jpeg_sof_extseq[] = { + 0xFF, 0xC1, + 0x00, 0x14, 0x08, 0x00, 0x40, 0x00, 0x40, + 0x04, 0x01, 0x11, 0x00, 0x02, 0x11, 0x01, + 0x03, 0x11, 0x01, 0x04, 0x11, 0x01 +}; + static const unsigned char jpeg_dht[] = { 0xFF, 0xC4, 0x01, 0xA2, 0x00, 0x00, 0x01, 0x05, 0x01, @@ -393,6 +439,90 @@ static const unsigned char jpeg_dht[] = { 0xF6, 0xF7, 0xF8, 0xF9, 0xFA }; +static const unsigned char jpeg_dht_extseq[] = { + 0xFF, 0xC4, + 0x02, 0x2a, 0x00, 0x00, 0x01, 0x05, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, + 0x04, 0x03, 0x05, 0x05, 0x02, 0x03, 0x02, + 0x00, 0x00, 0xbf, 0x01, 0x02, 0x03, 0x00, + 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, + 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, + 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x23, + 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, + 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x34, 0x35, 0x36, + 0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, + 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54, + 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, + 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, + 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, + 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, + 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, + 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, + 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, + 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, + 0xf7, 0xf8, 0xf9, 0xfa, 0x0b, 0x0c, 0x0d, + 0x0e, 0x1b, 0x1c, 0x1d, 0x1e, 0x2b, 0x2c, + 0x2d, 0x2e, 0x3b, 0x3c, 0x3d, 0x3e, 0x4b, + 0x4c, 0x4d, 0x4e, 0x5b, 0x5c, 0x5d, 0x5e, + 0x6b, 0x6c, 0x6d, 0x6e, 0x7b, 0x7c, 0x7d, + 0x7e, 0x8b, 0x8c, 0x8d, 0x8e, 0x9b, 0x9c, + 0x9d, 0x9e, 0xab, 0xac, 0xad, 0xae, 0xbb, + 0xbc, 0xbd, 0xbe, 0xcb, 0xcc, 0xcd, 0xce, + 0xdb, 0xdc, 0xdd, 0xde, 0xeb, 0xec, 0xed, + 0xee, 0xfb, 0xfc, 0xfd, 0xfe, 0x01, 0x00, + 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, + 0x0d, 0x0e, 0x0f, 0x11, 0x00, 0x02, 0x01, + 0x03, 0x03, 0x02, 0x04, 0x03, 0x05, 0x05, + 0x02, 0x03, 0x02, 0x00, 0x00, 0xbf, 0x01, + 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, + 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, + 0xa1, 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, + 0x52, 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72, + 0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, + 0x1a, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, + 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, + 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, + 0x77, 0x78, 0x79, 0x7a, 0x83, 0x84, 0x85, + 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, + 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, + 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, + 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, + 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, + 0xda, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, + 0xe7, 0xe8, 0xe9, 0xea, 0xf1, 0xf2, 0xf3, + 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, + 0x0b, 0x0c, 0x0d, 0x0e, 0x1b, 0x1c, 0x1d, + 0x1e, 0x2b, 0x2c, 0x2d, 0x2e, 0x3b, 0x3c, + 0x3d, 0x3e, 0x4b, 0x4c, 0x4d, 0x4e, 0x5b, + 0x5c, 0x5d, 0x5e, 0x6b, 0x6c, 0x6d, 0x6e, + 0x7b, 0x7c, 0x7d, 0x7e, 0x8b, 0x8c, 0x8d, + 0x8e, 0x9b, 0x9c, 0x9d, 0x9e, 0xab, 0xac, + 0xad, 0xae, 0xbb, 0xbc, 0xbd, 0xbe, 0xcb, + 0xcc, 0xcd, 0xce, 0xdb, 0xdc, 0xdd, 0xde, + 0xeb, 0xec, 0xed, 0xee, 0xfb, 0xfc, 0xfd, + 0xfe, +}; + static const unsigned char jpeg_dri[] = { 0xFF, 0xDD, 0x00, 0x04, 0x00, 0x20 @@ -802,7 +932,8 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) if (dec_ret & SLOT_STATUS_ENC_CONFIG_ERR) { u32 ret = readl(reg + CAST_STATUS12); - dev_err(dev, "Encoder/decoder error, status=0x%08x", ret); + dev_err(dev, "Encoder/decoder error, dec_ret = 0x%08x, status=0x%08x", + dec_ret, ret); mxc_jpeg_clr_desc(reg, slot); mxc_jpeg_sw_reset(reg); buf_state = VB2_BUF_STATE_ERROR; @@ -814,10 +945,11 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) if (jpeg->mode == MXC_JPEG_ENCODE && ctx->enc_state == MXC_JPEG_ENC_CONF) { + q_data = mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); ctx->enc_state = MXC_JPEG_ENCODING; dev_dbg(dev, "Encoder config finished. Start encoding...\n"); mxc_jpeg_enc_set_quality(dev, reg, ctx->jpeg_quality); - mxc_jpeg_enc_mode_go(dev, reg); + mxc_jpeg_enc_mode_go(dev, reg, mxc_jpeg_is_extended_sequential(q_data->fmt)); goto job_unlock; } if (jpeg->mode == MXC_JPEG_DECODE && jpeg_src_buf->dht_needed) { @@ -868,8 +1000,12 @@ static int mxc_jpeg_fixup_sof(struct mxc_jpeg_sof *sof, u16 w, u16 h) { int sof_length; + const struct mxc_jpeg_fmt *fmt = mxc_jpeg_find_format(fourcc); - sof->precision = 8; /* TODO allow 8/12 bit precision*/ + if (fmt) + sof->precision = fmt->precision; + else + sof->precision = 8; /* TODO allow 8/12 bit precision*/ sof->height = h; _bswap16(&sof->height); sof->width = w; @@ -988,16 +1124,28 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cfg_stream_vaddr, offset += sizeof(jpeg_app0); } - memcpy(cfg + offset, jpeg_dqt, sizeof(jpeg_dqt)); - offset += sizeof(jpeg_dqt); + if (mxc_jpeg_is_extended_sequential(fmt)) { + memcpy(cfg + offset, jpeg_dqt_extseq, sizeof(jpeg_dqt_extseq)); + offset += sizeof(jpeg_dqt_extseq); + + memcpy(cfg + offset, jpeg_sof_extseq, sizeof(jpeg_sof_extseq)); + } else { + memcpy(cfg + offset, jpeg_dqt, sizeof(jpeg_dqt)); + offset += sizeof(jpeg_dqt); - memcpy(cfg + offset, jpeg_sof_maximal, sizeof(jpeg_sof_maximal)); + memcpy(cfg + offset, jpeg_sof_maximal, sizeof(jpeg_sof_maximal)); + } offset += 2; /* skip marker ID */ sof = (struct mxc_jpeg_sof *)(cfg + offset); offset += mxc_jpeg_fixup_sof(sof, fourcc, w, h); - memcpy(cfg + offset, jpeg_dht, sizeof(jpeg_dht)); - offset += sizeof(jpeg_dht); + if (mxc_jpeg_is_extended_sequential(fmt)) { + memcpy(cfg + offset, jpeg_dht_extseq, sizeof(jpeg_dht_extseq)); + offset += sizeof(jpeg_dht_extseq); + } else { + memcpy(cfg + offset, jpeg_dht, sizeof(jpeg_dht)); + offset += sizeof(jpeg_dht); + } memcpy(cfg + offset, jpeg_dri, sizeof(jpeg_dri)); offset += sizeof(jpeg_dri); @@ -1138,6 +1286,10 @@ static void mxc_jpeg_config_enc_desc(struct vb2_buffer *out_buf, desc->stm_ctrl = STM_CTRL_CONFIG_MOD(0) | STM_CTRL_IMAGE_FORMAT(img_fmt); desc->stm_ctrl |= STM_CTRL_BITBUF_PTR_CLR(1); + if (mxc_jpeg_is_extended_sequential(q_data->fmt)) + desc->stm_ctrl |= STM_CTRL_PIXEL_PRECISION; + else + desc->stm_ctrl &= ~STM_CTRL_PIXEL_PRECISION; mxc_jpeg_addrs(desc, src_buf, dst_buf, 0); dev_dbg(jpeg->dev, "cfg_desc:\n"); print_descriptor_info(jpeg->dev, cfg_desc); @@ -1338,7 +1490,9 @@ static void mxc_jpeg_device_run(void *priv) ctx->enc_state = MXC_JPEG_ENC_CONF; mxc_jpeg_config_enc_desc(&dst_buf->vb2_buf, ctx, &src_buf->vb2_buf, &dst_buf->vb2_buf); - mxc_jpeg_enc_mode_conf(dev, reg); /* start config phase */ + /* start config phase */ + mxc_jpeg_enc_mode_conf(dev, reg, + mxc_jpeg_is_extended_sequential(q_data_out->fmt)); } else { dev_dbg(dev, "Decoding on slot %d\n", ctx->slot); print_mxc_buf(jpeg, &src_buf->vb2_buf, 0);