From patchwork Tue Feb 14 10:04:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13139781 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 2076DC61DA4 for ; Tue, 14 Feb 2023 10:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231758AbjBNKFz (ORCPT ); Tue, 14 Feb 2023 05:05:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjBNKFx (ORCPT ); Tue, 14 Feb 2023 05:05:53 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAEBD527C; Tue, 14 Feb 2023 02:05:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MF24CDDpUFkuKATik+KbJZhqwR9wPJnXcLYI+BYBazQBVNN8Cy347vZrVXH/78xyxzfbG27BTVByjSMvfVw2kT8Fyvac6fpa9u4oqtCD7oJGFJvW3UGtOKrRDokiA5ljs5pdNUDjlubE8Fs9A0OIeSRXlXlhz8ApqodOUHPVOSU1MpXyIY3lywb4Yf6Wy2ypBegQY211A/OaWAQdf0Oa33EaIBtmyORc1fZ1mdzICBxxvPZgNgfrIbgOxSb97SNwodNTY1KuVsU/yDsO0OOhD9aCYv1U6950aumO3HK3/HHvelJTa2F9vfWneB/D8HTBxzEGEgthHTbXIO4UvmA6Sg== 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=X/gvrBgcYfBMiPuYaztMA7JJWd8ZL+CtVG3h2U7bgMo=; b=bT9AKkBBs1vodJBJSN1WPu4JqmynKTPWD6NZbPd9s/8ylZe6xq+ByeO8Dp6mtmJl6gEzx9N8jZjo8YxpscH3lL6l2IWcg4//DAvD7sqYhHdF2DUIFnsix/4NnPPyQpO7To5ZCrK7GcTL50xKQ7oU3DfXgprv4Lt5K+OUD0KlCOaaOgyVd7n44bvPuVqCYSLdQC164E8UoXkXBtUYV8qwHzq6x0kP8tJdMOD71nAJ6cQyoBCfzu4heRsLXU4tB9/DIlX/hj4Ul1gbbRTUKzJJQPGy5wngUTeFcPNY1HgHegLht2cGxjamW2hJj1twQmxooQfM78UoMlp6vycyCKO7mA== 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=X/gvrBgcYfBMiPuYaztMA7JJWd8ZL+CtVG3h2U7bgMo=; b=LuBtFsVciGCOsPLA22NqK7TUeKA1EzB0y2GgaCREdI40r1YHzw+nzNVp07CA1LmAWtOLH0eQcSgL45tIptJiFEMpBmPd/GvZdmmuIPL4ukvkrze1EelSV2dE6QK1Ms9qzt/NkXAEbzD6EAbyxX6X5XCZ/k4hpjWeEcaGa6H5QS8= 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 PAXPR04MB9204.eurprd04.prod.outlook.com (2603:10a6:102:227::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.24; Tue, 14 Feb 2023 10:05:47 +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.6086.023; Tue, 14 Feb 2023 10:05:47 +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 v3 01/10] media: Add P012 and P012M video format Date: Tue, 14 Feb 2023 18:04:43 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|PAXPR04MB9204:EE_ X-MS-Office365-Filtering-Correlation-Id: 6681713f-2dd5-4c61-9c89-08db0e730afe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BS7eU2nd3x8Y9VQe7D/N0UZH/0XW6RNN4kvQ4LW/PmzTj6FPH9CH1+XnyCpOUK+NTYR/shXg6of+tDw4+74OLUqP3O9UVqGyL6D1hZe/0uTsazN2ysnIoKziebqci6e2MSG0+pfCOE2LzyDwkifgaZQBrWHpJB5L7m5hO++2DG63CLBmw6p6C0BeUfOAIqkqlJZw9m4wKCChDpDYDj8u0zfizqGY+P2HvtIF7O62oSJR3xjVq7t7//GMWQ524H/XVI2t/HcTJvOm8br7vNypjJS9mQxs1hGzrtLV945kKxV3k6WhHDizuvDXUrXvQA4wkQsuuSX9PwpXci8iAxfDBaMVwYMTi0Tl/13n/rXLG1BFU+ziF+cdmhO/BvGj5K9qQhVcjQwNEGnVzNLJrrpghj9mbpgC88rxGrPUVRoFr5zE/ETmQekQ5TNccp0X3zzQwUMbFHL63B6OXOghzAYKOGb1BswLcQYVFj4kdVpXK8+iwVadHHvPzwgKA+kvsgWfDFXWk+wpUsHkLGdwieQ5qucrCV+RiSE1vUxn6LI8VZPpgebapWxLxqUem6n+Gs5p+aWUR7CjguhdAHnLcOGpgJqBsF/ivDAE8j4Q4R6eBeTP4+1opYsE+lXBCLGbnrt1W+rpAKlgURzKSHoOobiBzzHqpFyVyhP2UH5Xeu7YJ1QH2rugOM5hmd8Q39L5tgXnZ7TMt7HN7Ox9TtRP7C1xMA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(396003)(366004)(39860400002)(346002)(376002)(451199018)(6666004)(2616005)(41300700001)(8676002)(66476007)(66556008)(66946007)(2906002)(38350700002)(478600001)(8936002)(38100700002)(7416002)(4326008)(44832011)(5660300002)(316002)(52116002)(83380400001)(86362001)(6486002)(36756003)(26005)(6512007)(186003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1hQywsIsj3oHWea8322la+Y5C5LITV+swY6KW7p5E6phgewAomIk+ijc7H1btzuoPeFLtdyww8QotEwIH0dEeWPntCc6XTuh5ue/aD2i4SAltmEP4A2zF9nusNc7sp2o6gOZNvxai99r+iNCFZqDblc6Z/wGpV/NDM/KAIi4t9eZoA4qStIGItrScIJJ1T2UZFYDoixuUDy0w7LrL9Xe430krfFyU9lmNJWyWgHxOhtuAC4rNIPeukXIT+XfwE/C7i1LFxUT3qcCiecnXoxmZKk1cAVW1yL9UzDNIJJdCsbGx5O1GBFLTyDfGQFKhz49Dinwz0q1qAM/3jS0FF2yvIR9jQioa080ZjU1DhC4S+f63sFK4t/0DVPxNY++70EQUkIpQVHMu5ccqTrJdop5298ZzINkLhe95u/FVBCtYG+3hZq8xteC/B9h9FCrg+dEHpAKrP3yWWI1pN9To3QXtNWQYR5bjQcuyIpivsqDBPePZvdh2l8lvdL+co/zS4RFc3sMHRjY5hEq++X2znLfxb3vbVfR1SsOFKTjQhUkzJMZkWwvqZEngUJJ/c34mt8LZUJVO5+Z/DZ8yJ2BbaBA4w2Tpq1IeWMd/hX2lmg1ilym6PaFnS1JO8C/38CptRZBS6naMzJSrYKa0+ONLolf1WsLV6ryL6gWYt/n5FXfIzGv7ZaeBZCBEHncyK8s3mafsBULdNNcEqQ62dWuLx0ZcorYHcHqlotlEltS1GvT5BfRc2YPH4xn8/9mijnT1VnyiqDaP6iqRNFYNui65xAhPK4WVrgH5QHg0aP0pfIDMp8VPoLgSWM/kg49bbQdOx/nw889ABzjBk9/p5COJFKB+UBTU81D5d6we9Z/jDKjhCVkzYrCRQ9wy979s4Dd9K0/DCEuDB5+8H6LMvWcOn6Rhx5OvfbOT4Qk1OvhztyQVMHVzU6wMmyM001ho9VN028H7Ty/ELXY7nrrvu+NTcgtmGM1RtI/i+l2I9PJg/SkGqoUcKLvdoR2vA3ZrnFeufrgaQz6wMTZrnhyeMCFZcefK8dMKxMvKVG9R2ajZG5zZAfRN0jPcMBqdooj6TlCtGfStcG1HvCckVf6Ot6aRczCgi8ege6ueExz4aH4mvHVTBt4ejcChsQceyo7V8TjvRIZh1dVWnR9BXt1yphUkI/xnH+sPake1WgTyHgTyZSLyrDqcsbBbQQe+GGqiP2IijBNihpjU1Ux6sGJ3OrInXufPCm6JPGdbk7MWO+VRArSF7aw7kuh+1EQuXaEhX8xK6LDJCi+HlrfNtcN7KBPsayJwBKbAlkgRZ1tofr7sAEpaJXvnEg2w3n5ciCUoDv7AmCZ2yy+h/ZTsKm2ZjmqoH9CAuWCHaWdj08V19XxeTA1X7MErBe7+kctGT7jwA3EdDkz0RihMUfz4v2CpmvPo1zZiao3/C6/hUsQk9S2Af71V2hqr/8NI3zzxEPTKcTTL+6QwzKC0pVYtFI52ruEZyvJUnqQavqEl0i3JjC0fqmtymqwT7s2CQekaV2fXgU8kBGLTVj9lQID4p7whS462PXwdmVdigVcQ9N11HBENQkMgM73k0UlL0MF+keZyNBsx4R1 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6681713f-2dd5-4c61-9c89-08db0e730afe X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 10:05:47.3574 (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: GwWVKcHKWftA81n0xZHWDbygWAFV4wgdtfHQaGwNdKgo3TPSyAly0TqXjIUhERx6Ya6Y7mpQLPCUng/7bKfM5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9204 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 b26da2650289..a166436be83f 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1349,6 +1349,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; @@ -1359,6 +1360,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_NV61M: descr = "Y/VU 4:2:2 (N-C)"; break; case V4L2_PIX_FMT_NV12MT: descr = "Y/UV 4:2:0 (64x32 MB, N-C)"; break; case V4L2_PIX_FMT_NV12MT_16X16: descr = "Y/UV 4:2:0 (16x16 MB, N-C)"; break; + case V4L2_PIX_FMT_P012M: descr = "12-bit Y/UV 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YUV420M: descr = "Planar YUV 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YVU420M: descr = "Planar YVU 4:2:0 (N-C)"; break; case V4L2_PIX_FMT_YUV422M: descr = "Planar YUV 4:2:2 (N-C)"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 1befd181a4cc..5448aa3b7858 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -626,12 +626,14 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ #define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr 4:2:0 10-bit per component */ +#define V4L2_PIX_FMT_P012 v4l2_fourcc('P', '0', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* two non contiguous planes - one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */ +#define V4L2_PIX_FMT_P012M v4l2_fourcc('P', 'M', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* three planes - Y Cb, Cr */ #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ From patchwork Tue Feb 14 10:04:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13139782 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 C875CC6379F for ; Tue, 14 Feb 2023 10:05:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbjBNKF6 (ORCPT ); Tue, 14 Feb 2023 05:05:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbjBNKFz (ORCPT ); Tue, 14 Feb 2023 05:05:55 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2041.outbound.protection.outlook.com [40.107.14.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 108AF1420E; Tue, 14 Feb 2023 02:05:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gBE8fQP5orMjgGNsI+bEdY6SaYeVxBurafhEwPdFQgk1D6VLCGyltQ046i17pLMr0TAF0g2sa1XJiaC62VXDlZXItQcODPz1TMRXLkJmUy2J5UwB3ReMFa/CWfhQKpIgECTiyZK82eyOTueF0dFDlVxs+SyjHlnyAFz+D2OBP9AZ8XXMQEcRy4YrnLizK0S3J4JRkjOE5YcPpWMFRTUrRQMB8ZQ6LHKxG8EN8aSZ/ELis221wp9LIFelA9GcErJvetDe6LTp/UhSQ+JBhmYldVKwoNMUrcT0FAyNSZXD3IaxB6CRmVsvS5/zr9ic/qSdKvLmL5rrnaSwPDZkzPkb9g== 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=Ix9v61PoUsYvkmqee5FtlDggASkuV8T2VAn8f1BTS0c=; b=WB5Jr1N2U6PeVYcP6wQgdxt/9yIdZ8yYtqe3Db8uOpgUz3UE2aMd2FjaDUQQ32Xj0GNv1QGS9EssXlElWxVAvNCKaKCUHVZ8khlN9X14zKINhR8S4wmiRKYgRq6TUQIX1FfGD/UCv6+IKc7pDlsr2avlB94brmvhryj4cVYYMhMqq+tS4O4n3uqp5Gp1yEIApEbe7Hm9lMlkdXTays0oBCE43/yrFLGkrZYTwLIZ9m6jVrphK1dHiicAUUdAymuI4x8rXMooDm84KtbPcpjasNTCexvcUqhxJISLnUL/P/HMvU2Ubvn73tKfgTqkJlRAWWPGcfR6RFvpa8YR4UrDJg== 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=Ix9v61PoUsYvkmqee5FtlDggASkuV8T2VAn8f1BTS0c=; b=BVFyMBiN3PYeZLoLvDjsEx3E/dM8QrkX9n53+fhgQIr5WLZvCILj5M9TOc4iGzuz/ytiYibFwmmkPq6YM7t/Mrma70tOiHav9HQUGf1E2Y5eIOwaILjbVcpLg+7fIrH3HTh2WTQcmBVw+xoYBYr3JySDl4J3jRv0JGNJvDFTrlk= 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 PAXPR04MB9204.eurprd04.prod.outlook.com (2603:10a6:102:227::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.24; Tue, 14 Feb 2023 10:05:51 +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.6086.023; Tue, 14 Feb 2023 10:05:51 +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 v3 02/10] media: Add Y012 video format Date: Tue, 14 Feb 2023 18:04:44 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|PAXPR04MB9204:EE_ X-MS-Office365-Filtering-Correlation-Id: aa20e51e-4bb1-4700-9ffd-08db0e730d52 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0HhJOLneZYoij2RU/PizS1O5KTsr83V+nUXYCrXqGcg/XzfeSm+OFHLtIGMe5NsbaWf3FQAGtA7A9liNJFd0i3n8hGHcj+Jddf2q00GMECFKz6HNeQLuXo4L99z3AKKx1VsX9s8XiSfNIrpY/DamrXNUwcBTnjPw2Z+u8jlrKflmRA++2VhD5MY65xfE0zp729Fpv2/OALt0gb+nOoOmYq9EA/A8DOJfKIYwLFHD0bzTnMIp8DQc0BjHTyo6BOmNZAhtVLUC4uzc7lrPaaLlXE9SwugS9FR94M5BFNblKsGgQm8Tfnc1WXU7PJegepK1gJi5DJWiQUIak6OQ5SMfra5o7udofBukrqNfKLeY3p73GGB17RHoDNw62CJLC5uyRhz97u23jMaSlg4FGx0+XKhE7eY2MVf0VeR9330RNRMd6E+hru2qQBzHw21uDS8H+cqvFtpyFfQ1TaWbxqCyDKdZTotwRsWCa7dXWd8RFWxwhHhpKFK+Bv/svPwTCVVjTRlTyZZiov52ZT1CA7eKF3nSrHmgdNkX9aPszP2EDHUm5yhbhNLErnPl16ivPJacWxyfHTD5Z7x6daZF2JVW03LFmAENo7FNA8SAT4oBzPaB1mMufXBxcmbgsbgIvKKCDL1twyvlr0YxejaJQzTtL4Zv8VcLYQMUt1WfWja6boD4EsuZzux79ZHlBGBrAR/BuH4n+UVbG1F5qbQ5sl+ndA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(136003)(396003)(366004)(39860400002)(346002)(376002)(451199018)(6666004)(2616005)(41300700001)(8676002)(66476007)(66556008)(66946007)(2906002)(38350700002)(478600001)(8936002)(38100700002)(7416002)(4326008)(44832011)(5660300002)(316002)(52116002)(83380400001)(86362001)(6486002)(36756003)(26005)(6512007)(186003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sTq82RkKIRyB3b3NqKJguMzwmPL0felz7xi19VHF/1ukCsYb/AtOFiWlzwgdwB/PT4kauzgNMOLohiurMWImCm7rtPLT6kbszeZCiTMcCCBA8XH4pjzI5J7Ub7pgFrCVkREWp7zHWM1pn/R+ktdgJSWFCFegMQnYzhy2Go4bnmd4zbH00+Fk917xSbGA67SlZ/z4flexMEmfVYVboRGhcvvrdOd9KnlJywJ6hQdzZtr7AYFc+/6BTKzavFAERFcDOMJhBgixNT8RawKovp5Yn4emP7wtV65RmXzMK485QbEfh6ftwdgKvtac7GokuIM/PnjkX1d6XIO7icUVM+kzxXIxqWjSRLaqkcTxnE7kI4x0yIDMHijUbzg3jff7XUDdXB/r1bW3Wugjq1Hvof8TibLVBT6HqvAJYd54jnEVzwHXDKTNFamWxTloXjXx6kUvnOud3V968ViCYgv+fqXh90GefSSrIKbJrsQUh3eA9LjODt6FASUVSx7rgG22YkgTkuPI79U0AhCVdqvvshGSIrwzQmsMR6VJbIW2scuxOUFX3GbU0dMWisXKZKz+t8Lqa/4CQborY7nI9uY7R/Fz0BGTIVLXUZwCaAeoHs2+1y0fTcYC1ZJa1sX3RR5GRvc3uYl7wcszgdMOqUf/5JijKOI3JtIN1SukKNXrmuIcoF7ZBtsCbjzlYwUs/wEKfXFPgbca2uxibJuwqYGB2N3eWrB7k6co073+em2j/15bTvywfYjEPAhM1fJTzX+EI6/m1v0RppiFXwLl0GBpOM+egIQVuyO6be9pYVZYApsclEQOeUtCsPJdoG1tNdFeQUKidOYZa3XlPUH2CcoChGSkEwag2RleMEeFTb+bXhx7EfAeuFdtK7DsSoappmVTXH/y7rOyCnwMsRY/EJP1QOmKimk0UJ0lIu5p/BAjl5dTkyb98n/KUmtmeW6i4x00O23FvKNOABwVJ1HjAkWLIlpzSI8mzleY2BvhV81w+EEHFYh/q4dcGCenA8tznaB0dYqDt7VZemNIIMFm4x9TCbJ41eAaBHVbr6vKIRuRa8WrBHWUfZKUHhSbxAF/qfP54gbBRJkzStWt1IrjP3Z+ovf8d4fEHfOmBrDnUtp2mWSwh5t8AWWBPVFwvk9rCxjrGkXYhPonegq7TlxoRyMZxPH0WOZhBaQluf24XWBDCgwzU8SKEW3Tuoh+JyRixvOF1dywK9eL1a/0QGdVrq/DBccieE/W59aUvYmadPL3Y5/O39OOZX4CaYTCP2mfWq60gdBsV5TrOfAw3SnfwjEXLlniLMC6EUN+FayMOT0XrukbAzB4eeBZU8BdSzxfnnp8IWsMxHliIdjkUgqwy7uT20rkYU9v7bMSdUGu6/wK/SGDVYwjKZ6K5Jx6eFwPgbyf+FbisCaq0sujVmq+3khfGYM/XCapwtPTjm/jcmIQCDuqjFR4aKR2KUEA8YVnY5lsla3NcR/sk4eM0Tao7pik//WykUO56bWaWhIQW79meXshzRtAbOIOB2nnU2IsbF6YsiZMi1fBQ9kYx7xaLE2wvu9JUClci0Jyx4xqvaM7eSQ+pGR2NlzJnrxu32NHoiS23f33 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa20e51e-4bb1-4700-9ffd-08db0e730d52 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 10:05:51.2791 (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: xoVukyZ7+wZh8vS4K6An1hvwEfRw66cTutDobBWOndvTqE+bRteQWyVpGMbkrh29WdFrC3agF0SlmhjaUzGOhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9204 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Y012 is a luma-only formats with 12-bits per pixel, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../userspace-api/media/v4l/pixfmt-yuv-luma.rst | 15 +++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 17 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst index 6a387f9df3ba..a114ab76b298 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst @@ -103,6 +103,17 @@ are often referred to as greyscale formats. - ... - ... + * .. _V4L2-PIX-FMT-Y012: + + - ``V4L2_PIX_FMT_Y012`` + - 'Y012' + + - Y'\ :sub:`0`\ [3:0] `0000` + - Y'\ :sub:`0`\ [11:4] + - ... + - ... + - ... + * .. _V4L2-PIX-FMT-Y14: - ``V4L2_PIX_FMT_Y14`` @@ -146,3 +157,7 @@ are often referred to as greyscale formats. than 16 bits. For example, 10 bits per pixel uses values in the range 0 to 1023. For the IPU3_Y10 format 25 pixels are packed into 32 bytes, which leaves the 6 most significant bits of the last byte padded with 0. + + For Y012 and Y12 formats, Y012 place its data in the 12 high bits, with + padding zeros in the 4 low bits, in contrast to Y12 format, which have + its padding located in the most significant bits of the 16 bit word. diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index a166436be83f..ec1c9ef27e88 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1304,6 +1304,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; case V4L2_PIX_FMT_Y10: descr = "10-bit Greyscale"; break; case V4L2_PIX_FMT_Y12: descr = "12-bit Greyscale"; break; + case V4L2_PIX_FMT_Y012: descr = "12-bit Greyscale"; break; case V4L2_PIX_FMT_Y14: descr = "14-bit Greyscale"; break; case V4L2_PIX_FMT_Y16: descr = "16-bit Greyscale"; break; case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 5448aa3b7858..3d8f89bff33c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -583,6 +583,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ +#define V4L2_PIX_FMT_Y012 v4l2_fourcc('Y', '0', '1', '2') /* 12 Greyscale */ #define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ') /* 14 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */ From patchwork Tue Feb 14 10:04:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13139783 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 ABA70C61DA4 for ; Tue, 14 Feb 2023 10:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232077AbjBNKGJ (ORCPT ); Tue, 14 Feb 2023 05:06:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231398AbjBNKGD (ORCPT ); Tue, 14 Feb 2023 05:06:03 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2045.outbound.protection.outlook.com [40.107.105.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5E202310B; Tue, 14 Feb 2023 02:05:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OpOR9nXjtUs5OwiYMCZDoXlUnPFvKKW6ROx5zLvhKx5xlvBGDKKrKrxXO6cqUofypeu8eddh9z0IZ/1pmAhgZ5cRS1rQugdY23ecMcXil0QZJTC6bfzEoM4N5gBjm/6AIycck/Z1RNSAYImxXuL0knmukXjMCcwNjjWz8hc9Re4S3xlxSlCLcj+xfSRxUVi8uOhMoY79yrDVUWgz0KmOiCfEq+mqvm6ngSLQ+aoF9Ps4I6tEnSrgXwqUC8Pmr9K4XUaAGXSH11K7ik0a2zkD/8bIro53SrgbNF8ax+xgCrHkz05zwQHPazybl2tuJOa3JgiyNYWpRLSG5WxYAvD+VA== 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=Pihe1ThFcXRKGVt9cI5LHQcBem5c5kwpQqXfiFB377k=; b=k6eLyPIe4H7wHjTfeI53bEdePbsIMSX0Siz4yYXcYDD6fOm+VeB+hJgP6rtd75VdruWhENuxRW2ZPOUBOrQiLjEdQkDSUiOv3Wilnlk5z6KeHqFsOkevbcdYcopmb+7w7DExUHcRTmDVCOwmPEiVdY0EIGWQNiN7TBzU9Gv2fsniPW9t4gx+CEwMb3SjBJTDOD/g6sby1RWNT1K5nalVyBwUJmRUuKb10IZBsgWJgxz/qdz4PohdYV2H/SE/06tE9MqjY0z1665OHnBHV/aUqvZxLzPI/lltBd+6wTjnkUDxfOXVfn4qk6ZXW9FfP2BDrZ6j3XaGFNzXzCzonk/gkw== 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=Pihe1ThFcXRKGVt9cI5LHQcBem5c5kwpQqXfiFB377k=; b=EE1ObRqq1Nn+xHGJi3B+HOAmLkdZ9LPpo+vujq9AFB7IzUircX/eBvtM+otM9jsbck3Q2eJstBJAlfz3qC6L9/QM536+OdaY4bVZDQW6fY4KN+jnD/kU4CFkjrP8Zyz2iYGqLAs3QsaRv0PDOZRVc9vV+YHcMc2dPdB0wcGCBaI= 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 VI1PR04MB6800.eurprd04.prod.outlook.com (2603:10a6:803:133::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Tue, 14 Feb 2023 10:05:55 +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.6086.023; Tue, 14 Feb 2023 10:05:55 +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 v3 03/10] media: Add YUYV64_12 video format Date: Tue, 14 Feb 2023 18:04:45 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|VI1PR04MB6800:EE_ X-MS-Office365-Filtering-Correlation-Id: 45eff19f-c13d-4da7-a367-08db0e730fa6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: muVatVx8CWMl4x/mleTFK4pkCgFp2jpn2fJVSEsQOPT90oJeSpN3MlalqKZhQWAaARTBSOAn0oSIVXYMit67freW2HnscwBC6s47HYUv8TZAll2wBU5xU9YltDkt2Mtin/QXODBbP7qC7jubKc4TLOdPGAAMt2D1fXYuX8HGvq+cXkVCKmMdvu4ARFM0i7UoplU3DtKEda1c7c+EjrASaS7qVTpF5h5o/2sPkTCgLfQEx0Wzzfgv+YOFgHWVYlNfxhytmoUmIfQPwZYBjS8bb4boNul3e+t45fUNzZtnu2xdySKA8bsEB2fO58WD4dhT1cyWy4PBkcJBQgOM/m26QimlaCQccEi9XsKIInOYBmlxNSxt5Z88PuchJKa+pbOCTzg/g51yRnivwnR/DyeNO9xDyWVxCBu9FsYX+WSPfftDHY2OKpjagM8JCGtCFqYFUCBjMId9oiZS2ZAmkvjpBeFn4LU9CR06a5qJ8Dy9+yP8k2yA6l7sj/HwCFPUhvwLOF2TNQHxiQvsy1xhlynPDdHGpyMixlFbbgZnKqVjhQRlC3lCQkcBOoaKsoumyk04crlMyzXkooWBrSyieaB/aZbUk2X+nGrvDv1DMxtxYHj/+3Ojj9DQhIRBQBsL9rPvhXPzQwLnez50UG8/IEhv6xyWJWWjYAO4E/NAW19Zpw0ho04gr8aVo0p1eV+hAK2IWjsPj7+ausIZArPLCH+frA== 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)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6506007)(52116002)(83380400001)(6486002)(2906002)(36756003)(26005)(186003)(38100700002)(66556008)(8676002)(66476007)(66946007)(8936002)(6666004)(6512007)(38350700002)(2616005)(4326008)(44832011)(478600001)(316002)(86362001)(5660300002)(7416002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9VXZwsIUgKdnyb6x7CrJaxcD8HtMaoP8aodp0cmi25E1THWKq0aI9yIYpoe/Xz8ADzQOHKaA28tX580nsyXso144lEk0PdPbbs67Imp9UjXJjv4T47RE9m3NMVwRu7YhrVXBEKjTBv+9UyaP0teOm+F+X6RrbFDiLUa8d8Sm3GlShz2KdTWiA0XArHa8KzcOMa0m/wmou0BrAHeiGtRP9eu0Z78AftidkPD36Lo91K/nIwe9uQlh3InRRYBuHfjx5oedqSfZQTgU+1w5uJ3Px1x0q2C6cqCo33BlDsL8VAVNMqCYzENu7hYv1/X27cHPUaCigOhLtP+afo0Dikh59pu0m67wC6QWLBOP9KsLKJ7lXvg846ghPie6ftQubGVVR8fKQqYI/JAk0LO3vycb9E5ubPWpfDmCqhB8wokbhlK9VR16AhgF76xjkkLJtV+ZioifeTbOckoljxeXScmdLR3QXtMjahgbXctLPPnm6BF9bOXvOro+ZND8P7BXa/Yy5orLPXEtwWaxt8v7MBZMwFaNslaWowOJ1MIsg2M+ayLlA72ptiM5mDmJTHVVmKuifmhXH97xJjHKEGIMewW+GierUeEij0dZFF43m446aQg9eAWmiqkDezuyv8zFSC1aZZy8oXnS5JmZNbHJ3+u8jB3OZvjceIhc3CHIQVBDut5SaiJjU5eLIUZytr3UF0JBKSsD6FfTwwfBJjzewAxSWJQ3/JJeogaY/0+sFrP1Chk6NlHPoB94qLQDfrEb2Pd+pF2p/ugw0sFpagb5TyXNO9go/EykImU8NXoEJSWT/kqK4meFR+6hffC5PFbsQc3BEEiG7FngVCIvgKoa5Uh6C0FGr6n/VDv0QiVvqWLCZJsP9qkpfu01syPsZha7cG3Sy/yRtUKVfDuhYgnf5PaAZl2ggndnNXgT33TqFn0F+WDaNp++Nf2havqx8XBXPA8hGQmbuICKnappKsI644PAtGf0uZtMMlp/gfte+1S34av0iUkwOBn2LolJ7iXky4Ud9lT+bby5aWyAsSZQ53EGZFKp9gj/pvlOqRP7/1esgTHUlISyP74HhhPke8mRaeFMEsuizCR81hdxY9PitORuIFlaX58rXnKV+9lIKKF0yOSZJAPjdXweRxs7BQ73mA9p8FQxQhN4j30f8J01HpQoEvZdwTmRp7YiuiC5Em19zZfuuEU4jal299HviRkaoy676OhGy7QLg2ziSiuKWRdZ2MsRAmpJ/rV747Xb9v1muTsxUIEV4NLFBk5QoJfxv/OizBV1M35zrJ80CKtR9Dpx0T68gCpR8TdIpMzhKrEcWbD3RIHw80U7HAg2aVLxGEhifa8JHp6noXOufZal9R9sGJ+qHASrepALTOVdJFiKTm1muZnVRHyAsYN6aRZi6ssen+8zGbvXL977PGdg2Cde98I4xyyfJB8t9rT/fiaFpBIPLsmUKFaP3KJx5Yd5IdLDLTBIY6Z6UO7vcfBGuPjLQO8JbnJKJh3hklSJiQJUZcrGrJaWis1p4xv/s5tUlae1zDRZIqZDoYeWZjdlgxyiGp5ctR9n4TkF9QaEg0RvBLThb6ykVoamHRm7isqdduFW X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45eff19f-c13d-4da7-a367-08db0e730fa6 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 10:05:55.1695 (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: 1O7muecXhxTqeVKbxwShC6fNmwOCcKbVJpKAWu8FrM8p4JCdqDbIck+k5/4Uu+G8uS0vdF8Ah5lWn417Mk7RIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6800 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org YUYV64_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..76fc331f126e 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-YUYV64-12: + + - ``V4L2_PIX_FMT_YUYV64_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..8fb1c0fa8158 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_YUYV64_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 ec1c9ef27e88..e5002d6fe7ee 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_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_YUYV64_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..3712a36d6fdf 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_YUYV64_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 Tue Feb 14 10:04:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13139784 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 2D17AC64EC7 for ; Tue, 14 Feb 2023 10:06:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232122AbjBNKGM (ORCPT ); Tue, 14 Feb 2023 05:06:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232035AbjBNKGI (ORCPT ); Tue, 14 Feb 2023 05:06:08 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2045.outbound.protection.outlook.com [40.107.105.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 246F212060; Tue, 14 Feb 2023 02:06:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KarF7sr2eKMPtRvhjeKyqeprXF9eZiZks2lUFe4xfWfUPu2MZPytzBO9tmjwde7tLqJOcwY0dCyjIjN/xhcsrZ9B5/KYrN6P0GUTp4t3nHfJF6ILKGAoHDrttDQldJX0yZNnT+VkrJEko4cudEkaoqbNKxPXJaBE1+HvwGN/H2YQVRQSJuVHykXTcqb0b5OwrDR7ZBs34LgC/ZJdVbAnTddNvcS3fZkNuwVoYPa5ssb02JwGshVdH92lHEJu2rraiGJKa0G4eP1mIr6+B/QG0oZCS5s8WKeMC0iqTI3N5ufNpJ710hQHHqxy71sB9BVL38V9UMxfJTKEzpoTAhX7dg== 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=FOFUtR8COD7yZ5nrA2OUKwht/S07omDvy7VCDzMG9Qg=; b=JBPDkXnPL655SZY04vBsOqa7owAvoWIjKKW+nfqrn+5JMms8zCIQIRBx6bzhN/jZcRc3baYr3ACV5NoG8SuUDsWUQ3lAGJJP/f3zTS5udCkD4VTqeK9DyLAMrVHog9WyGrF2TrDcYv/jrHvEL98ktFW9KSgztJU7eOVNwB7bODUl5nAz+lLSyZdvSHYMFlMHPplCIye0DvXwzqf7af/ztu2k1C+d33AsCqhOzv+3xZXMRi9aST9Py6n1j2aTkyXB0Ix4xdVDAsM/RLVNYZSyO4PdGAxEXUYbdA8/HpDzDM9oB3POQlpglRifAzF+XEytwTDB1hGOa2Iq4atPbY7/Lw== 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=FOFUtR8COD7yZ5nrA2OUKwht/S07omDvy7VCDzMG9Qg=; b=R2NT5wwesc6iQYWZv1RY2ST6xbpK7qiuTzQvBtBGhHWlkpnn3bTomHCp+nP154+dH6yGOO1qgQ0tqSyqrIX9Ni8K0NRdt2sPWCbk0CpVEneXVtBoL+sVXmmp/ARfoglUlGPcVX30haFypAhiF93fiLCehktv3UDaEQXKLTBjeSs= 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 VI1PR04MB6800.eurprd04.prod.outlook.com (2603:10a6:803:133::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Tue, 14 Feb 2023 10:05:59 +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.6086.023; Tue, 14 Feb 2023 10:05:59 +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 v3 04/10] media: Add YUV48_12 video format Date: Tue, 14 Feb 2023 18:04:46 +0800 Message-Id: <9d30b46b636451a4a1092e7f486c7c75dd39600e.1676368610.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|VI1PR04MB6800:EE_ X-MS-Office365-Filtering-Correlation-Id: 39ff5efd-9b5e-4e05-a6d8-08db0e7311fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2awftPDDtf4p8NYx/GJHX5C1jJEbGuoyAkkC8YPD2PFUkVvU9YiVa35ugb1ndvJM2tT1rMs5AbqpE5ujvh7lml7rmaY9i8ddXNvkte7750Gh/q/PozJQNYopXkK9Bcfj8uGzusbUuNqCh8UtlsiBB7YLDe/gt8Yhea6ip5oe54j9tz58odfppb5OUyvZnDOeFdGA5zCEz17AU/+5ku8w+X4OMvJumluyPfWOetSnPMxu7KNV1wqZDoIKoI++OQslGq/CBaNVBXLc/d81fYauTWEKqUiNUz1qoPwUyi3C3xuvgixmAlgm86j9EduPVSiNFx2DC68q4XmW5sAp0MvOcMYBWvNo3JFkA5IgezdYlKuf0ti8Li90N3EA4J5DNtcv/ZeYvi/ZnSwLTOEVZ0r+sVJOQqxgnNHMxJzEs1wyqHylle2sFV5E6cg/3qE3uHwkWz4kq30hcs9KY1fYv8SanlSBEDjG/9E7wQnM4TJ0G3f+6iUXyLivFnvXltRos7/2IUTC6LBRPVX8VMR49k/sM68QrFP2n0SdmPaikhyatEGT47/fD8rFWTH+s7eMz/a+VJKZI6GuoLXp+FxOvn59vAPr+wk0oi8rfzyIyDCbuIfTCXMReD/JRocdAAnSG8Qi+dpE1Eu7cmsw4h68qLGZ+L6jqr0bMTlJDqxXj9SmP86ocob0cgJQ6Cr+JhyvIoDCcr3yca2PS1WACL92Vt0IGQ== 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)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6506007)(52116002)(83380400001)(6486002)(2906002)(36756003)(26005)(186003)(38100700002)(66556008)(8676002)(66476007)(66946007)(8936002)(6666004)(6512007)(38350700002)(2616005)(4326008)(44832011)(478600001)(316002)(86362001)(5660300002)(7416002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SwSMINcd+TojFKT6xPK+yj7xID7/9uXba4d5i1AhRfpzhgnuxptoEG50G6fP057saf+19J4EmfTevg5OJFDdLDTCsw7nLtXlSl+EqQZEWZzr7eiZhyFR6JDXX+IlG62aJ3d9TA2AJqvRGlCWCBYs2ATcH50lNkj8FCRgnOWk+SHS0uavN1sHrAJh4tlz2NKWGQK7da3tNmRgMun6LOwfI0wZuf0Ja2amDh6dUlMlvsPdLn7OCTMz4ZJMp4a2xUoAn8uDie5Rce2Gl/bY38M/7Yalwx+jkwOhIUCjBeuiVdNQFeenLz1hRfHAbhkEL9T0f0pV3ZIsRdusb8jNRqzSw+dSyWVYKIHCjQLnSfjApsfr0TFnNurAEolO1k7e3xxvVYECLtQdPGCmT5bKRCU4uq3zYUxZrfpkHnqcfjvNmfNmktEPFU45G6gTh5Hn3UEEzbX7n/8NlOkS0P3PcBwj4nOqYB+zRhy8mavQh+ERcptQtQkTKEOP4vcK3zL9Vd1je5hFtnbvwibz/9KGp9txLizC9Uqqvp3zJ+yi9jjxxCxD6YRZWij8AaD0fJgCZNb4iMQeMgO2/Em1bq9VvUVaFsBcTk+0MWoFhUgD+cUrMz6wHuSWmQ0l2A2C2SUkZ2MNh7Q4iID8rqeVmdidd3WcEQsi+YPYInYKLvPz2aRRG8vkuoqPDrygAdxw45u6WvDaMmLaioxqa/P8r9d8+v/T8e0uisHl8Z/55M1dye9IoPSE5WipfG0ZT797WxWL73ib5N6BWTZbY759aokTz+T6nSPQLD0TkYXxd/GxkXQixqTDw8AW0mvN6sV/kf4L3d6/DFlTeF0KQdPOMO1/Q9swj9d1+WH4IITeh6BuGiBSIZcf5n+1j3j/DqMwGPU1qXZvIIOxnhUmNG9lli9ZpJH7d4FhfLa0qpMSzDy6b4no3hOXoeaP1QVi++TlpD/YOgBRFfC0go5h76DBTEFsdilIH90VTmFDWjbH09SVyI360CV9+SYNMcx9KFU3eIVqDjaSOxBEKNIJ7Ll4yKeXHhyuwspy+iR2PX+J8DqV3ADMSYUhk9QTDuAEU/r2EVoJHo0SrbdilDMIoLcqff8VbJEHMAYozuPQuQmTeRpEeYsZNs5oPHpbrRx9QYAYjUMJnmNblzz3HyYVUzbFGh9GDWDrH0KwsHap1FTTgmUyBcamHcStj9rsqDKqdwcRT8PlLVGg/R7Np57X5OQCGicSaJot/Tb9DcvjZ5WUHV3rPElNPejY1PT2FIp7XJc3lRFgbqHvaq+DhUq6MXJe+qvqoxFXnFt4ntg1CJq4WIeqmhUASzQqNJ5WkTDfusQ3QIrb8RgCUuuziMnj0UOMYGp/AHWxw//KPWDgm16Ao7n2MX0Vou/ko76MSVoHBtXLDeZ2mpyNwbLGn4EUcMaFFx11+jMshEYHbnAAlbIN4wrJbaNn/uVKfdMgInvRjZVJxVOqoHNoBdKQM5VHtO8Q5rt95BweN+2fBVahMrq8lbKARULZD8TrOj5EB2Bo81tq0LjDTLZ83ztB9EXF65ElNR4kPohFYRSTUwIQdcV2L13Mk6MckIme62IB/PDG1Qr8nuGsOhl4 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 39ff5efd-9b5e-4e05-a6d8-08db0e7311fa X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 10:05:59.1380 (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: sHLenk0voaHg8DY2tQkSmeW3gABYPx6gmb++jK3dzDnavwekudao62zc8TmHWLx0T1MGxWawprsN7X0VDEAjeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6800 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org YUV48_12 is a YUV format with 12-bits per component like YUV24, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../media/v4l/pixfmt-packed-yuv.rst | 28 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 31 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst index 76fc331f126e..73d878544f8d 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-YUV48-12: + + - ``V4L2_PIX_FMT_YUV48_12`` + - 'Y312' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Cr\ :sub:`0` + - Y'\ :sub:`1` + - Cb\ :sub:`1` + - Cr\ :sub:`1` 4:2:2 Subsampling ================= diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 8fb1c0fa8158..7731ef63543f 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_YUYV64_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_YUV48_12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV planar formats */ { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index e5002d6fe7ee..e27ed78684a2 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1344,6 +1344,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_YUYV64_12: descr = "12-bit Depth YUYV 4:2:2"; break; + case V4L2_PIX_FMT_YUV48_12: descr = "12-bit Depth YUV 4:4:4"; break; case V4L2_PIX_FMT_NV12: descr = "Y/UV 4:2:0"; break; case V4L2_PIX_FMT_NV21: descr = "Y/VU 4:2:0"; break; case V4L2_PIX_FMT_NV16: descr = "Y/UV 4:2:2"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 3712a36d6fdf..0920f20764db 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_YUYV64_12 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 12-bit per component */ +#define V4L2_PIX_FMT_YUV48_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 Tue Feb 14 10:04:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13139785 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 F2B30C05027 for ; Tue, 14 Feb 2023 10:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232085AbjBNKGf (ORCPT ); Tue, 14 Feb 2023 05:06:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232099AbjBNKGV (ORCPT ); Tue, 14 Feb 2023 05:06:21 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2045.outbound.protection.outlook.com [40.107.105.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71F551420E; Tue, 14 Feb 2023 02:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fVd/zomG3uQ/5qBkxZlctYUjDCPsJ4SA3/jCDdV9+s+HWZKVep8qJ9bgT4O3qKsrVl4eL8Ekld305mYuvX4c0ITfJ3o4dc3QIZfJYETwyxFPSHexkh1RUp+loX2B3Ixvm6XkQbMhHmkcz2jm+HQjZ9y2S/jmaIqndZGrHTDWk/kqySGi8nwYRm7xjfHc/cecMthzvdwY2+kMxX/A9odGwnf9rDeNmPB3+r30cn8BOHUNCh+41D5b2G0S/oeACjpvYnBA+sl2fflbutpOdK1J1REemjlFmVDKTkJMG7Wx8N90hMKJ5x9TvtWior4gkZL3PPWqRGPtebC71C69RtohHw== 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=y0OdUp9s+dStWlUALHKkK7Av/wXlOt0a8Jr6xwhaD74=; b=V11vZsxPTxHnIWUI7ipi+cboq4L5/k/2TdUML2X5NAlg4pF8qyk7N2ANy0AzmGR+w3/BFwq0S7yePjF2hG81dUFc+K1+wwaDmxOny7WE2ly7AMo5VbgG6obA8ds4qXTOcfgVTnzM9B4FU80k57jM4P8SMOqxHrOrI/x3MKvhQziUDljb3rGgHeaVWHCMABb5ABrvlmV+3/yCOuwV1ceeuBmdawtQPZWyqzx5cm4Hc6Xamy+pcB+Z01lFX3BgOgyrxV+Zbld7+jYX4KiIQDbn5VLn/UYkoeVx8wsPqf5sRWS21Jp0jMW3MDnfCoYDiszrapuMkMK/udFwaFoDvyRQ8Q== 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=y0OdUp9s+dStWlUALHKkK7Av/wXlOt0a8Jr6xwhaD74=; b=XgTUlvnIaFB97FL6wi1W31eU3ogBpD37cINnxUDbGFKs0T8dWv7A2BU6giHINRKEPg+96DoUd8hNuqGs23FAcykmGkQIFw/wLEh5X2Nsn53CVX5x8U+lxW3oTnX1CmOHZ8aiC3Y+E5imTV/nO/SG3o7ypYj6QRXe6yEK4L9nUyQ= 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 VI1PR04MB6800.eurprd04.prod.outlook.com (2603:10a6:803:133::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Tue, 14 Feb 2023 10:06:03 +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.6086.023; Tue, 14 Feb 2023 10:06:03 +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 v3 05/10] media: Add BGR48_12 video format Date: Tue, 14 Feb 2023 18:04:47 +0800 Message-Id: <7bc59312f70c7c293dbaac156b3c6e2ac9095ade.1676368610.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|VI1PR04MB6800:EE_ X-MS-Office365-Filtering-Correlation-Id: 10cd5b71-79e6-4f20-2df1-08db0e7314b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JSaQXS0gquDiXB2iOV9DNk/hjuZz7iNhD419jxiDX6b14i3giXmoYhy0dJfttwBo2BNsLSYN+4dxXcKDKcY9YsQwSd5nIJpEEP+y4nuMI+BOTjN1R1I2nHS1rbM1I8nRQmRhM3VqLrd62hbEbLxr94fOnpTG3knYU2ApuPSbPsXa/plitCT6LDBYNz4oqdf85AHlIDJruElRzhJClPVAkz+0ee5pOYNSJOL4gdhogx4GV5UU9w67rWfeanzgsf3/hVcgP9KvRcr1KIngXgF2JyiF5ft7ftqIBjpg6dtBgLSPqM2GbM2oqgHg4laSG238twS6xi2+NU4ysoyF+a3JS+wqah9B4c3IdSrSTjjZommHcGpS0MzoG/WF8Nd/zCEhTbTQJjjWhAI0r5+T3JaAtU/sDtw5BdyHU3n7pCcI+al91k7AfsgN+Z3XblgopQA+9wPFxzydSoofVYW/x9liQcZtROHsVPOtfYFnzzZHPTBNCl69DpQUoKCPdZr2pCwr7+X0GEVfwuCDvEzsVAJsLUzWW7RQN+LIguw94McXrc4tfQdsHLn1NBB5snV0WPR42Ff2BCsLPLpNbUe46AP3SI7ZlBuhjeHGdxoD0HJStXT9NTEhreByNNMOyOAsAmmzcp2AXh3k5kM/eDHFLprZsF1KRyor9mgnmJExRrup1OvoJWN0MXTCYH9eUpVeRqRO75Jpb51ejYfWJFjA6CF++A== 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)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6506007)(52116002)(83380400001)(6486002)(2906002)(36756003)(26005)(186003)(38100700002)(66556008)(8676002)(66476007)(66946007)(8936002)(6666004)(6512007)(38350700002)(2616005)(4326008)(44832011)(478600001)(316002)(86362001)(5660300002)(7416002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wuVxkVsnAcTrMw29Y72s8z88lxrTrGqL/VeE8B2GSzJhngBkC52QNAFRPYN44X/ZOOCBu69r4cITkfkys+QWqF5qWi+YrEUDEkpm/sh9Wi8IbMbbJ/IRf1FBXw6oKTXxlRpKmWQ3CGBONSTWlv5s7t9FUI9aFJMC5q28l3qOQ2L0iE8umTqluICOy+y4Aw77QurFJmLZiDhRUH3RyvY+/GFGqJrWZPDt1XKOF4hxhyWL1H3Qn/STHcAnZfs6BD0Lr6apN4bAn0JEjB6beKcPvZ9tqIIx3gLO+jmsmxU2HKhWZ1CEJJeoS0zOUqMLK6oxlHdJ6xZ0j6kiQEQ2rrbmIBUoJgsd+7Aw2Gp09BXe3uC2Cjda8FoC2Cwet5dUsLAgsabPx3MECIO2p792GshH5vs4rxoPx9PC2qG/08+GQ1hWdUx0tLFWa6V+yxQ21Q8LTOTDJyt6GnvqyLww/Xzg94zVPM9Mf6EaHfqPYgfyDmUaxIRfxIL7mPd3lRfxjpFiIXD+pZXEdPTay75ad9ZBJDuIotuYS+Kbv0Mu0Iq49JLMO3euuUpSkGbkABVyN0fBrfj1H9Hfoc0H0kiUDnZzmR+WgYb6L8a3KwKr14K80Pdlc9p3TASIebId/+d6oGRPTWlA+Df3eiMsMAKenZqtkSTRNtWOAeHaPJy6WEZ0ZXImxVc666wPtwGsJ6IwR1JzvRcJwKPL12APkfLDlBZzoKHE9pWCmYiFR7eygiQbDcXuzfwXflMZ+V7v4jQrL83BPqKuYiMvmlK8+I947PpiBkPeMjzLdOFojIJo97eiVVwymX/TIOnt92jXb/mHldGAqytDVsjWBM0yiwHxazS+19XUFr1Dz7Uy5gHcEmaQfqY9RfzhTqbERHly55AV2wib47Tv75hbuCaRlnDGDrXs0sGjmyrHXBXiAGlsl4oZO97n+Kb57Fz3/fvLonJFJu+RI5Nn9evq+ZyUYxAX43vrQiYpChq7jfxyc+VRX4FT4PvNA14RyTbojJTSfedYvrBL+Jr5grQYgzdnH6+i+yvXcOGLL8FdxlTcipRHgHkwp8ev8XC9v8Lf0ZeLon4rEVLgJizjO1SrdXp+T8RnZJ7S41seLjLEHsbGAAhp5rvtaxOogvuc484ZO32IoOeheZho2AOfRe75dGZIEX5jzwPtLxB3J3YvgVgl6EMS25yNo39snm+iU2hZ7UI7UXtH+2YWzxsKgVIQ4Be8N3itSHRY9yy1otLImQJoueAK0uU1UR02gVFwwuBz39EeOuvkCac5lBy/gghqgd+Bdt7d/RuFBwHvB+UJa7Qv2AipF0hfL6E7KhOqqHcSCt9DrQv4smRGJiDjWdHlvUpN1ui6eC5uvEBrJcOt8LmkHk6y8udzNEX+mXp5miJI9Yrowrze9HJEiUzUEnMjSUfv6mtRru7axWxUeWNvds2QE8xisc7rGpMT2I8CxPa3ps3MsKt8DeAxm+8w7mYHDN7DYXHa06CQUmvGGIyeaTXcOc+tmZlaWozY3nguWrYAZnJqNRw/ztf0BjcwVT5M1mxRPjeqQWySdeYo8OuxsNfYU12DKbO38pNq4IdJVEm5HWtSmt/One/e X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10cd5b71-79e6-4f20-2df1-08db0e7314b5 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 10:06:03.6690 (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: q3VKRyfTXQn6Bn7m2/HyEm33DbvkMtOyScbQkx+hdsP+c+5G3fbaj7+nQ9Auwcn4Qq/fBAh+pOrh16cOPN4n7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6800 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org BGR48_12 is a reversed RGB format with 12 bits per component like BGR24, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../userspace-api/media/v4l/pixfmt-rgb.rst | 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..70568f7ae130 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-BGR48-12: + + - ``V4L2_PIX_FMT_BGR48_12`` + - 'B312' + + - B\ :sub:`15-4` + - G\ :sub:`15-4` + - R\ :sub:`15-4` + - + +.. raw:: latex + + \normalsize + Deprecated RGB Formats ====================== diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 7731ef63543f..e73103fa65ab 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -252,6 +252,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_RGB565, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_BGR48_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV packed formats */ { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index e27ed78684a2..e63580a3d712 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_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_BGR48_12: descr = "12-bit Depth BGR"; break; case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break; case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break; case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 0920f20764db..7aafeccd8f02 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_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ + /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ From patchwork Tue Feb 14 10:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13139786 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 EFC0CC6379F for ; Tue, 14 Feb 2023 10:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232204AbjBNKGx (ORCPT ); Tue, 14 Feb 2023 05:06:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231398AbjBNKGr (ORCPT ); Tue, 14 Feb 2023 05:06:47 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2045.outbound.protection.outlook.com [40.107.105.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59B2F23DAA; Tue, 14 Feb 2023 02:06:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NjF1UglkDWBGe5Ga2L166fV4VvAQwZUumXDtmz9MqGyGuflqg0Astu4Voal2ZrS0o+5gi189YY679PVvri0Y0InhUASaXuKJzcgjx5N5viyPOZBRngpKEsBa6/uCllISEtSKijBDK0Qe+UfuW9lvgQE9Has/8HCw2XYF4D31CWZOiQ4FbOS/RYl9RmwdAlSVgm4OhIBMyL/VIw6ZmvLahca8rGnO+h7bpupFXm6uBSpWXo4TlChArFO2Kus0/PCXe4mCU00jOk+KyJXWSmKyl7Uvcru3SgvuXi9fvWOftEpf7gEUbT3kV3e2JJpF6s0z+5FjMat9kOryHuZVpewPKQ== 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=YbyBPRtBvhf5ILwYjc6qTJcGWFkiWrhaf6Mx1Yxebss=; b=UZ3S2mWGA5KNhnT7eBQmrrqXF9Hs/gmqQDMnB7L4gaWmZBXmhVnQZphmRo5WCvtBvKdJ+tU3Cir6mS1E4Ul705vpkwV7JpfV2pouuhxISKbx6RhQvMF6ayE5hxFZPl3DYWPKnTRYBkSKKt3VUvz2idEZk5onCbUYlVPOTECTn2jEFXfX8NnCgek46ZIZDMF01lJK0shDAWAWFTQElJlTWstZw06K47eHnVJyQX0eV0zIO+d3YKGXT0US7fWa9FVUSOMfrCQRn35Zx5iVPAuR5W02oZcmpRvWseVxwr6HnkdUpylhJhGNf95BnWsmg5UcPWu5EIBgWbPNNWIMw4oojA== 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=YbyBPRtBvhf5ILwYjc6qTJcGWFkiWrhaf6Mx1Yxebss=; b=M8xXs3WChkrXF98Flt2yPvdL2rcllFORQhPoofUKNuORURYuHjGPmCYcDebTte1BUunJPqd7h6kTd19zrcPk9ZToTcgXSpGJMnxxjT/q8wH/2OBPzih4d/+BJdSp+srWgL96pfTnViNc9P56XG5G5xYHRt4H/fco2S2XBMEkq4Y= 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 VI1PR04MB6800.eurprd04.prod.outlook.com (2603:10a6:803:133::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Tue, 14 Feb 2023 10:06:07 +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.6086.023; Tue, 14 Feb 2023 10:06:07 +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 v3 06/10] media: Add ABGR64_12 video format Date: Tue, 14 Feb 2023 18:04:48 +0800 Message-Id: <001d80111433446a324fc907bd6b4b71c4b263ff.1676368610.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|VI1PR04MB6800:EE_ X-MS-Office365-Filtering-Correlation-Id: cf075cd9-49bb-4e0a-cf0e-08db0e731706 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W+BDx/MAkb9VeOsD/WiRzaccev8f/xxTMfVND7LtjGsurC5QsiuqyO6fL2aSEajgiVfj4Xl5z+8JIKFUjuNbRC4wHhbbiQJNbi0Ph13v78v+nslZBPIGu0tA3WoFmNBZDrbyUO7os1HU3j/lcIisEvyvC6Pe0S/tUApvm7mNb0DthAkP1vwYsmsG+XsZYae7WbxbgG70ud8hp2L4Xt3XOzFEXTwcjhGZDRTHqh/cwLgNOk2eHY1WBe6bUuMgLKnHy/Gc4oAmP+tYSJeEAYHvH9x9xX46rq9iNa6ZUhfmjtetBTTteDQUeITLqFInjFCjQP9m6xO1f4txl3FHCwf3gc+8gxykHyrBnIy4wiSRVw+vTZOX/Q2sXCwZwZWmcHjzz96Gol0I2GtKrd7c8CTEsN7EKCYgcDyibM4M1ojl3XGQNWY4sjzFs8Dvx0eacacWb8nv5rtmA3LaYjLXzhoRVAZ5axPS39E2vSfNTb60W1SVJ7KfqKf/NQMrjlwvRyU+XZKDu4ebbRrdOxEPkcrrP9finaTAud+X4UmJnBu7IDf2rMkxvPitGe2h1rw35FJRWdcksmu5R3myOZsxPOtbF+hgyt7JEkjYbQLvzKRxeuk+8QKkn+CKUa5UYyar4mxTF5Z+kcXvas7QowjDn+povNVxwN4o93kpDCOEe/6z5jHlulEgS2d3kti2XDnXlBsJXb3s6LXhd+huQInJyMz1wQ== 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)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6506007)(52116002)(83380400001)(6486002)(2906002)(36756003)(26005)(186003)(38100700002)(66556008)(8676002)(66476007)(66946007)(8936002)(6666004)(6512007)(38350700002)(2616005)(4326008)(44832011)(478600001)(316002)(86362001)(5660300002)(7416002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pqNoHb1Vy6tZpDsv67Vz/plpaKtNeRNbbt+1jqrU4WbWjF3Ny77J3e1Mtoadv06hdjahL4tKY8O1NvulS9Z/WPfgrJmseMaHL49+QgOm/wdMM8pkH3mIghK7jOCnbt0+Or//1igBUgOTfAbFAQnVDVOtcS1WlFzdGhD0ySUwXxaDGD7RotrsFvlv7BeedVpNs3aKM3zE/n5Mkuf56o/iNurfRRBEwzjkPspFoYwfLvXdAih6lDKCGv6BpJdG1+0LWhvCge53eh5I7knpsDntGfWNF7eVo8sBZ0BpGyMtHEOIfSGz05tCsrRWCKPbYTy2D0P2D1C1WlxVaVKB4BAQBs6pIDroGZZ6C8T5mLqeWKQW9JqgHgpQhXzvPBatK/7//9Wez85KFfpt9NhePDIVXYM3PyOr4Df0gjfvM0OTs3nG00/68n4WLR4Wj3EAkrYgQa3J2WVRO6jSp9Avdnll9iwgf6Z70aMmRY6IeTPiBlPjNemdrdERtlEhqa8J/IIqE9Qu6RYVlt5W4j+gAuA7G8FoVKGqR8LFkDjdmn3wgX/2pAUlLcLXI+9yy8/Tbe1Gt0NE+FKu8VdaQPFPDXqzUALP7g3Wmf1GcLJBFv+Q1p5tDrXtTFfYR6F0zrYdX+qvq6HFaL9Uw2WJ3HUnEx4Wn4NnMuytBO7WSX3UdiEdAk5eSOSiajVwvdak4UcpPNSMS40rXwzvDHt1Xl7ntYRdQWeY8Lhozj7F92smZLUwzERttBCBPamoJBhS8eMiwUZ4fQA/tsnYf/2i5DqlVJIdsf/SY8wM+gIkKbKnWn6rOuvNz071cLX3rSi7+FlFVi4WQ0HQouekCVOqvKj6ohc1v4nQpUT3m8wFTMSgegDv7yTotzHel99fgt2/2jSRHmavbqpIELwWCkwd0g5TF8iOC/PPMoJIvtRj/lT61/ipHMjebs2amYEr/qWRus5n+ex/W+fxUCWX4Go0BkSOAl+hOEKfSZSmw2PcidzIxsZd8lMVRYrqvxXMhMmEImaB2uGo0iIevgzVN8PgWuDDKod2HbOlSpf7bxKFoyoKPsJTSyzdFkbF5lAY/S8r2qRcaWAh1TlrYeDtkRJOdybaa19HFbZbMS6mMf9kgwllMnA6rfa7b4Kn2mjzPrmoLQFoYV2aiwOT4UozXKyKVjEQrg/dUUVJXIWwltT23XEGuX93qcUwlZi9Go0wkTzTAuLj9XdNvIai6LV3xDEaRfFAFTTmfl5WDh2uzmrXhqZWOZG8m7PSyq4o3ZhOH0xOxxNM3TcwKkz/a9h6uXnyCNUzCO+1iwsNsP1FwNv9bylw0pt+f7sge1O7QJKWNT0XzLkrGYk5jGAahBU4DhbMkNQBlCztmgbHBo6bKX+igLf6ZpKAguSin3J/E8jwbq1BYl0bnt0s2+NBEHBGvwvozaTdv3y0zu/foESI2ClRoTC9/gEq/qLGOdX8Ti1MqKX6/RI2BLp94IB6hh4UB7zFom3RZ7+4ZGK1vSZluyM6zlTvyCLKDP1Fkk+5bOY7aMLNEjOrHt2jmLDRFDxKj+s5v5xSfSOxa2K6V4ucpC3Jq7rY0JTwiWkTctNK7MHyOBtjLyyHrjsh X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf075cd9-49bb-4e0a-cf0e-08db0e731706 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 10:06:07.5282 (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: cPy/MIC2WDKftmaZMlbiNMFNB9hI0u5r1i0t6u5pKK/rId8UwDa6Wd+FiweeO/ALi/lQZwncUtTse9PcC06cHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6800 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org ABGR64_12 is a reversed RGB format with alpha channel last, 12 bits per component like ABGR32, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- Documentation/userspace-api/media/v4l/pixfmt-rgb.rst | 9 +++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 12 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst index 70568f7ae130..28bcc5391f27 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-ABGR64-12: + + - ``V4L2_PIX_FMT_ABGR64_12`` + - 'B412' + + - B\ :sub:`15-4` + - G\ :sub:`15-4` + - R\ :sub:`15-4` + - A\ :sub:`15-4` .. raw:: latex diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index e73103fa65ab..a6aec35bfb54 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR48_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_ABGR64_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV packed formats */ { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index e63580a3d712..e5813ba3e3be 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1300,6 +1300,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_BGR48_12: descr = "12-bit Depth BGR"; break; + case V4L2_PIX_FMT_ABGR64_12: descr = "12-bit Depth BGRA"; break; case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break; case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break; case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 7aafeccd8f02..3b611d7f2ee7 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_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ +#define V4L2_PIX_FMT_ABGR64_12 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ From patchwork Tue Feb 14 10:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13139787 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 AC764C6379F for ; Tue, 14 Feb 2023 10:07:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231865AbjBNKH0 (ORCPT ); Tue, 14 Feb 2023 05:07:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231785AbjBNKHY (ORCPT ); Tue, 14 Feb 2023 05:07:24 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2045.outbound.protection.outlook.com [40.107.105.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 620251E9D7; Tue, 14 Feb 2023 02:06:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jZI9O0Gow+csqnIi7dfzD5BYo+VO/ouYi/90j4ACY70bRpuKPntT3N5lib6bPLnPPVnOiKuICgpYFi9NH4u0fpgblZm+5JnapfbgRwK1HQl0co9pzb2Of0Hur+lkmxdtNWIHaAXWVqJNmqG62/o/iIHjLKtOnu3WXr6Hl4gzxn3Fn1SvEqeTIe+Pv8C+4/Wi4L6aK8zpcMnkV0iYSj0ybGpMET9s+8gpVLisMZTj7e8rg8V1R87AWKIJfQqiuZZqZuEmoYc6Yovm6+C9Tfk89rVZSWSOqo9jzPEdlyO3qorLPQMfrAWksBD87TN+LmpItG9nM/T7++SU8Jlf2VZLxw== 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=N5d8Wx+zxDPjyvO/VA1wxULAm4TzZyc7nRb1wQ7QpKT5Xzv+/iR9zSdVJmBQylNawNC+/CO8g8xkEAZEHvjJdyIU2zW/h3XaZlTfTPdjCWP3+BwnogsxJAsdnCLFgXnG8rsVcAdfyhTKQ2+AryFzkEolh+3VArk42tHZYjgVUd8zKqk8bikPsKXTxX7B0g1GsBA0HFFSi8HzFStOV1n3HZAEJQIZ04cYItkwao9sS2ksfOS9ELVb/+vMAQxm2cedQ547sSK2/wUlgfHy5D47SsThEOYqX48fMS3xYm8tFi9sQIzoWKC5ApuzT/oJ0X23tOt60JTglE94ULlTyY4K1w== 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=jLOLPm4bppzTb6KDmWRoFOFszbtAnmS8kJO3IMGraKmiI2kVNi5s8MG/q9itB2aj3Zftc+bLR3ns7l3XIvmYjLsMhhxN0dSj+Vj4yFP+eULhF3zfgcpRHfH96Vzo6XeEzOjycLxu037wveOGOIHqPLAGS5IAkvAE6THk8PhJ8KM= 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 VI1PR04MB6800.eurprd04.prod.outlook.com (2603:10a6:803:133::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Tue, 14 Feb 2023 10:06:11 +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.6086.023; Tue, 14 Feb 2023 10:06:11 +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 v3 07/10] media: imx-jpeg: Refine the function mxc_jpeg_find_format Date: Tue, 14 Feb 2023 18:04:49 +0800 Message-Id: <28d3f4f44f7da5bd84a03468f0fb541734395a66.1676368610.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|VI1PR04MB6800:EE_ X-MS-Office365-Filtering-Correlation-Id: 22cba84a-df0c-4e6d-7032-08db0e731958 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9Vhwb+1Y9Ywd/Zd1p9pO/V7IflRcrw2ypFlg7zVPnp7ygIMQZF7Xr/TUu5H+143J/KiGTWJhVKR08Dkgm9jACCjvxCNg12SkZ4EFdHxvL6BRs6OZocoM8FlZ4Vs2WLIy6F2MFVLf+skSeGsCKqeXsiC5o5PboZPuW5Jm23D1a2xGtimh5IL165tG0p5KJOuOyF4Bwsu8CFqHonxpnHzLjlrVSOxiBc4E0nTfiC88S2sHhEeeomrtm/tHA5K7QMs6+npV4sHnVBE7SWssQFDqFt6PpGXwUIDqlvYslo0v/E0JhGQCxzjbAuifwZLRsAciQejg3kx0u3bIWX9lKVBlLX4+AXV0JlQmrpE1SDW5UWK2iiYLU432ZkDwhNUv96kZXwD7dQw5/7cuV/dWb4CaH5hnC4APabHrR9Q/xNy6KownF7VfBwzjji4AsfjINva/vMYgRSwk5DLIpHxdoZqfYN7tHGyYySW81SmVO4hjJYWBFyc0muXbnGwWDkBQFw0+q8FzUcJ1GjZfXJBGVYpHVdpwIcsD7OlMY9ife2StxuxQ+9BGpNNJknc4JmOT5QUmigQr8DW1qCY8o6JYzXt7WxFqW26Yd/3dLGE0xC/Fn2fdqWs/wVMbRO5w1wAf6s6WlpFHrvhmbhr2YMHJNA+vtD2iP31uDHuafDJmEn0juDYfK337Te7jPUTtF8yP4qTyFOZqLHh2DcbLlZDk2jxLZA== 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)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6506007)(52116002)(83380400001)(6486002)(2906002)(36756003)(26005)(186003)(38100700002)(66556008)(8676002)(66476007)(66946007)(8936002)(6666004)(6512007)(38350700002)(2616005)(4326008)(44832011)(478600001)(316002)(86362001)(5660300002)(7416002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pPfijjKbSQwdLLpRrbKzN1ws3eW8gnzR5QlvXDLikVoTw1CCIZUbLwXRS3OL8RdFztAYLOvwVdVXpdQVE/0jvgoK4RsWJccbYb2/2jySsVPieJn0zqGXDiRGjjSfpTEASEBQoQZ55mSInXGjk6JpoGoOOrC/xCZOPVQIZ41ehSHk9KbduUrSr/RQ8IdU1Jxko5x1qBjjBpx6J9L3LfJMLLBQbPNKfPKZ4NKqNMPaTrlNcHzeJtv1POX0chyIAnR6omV/aKB+dwqLUBNnP1M2YW0yU7n/44u62gxCJuNduAGsIWcZWNC2DzikMVnUHOzRNA4A20CnkkJYWRGosN1hAE1Edr37a+LeekGp04g2K6TAobJfMtiQ2Bhgp66kZ51SQqDICBsSDpIe3H9gtp06r/8r4+MjrSaqU0f8E+RW+stuACEjTM35o8JdL/JR9rP44PBAH8qXd7I+mb6Y46/D1HVreAsCUdr1GhxCzFhB1f90FTnqPl/r1wZu/6FN+xQ4RkQydgfhYwbZePtTw6i0jQFm9Y3+PoJfzqJvzvOmMEQ7NLpuXZ/CzefpzDHc70k/pwviAuqInd8WiJ+gkTfuj5e86xY/a5k2FCL/iD9V71agpLkkRX2bBb0JMSqeQhIzMr0Y25Oxj56GLhmkVjc3kEGb7Z4kQarcuMkiJSVwW6fuKkuHzxETFWFOjnvDvMRV1g2pPRCqvckI4jvjJicDfcYOn9wmXJUeZ+V6MQcDwfw+vt8W65y4ncBZusjble9BKqWLqUpu2Fnox9XsELwt7M3GhoDEEGtbSJNkKbbFGZWIyCrLR2gDIbt+B3llFfb8LFEFYHwH6G6fwZrxeOyMpTuMRczKTxxLosXhxaXxHqHk3/+sI1pXtcb/XlQBFOjdkRBetpJqtubXRAn56WqJDESJwfIZX8P9OdusvqBBT/bBP6lWROQiyi1WUpvF3ZrmP8UBG6XELPXwtAannDu59saJ4seGdXCfesx/E7pXCTOqG384uc2GtWWyq/T+v7tDUa7FD0jtHKXgPDhuaEJVVkmzGc1BZCZlaBe6z9qBCSkAG1lf8Y+jQx601Ra5QqFjYPy90XfRmSwLk5GqkR/ffHziwB+g7zgTUNI6WMcXJ0WIVeX17otj3yabRPLAJhyUIGnGH/+Do8owqpqEx2UEGUNsZ7rzkGnWWeRGr782eyzw81OMoZQaCLrYqzW20BdCkNIuZ+JKHMiQPcHFdEKeKxOS5q2SUTU2+GITZGrMFp0+jCaPaNjnPWAmsqY8sgEN+i7tDIWTm5qHrfOFRQsNF+1kyzM5hHeHWyxRUFP6QaweCDT2SNijD/RBLTwh/OC+ajjQ3kX0i46G7pGBwRebI+CpT4Zr9Qyna/3aBaHjFngiUPP19dLFby/fX42Othfr85CQo9hYJQptmccbxj8/+6K9O94cjOF/rxkKFF19OqGy1SOB602HpFgnQGYergESbMrzzt+bXIR645jZJ9YgtsnOmPhrtqHh5oUwUI0WCQFHfonbnbs5Jhl1vvNzcad1V/FiIDNnpQM7DoWaaYj4V9iVEb36yMqxDlCodeP8yJZnlpuyDoSTr96wYDccw4/K X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22cba84a-df0c-4e6d-7032-08db0e731958 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 10:06:11.6529 (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: N7Z195wHhC10pW5qsnH8ZzaFrJOveVhB957p888b5LO3nNyT+NXdu+QuEbufUafkfdPG+9jxVzl3ccdk3sPleQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6800 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org remove the unused parameter ctx Signed-off-by: Ming Qian --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index f085f14d676a..70b6eea733e7 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -420,8 +420,7 @@ static int enum_fmt(const struct mxc_jpeg_fmt *mxc_formats, int n, return 0; } -static const struct mxc_jpeg_fmt *mxc_jpeg_find_format(struct mxc_jpeg_ctx *ctx, - u32 pixelformat) +static const struct mxc_jpeg_fmt *mxc_jpeg_find_format(u32 pixelformat) { unsigned int k; @@ -1562,7 +1561,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb) if (fourcc == 0) return -EINVAL; - jpeg_src_buf->fmt = mxc_jpeg_find_format(ctx, fourcc); + jpeg_src_buf->fmt = mxc_jpeg_find_format(fourcc); jpeg_src_buf->w = header.frame.width; jpeg_src_buf->h = header.frame.height; ctx->header_parsed = true; @@ -1702,11 +1701,11 @@ static void mxc_jpeg_set_default_params(struct mxc_jpeg_ctx *ctx) int i; if (ctx->mxc_jpeg->mode == MXC_JPEG_ENCODE) { - out_q->fmt = mxc_jpeg_find_format(ctx, MXC_JPEG_DEFAULT_PFMT); - cap_q->fmt = mxc_jpeg_find_format(ctx, V4L2_PIX_FMT_JPEG); + out_q->fmt = mxc_jpeg_find_format(MXC_JPEG_DEFAULT_PFMT); + cap_q->fmt = mxc_jpeg_find_format(V4L2_PIX_FMT_JPEG); } else { - out_q->fmt = mxc_jpeg_find_format(ctx, V4L2_PIX_FMT_JPEG); - cap_q->fmt = mxc_jpeg_find_format(ctx, MXC_JPEG_DEFAULT_PFMT); + out_q->fmt = mxc_jpeg_find_format(V4L2_PIX_FMT_JPEG); + cap_q->fmt = mxc_jpeg_find_format(MXC_JPEG_DEFAULT_PFMT); } for (i = 0; i < 2; i++) { @@ -1950,7 +1949,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, pix_mp->height : MXC_JPEG_MAX_HEIGHT; int i; - fmt = mxc_jpeg_find_format(ctx, fourcc); + fmt = mxc_jpeg_find_format(fourcc); if (!fmt || fmt->flags != mxc_jpeg_get_fmt_type(ctx, f->type)) { dev_warn(ctx->mxc_jpeg->dev, "Format not supported: %c%c%c%c, use the default.\n", (fourcc & 0xff), @@ -1958,7 +1957,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, (fourcc >> 16) & 0xff, (fourcc >> 24) & 0xff); fourcc = mxc_jpeg_get_default_fourcc(ctx, f->type); - fmt = mxc_jpeg_find_format(ctx, fourcc); + fmt = mxc_jpeg_find_format(fourcc); if (!fmt) return -EINVAL; f->fmt.pix_mp.pixelformat = fourcc; From patchwork Tue Feb 14 10:04:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13139789 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 29EFCC64EC7 for ; Tue, 14 Feb 2023 10:08:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231984AbjBNKIR (ORCPT ); Tue, 14 Feb 2023 05:08:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231641AbjBNKIQ (ORCPT ); Tue, 14 Feb 2023 05:08:16 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2063.outbound.protection.outlook.com [40.107.105.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 655D812060; Tue, 14 Feb 2023 02:07:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BJcKFUQSskvIZTIStACnNs8gE/jhdCzYSS55yf9C3fNzCW9U4dUdYH6kC6HcEdsW79qr63fb6AocNpb/OS/B3q2fH8UqyBcyrkqMXr06YBaGIuYIhUm7UND9ATOVJNI3YzLD0SmzyGHum1BtwCAYXX8lRaBUTpXGdcrfamq0zDmETQzBXKRLxoS7NEYINSpT451bo7RpWy2/CN9+uthqqwaBw1Uxt9Sj4HDBYA3qAkiutFuDzb8EbxY8xK1t5MuMu1Egf/8AKrDM/2/f9viEs0gtPs+xhsRlsDU/pMN3Qhj/V8tAWYx3jjYbBWQsphsqhwObZ8UnaNlvUX9k2E1ACA== 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=kqMc1wfuMYeYDAoVY7BuI0rnFRwbHySlWETY3IoVutcEvauvJpJBuTnZ0dZfloPzQw3XOhrzzaWfvzr8GSu28Ht2+90xOaCqlPWAQXN1GT+WqhPRuEkeXEdiCABLI1CVDfffh8A14WyIWtbUWgLMGJvP6HgKkb5gY5Luu+228l+aPfFrcJEwtvAHrJfQN+wxw20MOTgLvzn/FjK4WGcWFcqG9kICkTvmI/b9A/81o7YYNg16rBPvGlPoOmerOfSmKDbiX82f50iXdJbo39VmR9y6C296fAi9+cXbLAvbV0kaq2nsRgu6DQtK0IO8yNwXLsVjvmNEVHCR3rGmVyX26A== 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=iA9BSDZJBf//Bgv/ggPRETLqoLEE7IqfEiTNr9FDeF6rVrFDNsV3rwY2YTy54McU1zTppZK0BH9DOpaUYBmtf6C2w2xzK6mrFc+ojYZQXTSbv9pPM+kbTWcV2pe4os1QZLdExwZOpDnfNmldPjZa/y9tX0PxxVJvt7oJ+Hcd0k8= 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 VI1PR04MB6800.eurprd04.prod.outlook.com (2603:10a6:803:133::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Tue, 14 Feb 2023 10:06:15 +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.6086.023; Tue, 14 Feb 2023 10:06:15 +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 v3 08/10] media: imx-jpeg: Clear slot next desc ptr if config error Date: Tue, 14 Feb 2023 18:04:50 +0800 Message-Id: <4cd90d5670b4df5708abccacf210930eb0f44ede.1676368610.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|VI1PR04MB6800:EE_ X-MS-Office365-Filtering-Correlation-Id: 91803d5b-eda1-40bb-ab3c-08db0e731be5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: imVMnzDyQ6xnQLU3A+Ji5eVZ5MNHrq3t7MEmNVzQ0VYa5seoWTJNa95PaBp/3qJ4dkhA7ZujKAwpcv5g2N1+P60ShrYd2y3bj8sYuNHGaZrSyy9Kz7dPTatwvj1pji4wPCwcfLTdYAkb+3NRo5IOsLnyAlvU0wCRfnsvlx2ab2oNyokywM3YRo72CzfpP5FoW4PlAbKygrUYruDuCUoilb1eNmc0ZJm0Euerx0INnbeIquRDVRZiJexw1z2pv2EqmLuGlfcPXaXXmwAEjamzv4JbH7ftb6p7MuKtDkS2qALTMoYH6PPB8NN3dKqoXJU2+cKq23qJA3L+YMXSxSP0mLUE99yOcyFNU5HBSB5jrwSAcohq1b+BGUh6yVY956HdT4P9Puim592tUp4wMyxuKNzZzdMGC8q8/2FhhxEA6KdjaGrUROSz7BUUz234aRqktxUvcvg6C54I/cmRXoWp+dz3u3OEz6ANwyIcW7nxtL8LoZiRvEcUesFiPsbGUT0vIQkbLfAuCaPxlmeuQcQFEiA6SnPmKC633azsIiY2q6Z0p76KA16SUsqZbdgT1QJBzCKrEKDLfQQ5xeYLkb4onGFPmMuNGTOHaAzfuB71iUpbUgN9HSgOF+Vj2fZWuCN1JU8UEh666mtw85KRTAj8a0vpJZEvFinDvpKBkPNIciI/qwetwZIuh4cgsLhADp6SyQDuVC7Fd9BzlL8A8PA20A== 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)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6506007)(52116002)(6486002)(2906002)(36756003)(26005)(186003)(38100700002)(66556008)(8676002)(66476007)(66946007)(8936002)(6666004)(6512007)(38350700002)(2616005)(4326008)(44832011)(478600001)(316002)(86362001)(5660300002)(7416002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8NpHm8zpXrHu6qaCTaXBHj0F3wG8XN3Mpk+xlLNlBhLfKwrvp62PrSXikn4TuFiVfKkesW7clOzYe1bls2ZA8SF/N/hRhiGGj6Jb8WmJcP5XKwGRtb5uuHrSf8LY8bAcQPdAUh1pm460tNjBNRt1yLoma2KXwRyLQn1aT8tU1ZOxRCM/dLc1ANApkTf4+Sw6DZGyXf8s4A480y5cM8n1Ypyyo6MMCYxv22TuBeBQPThf1h4kNaS8uesGg9eZ6bzqa4rFL/fjOrQ86zfTUt5ax1wov7sgWZHZz2vxGFum/sia8MeshNH8GX/VXGjP3TUdlaEQOYz35A3U1SiOVCZuVPvrjXnl4Z07qAxdEOElab5GJaSVqd7WV8mlktw/lJ8bwUu9fK9ikB8faC2tSSakEKXnrb8mCsPQdD1R5IGvwTwOevykQ/detSyzF1FIrVTd7iAdPovVIAgh+gtwnsYjNDREcl124sIm7Ny/GCtQ/R+Ya4S09xN+FabFTlgPREx7ih7DxBM7xS0BrxGtZuKvJeqc8w1bK4aICXpXyrVY1D/65A85B8gaTcXl4njtMJj3ERieVYSQcECUST633QoppppVZ3KOVBjcq0z/yI+soxDhZ1gbuDjPavMm0lga97ZsiwBReNDWTPUYUgl5rfliTns85RdwTfJ+bpLkOscXNinXXilJK7B6ga4ZLhU+Cl6iNgy7SbuQzd8+l5eVVKnmJlVuLtnNgNDw8UyVhWS3jDvi+mxJqj8vdDbJky1Yo/FCzK0GgyWUQvV66FlmedcNpH0hOt6Ny4VU2Zx0a0mooL7HjP3A0fl0Mkky3QQCRlxy7vBN5eiTnOloZP4N+8PNGZSEbmCqwbenrfrntzJmqDZm8A3Kc9w/ffwgxb1iRiAegWBLtBW/xJ3jAYUOsSvy4cs/9/7M3pDJ2593ChvhqAKrcF79M89PdrAQLV1+pGoGL7STUv/jkzWC69Y9yvs7ccKdSaZv+9HSrTBILy1Dpy9zokYwMAN+omtF8Bp21+UJ3Vkdg781pG0UT17Kyv/Uxs4OaoeB8BXM78IVMUUlrOKQsfvxecFI0UQIcbVQzRwftyUjDmjIHCOVYw4wuTYdVnMqB/w7BNA6Zzv1+hqSABn/hh1qSVLtA86bkbDuZilhKp1IxpHYhzF5m6+/TRZgLf4Cg2UBluy8aAGVLN6QoLT/q+nBUTnRgMxrt3oRvjPzeX2Nn53lp9/NjohIL9Bh9phZtVjxnj9H75VWm1UxyP80N1FJzBwonQrR60mXWGyLyyGPKbTqENbhvqkBidrdGpcpqm3XrCZOj8AxR90NCi51OoCjQqarvFUlQuY5b2D8iI8zd2GmQCXhoi2/yvr9tAJYo0xsjBUNP+TIknwhUALJKI4cQTdLRl3tOLEiUkrpYeebOYhzhRvTJFKkcgcUb5ASKT1Bp78ZE8s105PPDPXZW1WFU/RPUGssPSQ27vadXjl1s5uCp8PA4aowIyzFaShltN4JkHpdSb2KhAO46Gjf/Gzw+YmWYLzDlhyANK+PEE0sUFLB8zKahtzHdeKoO7qqQnDfkxrjlL3GycMNSRH1xHS/ZDSTyOPTtvWAwex6 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91803d5b-eda1-40bb-ab3c-08db0e731be5 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 10:06:15.7152 (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: 76L/lHmsc29i3VpYuIEIlB6UkvRNQq8KS/X0pcZ/kucvVw//YvKXxYuTwjpt+Bbp0Eh6BUbNaTJxIJhHm4iH+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6800 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org clear slot next desc ptr if config error, otherwise codec will report config error interrupt repeatedly, it may led to system hang. Signed-off-by: Ming Qian --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c | 5 +++++ drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 1 + drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c index ef28122a5ed4..bbd5d6a9fc86 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.c @@ -178,3 +178,8 @@ void mxc_jpeg_set_desc(u32 desc, void __iomem *reg, int slot) writel(desc | MXC_NXT_DESCPT_EN, reg + MXC_SLOT_OFFSET(slot, SLOT_NXT_DESCPT_PTR)); } + +void mxc_jpeg_clr_desc(void __iomem *reg, int slot) +{ + writel(0, reg + MXC_SLOT_OFFSET(slot, SLOT_NXT_DESCPT_PTR)); +} diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h index ecf3b6562ba2..8b7cd6526efd 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h @@ -137,6 +137,7 @@ void mxc_jpeg_set_bufsize(struct mxc_jpeg_desc *desc, u32 bufsize); void mxc_jpeg_set_res(struct mxc_jpeg_desc *desc, u16 w, u16 h); void mxc_jpeg_set_line_pitch(struct mxc_jpeg_desc *desc, u32 line_pitch); void mxc_jpeg_set_desc(u32 desc, void __iomem *reg, int slot); +void mxc_jpeg_clr_desc(void __iomem *reg, int slot); void mxc_jpeg_set_regs_from_desc(struct mxc_jpeg_desc *desc, void __iomem *reg); #endif diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index 70b6eea733e7..3f1c9bc4b144 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -692,6 +692,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) u32 ret = readl(reg + CAST_STATUS12); dev_err(dev, "Encoder/decoder error, status=0x%08x", ret); + mxc_jpeg_clr_desc(reg, slot); mxc_jpeg_sw_reset(reg); buf_state = VB2_BUF_STATE_ERROR; goto buffers_done; From patchwork Tue Feb 14 10:04:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13139788 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 C3300C61DA4 for ; Tue, 14 Feb 2023 10:08:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232233AbjBNKID (ORCPT ); Tue, 14 Feb 2023 05:08:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232231AbjBNKH7 (ORCPT ); Tue, 14 Feb 2023 05:07:59 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2045.outbound.protection.outlook.com [40.107.105.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2874FE3B3; Tue, 14 Feb 2023 02:07:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RqOlLKL/8FM6Ct5Q1N4uHsIkYOKW7So2SIautrMlQMyKvNnqCuzotpfQwKWqMDaz7gu0yrD2EtI+W/CEcV9fbLNOV/PMnuvJoeeQe5BKMI0iW/+n59UvpiDO6DibsgtRrup94zrZOWOr0hdF4G+qyWsYwiECkk/HG+P2XZnw6W3j/aPT0r/BTFGI1Sp84+WxPZF9Nh+14ZO5lkTAGHZankjXx2OOdeDzP3H8w0Ll8e6GIU3wazkMByYFIfp3MIj6E75yYnodF9YE03ZuorE/G9/R7IuJ3GTD1UG+m1TC/J9GIc6UOYrIGNT8jOgNYDZx+emU0eK02i1ITujSwQ20dw== 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=96gy3aHr7cpkDLTeFd2DQlBvTgiWWIT2l1W6YnPOVSM=; b=DB6ZRmCv8pe3Cu8SCoqclraaeSxikm5nXiVtOaem4WGqDReTlpZSxzSuk8w6FcgAtC7BxDOiMVFI5tF15t2iSpOFfRgxAUUFuTslk8hAWkBTjxgQFsWe7PVk1XvuHGq2D4raUD82Q1abZv/vXZRlTSA0+Prl8JaOTfFX96rI6i/MLkjXFfgG8rRxrti94iyY+GHKXJ60o1BadRbC9+Z4RxHNlRWYmXtQQmScWxf2l6ZPiByRL3jPIQ20Tq9/8LQ8C9l4uyzanYrC1btjBFb7ntP3iWp/WEAG2DYH0UerHxaqa3WyYipJXqY4XwGBdBpyPD6KJip3QhwtxzNJFqvFMQ== 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=96gy3aHr7cpkDLTeFd2DQlBvTgiWWIT2l1W6YnPOVSM=; b=kW0nchOzGO02Dbv0uwhbKv5PRhAEkuSGOdahW0EWmm9Sq5u+5aHr84z3SUpu60HmjuEjMUXqwe0gcdjF7gA+/ohvMVqjsnnpkzzlM+L6vWAl+p60zFRxiBZfz3Vv7sLu1UzN4ZVv+sGUKANpCgzFX6BfAaQSTJu/83QY7y+92P4= 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 VI1PR04MB6800.eurprd04.prod.outlook.com (2603:10a6:803:133::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Tue, 14 Feb 2023 10:06:19 +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.6086.023; Tue, 14 Feb 2023 10:06:19 +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 v3 09/10] media: imx-jpeg: Decoder add support for 12bit jpeg Date: Tue, 14 Feb 2023 18:04:51 +0800 Message-Id: <9e72cab82f407f4d039d7979ff8995b768bffc69.1676368610.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|VI1PR04MB6800:EE_ X-MS-Office365-Filtering-Correlation-Id: f7a6bfe6-d2e1-4d2e-4c68-08db0e731e37 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eDD///rl5tbSOnFzdmFn3ALxWTfCEpH920qKFUnFEd3d3rGBUNn1Nadr+48Dhudqax8sXOhCZAmjmYNn89vSAb5Iou6SuN3kJNHHvkvQ/ERZq0eMVkiMX2CdBFAJ9PB9xQ2qt3tl2U4ADldutWXo6ojXfieUjY3PBZ8nCcXibtU5qQ9KVU+m/4FJx0r+8fmlPvMXGN4aA8pggTmeIaGw4zRahW4c6lHwk6ZxI0wcDSJn2fm9dOkkRJWt0W7ttL4KsJh8Kk510SXQhTZdcbMFbITQZkyxqscIYsY9Q+8goJnw5miQcLNsw4srtFJSA5w5uJU3Cqv/Iuevy89Ecx3Hf53Dr17UU7u0lZzlNi9alrmDYGeeVR+MIis4k4pBFyZpltfqzHXLyM31xbk8JkkSimgAyZDzB8SlsL7MyI8OhpexYZZEGXHwOUZvmLpeqALKcK7XFezdaYiQ3UOel44zOYKirc2SSZJ+pFE7UDHb14Wo7Ug1pj/LT3IrQ1OCKGhKDVh96L2xxciW0GaZSmdhVKOjUiyFimW4WBD7V9yLDhSXpr9I0L+L8Tlzb55vqkTEchossaotIMkSxRIu2yQs2KdTZlDe7j5wUy/PLuDyxQULYGevu48lZ7psofDVRCyi7n59tVohS5QZzjJGJJzPBHYvhNfd/Hp0tUb/smOn9jEAGdSWxgNZdAZstEFWTMAlXRwTfo7bFZLDGR5ocOJBuw== 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)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6506007)(52116002)(83380400001)(6486002)(2906002)(36756003)(26005)(186003)(38100700002)(66556008)(8676002)(66476007)(66946007)(8936002)(6666004)(6512007)(38350700002)(2616005)(4326008)(44832011)(478600001)(316002)(86362001)(5660300002)(7416002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /csrpP96t4+hdB/i2Ima5XV8AeLVwqtJmn/SPMP8ERwSBW5sTdiir5K0cd90KvnyOEg1ookiY2tTLDeiH6vo7gs5o1XwkmMPIUL3GbdvanWHjA5WAFPE0mSdiPIxkz2DyUZsT/Z26eIyV7Mh/nOZBsYE8XnOGGl5X9K/nSomMhfBgqjLwumNBh1KCgbytdUnyWOF18EFbpXsOGhzIdG+OJKhgEzrzguJxDyzxXHAK/lG9AcIeOCSBKA10iugnpd8CWnUhu8Dq+GKgIRqvysRO2Usp8NEXCAheRGJ5oU48HC3P/4LpzNtx29DjpqobcLqr3LyO69ncxzQ2CwoyaRd/zUL9QbReyQPRPs6qmH6IOm11MG3VQccpWneyjic0s19DtHtASgZL3kU42kqmBPF70eCxtZ4c3e70HfoVOe9BzMTp0PvaE/XBFbAHGrpWwEHXq1t+7foB/4Y3xt1XjEfFDYqU1rEo91kXo00MadV/FiIStgrYlzNBlm76s6fcGuVO1HS8f+MU2ZT9Nj3rt28VdrsCzqmCa3yrMLNm9VZ96BzGPOW4kFmkPKkL0WoI425iIYYwdXrpRB9ExEb5ElnNY79PEnB+xssCJsfQr1PVS4I7v72dc68D7UMAdHi4L9aHPupDiyKh4hQOi+tjjcop+18coKnhR4Tbmv1yKtAgbJsolU0R8zvIdQjWksFndHmEmal5gI14cVz3d4d8/byfw6MnCwu6VSZy0SjMvnT39T5SxeiUeGhi/NL24tD6XeRrhIA4XrTvsRHn4+2nQ97mp+XN8tzPMIsOecUXU6dSUXTqATUdO3rTbRw7nEjIU30havhpD+zwW4Z0eP0QSfTY+xX5vL9l3xYVII2kX2els3AWX0ahU+K0enZiP3RlSk3xMlgS4o6pDcgHjcMptNdSKFPBghwhzdyXFb9B2N1hjBNdhQbXxJ3T32TOGSdpOYzks6CSivrxF4GGeq2sXBuDktsRNrTK6Ocy7glw37SG8VEXRUAIMh4w82iyqVMYz1sLYaRTwRaiGyI9RhQzmvcpA6TslvVc2w7jTy2dfUpFwAi8czOcc7OqEV+8603pMZirb4jB1wIxihjxFnwEdhJZLLvnNhweGd39f8FDAEad0tv9q3SVOh/fRvLoOcjjeuoL+ZEiOoDrI4eVtI0At/H1+QGE7yP66STUPk8YNTkOkWWgkq9xXkt6rbn9OXD4KenPCuYI0p+/0lHiUue8OTkFxw9w+StCKWHcacDQ9se4k/pKovy23vKrqO3Ng61w9FzivO00u6SeKnAfY/Ah/lMFIIQdzWqTFZ6NBzuTnf0Uci+ARJH2RwJ912uzxiJJvFJb2ZcDF7/OaVGIDmCa6n9+q7HLSrXTEYjzBAW5VG0dayrhZQHlYD1SXM2T5zoiwGZiCzZLy8JLjfy3Q1uBz4OoVj6LFc8FjMz0vv5BVQfzGSTIaJ+ZpJGo6yLlwVkTNyBm1gCzNo2Ysd1wVObMpgbbwnehYeSqECSFcuvFZUAARsXHGxeVAwJp7nuF3rOWS6KZVribgD9bBb3gKNsfmq3e5BCeo88VI2Dybp7bewmLHWuWRFs4GnsnBWujvf8zu89 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7a6bfe6-d2e1-4d2e-4c68-08db0e731e37 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 10:06:19.6837 (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: gcVHPjymZfMRFoAAkllz+827u61sbGu5BcdcMdkms7258a7+7HMcNqjcBW5VHeNGKTZ8vyEF9uod3vy4hTzqsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6800 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..7743655ab12f 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -87,6 +87,20 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .precision = 8, .is_rgb = 1, }, + { + .name = "BGR 12bit", /*12-bit BGR packed format*/ + .fourcc = V4L2_PIX_FMT_BGR48_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 3, + .depth = 36, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + .is_rgb = 1, + }, { .name = "ABGR", /* ABGR packed format */ .fourcc = V4L2_PIX_FMT_ABGR32, @@ -101,6 +115,20 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .precision = 8, .is_rgb = 1, }, + { + .name = "ABGR 12bit", /* 12-bit ABGR packed format */ + .fourcc = V4L2_PIX_FMT_ABGR64_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 4, + .depth = 48, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + .is_rgb = 1, + }, { .name = "YUV420", /* 1st plane = Y, 2nd plane = UV */ .fourcc = V4L2_PIX_FMT_NV12M, @@ -127,6 +155,32 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV420 12bit", /* 1st plane = Y, 2nd plane = UV */ + .fourcc = V4L2_PIX_FMT_P012M, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_420, + .nc = 3, + .depth = 18, /* 6 x 12 bits (4Y + UV) for 4 pixels */ + .mem_planes = 2, + .comp_planes = 2, /* 1 plane Y, 1 plane UV interleaved */ + .h_align = 4, + .v_align = 4, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, + { + .name = "YUV420 12bit", /* 1st plane = Y, 2nd plane = UV */ + .fourcc = V4L2_PIX_FMT_P012, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_420, + .nc = 3, + .depth = 18, /* 6 x 12 bits (4Y + UV) for 4 pixels */ + .mem_planes = 1, + .comp_planes = 2, /* 1 plane Y, 1 plane UV interleaved */ + .h_align = 4, + .v_align = 4, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "YUV422", /* YUYV */ .fourcc = V4L2_PIX_FMT_YUYV, @@ -140,6 +194,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "YUV422 12bit", /* YUYV */ + .fourcc = V4L2_PIX_FMT_YUYV64_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_YUV48_12, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_444, + .nc = 3, + .depth = 36, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, { .name = "Gray", /* Gray (Y8/Y12) or Single Comp */ .fourcc = V4L2_PIX_FMT_GREY, @@ -166,6 +246,19 @@ static const struct mxc_jpeg_fmt mxc_formats[] = { .flags = MXC_JPEG_FMT_TYPE_RAW, .precision = 8, }, + { + .name = "Gray 12bit", /* Gray (Y8/Y12) or Single Comp */ + .fourcc = V4L2_PIX_FMT_Y012, + .subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY, + .nc = 1, + .depth = 12, + .mem_planes = 1, + .comp_planes = 1, + .h_align = 3, + .v_align = 3, + .flags = MXC_JPEG_FMT_TYPE_RAW, + .precision = 12, + }, }; #define MXC_JPEG_NUM_FORMATS ARRAY_SIZE(mxc_formats) @@ -437,17 +530,24 @@ static enum mxc_jpeg_image_format mxc_jpeg_fourcc_to_imgfmt(u32 fourcc) { switch (fourcc) { case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y012: return MXC_JPEG_GRAY; case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_YUYV64_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_YUV48_12: return MXC_JPEG_YUV444; case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR48_12: return MXC_JPEG_BGR; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR64_12: return MXC_JPEG_ABGR; default: return MXC_JPEG_INVALID; @@ -483,6 +583,17 @@ static void mxc_jpeg_addrs(struct mxc_jpeg_desc *desc, offset; } +static bool mxc_jpeg_is_extended_sequential(const struct mxc_jpeg_fmt *fmt) +{ + if (!fmt || !(fmt->flags & MXC_JPEG_FMT_TYPE_RAW)) + return false; + + if (fmt->precision > 8) + return true; + + return false; +} + static void notify_eos(struct mxc_jpeg_ctx *ctx) { const struct v4l2_event ev = { @@ -767,24 +878,31 @@ static int mxc_jpeg_fixup_sof(struct mxc_jpeg_sof *sof, switch (fourcc) { case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12M: + case V4L2_PIX_FMT_P012: + case V4L2_PIX_FMT_P012M: sof->components_no = 3; sof->comp[0].v = 0x2; sof->comp[0].h = 0x2; break; case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_YUYV64_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_YUV48_12: case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR48_12: default: sof->components_no = 3; break; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR64_12: sof->components_no = 4; break; case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y012: sof->components_no = 1; break; } @@ -804,20 +922,27 @@ static int mxc_jpeg_fixup_sos(struct mxc_jpeg_sos *sos, switch (fourcc) { case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12M: + case V4L2_PIX_FMT_P012: + case V4L2_PIX_FMT_P012M: sos->components_no = 3; break; case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_YUYV64_12: sos->components_no = 3; break; case V4L2_PIX_FMT_YUV24: + case V4L2_PIX_FMT_YUV48_12: case V4L2_PIX_FMT_BGR24: + case V4L2_PIX_FMT_BGR48_12: default: sos->components_no = 3; break; case V4L2_PIX_FMT_ABGR32: + case V4L2_PIX_FMT_ABGR64_12: sos->components_no = 4; break; case V4L2_PIX_FMT_GREY: + case V4L2_PIX_FMT_Y012: sos->components_no = 1; break; } @@ -847,12 +972,15 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cfg_stream_vaddr, u8 *cfg = (u8 *)cfg_stream_vaddr; struct mxc_jpeg_sof *sof; struct mxc_jpeg_sos *sos; + const struct mxc_jpeg_fmt *fmt = mxc_jpeg_find_format(fourcc); + + if (!fmt) + return 0; memcpy(cfg + offset, jpeg_soi, ARRAY_SIZE(jpeg_soi)); offset += ARRAY_SIZE(jpeg_soi); - if (fourcc == V4L2_PIX_FMT_BGR24 || - fourcc == V4L2_PIX_FMT_ABGR32) { + if (fmt->is_rgb) { memcpy(cfg + offset, jpeg_app14, sizeof(jpeg_app14)); offset += sizeof(jpeg_app14); } else { @@ -918,6 +1046,10 @@ static void mxc_jpeg_config_dec_desc(struct vb2_buffer *out_buf, desc->stm_ctrl &= ~STM_CTRL_IMAGE_FORMAT(0xF); /* clear image format */ desc->stm_ctrl |= STM_CTRL_IMAGE_FORMAT(img_fmt); desc->stm_ctrl |= STM_CTRL_BITBUF_PTR_CLR(1); + if (mxc_jpeg_is_extended_sequential(jpeg_src_buf->fmt)) + desc->stm_ctrl |= STM_CTRL_PIXEL_PRECISION; + else + desc->stm_ctrl &= ~STM_CTRL_PIXEL_PRECISION; desc->line_pitch = q_data_cap->bytesperline[0]; mxc_jpeg_addrs(desc, dst_buf, src_buf, 0); mxc_jpeg_set_bufsize(desc, ALIGN(vb2_plane_size(src_buf, 0), 1024)); From patchwork Tue Feb 14 10:04:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13139790 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 ADB67C05027 for ; Tue, 14 Feb 2023 10:08:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232289AbjBNKIk (ORCPT ); Tue, 14 Feb 2023 05:08:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232207AbjBNKIg (ORCPT ); Tue, 14 Feb 2023 05:08:36 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2051.outbound.protection.outlook.com [40.107.7.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A618125BB4; Tue, 14 Feb 2023 02:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GCgopBWW6T5w/yJwGAU/c3KQt/8PAKocs/tKLM7bxHmcyzgLh7aE1usSabEUUzTzT7/6QRWb9ELJOohcWVxYG6b/+CLLJAK9WyiaRW3u8EIkAQ6tiQgOUJqFCLgHTkT8zCa6ld+a/xtLPrD0fQoYFTrjqshjkyEpDbq442m2rRnqFKiqFfkWD2M/7UGRccVaqH216kLXPxsHnE5yfSv4uS6pfOAlFOBgwnve/ipEV8OSGZgBWd3p+u0Uc8G9GHBG4phEH3Xwwc23Stq5kS046fG74GiBf04U8x8fjwrjizt/aYROK+QRrqir/8n8qc+cAK2sGW4NATOqS8pk1uZlyw== 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=xceXFxJqeTf9QvZDRg10GRa9Hib7VJ4bMxWrNIFEe2w=; b=c5HWzAZWOdTeLX4WzJN/XkRGHiCi+E6uC6MxSD3YA70pBRwWXuYsgWskGWkdyCDZECzoG44kSXRKClS70Lk8r1TbWQ7JW9cffGHViG97Wd+BUh8iO/T8HRv2hNPVy4fqw6B0PUQM3qM0GiXxziYGsjWVqUbi54JWu/jbJOQ5VNseoVKC+CZHxiuawIpWToHdV98AWaa1RdNJShy7wLxwrJVFaacinCttzjw9i+R0Siet4Xd6k6ElenGGNjb/UgxRthcQaDT5iwQ0/ibKIY5CHIUPk3XJ6I55NzM8NrVXP8u44i4RuudBQwU5g6h8fz6NdIgRDN055dQzZKYIjIMbAA== 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=xceXFxJqeTf9QvZDRg10GRa9Hib7VJ4bMxWrNIFEe2w=; b=L5hP3dod8QszqOfn3jWOao3iXebeUfx5Xud3HBnAfkn9W/FzQjn+BKfXj9xW3lJuiZ/iDAcoxWIEPlZ7eD2rmGRoYLYtaaWBMhlVy6CyVKBSBpMeDvAhwnB3qpJxQqlqqcaUu+T5wJnprgtB7Rhnz2eJd8y2BaTLI1jPrW96JHg= 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 VI1PR04MB6800.eurprd04.prod.outlook.com (2603:10a6:803:133::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.23; Tue, 14 Feb 2023 10:06:23 +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.6086.023; Tue, 14 Feb 2023 10:06:23 +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 v3 10/10] media: imx-jpeg: Encoder add support for 12bit jpeg Date: Tue, 14 Feb 2023 18:04:52 +0800 Message-Id: <119bbd952b4739d9e65a9f54b8547f067e0adea5.1676368610.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|VI1PR04MB6800:EE_ X-MS-Office365-Filtering-Correlation-Id: 4613f0dc-cde3-4622-129a-08db0e7320af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VOoyeDZyRcG5db5MwvrVo5pHob3KXYPu52BIwX68pNZXb7/sCpodmAM5WF03FyV8qzITW2p3tZ2EWuyC+JQ+mft0Ir21Pwj4rJjHZRSFdCDZpDv+vpMA5OCcRH+230OyoA0xh2qojBw0rOIyStDvjSucigLYl4w6hLZIAe3qZuXcjexLf3W+qGrIqmp1usqhHSI4Q0Ubs6AHi0TMz7GQJFb26vhfTRyMIa9ZT3VEfyzODiwRDSGykFFUXMBVnDoy/z+me2kCMFNjW1he6sX9kmNQnviOf0f3U1/bLcCSXRKJLvNqnkKevGw4uYCUAcn7GKprR8TXplp+fY5RUm/1Jleg7K4/uMA5tAuBDtgYKyuHspT6P/PbhbZDKy97c6MDTnPSjrQ72UWoNGj9kltaR92NMtmOz0IrIc04JIhh5P6WZswYgtdf7ZRCTn3inwWsbKMwgdKhSUPOnQRqdUR0i4X6vYCrUPKcQMNvxKKYDfkvyhPxjDEZ3iGHEthrANwlS4sD6GvFuZZBmNeniPK8Wp0oWSIN2yXcPUwTFnO6d+jSkokPHHF4z0sJzdGMJUv7Q/q0vFTMpIJ1ZO6FW5QLeHx4a5EDLCZXhZsdZ+yYvKXlnefMCWgZoPc8n60LAkcD5sHbmc+ZCUnqav0PxZH1ouEFjY7yoqn+q+OM9XGM4ELQ6gN6mGUW3nWXPYib8hMCUG+bQFsRzLegGHLpUVjt4g== 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)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6506007)(52116002)(83380400001)(6486002)(2906002)(36756003)(26005)(186003)(38100700002)(66556008)(8676002)(66476007)(66946007)(8936002)(6666004)(6512007)(38350700002)(2616005)(4326008)(44832011)(478600001)(316002)(30864003)(86362001)(5660300002)(7416002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lVHeeaeblWWeGn0VWFaShkzZ3yMBsmnKnbhWy6YBwCcgRpCB/pkYmJUsi425GqXGqGWRgeYvUCZTvY6t44ohgTHB0nibEuIWoXH9shWWycQi3gwotf0OpRptdgd4hzB7wWOCD6thTHWWx3BNrajCh/dlkxiqS99J/c2GFNz0St7W3sLGVE9gGS2yCyqGkOYdNTbb27JPbMGihO+Y7HmBhAgTRFdCTWu4UMNuVlr6rOmoQn8O2Ed2kgxq7LzIbafOcEeloAWzWHVDvW08JVq3tIiQJiil8fTeGQSK38XVApRKU4UIlJzQ1nqXchLFdEvL8JHYOWhLJ1bXVJTOqlHl6otm+JxQvZgcZshckP5IcZ01q6Qgzz3BWcr1Dt29ptLClR/2fStG9ZevhXLrQZ6TiBO/uXe1n0QXK0cuA3Dazfp+0VU8hmDryLZt9DT9uFtGQsr68q95zRFYNW9TCjp4hyvE+EKThaacLXTMtaiO/GmlGJPWb9kxcrVH8ieOn7vlAlI5rTkyhVtZi6Iu2o75LIRc9DJqM5X1CYa8AEJeJzi6BNIQ5g6P5eUZMRYu6GYflO35Y+pcaoaWr7yQ2YqE9f6F9yfgDsy1JHsDDGNgVggTZH9bm8wZyzRsY9yMlBCt06wM3cJa7kVbv/8O41vHRHBwtl77iJrvPtciInamcR52t83zdh/P7fxiXkMaDffH2qzerkYjfNkYjEP9R8dyf6yn19dbAGecLsdhAO8szZd0PyHFBpi3dncp6RhQH9aMbUxRIl2OlzcjKNhrxAs3eXyjJlpfCwn7tllsgYlBQ/vvz3qT0JWL0J6mxmbFGea+1yvrcQG5I0XVcF2iUKfcR7MUdMmLh4qPANzAOSjJI3UL4OyINBPpqMNsh+Vqxoedl/f2wlBF6s2WgSDEhDm/CFovewkRlkq4wUuzZPt1iaLFh8dVgiJHiGtD4lrBE01jkOaxdqIAhTlHL5vQdppdKJ79gsYq4JANe01BkDzpIw7emUR8IxtkWy/3l67c2/Qjw76Pe9X3lmXuuNfGp8oCuZZefja2kVzFEFR0+63B07TkXGVdMStNnouPt7Ul1D58rpgD9K/1gP1tTt7ZOcd+xv+RWvYiF/xijEfkDf1AaY2h3UHrGjhU9hzGpDtaRZsBFOryv255JQ9TwTjc+T8jhtnjH5lwceMERC/s3yMJlTvod5KuIjuX8hICD5YpCZ+sclA90TtLgLuzZJV/82mK7y4wBleiaYP5t8TtsW7Gjqy0SH4tn8AN2jbb/RVPciRfRtZvEdBX1Mp0gbcD2gsA/6QCYm2FVq7+d0YzeGneDljXlFV2r8ICu6n4v7xgx1ByRNC+xbFHScY5kV9n3pNFJ79g3aRn9AYeYwh61cc1WKELbLXKw+mrU98K8AR4ExgQntYwDodBLA4o7/wV07U1u9EH6jYAGW5irPcUp9DtAuaan0Op4GNvgrqcTpYA9QgPzjTn+ORyQSgIFjWB3xnPyZWB5L0LJlDCVx0oy/47QrzIt03M/+P79ZH2KSDpGuoKKZwlHNny4BN7WkAs+YVkU12BmmiB0uo3GJllA7J/htk6rWTjpJPh/6s9DFuiYg5p X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4613f0dc-cde3-4622-129a-08db0e7320af X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 10:06:23.8085 (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: jBHKMboA+bs6M9kUqNY10oqRbdyNNDFD//S9d1D4AjRidejZJwgXaOQyrp2YikR5uz1tSGdncudBNdqwvBBwKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6800 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 7743655ab12f..3a7bbfe6a9cc 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);