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: 649425 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 D2499C05027 for ; Wed, 1 Feb 2023 06:03:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231556AbjBAGDb (ORCPT ); Wed, 1 Feb 2023 01:03:31 -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: devicetree@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: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: 649424 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 09448C636D4 for ; Wed, 1 Feb 2023 06:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231611AbjBAGDk (ORCPT ); Wed, 1 Feb 2023 01:03:40 -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: devicetree@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: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: 649423 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 45FF4C636D4 for ; Wed, 1 Feb 2023 06:04:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231648AbjBAGEE (ORCPT ); Wed, 1 Feb 2023 01:04:04 -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: devicetree@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: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: 649419 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 F0D9FC38142 for ; Wed, 1 Feb 2023 06:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231718AbjBAGFQ (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: devicetree@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: 649422 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 2519DC05027 for ; Wed, 1 Feb 2023 06:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231717AbjBAGES (ORCPT ); Wed, 1 Feb 2023 01:04:18 -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: devicetree@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: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: 649420 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 9DD29C05027 for ; Wed, 1 Feb 2023 06:04:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231730AbjBAGEy (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: devicetree@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);