From patchwork Wed Feb 1 06:02:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 649523 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 0606AC38142 for ; Wed, 1 Feb 2023 06:03:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231527AbjBAGDc (ORCPT ); Wed, 1 Feb 2023 01:03:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230109AbjBAGD0 (ORCPT ); Wed, 1 Feb 2023 01:03:26 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2058.outbound.protection.outlook.com [40.107.6.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F9A55C0C8; Tue, 31 Jan 2023 22:03:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kk20gGXIaYQv4pR5qZwyqhSxywLVtzyvuVcZliPj4/M8g++qRVkohsOXrDNMDOB5wEoItYQD0F9zxAdn29AveDc8BUSbZt2yrq6LfFK19+MTCJDq6OrCc0bnyRUg/ODO+U2+v3IeLhLL6WE308PsG3JIXsrQW4gJDMO04+1Sn1BAi4xGtQWk47lB/mBnW1i0YMPem40khGRYhinppwK/37FfkMChSTBqV9s+jMP1IuMD5ZFhkQX89+gdUVQfGdonRuyII7IS/2AxpIJuEIzl5WDiG63+iZsBTL0lxSPlxwKhWPIvELGQwlIGHjrQB/1l4/CysMH6uLHBy0vyGBTzOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=miYxDbfwNBWe1KNc4EwmJT97nAHpFZhA3X+bNK+LYGc=; b=UsnX5KG1gjkFW+v970tngE5a/gh17KKZZCHjkhjxnF3hhgvcDre3iwoPoUUQmKsX10n04bYoHSjLhnD9iIzXtpRPCtyLUMWPmp8z8YzxpZTBNiJoZ8iEORQ3sZSkvlE0vz3tJSV2CKUC2Z7iSJNke8x15Um4fpGDHRI+IpMsXLJdpiDY799zfQFDe8tI1tn4nvktfiyx5DIHKvl8+PUQDUnkaudmQwXYV4DLkM0J350R9IiHAPUV0uTaiUOx701szGvU5tEaaKsi+wT/4JK+/w21vInOJ/D7qKWqGOWaobpktjw1O81tV4rNqJd3udOEHt915y+agVnib0V4pj94+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=miYxDbfwNBWe1KNc4EwmJT97nAHpFZhA3X+bNK+LYGc=; b=AJiNi6jb//Zm1xeGch/wMWOL/SVjxN+LjGG7zeX4ITV7vCKvYnt8LXY9MO2ChZiazbw4P3UHchoqr0jeJkzNQnWs9a29Bygl8RRHnvN52WrsRjnHn0U/MYFG3fjh3LVx0FGiH+WzcQZNicpRGsi1TD4XQMhpCmzLpA5MJ+7vZuU= 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 DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 06:03:21 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.6043.036; Wed, 1 Feb 2023 06:03:21 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 01/10] media: Add P012 and P012M video format Date: Wed, 1 Feb 2023 14:02:23 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a6e70d7-e3d1-435e-90c5-08db041a05ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w5vY17yn/pzskLvxQIVoKUcAruZphB/V3/ZBmNANRtgBu0cf0sWbNe8Oalzn6PJaKS+yP+S7XTxI1X8UEhpz9RR7VmBvLuxzT6bqh2U52Y04WnwmURVi3tZ5MhcqgTEe9Sex/2f6vZYpLO+6YLH7v+YVLi8ZesFnSrS1zYiuz/fb+N4KZe7S5bwnklxBiAjeGm0tNxq/O4oNd3e5kZ2yubkmXti7YS0SXQniojw7TfuuE8mRxlDHVvtvMHC353yzwQNNwMmwFe1rPh08NNUNXRymLGqglXDPDSGdD3ZWWGy/8eD0mg+DarLZdRi3oFnJeXt/hIuow3WJZ6t6R/KLlbtVvbS+5xOu5BbhUr53CjU7706Duy8Rui4k9xRpesxZuCUa4x4oQ3pDirFF6nMT4j0ho0vp7x/T+GjQXktlFQ+76wEPrEX2BD66i24jqO5nwir2hKJi/9irKjp+rMHNLJzKOqKcF687VXep87wa1bpeGU63D9fAzX0eQo2j1mBi6FJNH0jsgNBq71KI30ys9PMZSp6zrI/rmHqiXAbZc+8pQqbKJ7pAQCmO9Q9/bCK0mQnwg0V71M/oXClIDAnGEiGx5m9T6GnrDYu1yfVkJWV2qc/sK1DmW2rO51XaDBmvIiGM7CFTtZ5OLPsbcHYibGoLUo44GVV1pkdI3HirwRS2B008tgAID1+5rZcvLzFyCKy3QNv8Z+0qF+JCZ4jtMw== 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)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199018)(38100700002)(52116002)(2616005)(38350700002)(36756003)(7416002)(8936002)(86362001)(5660300002)(44832011)(316002)(41300700001)(2906002)(83380400001)(6506007)(6512007)(8676002)(4326008)(186003)(26005)(478600001)(66476007)(66556008)(6486002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WKYYMLH/0OPkCYnoktLcp581EznFks4IoKjNfFxOZQhg7RupyVvCkQMdoYRO0khZxw+kMKPneAGtyg3TCvgnoN00wvle5eGtR+1uQ3u/LqDKfFFSBpnMbJt7w+QoqY7+Q/akb7KUmZ2ny2Tfo+dYmM08+mA1B+o2xWCBgD/qknVhFZUwMblqb3QvIpKaUIJmNUgOjob5WkNvjPtW+vu+ZxOyx/46RuEBDj4dB3fmfVm0txF/8xKM5qgJZmVwH5jfvnBMKdxXFvLOe9sdZ5afXwxXuAYyZhsZ8mhHX3KgRRA1A6V777AgefMeVvZD8OXWZlxYXhA22jamt1vkd2NxKLJ6uz89KEm+6wBaMhQv5hW83WF4uY9+dSD1SyFl8xtvfLlFLBITR9EUu1Rj8i2+3Ed1fcHQIxZ9BqB9uIc52AIyttWcSF667SeBc6pnzKRZQK4xXkb6jb6sWNzoSNa8/InQ3VscnHClQi6boRUsQxBUhdj/NIu/u9CZO5Dtd/o/A+QY8W3M7POy/u8/mDiiyQZ9SsbFUGzFMZqBaFAgbErKXVUolnc8jsZDTVQyFmdEltYJFvTIoqFfc9WZl6HFdWfdHUBjpZpqD5y0IQc26WUIpeJKPsZItuAUuxzLLrshQawDTU5hHpx1VyOHxugHkEUa6j/dJpxO4MbQbVS1+zTC+0DD2Rci52MZcFtvscatVjgZXl0bDuPrN2hd/Bw+lWMKEA0qYlQptn26XuxA10n/mYM0+Pz5Yt3Y2nt5EOxV5pWmtjKhUp/sT9tmk1D34XFczLwjHvVxAjOGU8yKuNOoL+sxufJHeugAkS2mW3mYW7Am8upvmcQ6TYsl9nGFD6BbYQ68PwvFDo9SOr0+b02QTTE0utUDOYr5z0c0p1rf0MmPMZGMDHzmvX3QpD0TkK2jIkus9mBJB2yrE6bFoM0+8maUk1kagPuLobWAd9a/KKVqndK9Z5vc8XM0eeYU270PTpsLLxrysR/lmB16bSq0uOuUs32CpM0KO3/gr6DssmwBUMfNJcy+IlN9CZtmj0b6TRk9Tqfgartor3/aiWXL4Myz4ERRXiSwq3t3s1uiTrRRPSAxiYroIrXlQssp4bs1BtEuT+lfLlyHunKJhalS7jFDWzZFPbiqLZi7Fu+vGWj6QfrlXwv8BG9ZB8UAgj6ll1Mfy5rtrk4ab8TyjoPgMFiuzi4cADXXfGQBeni2lVgUY70oZyqDYLno2svkaTRD0Wnko7YTT4XcgnUPdx2CupbApmi/3GxLhd+ncdnq7227zEAdN0Xj1ybXuc/k7ma3uJK4aPSOQKke0fAE9T8st9H6D4vvwlavNq5DpdseNOkFiZvIIBUFUxC5dR4yK/zDYgmWAuMsbPQXNdqNgaFUn7IOfyQC+BpMZegU0CDn2ZAl9wpUxzk5GtjtzBZk+IaWvFBUT9TvbbCJ94+D05nYm5PFeDKmjp2I7E+DbsWUkr2+LYOfz9hV6g2F1CyGABajnHH001pnEKomsfHlEFJEQtGrKV1UOSnChwZUzXyYdI7eGafoRtI2uSwyS9qxpMG5HfRBoe9hDpQ/eKZjuKbaPhBouXRD2RrBrybMwHVK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a6e70d7-e3d1-435e-90c5-08db041a05ce X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 06:03:21.8485 (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: PnJo0D93R5FzEUF3NxgoIitTKTEcvKCc8pkKkn0OYb+wmY5cRUEcftCuSTqaE92TOa2Lf8TK/c4BYtnpfSSpZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 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 8e0a0ff62a70..067dbdd0a9ef 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1348,6 +1348,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_NV24: descr = "Y/UV 4:4:4"; break; case V4L2_PIX_FMT_NV42: descr = "Y/VU 4:4:4"; break; case V4L2_PIX_FMT_P010: descr = "10-bit Y/UV 4:2:0"; break; + case V4L2_PIX_FMT_P012: descr = "12-bit Y/UV 4:2:0"; break; case V4L2_PIX_FMT_NV12_4L4: descr = "Y/UV 4:2:0 (4x4 Linear)"; break; case V4L2_PIX_FMT_NV12_16L16: descr = "Y/UV 4:2:0 (16x16 Linear)"; break; case V4L2_PIX_FMT_NV12_32L32: descr = "Y/UV 4:2:0 (32x32 Linear)"; break; @@ -1358,6 +1359,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_NV61M: descr = "Y/VU 4:2:2 (N-C)"; break; case V4L2_PIX_FMT_NV12MT: descr = "Y/UV 4:2:0 (64x32 MB, N-C)"; break; case V4L2_PIX_FMT_NV12MT_16X16: descr = "Y/UV 4:2:0 (16x16 MB, N-C)"; break; + case V4L2_PIX_FMT_P012M: descr = "12-bit Y/UV 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YUV420M: descr = "Planar YUV 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YVU420M: descr = "Planar YVU 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YUV422M: descr = "Planar YUV 4:2:2 (N-C)"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 1befd181a4cc..5448aa3b7858 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -626,12 +626,14 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ #define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr 4:2:0 10-bit per component */ +#define V4L2_PIX_FMT_P012 v4l2_fourcc('P', '0', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* two non contiguous planes - one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */ +#define V4L2_PIX_FMT_P012M v4l2_fourcc('P', 'M', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* three planes - Y Cb, Cr */ #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ From patchwork Wed Feb 1 06:02:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 650779 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 95E9DC636D7 for ; Wed, 1 Feb 2023 06:03:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229761AbjBAGDe (ORCPT ); Wed, 1 Feb 2023 01:03:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231543AbjBAGDb (ORCPT ); Wed, 1 Feb 2023 01:03:31 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2058.outbound.protection.outlook.com [40.107.6.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93E8A5C0D0; Tue, 31 Jan 2023 22:03:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XHFUryWP0sVqo5J434cwxyRxNc5PS0oJ54RJOn+rgLTiWU7z7dSbjKGPKW0KofspTIfgMYLqqaRZqrTt1qUfIAxIQw+E+NtgyCC+dvms8Utw1jY0C9vUHiqeiHPuszLtj9J1ur0wt3dCi+/I/g0M9K/VsjT8UhnkPmA2gF5o0kNKeRo/0/aIsFklepduvWHXfeCIrXHUMKMJ4ill0pb/X/kEqbxPrQozvaIE4EtX2JLCu6wOsv911UhcHRnSGHc/iEJ++WkJxMVQhc1wkpoyU5uaJQbxsTGQvtwWikpMAw2URwSpBcvbpSfSbYsK6jIUHORdHEpGQxWks8OWL0gwIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d2Yx21b0j1MK0Ce6cSenyGIaB1kBCSsck2Aem2dw9Nc=; b=hm4brprARlP8ul2zLawpWagG4SmxCkwCBPw1Zg/8Kajrh7B32YNj2mvyR/8pgwdLcc52uuuhwGCDWbT9bttyFeTK1DutFGNKVOVlx6A6V7wYYGN8ICxS4+YheDfuSfD8xNuiz8Jf0Px7yvYwtRtqZEA706R876fc6j6QCOJUFOGFeRT+yMnTjz3TSqUv/n9Ijc4dGaB1D8vOsKx4J+cqHq/w6YIbjvb7UcgfmI+XFgPFlTcwH/GSr/UYFCPQCt/IlRHBBEOMLra/nRnSJ10slVGZFkvCheCmgDsk+ibOSUktiZq6F/K5F6KIsUMabg4tAv3t6QHGc8u616zd80581Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d2Yx21b0j1MK0Ce6cSenyGIaB1kBCSsck2Aem2dw9Nc=; b=jzqmvKEIWiySfDXSgT5TMpGnIq4ekg9uOohs8GhTcmN/94wK+DJn/bEw8fbhg3mQ1qVzBwuFoZzLIHM8Fs2KwhdCaRdtVQH9boBmNPP1cFXMs55VURoO32jeEpLlA0m7dng3DxYXHbhtoJNg7MJSb6Q/PQv7THe4dlnJNjz2is4= 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 DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 06:03:25 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.6043.036; Wed, 1 Feb 2023 06:03:25 +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 v2 02/10] media: Add Y012 video format Date: Wed, 1 Feb 2023 14:02:24 +0800 Message-Id: <93889cdefacaad260d978a8353066dd384a64609.1675230665.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: 1de0bcc9-b257-4596-1dcb-08db041a082c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PWDYhOdKQFAjIjMVUFcI46pp7/kENpet3qgMk4M414AEi3BnXEG3NvtvYHo02xC7DTYBAEnI02YibG0DNLvv6XYHkV1D2VavXhXO7Up52g9aJbHkvNH+x/kmz70xE+NDCNgjpzu66HOSXHf2HewsMzzpjI/Au8fpVmsJsoPEYFiDtut9Q6gevJTVqiqqYXw0C4eB2cI+bDD355MiWxlHDsI87hV8mR41b0ADueXY8PLoNx1Wf/rDqbIMSnLx1OuPUH3U/zjDil+mz9VZGINiKL4InqWo4XX+HOwqvzCzKco+lpNqWXvFObkRizw0xaQz3sg4YxiSdBfbcHRv20eIHzwfvjB8H2rBvUndkgCeudBckD/+wmxLAr0+SnIVj/jj/X4bBJtq0HG3ySX+53mwEzCwEzLaltg71EKGNfvQrs+CD07ElB9YjigB2NvnGfot8gWZTB6rwggPmyqdx/xnGiPBLyZVw5be5dIKeasiJv0Jqt7G79UMmlt0mV6wsGdVq5/YdzGgnNJxPgh6RHY3vb/oR79wY5XXnuY2ZlSxPvmsUKKDSLgiWPtdjKPvo2cqDnQ6AL73NEItiOW9Q6yl/SdGP9Qd8KmBHkqNCaNy7ldN4Q7l+W4HBssJKkkan6MYwb9hgLWz0p6Dt442hQGdpcdS7FVEhbqAUYcYiOu3F7+Ow4z0dObuCX90BZPeW1XtoV1ximtlFo5uQIFj5/NZ2Q== 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)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199018)(38100700002)(52116002)(2616005)(38350700002)(36756003)(7416002)(8936002)(86362001)(5660300002)(44832011)(316002)(41300700001)(2906002)(83380400001)(6506007)(6512007)(8676002)(4326008)(186003)(26005)(478600001)(66476007)(66556008)(6486002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YP9mH6UdS3ni0hrQJnsG+HQnrcPQFPsgAskJN+oLxw1OFMZL5rFnKK/olQ/IDHqjaJqfP9EXSPik3Y8gQlJkkRoVLhcW90B/UI4N81KH5/wOzb4GFUtGsgikF0xuTtp2QepCw+wEV3egRutY+xeimDBtPZ44cOFdmK6HY9RSTD6O+grYcwp7ESvvjD1trfBkZy/8H+brV8Y1bwoYE52EUgw9xRF/fS9yJoaKTpvRhTqSNDdZaps8QwRUBNk0zKzXcX4C8DmdyeHBUvyCPkOzT0znTyJrt39zPBnCPi/50Kbq7JrsbBTZEUOvIvIvFTzBIRgTep2IjpfzMB9fC03paYoLBZPF0HHpXZhANPVVi9/fWI/fSNERz9BFhwGYHU457n4MhYqguNn7dTx9vNG0rEdV4zejwgrP1S0ZPVOuWArbgBsznUUXLIuUWlO6IPq1AKbbgS44umckRFlTnAYENYVQJC8+1wru2gSQ+STdMX1L6ZxkSxtPxZw8WTFZZGJ4W4Bqcyba0aG+8nXIgy8v3p4qzttStBvzQTbUSc8oamzc8G/IzMCLcYYokXzlfXrLKsolojAZeTqp1M61qpntsjRBfJDkPxWw7Vn07zQuTdPr8i+6wF+hA+fNI6LdGg1xmxhcx2aeWyo0D0ewSEK9/6MKvmu5951hQf7Te/vPKsD9p9mYUbgigRbJgXl9yqImNudQN98ZrTzIPo5mTqUarLYGw0DOnfAnEwRkOAHNBSB3vxkbjdXTBOuuUdYDLNfg5C+PY5Shq1Peasfjlq3bmzBrRX4iM/QkrxavII9M/jQDU9FVbkg84rBoCQLMKW5ocHLc9b9dj7PBAX6gnGurMtA7OSFXnGo+VV/PS4NouAzlJAdQ9F4UadOIpO2cSzUJZQLhA5gKmdJDC2o0peUZRewRWcxRNeqLFDkBECyakaTJVwmhn9snDShQGpR2c/iIeoCf7TYn8va5WTsn3FvVWLm6bk1yl64YOqraHqOBFp5OE7iBKDYX0cE8AfUaCTpdF+zMZfB5fmL8INelKa0rkjUPzKG8y3sYQQVocJFS2vg+efTca+xsgYznucPvNPYpLKn6yZDGnL5cxVpxakoeErXXAZRe3kSTAXxsYyjvKMWp4ILq0Fw1cACmu9GCio28DopGXBbY3milrcFttwSM93WzDZ4sPAkEVaxLdJzaFZ/TiAfwSapuNTAsMMkWBrgN9SLVMxZCcuzovR8i0Kn/B2bawgU0u2YWUz8ilsWXzkF+DgXFd4Br+lwMvKvK8MZabC/UoJmi1hCuWtAAOWKEhOq69ByxDoL612EF6cLR+55assk1uDBQlOKI0VDs94DyydP0NO+pKTyoS94NafP0tUiVoBt6gXZzVTLx6pk4lSyaH9DQ+9D1E6DTiXHwYo+MPjfzcZmczzeqBUdUlkzhMmg8qyiaDyKhN+tUlDmG5j0OZSh6bT0/oavBJNDCihoWIku2TnBkBocBnOkuvzoubxJf7p6gGnYl6yQlM7d3U69LzDRWXyChE8UQ/jtG/7ySHrNr4uLPROSTifPaws8a9Kt/f1xZwvebjnxLZKU+jRTP6T1iFkkMLFPq+3VDI9Dw X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1de0bcc9-b257-4596-1dcb-08db041a082c X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 06:03:25.8170 (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: E1M0eYWqIi9a6WPt45Fou1s5W3XB15az4asrZ6frCI2fCV0e2kl+ph5GkrKvS6hBaT2frjSlTbWq7P5qIme9/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 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 | 11 +++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 13 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst index 6a387f9df3ba..3ffa29000238 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst @@ -103,6 +103,17 @@ are often referred to as greyscale formats. - ... - ... + * .. _V4L2-PIX-FMT-Y012: + + - ``V4L2_PIX_FMT_Y012`` + - 'Y012' + + - Y'\ :sub:`0`\ [3:0] `0000` + - Y'\ :sub:`0`\ [11:4] + - ... + - ... + - ... + * .. _V4L2-PIX-FMT-Y14: - ``V4L2_PIX_FMT_Y14`` diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 067dbdd0a9ef..0ee730aa6cc7 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1303,6 +1303,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; case V4L2_PIX_FMT_Y10: descr = "10-bit Greyscale"; break; case V4L2_PIX_FMT_Y12: descr = "12-bit Greyscale"; break; + case V4L2_PIX_FMT_Y012: descr = "12-bit Greyscale"; break; case V4L2_PIX_FMT_Y14: descr = "14-bit Greyscale"; break; case V4L2_PIX_FMT_Y16: descr = "16-bit Greyscale"; break; case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 5448aa3b7858..3d8f89bff33c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -583,6 +583,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ +#define V4L2_PIX_FMT_Y012 v4l2_fourcc('Y', '0', '1', '2') /* 12 Greyscale */ #define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ') /* 14 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */ From patchwork Wed Feb 1 06:02:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 649522 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 90408C05027 for ; Wed, 1 Feb 2023 06:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231617AbjBAGDl (ORCPT ); Wed, 1 Feb 2023 01:03:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231591AbjBAGDg (ORCPT ); Wed, 1 Feb 2023 01:03:36 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2058.outbound.protection.outlook.com [40.107.6.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 658E85C0D1; Tue, 31 Jan 2023 22:03:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ma9EMjwCW/qojNe9FG/y2RACMb2luXlEvsTR9Zw+lUx521W1MlnYe6hBRIoNs08S8c2JAk7//zBGB7f+0v1C2eADymlCTyuDIPJDmKOk+EHNtgateC4lE5pjuiBijQnLEZzlxi9miRd3Pcx5Y/enZ9O/eO9RALN7rvBdA53uY9jRH4GLVhMvlBdHiGcpfvhovY9my1KYLrCc94lPZMHnTF/eQE2BXSjsRKHfM8j+9wx4ZEg7AnEqLK1L2tpLn01FcF+wn8E2lt2ZvUWZCZg49g6+aIvu++AjzidUCTkEJOsgnS4ZMYZN8MzdI3hJR+FboY5IAv7kJFK+n6ZjHGWCpA== 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=J7GmRrdRROf1UKXvZqMMMOpYTrLYX5IvJxAswZRaMtk=; b=ms/Lbg64ShfudVgGcDwv3hqLE/jvfNeoPSsS/1b0ucAHhsK4l19W7SptyOXeULE1A4kjEcDxYrOBNI67wucoW/psrnAtc2/geZi64Qs7T/dxiCSCr5Y72SyBfDE/J23Yjx2QF1j2TLsS+M3FK42bWI+6mb7qiIR83nMwg1yAmTY/VO0RZj2MofCGBZ8ZI54CiF0/Kpo44epV47jHDR0E35sAFxsxngN+8AViVQ6KwtWF/6508MLXGOIjovBrdc4kec8MuYs1Usgbvbw7MI5fUcA1TIJRo1tspCOvL3Nb75GcLdJpUlP4xSniB6nnRBhObo9r4uD8pbp2+LPw86RHAg== 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=J7GmRrdRROf1UKXvZqMMMOpYTrLYX5IvJxAswZRaMtk=; b=E2oBqeN8pFK8c2+y3nKw7ge8nOBMBvQw4LA5LAZPZeDzl9eQTvE1wAHaOFa6SpUNlVnyysJqCTrUmbwtTnuImxHGZOaE9PQMM34gU2Dfo6hrKzrc/H1RVprtWDhxysSaRRq9Xm1trumOSLpovO5OiIMD5K8QNAyui4BYZqFVZwk= 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 DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 06:03:29 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.6043.036; Wed, 1 Feb 2023 06:03:29 +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 v2 03/10] media: Add YUYV_12 video format Date: Wed, 1 Feb 2023 14:02:25 +0800 Message-Id: <116656d22cd244ed0c1df74a1968518d4ab51c23.1675230665.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: c2f90a93-8fb4-41e9-aacf-08db041a0a89 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xwPWluVZCz4XvuvyTiUYrE9Px0W5/BwWWZy3ne/JsrP7KY5xmrG/QQc5+Qj7UivgbrQHSlnC9oIujnrwIgrkFxF8HB1pS/TReZolMtJliJQ605cyUWRsQVIeVD/Pq0USdET0H3NafTSouseoe8EdyClDN1WqDf1HhhyCg6+h59tI4n9NfIRag8xOi58mFO4WQRopAje9lvLF6c6HN6Dt7jiVOEtn+M4jB4c83EfHZTSbnLnngDFrHpIRkMGNefeUOfUZLr/NQQ9a3+5LH6dOCB8RukPGqvvcR/XwFIgk1QBXNDMMVq9zOz10NT6I45qrMsAWTtcXDT32YTibCgRT6rLdcur385zW8yMtNXbnrFmC4QIWMQwfrrVbEs63lxK3qgAZJLCNr2mOT2dQ5YFwmJJwbW11eI8sCeR1mEdzT2O7BgdqBKDpse3nWjvcTGvZiytNOf3DuRHkFiU8gnjLZ1kpIPSlwFqddOeTVJXwas/9Y/KPBfBn2oNwPY914uR+pMUS6gHBLNBfj77zlnJwZkAfOL7CvCEaolbumnfIAe8GCqmKdxnGUHSvpqTaqqOhmHTIL9Jp36JsvstIr5P+GSu1PjKqovtRiTf4WfDpSTaoKzGcPS6ck7tTocIKKqKWPDHtU1lsk06XFfz3uwm9os+e8mb4hxoj418MRrBPNFkjbAuVv2jO1Fq6+p4tLzsKrB5KOqvfKbG2rPbQJV58bw== 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)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199018)(38100700002)(52116002)(2616005)(38350700002)(36756003)(7416002)(8936002)(86362001)(5660300002)(44832011)(316002)(41300700001)(2906002)(83380400001)(6506007)(6512007)(8676002)(4326008)(186003)(26005)(478600001)(66476007)(66556008)(6666004)(6486002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /L5TRbA5CX9QwdkrSCSzEXAZdh3jkHLk6f344QOwVezUElEnWJXxVDlRRYd/sIax7rAlkZMLmNTqMki8prG9/Vq3ZtFYF7B/OBgaYeoW3NSx1EN2AHkZSFOyv7pSKwey2UWFNwSUYAoMbYRku+ETagS+rULBDr0jyezvc2rVOysLOA4uUlbo2XgVlo3JHB7nvwCDa+Ana5KPpmQ5ToGHwYhIiUjTrediklQIjTX9xjOLGzZOXezD1fPzO9TzbgVB5fCpDz33ZzeAlfUnZg3SWMv3K9/bFjJ/ktpM+MPTkgEby0IZQVRwfNc5/jPy8hoNRy1IBZkxFMogMLXLg5axnSUFFkKtlbgdrZrqFK+9MOrCkEn0cIVwATxhLDsMnp/ArUD7VnAMFY4CwQV5VXyLiwJ0z9Rp3gCfpGre+2SGIMwjdECUxBxGw8VYVVxGkd02iAe9W96Wwl5Tij1PLrV1ihIb/hb+Q0/qP9f8qcpzke+QeVJiwEs0n1+HIMwztwevd/OsMUrvnNJlgypNd4rd6wj0CU4my/RdPwpdKiygLm0u9HqgwghQZzSFQEOMwJ9M0W4EpFQVc+0h2sBCXKRoTpMmG7CGrP6y8296J8moxNum6kgXkDPnzffn1QuP8jCkhoc/bFMaLr9GJs67q+bm6ZQSxt2oOWcoWGRSkW9ITd039yXlmabeZGLuy+yG6cQJaw7MtRLGTjmrbG6Mr4ew5kH4dxxj4HEVweyCA1IefsxXUixQRny2aoKuXDJ1M2n+flvUYtX5GK0lJwGhv7pajfs2sCQseFWQlf/vqzpEHcDc6a/ixLq8mBfVvflcDLMbWioN08loF8ftauIe90l9Zv2rmvNfkOqDanuDj15OUD1LSATEjgphV6a8fkn4Cm833fiwys/Q3o3/2bowfw+whNVUl5YGxLH/6s/1EmybOQkpbxv3mL9vD6AAn9CqhRifaIGg12R8r93Q/Nwgt8l+O6ExxHo+Mcc2OASOZCQI7sS61oOX4r0KuSJYLD9oETtXZIKzZ7lYViEy2tyfSZX1/88t8Zn9ktofjHbnmUNuSZW8L6VKPgBlPbvHgN0mGPzsOLID4nfCwqXExB9Dmo1nbBRZJTcdYaXXlKZa0rX1xD6lgOF0FpXfTy/8RXCRs/28Ssi6YV1y4oNUtAibD2JfuWYirxLzoV/HoAHahGMXe+7OCW1Zepujn24FT7J6smm05M2BZ/IfbbX5C07EnYDCHsnWnDFL/Xc5DBnzF0i8bOYIa7vEXhyLXyrHjHDZwIyTJTYbHQusEO0AhyuWURBOsx4kd+4pRjQspXwGATV0QYMPYMJezGd64OjE0nK4I+AvDk71C0xwfIAaefVimj3dOuAW4hmRwr7Q4g83qpVKNZDBCHx8w9fpP4DD9qflFdLsgJfUb1kSJh3m+4Ti4cGue7lie9kAi5uWgIYPMCxrGLouquACqlgXe95DkFwdRze8Rh0/TjwXjXXYUv6n30lYe9bQ3ZlVW9J+YF6Ec7Cf83vXEwua/1pFCy9BLALdAHfpOKSkAoMRSkOa2JMHbcxVAMehJcaMVmdAlnHl7WhA7YDmA75OkJf6Q887XFyJ+vSL X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2f90a93-8fb4-41e9-aacf-08db041a0a89 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 06:03:29.7230 (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: WS19zDO7HxmON1AtwzIiGXkzt80TWoC9pRjRrRsLwQRO9EEXOmIcNlTkSpcyxdyazNyMFZDQNLAzKBCu3Xw11w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org YUYV_12 is a YUV format with 12-bits per component like YUYV, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../media/v4l/pixfmt-packed-yuv.rst | 42 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 45 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst index bf283a1b5581..bb7169b2cc8d 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst @@ -341,6 +341,48 @@ components horizontally by 2, storing 2 pixels in 4 bytes. \normalsize +The next lists the packed YUV 4:2:2 formats with more than 8 bits per component. +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. storing 2 pixels in 8 bytes. + +.. raw:: latex + + \footnotesize + +.. tabularcolumns:: |p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}| + +.. flat-table:: Packed YUV 4:2:2 Formats (more than 8bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + - Byte 13-12 + - Byte 15-14 + * .. _V4L2-PIX-FMT-YUYV-12: + + - ``V4L2_PIX_FMT_YUYV_12`` + - 'Y212' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Y'\ :sub:`1` + - Cr\ :sub:`0` + - Y'\ :sub:`2` + - Cb\ :sub:`2` + - Y'\ :sub:`3` + - Cr\ :sub:`2` + +.. raw:: latex + + \normalsize + **Color Sample Location:** Chroma samples are :ref:`interstitially sited` horizontally. diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index a5e8ba370d33..3a882fb71227 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_YUYV_12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 0ee730aa6cc7..928acb9d13ec 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1342,6 +1342,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_YUV420: descr = "Planar YUV 4:2:0"; break; case V4L2_PIX_FMT_HI240: descr = "8-bit Dithered RGB (BTTV)"; break; case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break; + case V4L2_PIX_FMT_YUYV_12: descr = "12-bit Depth YUYV 4:2:2"; break; case V4L2_PIX_FMT_NV12: descr = "Y/UV 4:2:0"; break; case V4L2_PIX_FMT_NV21: descr = "Y/VU 4:2:0"; break; case V4L2_PIX_FMT_NV16: descr = "Y/UV 4:2:2"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 3d8f89bff33c..01fd233ff681 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -618,6 +618,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A') /* 32 YUVA-8-8-8-8 */ #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X') /* 32 YUVX-8-8-8-8 */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ +#define V4L2_PIX_FMT_YUYV_12 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 12-bit per component */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ From patchwork Wed Feb 1 06:02:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 650778 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 2607DC636D4 for ; Wed, 1 Feb 2023 06:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229962AbjBAGDv (ORCPT ); Wed, 1 Feb 2023 01:03:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231634AbjBAGDl (ORCPT ); Wed, 1 Feb 2023 01:03:41 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2058.outbound.protection.outlook.com [40.107.6.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AA985C0DD; Tue, 31 Jan 2023 22:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bZU8GW4BL3wHi6ZjIe9Ne+N+SHeRUnQ6b0n+b+JsnUqIHiLkbRSOANndY2UktPvEsusSnQTn5vs2Ocl/oUk+2kNbbUG64UWHo3RUIs+Ez/14+PqIvUCl3u0jqfv8lAebv63cv96BcGYD+kfqs32E5rP6qHQArOb1yJJdRBkeMP1PHnJf2T+4RvbogQMfFD+XDqQlEsQOXpgV1qopoMKH95zMhs4xvxyE8TJV1Qkq8Cq1BUjbYUPc7TCTukaDcFgJWFRWUx2AjT0vQcWkwnJzz6iFTTiMSxC9cxtEXDqJBTOmoQs07ESPl2V/yXWQcjT1z4q75NoXT7ZkQxVpd8iYRQ== 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=vu1AQX56LJV0XXXyYOTPozmFZsX/rucHWunly+erF/E=; b=FraaDy3PyT6DhuIzielI/lq5xZGT7LvZDH8F4QRuEJsFQRpb0NsBBGzx6dXgNyvf66kVkIJJK7pdv2NLrLDwCMxWRNyzJYs0FIrUAKWLEMfZpDmVj6gBh5/M8zE9l/q6Wx6wvCpD2vk8vOnuS8dRPC6UZjxUSgT6AhdBtRubTrPWRY117u566s5LtLhfg+vUUHho1pVzm2Mf/c9yQUV0ioJZfB4BPZzklv4Vaki1uc2P1NcKgVrefJpzz7C/GzvFovC5X+2fama7bS5uZmmCs2rQMqj9HkiAkHkebkzKqiVSUCEYHR8j/zhIiZA9Uw+tNydk9br6ojGgQiYHsNLBZw== 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=vu1AQX56LJV0XXXyYOTPozmFZsX/rucHWunly+erF/E=; b=Pa4L1wYFN5ueRSXSqAH2/UtPhKvh6tReKes8IJpDvVHGjrmxDPJLiFae5WWzNkOuFgFoPEmbRgrsbNX/jknQ7BArYvrfw7V3gsaJC1QIJOopfcOW4VwajDxPjicDqEVY0sqtKbhgSm1lp8rzG4ADIa5gB+UICBD631/8pdJTj6M= 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 DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 06:03:33 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.6043.036; Wed, 1 Feb 2023 06:03:33 +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 v2 04/10] media: Add YUV24_12 video format Date: Wed, 1 Feb 2023 14:02:26 +0800 Message-Id: <70b55bc46cd3cce59637d384013785c9efe444db.1675230665.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: f716eb89-652e-4d30-ae88-08db041a0cdd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m+d0BlgWal2Ejq2hk2U1ePR8XJyD2KCDRcViYnBBKQSrRcT6R5OtvWYHm8VYt9o65b6nQuROTld0IRQIuYI0QsIp0eNjEBEdQWHbrxL4rGZQ/zUEPgTVmgwlNJQ+1vV/6iX9PELAz2KP9pzsK5dDZFXTm7pBb9peXXg0azEbgPqluJ3mCT27jlBUFI46QwF7GuarJ6ZlqV71lb1ljLi4aLVrnv33l+yv6NBJooE4AOJnXFX4wKIJfdsWKQcJStLC0znSxZtrrfz5wXgN+m3moLXFBj/McZLalDna0+WwOJ9jaflj6DKUmdsrC1nCF02/2tMv8vLuiQN0+LAY9JMKydNlyFlBvCroQ88p02Fa5jPrbRDjyqMjhT+nos3lU70m9abiPE3PVOh8WH0M5f2VZgQlSGYm6hhLvjd1v7thMrBcJKlZcGnweSHoDu7KHHbZ8PiO/obJItgSKk6W/DWFZrobQWTCSw0aNpDlFbo6tEpCidZgF9CVPkYKryRFETBWu6nOu1q/aevu3eY+eH8e5hDX/IfvAbDX4tnzFaRvqjX6D17ut3WAZuhFv6/H/V6XEbnxjKrjM3vVw/v3mB1dcHvcP8Q61PFelQ4+kmHZknyglyy/hn1WnHxsNRdo9mK4yyUMXZ0+1hYvgCCc5Oak1924L7ggie3nKEwefkAsIN/WeS6+zqElQsJCppAN8cpMWmqOdchqyAX5ZzrQq2QRwg== 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)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199018)(38100700002)(52116002)(2616005)(38350700002)(36756003)(7416002)(8936002)(86362001)(5660300002)(44832011)(316002)(41300700001)(2906002)(83380400001)(6506007)(6512007)(8676002)(4326008)(186003)(26005)(478600001)(66476007)(66556008)(6666004)(6486002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DVFtSlXon7BudJKlGqjoQWHHZ4yg4094Mjf6oX+Wz0DoxdhY4Rj1qVevT30NLU/wfMZLPNDa0j6WDJe3fSua1AzFFyzU5CIjE10VcSuCvD0Y2uVz7p8Nr/ciplgriD8otyqpUV0BrGKAMJKC9I4UG8Q3Ka5D5S4NZhbOi+R0XJvfQEp6B6XThC2tEfVEFpApphuQxB/XxMrmHquPbOISVPovKQkt9k36RJyyUYwdzVb2tfxAgn1OFSypsIHhimA5/l4z3THWJYS2qj5Pa0VUxlcybwcjIPdhrhikiRsFkWzvciArwVvm3hLstCY40DYdU+mxhiTuqoKS/TlV0bcUcyBxtiEEthtgYJhwS73HgX93rVeswnROeSkDRylt5TRsS3cV3IvoqORkhHg2e8xAbVlmOguVuKQev2s2it6WvSuiD2uH2tdHmN+K6zQu5NZF3zgIYA19OySNgK7C0MrRpXBnGnRYUfe0Es+lx174Cp7N7n8WEXRz/efP0JRjuFsHyHDYpkZGq3ziqoENXzFPDRM5qcVWpnOwgHt2NNFKUt2ho3tQ3nTAvmUSh9RIr5VJJoKJNMFCDe+H0H2rJhIwk7tZDFKmrcSbLhX9MOB45xc1ygOc73LLChAqT3+GIxfCqOjEecrmNeh9ycfiHfadI6Hi0Kfxx6cY70niJjoewV4ovc1qQXM5H0M2qvLfhRPLhWd2MjKZB48h9qQPl8y6Z67esheDCMS1O8xIlWdDxOSIu5YAwU27JWQsrpUYzIZv9vhl4jaMrT/xjXSaKv6/tXBjOOhl5eo9Mq94k+nlDz6jSKM0kq7afPF/g0BMU7x/Uu7E+mNC+GKvSAFM7qRvbG9tU/rUTtCCNoprIPH29KxISbfbJMJrnului1FKip8rUKo7iOyIDkDoS1Xryk2WtvjQjWtZVL8CHA5623SioVvC0lzoZfdhGgDnjp+BSVR30bATLc5g6g4PZFvnGx1BWAOyYK/NtR15K32kbnIAz+qyRAOjW9vcSuNsRh+/M1kyDy3y4zZ5y0bd9UNJ0EdF8o+8gcOM1vQs65nuJCzVFvygex+VcVf6D033GbjW4VKhOHtLDj3gzGLJboYZBTtXnGs4FrMEC9eLI/chHtZHFcHJiFWtdcfAdGNi8AZ4KBaM3Va7CQ2POgP1ryIpU4q30d3Gy/hLtYxN4UBsNDt4pHs1Uy03T0JNKi3pDI4ZLz7P+0dc0xIctcupilsyPQsYHqQX9bCjWtp4wHLFpL5BTp5hrf7Lt9A+SP0sEABKjApcysy0612rY8McUa/It62S2Gi53R/BC6UKLZRk+MoTGrUI9Te0/btUstjeYwIrhc4yr/T7p5tHnwgDk4X9QF89yxhSpShmXSiCc69/Uq1gm1ick5PpyDkMp1SEsfg/3W0I0GKjt5aRS8RzkRwti7P0sHGn6MXJC2wRNd+hrL2dm+hUIj6bi3BJevl3CIHnSRQ4jOSZapcRbyRCRS1i8RlnXX2mXX8+t/CIEo5tZI4ggatPq7hJjKLfsYHz2I2N3ZJyQLzhtW9jL6QnGqiXWyea/565nICn2H3h/FcD/7HzIdPhjuAfD8zPiSrjN96e0Y9z X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f716eb89-652e-4d30-ae88-08db041a0cdd X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 06:03:33.6291 (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: BX3RS5kM6o7LP/bf7JXnzK4SGYWSUFcUmD+Iyy6/uqnBP9oRTFbyQ60UkNq7aDPofYbvkdLqHFRbrBtE+GZspA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org YUV24_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 bb7169b2cc8d..a098c5e8e609 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst @@ -257,6 +257,34 @@ the second byte and Y'\ :sub:`7-0` in the third byte. - The padding bits contain undefined values that must be ignored by all applications and drivers. +The next lists the packed YUV 4:4:4 formats with more than 8 bits per component. +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. storing 1 pixels in 6 bytes. + +.. flat-table:: Packed YUV 4:4:4 Image Formats (more than 8bpc) + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + - Byte 9-8 + - Byte 11-10 + + * .. _V4L2-PIX-FMT-YUV24-12: + + - ``V4L2_PIX_FMT_YUV24_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 3a882fb71227..b3ad02f8cf11 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_YUYV_12, .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_YUV24_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 928acb9d13ec..711d1b0a8184 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1343,6 +1343,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_HI240: descr = "8-bit Dithered RGB (BTTV)"; break; case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break; case V4L2_PIX_FMT_YUYV_12: descr = "12-bit Depth YUYV 4:2:2"; break; + case V4L2_PIX_FMT_YUV24_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 01fd233ff681..3eb188581b83 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -619,6 +619,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X') /* 32 YUVX-8-8-8-8 */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ #define V4L2_PIX_FMT_YUYV_12 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 12-bit per component */ +#define V4L2_PIX_FMT_YUV24_12 v4l2_fourcc('Y', '3', '1', '2') /* 48 YUV 4:4:4 12-bit per component */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ From patchwork Wed Feb 1 06:02:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 649521 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 E9958C38142 for ; Wed, 1 Feb 2023 06:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231664AbjBAGEF (ORCPT ); Wed, 1 Feb 2023 01:04:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbjBAGDx (ORCPT ); Wed, 1 Feb 2023 01:03:53 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2058.outbound.protection.outlook.com [40.107.6.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3D555CD18; Tue, 31 Jan 2023 22:03:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wh8hpoVAEhqzX/j3AUhuNwrA1pqBajtMm3Mg0vpjmvsxwNlYv+ZE+bUQ67VyMwjQb4W8B2RF32/Q6SQZ5CluFFTYmVZN4XPaGqk6R82fFTyW38WCF+evVuf1/mrkF4/wv3GLHdhMlqOEcupMuZGDTbGLE91JXlWcuemBvIKvSbdJmW4DoQFeoaCYLvACatayWeiN/7STRoXruGexGg3sSVIKTOkvpnVOwXrjPDZiUpUnpdMLnUA7nk/3QPGiBQtwCevJioDjarjWxWd5F9LskqmFaxtvjVNM1ppjzSm0YK3+rXLQxqc3XGc6LX8n6PQfBawQdQ7Frs67CzJi9lLk+Q== 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=rTXQrH5fMG756GCzr1yXe9rqr4+/N+rrRpiDTrCr+Xo=; b=A31XNGX/GtlD7sI97EYXoum7D7gjQwZ191lM6Ez4h5GQnTN0r8S8SuCoLKNlw2J73y9KlrfWrx8qMzhSEPS7KQKnTQSPYSEKydVUkWYis+JHLMTIJcCgv5dvDuUOyUPHWM3SOsfwfWFoXabinCfn5wSuMQrTZGeYFzFGu7gRIGRDjMi1UVhAa7SFkrd3IvqorAxJwJ9KWGZUl5wJBSKj05JzMAtT0mLgpNWYfIyro6vwU1RO4zcQ4mLEULaO/LY3hu6/0hHajxeqVvkENZTgQ78RPALLSpwxmcCShdeyqB43LoKTMjnztNdEcdLwltuwOiDFNcOfIcRZpTY8xWcvbQ== 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=rTXQrH5fMG756GCzr1yXe9rqr4+/N+rrRpiDTrCr+Xo=; b=OT4DsudzJnfmKMKs5HN3GXDjHuKbHH7z2P/Ffnqvme3KSTWIMnkjMZfYHhhNFZWtiI+sM7lkGu2K7blyibr4scpWfWMIUPdysdnY5hKWRYTA5yK+7tOnW11t9rqwU1QKHK7oSW+c9ME+jWHkBsBIhhtXYX5+LbpHZ8ohuyvGHMQ= 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 DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 06:03:37 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.6043.036; Wed, 1 Feb 2023 06:03:37 +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 v2 05/10] media: Add BGR24_12 video format Date: Wed, 1 Feb 2023 14:02:27 +0800 Message-Id: <8c74b48e728ecb075a4a65b9771610c9cbe27294.1675230665.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: e40a1b79-e735-423e-149f-08db041a0f34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xnUZyjYW29Bd/WA+YAhXVuOm6lsJnVJ7yLjdItkcSTJpwhVd+qyxDqh6RGzTMv1jMAdXRpDqwLVvJ+deYUK65e7OxQkFv24llNGvyAh9MFvRDxPMR2kx3WMb0UTdHl+ybqAw01MIRmA1j/qxK1WQGD9R2FLDi+Wew4Q6UXspiGgdQyUZB3jiX2O6cBzeeRHEa+Ed3vOQvV6OgNgzp5iGcV5wVdBCQ9jBFirKWe+E/FOteK7fHdwgrrZGkJhFuG8pFGlviTiXKbPaykoECyHXRgILBBjmK5DOcQb5uccz73hDehJOFyziI71e5Fuly6KGMBcSFuA2P+vg8oK5/AUQ+LBMP6IjSjgL3FocEuhFjOgyH2gYhKryrF12BKAVhEBhqVwVkRYr5V/C3YXx5Pb3pPtVfpnV+VCQvSRHdwQ8jqrZT8TM8uyj5oDgCceRQBr0swfTdccbO7bWgu9hxtKbB+1L7+Hgg1zwNRRdTYxGBurJnoydz0LLNwUls8fxTxpGiQ6RT2zeymRxPNlA+VhZ2bsF4yHbSyTxHs0sMvWfnziPPJgL4PsJJxt+LaBohSULwjW9W87V13GTb6/YEeZKGDNqEACQNjYPmT/9Q+7nTluSQ8D2l+owuixsXD+BOrJOAB2Pka1+CL9jmlYR9uDt+QVUOI7nzBVSuIUtNfS4JBaTj2J97d6eQwZvZLTWoAZt/vY7I/RSb35i58kFrimHIA== 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)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199018)(38100700002)(52116002)(2616005)(38350700002)(36756003)(7416002)(8936002)(86362001)(5660300002)(44832011)(316002)(41300700001)(2906002)(83380400001)(6506007)(6512007)(8676002)(4326008)(186003)(26005)(478600001)(66476007)(66556008)(6666004)(6486002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iILzlGBrpzbFqwyW3lXUpAZuWrUepksAy6ikdoHT2iR4H/J0A979gpoOCjsptDEFqQ66pxBUnVlNgWp5zRb4L3UBNAhAhSfnBprAAygDFFOJJDkUUJ7grajDWNFEbOlOc6bfKIr3Zm5OB6S2FygsCL4aq9+BTlfPX8ev5ZOnHRacam3azKJPwDjx8RGJY1j66lt/Pc8YOASrcydeTsSrAgMioPw1xaKf3UPP7llVUNwD4OViZXe3JJ/ilWdzqVwfLrOU/hZPwgDhA/t9W//5WZvvkSZfA3w8f7uVZbUxuwam9NiD4+E01yngC5yjq9jRsj6Aa/gc/+b2OGVVRsInHCdp2+pB4UEXq3YMst38e+8BXBEpAByvKXszOc4BoT2udYArKAMQbd+pUSgQ5cOVKnT3y5lbvFPTgy6jOGpKkuwMYvNCueWRVh/838rfQZ3nolooMY7TfPyTy6IIEuy7aJroqEf96h3rymVhsytcDiBWs9tD06fHdp11NahcU4gUU/u+NPbxM9XLGH/H8jW6FcvDY0rBZwuaCiDKfnnHMMxZL1gHX7f0nfPLl5RUJu1qJi+oVf+sko0RGUAOIoCNXg5YYNqty8bk8cse4ui2WWOXMS033jLI1z5xFzThVhS2c8e265Ny5Mntj54SfCZB7XVNtbpmEf8JIpE23s2G5csfzabubI5jOMpZl2waROKVJxCgwGlH2wIJ/H8dX7h+H4Wb+U2awi8EsmtaZWhYYDDysQWSu99wHaj+cz/NKLRRYyI3AeLwB8yDhjm2Hf11Edyac0kaKpWmSDHXi+XI6CkHZl1lzjVW0rQxgErH9327hB60OXUn7+RdBKyPxOjJNHtKK24hk8hjCHkKBmWGb3tYN4GRHHDoa2/JBp2P16LRzMuvkNpFtRmJ6EPKVLGO7S3x9Gzu0R5tmHpWnpbs1ffQLXTTGjrR1xhnkd++b9wHxAs8dtzS7JOWvUz/gy51faUb4guIzs29y48/zxW6rBRpvFAlUFETKxOErXecCTzQSkdHhZil7syJ83PKMrsX3vGchsSufPBSyfoDY1nlGXVjRFWHsRrtVhgRKT1KtQ/n82lbM9JtpaQ1Jk55YgFERIN51KgX+RYKaOPOiEOd6sXG+P3lCJQx5kYYuLQU+U1Tj51gSawA7AnYumtS5D1rQRSXCe/wGY18tLfmukt9m4sycT6a3waCojt7ZOraUWAOXAqE1WpGzWP4wxsIAilfU4lGFqKdzS0GWDRFKTzFSUAEal0HW6RaspInn1n175EMA/8/0VImQCAeZE9WumFg0vJaBkw+Ip+OvEC+lOJ8ZV+M5/xanDtQqTGO5B6gTnk2bwohWbH/jz/ig3WS7+3H5DYYGLqhfC6GlarNWPR2A5siwjkL0Cy8cdjCIB97YpiNg2VTg5/vNT5aMyEUt4vqwo3e3tVhJ1W08d9SQtYZN4xteQrRVgEV+erjIgH26VdprvwrBMuzziUO/CKQeM1w5+ErjmIwqYau4J6g0vJST4vWlRqVT52oMFA/fMDDI5z2eJJYW3U3oU2WRefzeWxV5wNSd7y2TCEdzAi9msViRZc/eyYJ32BQTAJiTzNB72xs X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e40a1b79-e735-423e-149f-08db041a0f34 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 06:03:37.5351 (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: oDrURza3sK9J4/Vcs0+gb/edtouuqNIUOmKxdpAKfUm1pciMY7manP679DecE6mq59gJRlmwgSFN2itAWjwgVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org BGR24_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 | 35 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 ++ 4 files changed, 40 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst index 30f51cd33f99..da29ba69c2d9 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst @@ -763,6 +763,41 @@ nomenclature that instead use the order of components as seen in a 24- or \normalsize +More Than 8 Bits Per Component +============================== + +These formats store an RGB triplet in six or eighth bytes, with more than 8 bits per component. +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. + +.. raw:: latex + + \small + +.. flat-table:: RGB Formats With More Than 8 Bits Per Component + :header-rows: 1 + :stub-columns: 0 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + * .. _V4L2-PIX-FMT-BGR24-12: + + - ``V4L2_PIX_FMT_BGR24_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 b3ad02f8cf11..024190f82cf1 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_BGR24_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 711d1b0a8184..329515786abb 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1298,6 +1298,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_BGRX32: descr = "32-bit XBGR 8-8-8-8"; break; case V4L2_PIX_FMT_RGBA32: descr = "32-bit RGBA 8-8-8-8"; break; case V4L2_PIX_FMT_RGBX32: descr = "32-bit RGBX 8-8-8-8"; break; + case V4L2_PIX_FMT_BGR24_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 3eb188581b83..ab52a605e6c0 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -577,6 +577,9 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4') /* 32 ARGB-8-8-8-8 */ #define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */ +/* RGB formats (6 or 8 bytes per pixel) */ +#define V4L2_PIX_FMT_BGR24_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ + /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ From patchwork Wed Feb 1 06:02:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 650777 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 83D8BC64EC3 for ; Wed, 1 Feb 2023 06:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbjBAGEI (ORCPT ); Wed, 1 Feb 2023 01:04:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231612AbjBAGEE (ORCPT ); Wed, 1 Feb 2023 01:04:04 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2058.outbound.protection.outlook.com [40.107.6.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66E2C5C0D4; Tue, 31 Jan 2023 22:03:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZcClNI4LI6LIEkaTDBmtZaG/eLHB2IorVoIdQ4aavxskxq3yEbb0br0HZCemxktdjPbyy4b7yVLMK7Ao6iuA1Qn3qend/MTkjFAoEQX8GM5zlnUme4tJY28nOouICPCOpghaseNxU7Lsj7a7CrWjfdVsYEXCdNW4XjcePr+ngQuows0K10F3PLQjdKzl4stSmV/RnTeQpQRwM5d9GqhaLa7T8T65sFFXdR9mALPwctVmu81SBjas0lj1587GLA9CgsjOowWuEOGBZtW2K+lCfOKAIerdGmGdPUO7xTS6zpiDTuuF0eCm4TvNYrO/Ok8bVBWuYDzNFdvfGfnsl6n5Iw== 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=ZzOpO02wOeajZWbfxSVroeD/TsCs0KSY43KB9xfSf9k=; b=RcA/4p3iUtBOI5nq0Vox9apaa1eIZ1o05k0uRSF2pOu9C0DkSiaoCMYmhPi4bh7g7EzNzN6MWyXxsBHAYay9Gw8vDKBmCXUSZhqu1tvimQQN46gMCo/QEiLB7a9kMHk2YDLrP/tTj4fUqLzxAKzldq3a8orebLNCWo1+zyzS2/INhgzqLWb79Qfcapd+axVPM//1Wr0K2N/HJaBZbXT1RQyiSNDylSLOV3pirTOINhSqPaEAz0hOQmJDTXV+TfQdUkOMAFwwgNC6rxqpBk1d/51UvGY+yiAhRlERN9dGqGXGfdrvljW7mqHrPEuuq7syjZo6rbkhUirY68RkH7I/Sg== 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=ZzOpO02wOeajZWbfxSVroeD/TsCs0KSY43KB9xfSf9k=; b=JVUPBWkC+p/ILuNxsBoyGx6d+juzAfPXnyElX7gmYFiOOV0ZUEU3900jPxBdU44mPrmEy6DeNJRB7taja7kNPrEXy3i09FfaILKj95CH56wiCzz7I7Yj/bYme4MLs0atg58YIHBzJThlXGXlWqpA+SYR+4MAkkOeEYns5ZqC7fE= 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 DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 06:03:41 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.6043.036; Wed, 1 Feb 2023 06:03:41 +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 v2 06/10] media: Add ABGR32_12 video format Date: Wed, 1 Feb 2023 14:02:28 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: 632d3ac1-3583-422f-53a4-08db041a1183 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Uk7WvzQ13dvwAO9qCe1bdS+rFHd+GW4YQkYyvebT5XqQL6EYPWw7vNrabVkGIvFa4efLF9Gx9/8oizdOY4gGiRSYbdjtLVCfErTv9pnE8l6XooCsCT1n33DQLn/rRuSekjhhCAL1klCLMCAVpfibd9OYx+jaoyFWlc6aYN5V+8y+rhw45vremldCIywlPE0f0qWDlvHMba8+QwiijrU7oCNunp4f2JJdFLi+nscs1tkHHm4wFUi5dKg48SYRf0KHGyRb8l/FDyKItGlEeHDXAa/w11c18uKvGXW5BF5L3E8oIrnJcVez4016tFttnl3aCROub8z1Np0IoFsCOyZKG4WhmwgrZf678T4AX5PyXbctMTg5yur5G25DsYcr14cwNQdQWyF3boRr2eJwbL+XghWFcIExkASCOMvYpYIkydBdQLvquXDCkfVQqc4d6IVQNYEtrmpU5YEbjVXJdV9aJ/el/1lrKHS/A1T6jaodcX6vU7pU4k/3DjBgm72fl9/bv0NPnEXCfYWKncZyebI2GAc7noUyEQH8G4dmeYtUOKTyoBIDtLqcFnM9r5IRahYvC+kEBcuuN7sVq7pe9Z7ERm35ZE+YpeCzSRRHG12FFnvqQtS0IgDoE4Uf6kS0tyskKDGIRrG+CW/aUNEezJZsetvirege02IxOkWun8J085gNLWJ+nhX4/kKQCeaKLojGgD4cdby1vl38oHH+zA2udQ== 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)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199018)(38100700002)(52116002)(2616005)(38350700002)(36756003)(7416002)(8936002)(86362001)(5660300002)(44832011)(316002)(41300700001)(2906002)(83380400001)(6506007)(6512007)(8676002)(4326008)(186003)(26005)(478600001)(66476007)(66556008)(6666004)(6486002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PR+LqNn5dY0JUMhBTHy4aVDmmrHknC8wUWpa/xd/xCdzmirKMqRRc4cAWZ0AhZ57Rvw6P6jC89ftaXXDBsVDWmqcVtFsZ9BbrLj+BoC9/eoKkIKvGsule4GgWkQKY4dx2vbGCVzycCViGSwiKjSSY+LtgWt+hU6zNH16Yz8c7RaSn61IlRYlBA1QwA9E+MnVLPRI85ivgF/DuGli8gjUMx4iaxfZ1VXIg2DoYbhxEbtQvdw95VUAaqjvI7T+xaWn646a/0rbSPIq/Q97uVBI609xdDZbo1vOGiLN03atMxEkp3Vfh+EJbn8H97IokIG/bZn9fF5dSkIgDLHoS8K1M49WSaG0SAToa0pYrak+EOp+t48r3DCz/dEajAjLYTRtKZra45TS1VaWzfbTW7oJ+0/R0DKn/jooVSAm2SlsAV8mtbdC73RMzwqdo0iTyf3vg38kE3rJSVqUxo4hzy+EJi0e8xncCR2OAu2ZsoAx/6sOtH+FcgMU/mlY/B47qWkfuAt/SuuZLUPyODvg5q7vpPpSquQoHRKxwtZyANhmxDHbX5l/QJlmdjF7+tCi5ZEY7C74cL0QlGTb9ydiO5UF/dDNo5KLoDlJhW2hjSYCTJ9BBIpkdWHghH/xmI3Po0DcakJ1Y+MGQYqfh5z4ugu0nVKZLRi3eTPVXWZr1UKnNW08T+9hcKkuLJn12ve4apgbDycrZKZoYhYfgwEPlgnqT9O1M9fmEvSzreJsNBDAFsrA8tvHmFd3g2isQ6INAYe8m7ZdViTJYyLNnNVhCMojlIXiOJspxuNz2No0oKLx31hCaFe83BdIWE1olhaKwkGxwFfWBbSXkp7oujOgIufKcLX90KwpT/2r3F+3FGzYmmUr00pMLzcViJg6dTRSYKl5Dv2TaPmDQ5AJ1452wVu+a8LLVvbKo4Kpz/p9jI5gzKALIsodESKmyiysDaDFQ/pyYAsgrZBUheMks2HicWdJ/p9LD2j5b12fFaOM3y2IJa/JeWWzq3a/hCXpqX/opLF9AUrkpIv7RNMXzdFL6uLaSme3GSLMVl4x9QfVsE4OvQ9SyMwKPeqDfP8GBMvrIFy26ECe+sh2enY9IwT+IVHSaA5FvDkNbC5pVFv5zyH6Ud4h4DZGV3jg22llHfFIm0Jmr0ZaiIsB/kzBE9cEHryehALHE978SshLaBrhtTiICBLWP36DuPsUnEhsXEI+dzCadtkhLRnXFzDL0fKoz7nq9Io3yawL7OfYPWrMOIMxkwv+8gZy5L6JNz9/P8goeo1AoefUSv5c0qSHMlM3/wulZTBljsxvyoaoqDXxcgYg7PTCdNPR8V5/F1jXfxFgeoW9b8ML/e9y9oh2U1QBrt4D5heBCsjcCFDJe+E+duzpDXKsk2gyut6/IQtst+bDo11VsySV8Lja6xPTvQPDd39711tYYEOITOI7wgIet2c0milPZoEHD12rb7jUjTpWL/SN1bM4vDi/rCPyukgDpabQ2+XmmQvXdjzRid7i3u88Wsp6AjTPMGQsYlGOk70vZC8RbnwSNiHF+uoh9e4u8keg1VFFLQOD6zP34lr5oWQFvw3IrUct2NuqIfKH1jnifRH+ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 632d3ac1-3583-422f-53a4-08db041a1183 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 06:03:41.5349 (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: G8U94Pc06nXGYjNW/jdD28D03pQ288o6Uj7uKUmWUMvPez4YcRUYwTDSWjCgy0H5AtmEiGeuqLQnyGbmuIYq2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org ABGR32_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 da29ba69c2d9..cb60ffe8f860 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst @@ -793,6 +793,15 @@ arranged in little endian order. - G\ :sub:`15-4` - R\ :sub:`15-4` - + * .. _V4L2-PIX-FMT-ABGR32-12: + + - ``V4L2_PIX_FMT_ABGR32_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 024190f82cf1..4b3302a07f83 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_BGR24_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_ABGR32_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 329515786abb..0f772e19890b 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1299,6 +1299,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_RGBA32: descr = "32-bit RGBA 8-8-8-8"; break; case V4L2_PIX_FMT_RGBX32: descr = "32-bit RGBX 8-8-8-8"; break; case V4L2_PIX_FMT_BGR24_12: descr = "12-bit Depth BGR"; break; + case V4L2_PIX_FMT_ABGR32_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 ab52a605e6c0..757ab14e7a6e 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -579,6 +579,7 @@ struct v4l2_pix_format { /* RGB formats (6 or 8 bytes per pixel) */ #define V4L2_PIX_FMT_BGR24_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ +#define V4L2_PIX_FMT_ABGR32_12 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ From patchwork Wed Feb 1 06:02:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 650775 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 61F88C05027 for ; Wed, 1 Feb 2023 06:05:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230032AbjBAGFQ (ORCPT ); Wed, 1 Feb 2023 01:05:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231543AbjBAGFO (ORCPT ); Wed, 1 Feb 2023 01:05:14 -0500 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2041.outbound.protection.outlook.com [40.107.249.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B21A5CFD5; Tue, 31 Jan 2023 22:04:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AOrtEwbyvA0JKfeC6dkMK8GX5a37JXhSps2R08Vvv9EjXzYZ/aTeICUT6YqLoF5c+FqKL7azho++dWTsrHHw7bENOI7nU/F8O6vvthhdbKFe7JLAEJNHExMU5B4n9gGxM098Xn3rWdbAEJBfub0pUSmQ753BvuxlCYlhu0//XgQpi92EUMayX1hStEhUD3GAfXP+2P9r1zSNHNC80R2o8CRkQeGMazYpQ6JE+vpflW1/eWpckNhSZw1DcnaCibk1JZ1yHJcQrzJ+hRNkgVC4zxbNyb4YgcKo04zwp7fOQ5XZGdKEat6hQJ9+pFI7avG5m1CmyWjEY+2CZsmPwmegGg== 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=MXFBQuD33BKGfzgZUpcbqrF8jGKzcz39er1bD/YK9S9eW4aBLxPuGAdH+JDMGMTEpW/SJ6Mg/cDcMJFVzrjleWA8B9ZeUanJpBslNcE25KCcVRHxzE4Llj0iMc0te5hMZjdZPPC7a/NJQ4qo2rOQA23h4LH+QSovjQXi4iwg/ERguF187hUDMejSvERacctgIXBoeqeh1U+dBF6BVI94ALWY29eh/sZHxuhztk4Tuv0pU1IiV3CD8xuweAnSXYFWzcqklGKFBk8mlr1sqc2gPIwZd5UOrmnd55vz0mvmjq7yyl9crehrNNUQSHiK96r6CA+EdwwKB+c4zzmcyjdZlA== 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=CtUIwAifUDSZkPj/Ygtyw1BnVAJHW365FtVpGJ5aZatoJpWxxDKWw5iWF8VAfGIIPgnL/2YNopKRD4mKhdKcpOsrw4vglGsMqt/qz4Sy4sTeknPNbObr+R0JkkEIkuGrirJkQXD3aTeaQYa9p5fj3uRu7X5R3x8y5AY86TOcm1c= 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 DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 06:03:45 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.6043.036; Wed, 1 Feb 2023 06:03:45 +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 v2 07/10] media: imx-jpeg: Refine the function mxc_jpeg_find_format Date: Wed, 1 Feb 2023 14:02:29 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b612d9f-48d7-43cd-69ea-08db041a13ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nHEanYDuc4A0XDXMqGR6Y4bDT7zpdvPcJYd5/wnoDrIETKXxeHzTAbPWP3nC0MXYMYUFRLXsnib+owxJUwpV1IGe0Gd3+HkbdhQRdYXeLoPf33UqbtrPVeXtex0aQcqzlmYLZwvZKIOxyIM5YjSlNF75CcBgF1j+B8NTTAf+jmrwx7sk5z0t/vGEWlbMeBak/pNas0hg0hVuqk54pjlsF+PVsmBThwJOqjpx19jVJK7+fm8ZUguVLyu1DGKK3OoHEKlnjXO7rMonIKu50aruhWa2W6mWW4tkP7145Ni0FeaYMl6Qqtp65LOPVNXWXfisLgsQuIysMBQLwyFVIAukIZKGj7war3jjsTG9QIYsko3ycGmxu2ZjBheBk+f648hF3h5gFb8ZM3KEKgKNFvGo0zmXZvDoNit1xrFQjegFUhrdChAA2AbHwSumTFYaMT6lytD69VmzS31oh1siE4H7Xdbzl3tVMlNm/SCAE54bNGEcCPy7uaxHfgEUf4SOcqk3ICB+bN6HVR7UMbdXMAmMoKymLYSsHS/AhtNoPIJtmSLEBUMzzb5ipjT7mqEU+QSPOQLn36pK/3PnMYtsp7FfUNSWkvsGplsqw46kl9d/z4FhDvQv9iOfoaaV7eF9TmABDCGlTbhAhYfX7BF/irn+IGQ95U9Fr1Bdrb69uGl/CKYgkFvvnS51ls3S4klsx9jMKcOiZT/VlyBk1Q52VS1IdQ== 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)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199018)(38100700002)(52116002)(2616005)(38350700002)(36756003)(7416002)(8936002)(86362001)(5660300002)(44832011)(316002)(41300700001)(2906002)(83380400001)(6506007)(6512007)(8676002)(4326008)(186003)(26005)(478600001)(66476007)(66556008)(6666004)(6486002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: v/BWDLPciA9jQCHnzrDCT4a8yzdBvqYBHsfqZIY2jRl0u0Z/jP1g0lM5yGfuD1t68YGmxDS1yHTL20irxxxBWWhbZl/5GflQNIdvqzoik5kB1lmvJQ1L7hr5KwBvGQ4giHLebqe8/ax8jk+zjQISLh8cO8iY/uvgoL+OYl/DvoWIuc8MqAe8gFPSGCluDn7nmvyO0nequDGknFEqJVIyuLjF8IuYdgAwQVI9alrQnoSKJLe/fh8RtfVypQoUmbcZJA8X2LDjgPIFxJ3Q+UuAcpqcF15fINvJ+9A7ESu+EZo3k5M33wgZoAjRsn/Kxe3VqiUFBbo1weiYOeRxuWatigk3j7UDfhH2z29B5/I+EbGouH/7vfAiByPaWgjeHLv5S7jf6ObcCqsRvkKmG4hMaZQTj/wCwPfDxLctJrGDeVJ1QDYo1jGqnVuLGgnKTKb2iKF4n8ik0BIa++ZXqsWYe+3EPoJSMpi5XfGAC2f+mVB6H2L8unCrsFRW0DRzSFuznlxGyu+xST+19F8xs61JphcPlvDqBwI9LJKZV6ixfmt23PGco4lJ6Oak6wLJYWy7uvtvUt7h8DRdYReLw57MZnLLCtqmQMfVES6Ofo9NbrkZUpnHK7a5X//A3a/2ND4BkCKvwEuk0+uM2UDii2ehknVY6ua0+7yXcrZwg4/nWLbIxbeUnPV/xH1uJPxu08BLwS6HTID17rbTQGs/fxNYe8Uu1hYygNHlczyA/IMGjEb0N3PdRvkKHb/7JuZ6rp2ZVCXBSfO6NUCC0dQ4S0p5y8NYnp2rtDQ83Zr04+3qapGp3HvuUh1oIi4vNXqttymm1S9cKwqwp05kFq2vuN8kd4lLJA9CDl1/0wgOxPPYHeXm0kUO4FadQpoYzxpdRWnPJsdZdRKBSVYBULmr1BmWW6Ex3bfqlQCYFd1mLmbv70qrLPgJ2D6vyG8/vN5kPmqs3STgA3/9yZluYt+dSHw3pwk7rM0Dyw8G4g4ybktNP8hY/fm/+S1JlHws9A3BxH4ZAaDczPwG5OEV/SFYZd1SPviYhGkdvGVk/KlxbE1oGpmPIRtnnZ9p9nRgbaPpWgI+qTokEwSxqbAjmvrGtLEZGkMcbvPdEHmiHNY1MA11v/miv1cnnqb8Y1HovQFg0PD5fYOgNMLVIcajmOcK/nwC1rhpoUaFw+JYu6Fh0FxbPU2tfQBXgSTORGg7jcK+mDGvfvEoC3DzAL+MBAqP3vIxWwqOb3fHI54v3euri+q1IznK4gYtlP3x674TQQpuYWQl7PvukSeGWpxy6rBMllFw2IGOw7yjEf+bt/L6i6uxZPRE0vG74g/EDAlw7QgNvIBGbQ8WI3ydoF36wZ92AsCICedxRmsS5MlYW67SvBRVuQQJAsg7y5C5KiYJQvGQ0lfb1hJNB1gBXJu/ozW3lub6w4yq3RN37lOHcGTVxqWbOWcm/J+tM/c2abIZ0iF0+X1mcqYcf9W96Ri03LE8epmC16CCtNfJshl4E7tdKFpY4FxOX1USw1rx6AifB6Wrz8OxV+magmFx1vUWII+0KJBXjPLGzJhTvilU8JIq6YaRJeX0OohnLUUq+2ukTPsllRVX X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b612d9f-48d7-43cd-69ea-08db041a13ea X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 06:03:45.4566 (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: 7nQSti0SC1n3fpselcbEq7qdGVVgZqpaY8rNUvKPKkYN0QtAAqGsZ2hrU3714JxG0uQN1cn5gwxSe6NPCEFg+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 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 Wed Feb 1 06:02:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 649520 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 4262BC636D4 for ; Wed, 1 Feb 2023 06:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230417AbjBAGET (ORCPT ); Wed, 1 Feb 2023 01:04:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231750AbjBAGER (ORCPT ); Wed, 1 Feb 2023 01:04:17 -0500 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2041.outbound.protection.outlook.com [40.107.249.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 132355C0DB; Tue, 31 Jan 2023 22:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g57+Dh02rMueuanUDisUQLpuaEaM0xEM/bXvHHJ9MDiHxiBt8AW/3Zdh1XL7obNxULXVgEvJLL45h5Lb8ForgzchA0oVAVnr3YnGJ5VBx+am+b63AuiI7o7Ac07rK7IYrS5Y9j96VpBSX8RByhJG1YvnbLdDYUUM7/r8XCtAGRKKxjWqltcP6vrgssBu/FT/K6ME/TMUtVJJITXNV+eijVg/xlBkCnh8K7lJouw2C0pSEXXSrYABXN17IwtPe/geJFYs8wNa44XtvLOj53QjkjwMt+y5HsscpsjeyIlx7FnvE7AjxEa4YOttvhONynZr+5lro3bQetoRB0zGdsvhzg== 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=Rp9fD2lxKZk/OyzO9ICbgNmLszxnSeIze7AxAGR3a9EA/XJPguAh4a/599hPSW0N5Rnek0Luoz/BoAkQ7oQwwboCEHvuQjYxiNrwhdtw3LpqIbGdpLmtn5d6JM0YX20u/4Dhy/V4ytq2rpRoD7Yq7hFoZtdTiDK/Y4WZlI62+uCS9aLMqIyYeOlmb/LyF8CvoryONjaOBpd6095v0uNrbQcDwk450Ht9K2DiE0ltNGd0E8qthQ07pVLCQUeKSU3DaGN18H0g7Q4rVrQp7KFPC2gk8bA8Zxn+NbJq9DnyaYdCdfQ6q8AanvBH0tI+eN0eGTx4XSvGSaZda/K+/wwO7Q== 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=YdNZT6Abe9j5eY0+RBFBjSOZIr3lMz9qNBdMKki9NQUyfCzB2uH55jORdtDUG7y58yNrNdXa8MIhvryf5ceFrRy5cbi87v2EnNVqHX3RkWcd2fCsezjV1+Gq20aO3JtCsu5P6mrLCdm7Mxepbv0tUEdkoQSIl+/6qO78BhvBvUA= 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 DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 06:03:49 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.6043.036; Wed, 1 Feb 2023 06:03:49 +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 v2 08/10] media: imx-jpeg: Clear slot next desc ptr if config error Date: Wed, 1 Feb 2023 14:02:30 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a2bbf4f-dbf7-4ce6-cff0-08db041a1640 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dWDpJdKg9FVp8yqEk4qW22BXhEx/MqLgtpnvqm2328sl1gxPYp5WOHAsaQ7ESBCXUrIp4wY2gVuwiP6GD3hUOqnpy7jbeVqBzzP+3d063PTUS8Y/9MAmXXEpsIc2p/HP+G6b53CboysP6Ne2eTf7uPFIHen/orjlp+jspjFg0G8VrbSJ0855gmxn/hN3V2iZYpNCILEz8P1mrYL8UEUM8zp5GEi1aoblWtMr/ALvgcS7o0wKyCka89kZuVFBGdLYtX0FoqpkHSuHNrjM5IXh82V/wQLZLlHQ7rj/aXoDO8GKG2AghHWI9xerAah1jq/O6Egrf1XF00bR5tLR0hiyEullfUN37m4J4JE+7N7l5ENLo0qjTx6xcAXvBP94tnUU4JPGNP1j7N4VVjp2bIFYiZzTr6VnPeIARoBUSjyrmwBur2vQJyNn4UyarDOmG6T5IEdfeaPSWtgkjPV+lV+cIpyNv7GWQ/b0y3oLiQE4mVxnnq56Gbwa9fJ0giv9s8Y49osKqHAG91aDT9aWK+fA35TKKyProOu8rX5QaDuyII+2xorVMcZfY2rrVqeNdkHZ0VZdqImReVaMDWSsEIhYe5iWats1XlXf0QobU/jnrDDb7BoekNwukC6Iblamk+gn3XwS6+2EzMEVhvs5crUsQ5FrcsfCUzT+G0woWzw4kLl6gp3Pgqaxr96XV0+5AZID8gBHPaNSplhMwzHbGYIB3Q== 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)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199018)(38100700002)(52116002)(2616005)(38350700002)(36756003)(7416002)(8936002)(86362001)(5660300002)(44832011)(316002)(41300700001)(2906002)(6506007)(6512007)(8676002)(4326008)(186003)(26005)(478600001)(66476007)(66556008)(6666004)(6486002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 61MDlAlUMhNlXHwGSNOFcJcwlJyM1n2zfoPB/LythPhpY370+pOlRNT3VFzfa6gR7i0Zznr7bkuA8PWyyL40mbdKVIFfF5ydFrMuuKik9N32FqL5zGbRzQSR9ZBQd7V5DkjA2zv4BukALUkJS77WiHw9kd3l4vgDWz+XExAo8Pm4jC+VBlFHk+MpAS4fsTOLASWaSvwBJBJvUDMMc23uNcHw51FQtMzroCPyYywzccFgOYKIfMdioQsDAB+Z1ObWPIVO6zu1BL2ZWZzOaOV6/JbIogMBk2hyyx+QzjoYsucl7s+R8vyHQhMLAAkpdiorxL9oLRwb1xWxHMDlDZpkYOi7iaU3xrQFOwqgOzkOM4sDS61/cY9jjHt5e2bIa7Wewv9RmvvC3pzpvH5MAVAi5wj5Zlr86VGZJGjVCBqsnoxbVsLESJIt5SsmmbFIW53UNLLyuMscPA4rKQm2B3KdTDdFJndz9s9Jn71nlWuhw9bhK9YN8YMCfA+DMS1Ra9drj9VSRo2GIxUhPlmyBOy6grPmZnVG9IYBj2VzB/OkPpoeTebc7ybsXDf9P6drU48FZ3ZsU9OgkaqMkYdNTNzMIUx4WGa7IXUm1mUg59qStbaoURxVj1OOzmlkPhsMT2WBES4Cfkx3MetHy5s8lELo3I2Tc6/k/rHP4RKZX55EqonELxC9QdX6NKdYdNl7aLPVsyWLIFlARQOtVMGAApMtlbB9Av2X+mlrooEDDXRuMgxem17H+w1MiHGjz9HcwQc+RKJTLI3qOkr2Nx4M0VYbG5bfjK0HJHuoIDsaND2CTGVj2VVCuhDeY8IqFdtLJInTTLdqZJzKXh6lL4iUySqmN3v8uoUQ8jUCCLIGFIT5hx8sK3kI13WcSyguQjqIqBPRrFPtlCIWH0KflQyR7qCbizSdsckK0Kd+VJ0H1q/CkSgPn0yeyQmw+9zD/HM7ghvLcCXjtVv4XfqDsFeUrFYfACkLPqT88SdvzAU12NiVhQrn+CJU45phEKS1MWbymx35mDnaaITVRstuthpNIh6AfMz3udXaQPz0NzKzIye+wBuxFMTi+zCN65bZcTCx3S9DXCNlyKoMLZSrSR1iTX4pY07nCmpuXDJ120ttfSLL+E6h2VTHD5kwYKAK2TXzP00Nk4vlpTiBx4tTv0m08lxnMYwUMN2gquEKzuiWMCKj+McWghVaB0RNQxT7p4CqPbTuxVcdyE18o5ltUUjMfq5o4UxK9Mq9GY/RmU0Lj58H61FbqFbNu0l/PXVl7A5TXQaKOBAun2qdQuL2vhkG/feHYGKoPfcaXLfMjK43I1xzbAbOLq1DVh+E11D5xk27BjdhCKHCUIrt2dSAVCoHYA7bncU6MDnB1gAj9YcXJKrQ2PaCzRN5w0F+/cfuCvM1RWyDF6GpUtZWGq3ie/Df1Dvau8i2BWtGUXW670pA5RbK5YnrDOMRRlBgpro2RcNNELX0HV2x6cQPmtkVaCHyaaBm0XbSIjdsIVlBGS7MDzkdSjanFEgasCVsHOXuPmT3bqi02T3gghzJ3c+KAcru1Qgftd857atRji/ElhYhZ0SrJT/Zx4vQlATQZM5tmdeM/adK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a2bbf4f-dbf7-4ce6-cff0-08db041a1640 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 06:03:49.3626 (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: U+rSYZZnEM0v9c6x4+HKuEFobGtZ3nr1g/vCzFIWGJP2+8kqcga4Q4lB6e/GdvmqJ2s7llneiJgQkdD8pc058g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 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 Wed Feb 1 06:02:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 650776 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 EF9A3C05027 for ; Wed, 1 Feb 2023 06:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231767AbjBAGEm (ORCPT ); Wed, 1 Feb 2023 01:04:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231766AbjBAGE1 (ORCPT ); Wed, 1 Feb 2023 01:04:27 -0500 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2041.outbound.protection.outlook.com [40.107.249.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3251038EBA; Tue, 31 Jan 2023 22:04:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XbxC9ExDTADgU8U60Kmvs0Y4VFcSeiiiNZxYyO/Xc55Q3KSSiT1wMZPOSK19yq7EzYlHSRIH3NJFImCyHjVwKOezi2LWWgolnR6ObKKl3mmqQLW0ocZFY96PQquwpYoFe0gV9ubfftvhBWiNmrqL5FFwkMAlblWBppyNZvb4Y//OA69LKZY5udSDrgqaYWEUUCsvLlwxh1HK675Z4E6IkfZ6bifOtyqqgH194/sD+alp/U5qXxHnQ0FrENYuGlaYzaMFSDQWs3d0OSJA/oIZrAqbP/lCRQejMlr+F9oQgiTU/sPy4ygOTOfEljOSQPfqO2dz39zS3Rp6X8EzXJPDhQ== 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=j2e0CU7sES36aiy95m2z3T9eE5qB7rasadl/DHDlusE=; b=NzYXUK4f7cMowrXw0qJWsMQuwOvM7at2FsbBlTv86epwyGiV5960Cjwz1VUNrVpEJ5/nswDBZ8HMbUaPlKJxMCX7xsikrDsXkxnh+Y/EMhmk5Cr+tsPR8ygPGXDNfdOeaWnRtwyMI4d0S8JcwdT6EbkaxOjvXYCzi60VX0RY+kog/iSi/6Zslgq5Ai8MvLbggSUL8M9lgFwSnuQO8dG6ndh179JzSkkp1pEPAXxXrlG9/jrkbRTyV4NsCMdLpCoLbbEgE0fvimp2juH97psU+8P734sFXscV+JsR3CheedfRL8x8A4bte95dcuxMgVhs4M7PUHDlTBFif4jzFCk9Og== 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=j2e0CU7sES36aiy95m2z3T9eE5qB7rasadl/DHDlusE=; b=VPvogLI21J/cBNzsm1fuk5clxohBiHUrAiSDAqDTbyMDSjIuAevRElyWFJYJYIpjsTjQxAkR+nv7q1X6CW+OEA4Ous/t8SX7lJqDshJiXJFMZvbyz6DWkQw83yGb/EBOXnIkXsS7wQ5TVdsTBvg8VrNeggN3lHG6P/YAiN8COYI= 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 DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 06:03:53 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.6043.036; Wed, 1 Feb 2023 06:03:53 +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 v2 09/10] media: imx-jpeg: Decoder add support for 12bit jpeg Date: Wed, 1 Feb 2023 14:02:31 +0800 Message-Id: <3c2df9a3093df66ac6a44a04b8c55211fc7a60c0.1675230665.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: c2518123-c6e0-40e6-d3a1-08db041a1894 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rPvs4EOBlAcBVEkXgJZGCn+/2v4o3Mn5AXtPYC6IphbP1r3Xc+0Ibg+YeZdDql71FpMJmMrZB1Q3QQ7hHX4k7VKIu3UKoETmOTmPc6V4G7yJbm0CBFDeUgMAYswECrwScZqbhMXWSEMd/ZVYLNl+jR/g1hjWVPx+2No2/YGDmkCs4aohskUq6liHusfeyXScEtWIb0ZEwkx20kNvi1U5Xzot8COilv+SmjKHNDk2vLY0zX+CGtLh48YPuNXbHIAFufOrNunRwe+wt0X9NZ2wehkKb8rVepJSNk8iBgmYxn02kMThf1Id+31ql6l+QfhNeb2aiQDJZ3E9AgBz4j8B0jBggeXep4ItbOxGyWzSRExK3yIJYPyZ4lAEaZ3/jMgqC5+zwV3XB7L59ygAbNoqL40CBfHnm8tZoUgWLXuatnaKkMg0WEqP0TAAXvVLHh+7WyS/C2aWHtpdf+mayun3ns0+n89492G4Tnhue/pUKdXYXLxVVbI9aCzMGVcaYFDCLh/0YTACqkMVkNbGriNRx7rtaa1CaIZDWfj1yFihkcaqTiN+ZaZ93Yrmu9fQY4qQw7gPbcppth+rmoOCLcOX/EvkZTKGE4bE0uGmTDt2tBH2SaHXLgCUlwijDon8hFjdmH9ZxMmPJ31zxPGYQ51gn7J0bipEzAnOPQ/Q6mg1KxBwdKOZGgTlGhPYv4ZRWZHtFkMTpTeuajHmafo93BiT+Q== 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)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199018)(38100700002)(52116002)(2616005)(38350700002)(36756003)(7416002)(8936002)(86362001)(5660300002)(44832011)(316002)(41300700001)(2906002)(83380400001)(6506007)(6512007)(8676002)(4326008)(186003)(26005)(478600001)(66476007)(66556008)(6666004)(6486002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 25fL1eRaUCFT0lfwpKWPac3lxFtNhzZmhLDIy8EC561cq+7e8oY+H6stbIoD5v4mH9/LhUkxg2y+x+NRAViCCvty3pEpAA6ZjMqqheKZbMSkbvWD/B06PowvZDa24CobOKmdpT5dhshjDrtTzQQBSk26oaF4/x1xTnDGTTIeripUNwAi7PyVQNuWlTdw2UlpMR/33brXheF6GJIxlguGesRDQ33N9M4JqwRsl17uYFqe5CZQqK6aIZfz6yHFrRBJicXsf8CDuNEPtJ06paJxurTEUY+Y0rzM8YwEDPJ9r4ETu1FiQlnQHW0lqtZdgWFcQlm1gx/+lELIOHeTyo496UgvIXAvtWjYaGhVIcaX7FvaJRA2cf2HU6OWF6qsoTJaPZbm+3nhJAFzedDEqmOBxfp6fLmAa4CFO8B+cx5cQwAE1QR+C+r3Qj29LP4isa6f9mcDHvF00I03gSYeE82jg6P00J97d56L4f7Ryqqbo4rrPkTMzela9nayLaG4tdnRU4hFfCZPeO8V1T7a8scFJ8DN0zWfrnRwX7SDCypKNmO1phbItc0B7qnGxJmaoBwr4jgCbtwEWatQAd1kfTj0smP4MsjpBbB2sJ3NvrxA9yorfkKTAbX1mMv6/yUOZDOjhaU/lZ7mI+G2m22K0YdzozUZc7kPdfgV5GaxCnNx0RonAk863CYawNQPI+fOwVOaQzLm+IXhWDGuElhvnmXmkQglX52xSFEv4EWo3f9lBDdAWgAXDB0uYxF2foZCOcQAGohiY3Zqoajl+sFh49haxJyFUAHikVWUteLv8UWeAt5hbET96zMJ4gbuUWVcxsQsDuSK71+FjMgefZKiEf7AU+HPQ3bDvhutzuw/pJR8Z92OeDhXBw9kHix7yEy8cLzr9y88zYBpv/F6F9WvrRZKVFTrKGTiawLDm8McFPEYYVZ2EKZqAYt/HRQx+NGvLBsMfClyVxwhijZkxS4cEWiSc/FiFg1SionRGCKd2Kx1hXJ69qqq8NujNCOdhvLss+foHcpMBrPWch8W9Iw7pkT/ruBJ1t2TOc5FsNF7lShcY8H7BzwJfXiXq6Bv7w++kpBmD99WznME3lFi+64uzAHm4w7bYHUe7obJ3xhMMpqYNYTmAi+T5kL6C35+yVH2OtvCw229tgQkArIITee4QDMaB5uoYKKPRgBq9lc/8cWkHJYICXL1rlfTpOXCZYKbk4RbZ+opptL57YxrvUDml+t+p/tovmgNVhrjSsqbNztIpzI6C7FpOd8NZfbNdAkWuMuLW0ymVqIc3GCjEF7NfSF4scP/JTtk/QHsIUo3vnVjqAAxWh/rshEOy1KGxsEiyISmzCNZX1CZ7mHtFh+rqdyeKu/sUviU2ieIgi/qv5YwUqmi9n12Z6S4PAhccIwaHD4u6w2tXbnshdQWgvZtoiPyINf89px2QIyU/WIzQlJdFfQHr0BBPIkqPAj6s1/dqNEHPPz620H/HchdgZNrYqaREd+/ut0HI/Asziu2aPbVPqpewMNoPRTuDJhoh9fYVXTfXs86PFgwL60njW8+lUfxjuo8FsEhj7OIjPs8bgA2Mu1o/hNwxMWXrP27/dTvFCoT X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2518123-c6e0-40e6-d3a1-08db041a1894 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 06:03:53.3780 (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: UhjDNKteNv5pR+vi9praooeuTXD9MlkRhGrPRH608Vqdfl6eNT8JE+xqkVzp0C8/FDl6jPdUcYK1HXgn3dd0ww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 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..d493fddf114c 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_BGR24_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_ABGR32_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_YUYV_12, + .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_YUV24_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_YUYV_12: 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_YUV24_12: return MXC_JPEG_YUV444; case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR24_12: return MXC_JPEG_BGR; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR32_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_YUYV_12: sof->components_no = 3; sof->comp[0].v = 0x1; sof->comp[0].h = 0x2; break; case V4L2_PIX_FMT_YUV24: + case V4L2_PIX_FMT_YUV24_12: case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR24_12: default: sof->components_no = 3; break; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR32_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_YUYV_12: sos->components_no = 3; break; case V4L2_PIX_FMT_YUV24: + case V4L2_PIX_FMT_YUV24_12: case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR24_12: default: sos->components_no = 3; break; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR32_12: sos->components_no = 4; break; case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y012: sos->components_no = 1; break; } @@ -847,12 +972,15 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cfg_stream_vaddr, u8 *cfg = (u8 *)cfg_stream_vaddr; struct mxc_jpeg_sof *sof; struct mxc_jpeg_sos *sos; + const struct mxc_jpeg_fmt *fmt = mxc_jpeg_find_format(fourcc); + + if (!fmt) + return 0; memcpy(cfg + offset, jpeg_soi, ARRAY_SIZE(jpeg_soi)); offset += ARRAY_SIZE(jpeg_soi); - if (fourcc == V4L2_PIX_FMT_BGR24 || - fourcc == V4L2_PIX_FMT_ABGR32) { + if (fmt->is_rgb) { memcpy(cfg + offset, jpeg_app14, sizeof(jpeg_app14)); offset += sizeof(jpeg_app14); } else { @@ -918,6 +1046,10 @@ static void mxc_jpeg_config_dec_desc(struct vb2_buffer *out_buf, desc->stm_ctrl &= ~STM_CTRL_IMAGE_FORMAT(0xF); /* clear image format */ desc->stm_ctrl |= STM_CTRL_IMAGE_FORMAT(img_fmt); desc->stm_ctrl |= STM_CTRL_BITBUF_PTR_CLR(1); + if (mxc_jpeg_is_extended_sequential(jpeg_src_buf->fmt)) + desc->stm_ctrl |= STM_CTRL_PIXEL_PRECISION; + else + desc->stm_ctrl &= ~STM_CTRL_PIXEL_PRECISION; desc->line_pitch = q_data_cap->bytesperline[0]; mxc_jpeg_addrs(desc, dst_buf, src_buf, 0); mxc_jpeg_set_bufsize(desc, ALIGN(vb2_plane_size(src_buf, 0), 1024)); From patchwork Wed Feb 1 06:02:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 649519 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 BCD42C38142 for ; Wed, 1 Feb 2023 06:04:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbjBAGEy (ORCPT ); Wed, 1 Feb 2023 01:04:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231802AbjBAGEk (ORCPT ); Wed, 1 Feb 2023 01:04:40 -0500 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2041.outbound.protection.outlook.com [40.107.249.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEA345CFC0; Tue, 31 Jan 2023 22:04:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q3uH0BBauGOeJnZmmAN4gXWsVE7lL/Fz5BoF2QIRdOz38iw3Wf0cQBUIOTHdZ8HlF2ejBGtvCxVZy/gDCYUawZxGZ95v+WeqnBTdSOvTrfjeec6l2ocHLMmY0MmwFXFSaCay2te39CWnUw0ZxZ5yjngfJWAD/shuBatCC30e56Mcdccyn8daxppApltFPQt1XpFutVmLgusBigHY7WfvaPsHL9JBRGtg7e5+eWSaBfIiokBNw1xDOS58Sqm/1f76iAEpnBi5oxWn5VQyYJOz6IdXpKwC00YTsGaderi6PiiJKGTBCqVESX/0gi/Qh8SCp1tgyALyo0CWyyInY2rRrA== 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=NZ2LXMJuZO+HHc137IjW94mxEk1lL8Xi4srJtfgS/i4=; b=LZD9MCuy38tQ5gkasFf7ncA+F/nTStdocj1G9M2TwtXNNWd4AjU4ac31gj5j+JGFGTvpvgp96UcFH4N+z/sKkpMc9oFXVy3mpyhj+2s/gVFkTxQFN29eM3GnbSB8J4ItLYla1sbGyIIjX7IVxYaGNt/79HWsD2ivIli6hLzOK2K5EcfcmytRJQUr3Z3MW+aZsj/6OmfcL7RUC+7Z02HCtqXGO+V0PiWLQuJ2CXpkkN2Yt7hsUayVFQnYT6TB8ksadn40khD59L9iXNDeloz+C/WZ/Y/2hScEsq17rrWk+PHY0OoJ+fyJmEPIrA3V2FE5gvUelOr++l5sKOYhpr8M9Q== 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=NZ2LXMJuZO+HHc137IjW94mxEk1lL8Xi4srJtfgS/i4=; b=ZXh7QfuTwqHFneG2e1GMPQKhl+vkZUe9Unz5EKbgN9+j0vqPUiVNL7pKpprRx/9pwd5I24pHd+uIUcvgqBRvLjuWTh4MAUlw8z7jw03Ge7CJTKiBe/fGVIwEygEraq/eKFBljBb/83lgPeczkADQdYqTBZBApxswdlCySGqIjBU= 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 DB9PR04MB8429.eurprd04.prod.outlook.com (2603:10a6:10:242::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38; Wed, 1 Feb 2023 06:03:57 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.6043.036; Wed, 1 Feb 2023 06:03:57 +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 v2 10/10] media: imx-jpeg: Encoder add support for 12bit jpeg Date: Wed, 1 Feb 2023 14:02:32 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::7) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|DB9PR04MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: 52671d98-9613-4bb6-878f-08db041a1af9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ong+Eyi415gN+ci0PJcSl9MI+1Zu+yNzL1YUBSloKX7bLvcL9fr57ylxza/g7x6IR4FIqxbbk1cOmN40xIvutfydKcY0Leeob03nHw7Px26/ovkUIVhHBMETu5WZWzdGJyaY1lQrpk9Bggk3qT6UkLvyMDmVpzNJWxrPvoxnHyfT3k5HldsUvbgHVHP/+wXGU5PxRPlGOoaReU2xc9rW9+kg+ql01U8nWvnx73KxTVmEAuc9wxoo+TZsxCF3picHCCilzX5yJ/n5pk5+9f0p2BkNQxwdwuNcWhoohUTxBbHN2PI9C+oNhrxPeu/g0nEOvRaq5SwLskL0G4CwqYnIxbCDax4ezOKfALekJlI3YAW1IRrhSYIZGdcePKn8tv9hHkpvDGOUekYlkjQdIbQMbzGe80iR2eoBMHDWdsIdqXBNEUFpdListCclITiv5KtypMfIbkdp94l0mWSUKN0xnVrCicP9hAxhytJ5R4Ay0r6thdt9lxzkJFaOX2l6ivfxTcPaAcIDcR/ZKachxEDYN11XWAavoEV8HXaWwmSs7KFyoVPqZjxmWJHIT+kBHd+/XjmvIzpYbHU81dAVLjhwennOR0ALt3o86Im8CmSCtSa8/QM+DhGQ5trNaiYGryVI4cdYbWB0EHN0v2EQgBQZKX71Uge2VyV+qUSvbwj29B9eIErQxcCP8XOKjwUckhzjsCObxtC402tFiWnCh4OzuA== 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)(366004)(39860400002)(136003)(346002)(396003)(376002)(451199018)(38100700002)(52116002)(2616005)(38350700002)(36756003)(30864003)(7416002)(8936002)(86362001)(5660300002)(44832011)(316002)(41300700001)(2906002)(83380400001)(6506007)(6512007)(8676002)(4326008)(186003)(26005)(478600001)(66476007)(66556008)(6666004)(6486002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tHfpgfiEUzNNCggGuyD3a5h+j9EOycI1f2qdAtoDaH4IubLQ8B24igXS2XeUWnTboOfHZx4xibT2F3P172cJpypynHYchQouhNaeENl6CVuME4w1qz6HvI2SaBEyeHZACa9ksEJlmOi7N82sLpuXFb43FeUIxIOQ4f7pMxjYEPtH7B7cwaaFyAgO1vgjNZzh25MP201ubBgcIIn8D4EP48ONo7ZtZ2SLnpYEGr0x0y2Phx348kcr+5CypNfkV0g6q7FpP16XGpQ4EGVE1F6gb7jc67vhH5+4B9CpYK5iNTo4yuY49UrWWCHfcyrDFxYTwI/4p3P0jiCVyJPJAECSUHzELOA638GsvMxZAfuf7eLnKss3CDuxdneSS8Efb/rI3nz48OECBU3HjmBfBlpzdi3vSiJP6n821udHTTILVTVumFfDiO4Ilh2RcsCPKIkzJTGfcjpBXkAjwISuL3B39qlP2L16BLTSCVUrKGpOZ9Tv265UJ51tIJvZ05tYbPeQFlo/iGmdHNY5gd7Bfmm9ySzpz8qYbNwoTxoHvTtk4uRJMfBRACXl0gectdHGrI7g47q4ZPYZOvd5OXXvTqIQc4OkJ4Dyv4CbHnyjAoh+6TnwLq8mkTPIoNCXlzLsdU7e8yS9FcNCtfeRWdrn94TOL6lMtHeigiVq5WH78VPe+iFi3ycPyj/+1sFLDgZzdhCxfK60zcIHkbGkWeWfgGcPhr6CPcXPlgW47gGhq/R22Gzmq2kr5FM4bTm0NvCmLUhJkiXzhMSTpGZLvD0HCDZZDscJGIC1Tv6l/CcqE2H32nq0bSxkCZGyOfjuTKUlNgo9fT0b1oI/wmz8XXDS8F5bhqDaIOSD3ZOxj8vuAGPJPEox/9cnTaOz2tno2ON9QjdshcqkI+uDaYWtYmNxpMGa3IdHmEo4vbOnCrT2OWiT2pAPAprMi860KpZEnyt10iuxyEBTJdVzZAs07vdlEW1T/3ZmbzT3Bw8UADMs0WB3/CPHtK9KAwyibTw84wGF622LXJBnQkjoVrv6hGjXOum9VQyyLRS4kSPSIYq9ptvNOp+85fpSt1ccOpxrr4GAHI2dCMG6Y+urHrkcB3T3XDcn2VVwzc+NC6INxVl06S7nfrey6e3+WooZ7WCI/DxMUTIN9M85mP4LmwbDM6+sRvKXpbd29n4VCT3gUQXNjeA0HyUfK0lLcFd2uDh7Iz/oXJFeVTqhmSwerCZ8V1umSwbNzDQWqIw2p55KMHzdIIHUMTd1wMqk2d7vR6aQ4b3hiQqIycr5I5jBwoorWwjXolgSJU8V34XVgG4s+yfiAB3WhjPHmTf7exQPxVWN04BbvHixdE/zcDfxjA3WGqa7a6/iRCmZRe6VkYf18SiW10RItMuNNzYZaNgOnoaoX8x2iQ7u8T2zZip/P4MvRbMY9OzWfUS0dvfI3Whs8+JYirj2jb191D8bUCt26f/WUMAc+hAv9Zut/denicXC10mFIAQ8Qs1OUu7EDasMW2dbpeDWkbyEP1clJ8PVK5wgQf8guSXsBmlJ70U0NEFM10HKo1gkqfiSS/iak/RPoNdVukHF1Eu+qccAygrpC5rz1JeC34hU X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52671d98-9613-4bb6-878f-08db041a1af9 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 06:03:57.4091 (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: O+JR/ELDLr6ZUhre1xF6T9nJR3OTak+GjsPwLNfgu9u88idlM86YNNHqD1g1H+7WxoWfrg3BSX1PM8y7KkMx0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8429 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 d493fddf114c..289d8c62b61e 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);