From patchwork Wed Mar 22 05:13:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13183560 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E3D7C6FD1F for ; Wed, 22 Mar 2023 05:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YWc19Ej02XRdsKVhgd4/Wt9uSnQy9pHQPE/nWxZmwNA=; b=IWrwHiv8Yvjxia V9iQUTCEMpXGB6tT8dG+M3KmL21RkxvZ9IS8kT8eioOoMAlW2YdpH3m20S/0iCaGEn6ZBbjaeKuBJ dsK6GRzratZsp9OR+hkHAb0OgGcqepO/RRJh9np/5DHtpSQ+QxJksLg0nKAXXn/IkhtqmR4ovNWdF Dsplqz7UdkdJjRinD0vbDzU+zIXAMwNfD6ntbjnnjk2iEqpaewG8m2rvHvl3knhrYtVqyuq4ykX1b xlZC56qUS9r0+aXmD8jQUgf175gzM8GZ4Mi3WjMTfrVLX7Et/budsGn5GSAugkFt33gWQr2CHpJuz M887pHhCmdVLAkZ9gFUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peqng-00Eeid-1Z; Wed, 22 Mar 2023 05:14:16 +0000 Received: from mail-db8eur05on20609.outbound.protection.outlook.com ([2a01:111:f400:7e1a::609] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peqnU-00Eed1-1b for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 05:14:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eI2bKZBcmP4N0SCrAq7RBKOZ3kHkodOEBZFCQrgLLTLQrZM7jysGGwdOlukl1xE4dvzUGaLFozD5HBx4xx2fdIgliPJpI1ROzWpkiQpfEZCHWHuviqyIY2fPlokfPh9TxYzedOhrbkgffZy2H9RWDDeZbcEnJJW8gUEw0Olp4oqTQCiW/K7+mF0vi2BGORvh0KwEwMOlfQoGU1shtRDNeDiV63Z4bsi2FHtXYkqw6X8UJtKNh6LHD7T924sRHv+FtEKDpvbgD/LRcq04RyTWYlaHBUTO+z6iut5YeWnWaE29SZprmRWQANXBQsZ2NyK1Ng02XgYRVBqiLzoCYCQ5Fg== 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=RNYYeP2WoEtfwMINmCboSPMspPL38A42Pfs0MlV+L5M=; b=Omz8/IfKa+14A+jhFxf5FVBPz5G08ufYx3t7aGmhr6fvtDSUX1ATgwABYR7R8QKs2Ur4AelhX3AZwuCBp63mOzXbyiNVWRy3Hy0GeMXEQGe0XvPtJEZp6+HT5wRfqOUJ3A26VZPAEvG/9skGj9LN6lhFcaJUrJjZeao15U576TGvWUmciC1YhuoZ/1FC4XqnWR7QgYaOSYXGajYunfhmEk2jpZ4L17RgiYtWQPDlY1HiRe/G+4G6b1RCJE/HRvvEy7/eKp3PFGgWi9v0b+nqzH1DA5C2GrRJJfD1qGHVz3lPCEwq3i7AMMZxCX5q2MeC3o0Ysefsp8oxHuVtHcVKTg== 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=RNYYeP2WoEtfwMINmCboSPMspPL38A42Pfs0MlV+L5M=; b=JnRqowug3LOMK5EQCc3Kh/641QaVshxyBMgQmC/TepCoavbsT/Tpvi6ne9d4/MWw0tOkuefsSFqVbIG9x5tsrSXOwGe913qQVRlnMco+9mXeEJCJA1dxPh3uiN0WcOP1WkJKw/5gxTTZyPDvS8D2imViEMY2AFAKWvhm24Rv0hQ= 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 AM9PR04MB8100.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Wed, 22 Mar 2023 05:14:02 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::89aa:9204:790d:e46b%5]) with mapi id 15.20.6178.037; Wed, 22 Mar 2023 05:14:01 +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 v5 05/10] media: Add BGR48_12 video format Date: Wed, 22 Mar 2023 13:13:08 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:1f4::14) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AM9PR04MB8100:EE_ X-MS-Office365-Filtering-Correlation-Id: 5fde2a09-7f84-40fd-30dc-08db2a943fd8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yQm9o3+8+AoD4PRp32FgCk48sTIDykk3lc9xpU/pM1Zyhk3H5gbOiR6ogffGqrp+7n5I1dmpWFMpdOGOWqLNX6aymuiNcjXKSkP0ofexWIgunLAtYljLtNfQDgr91FMYDJFxZfd6NUNBQtbGvo4i9fZLcxD1UB/SdNC+KXXNYnsmz5TKjhN7mxMtJ0EZECjrYkZB7NyfoWsHvLXyj9nvCmvbn0eM/4IzqW3YchY3XoJTj35GZR7jrYIOYZQ7FLs6Lbls7esX1fbsmYy7gK2e8r4vr4qiQaFW8LdvgosadMbfXKPtSscxYqDMPy8M8J5wXUlwnhrSsWvEQl1K9yK1gXqUSUOY6h/GunFs00ApP5amUxomKph8uP+A/k8o3L7lBq7y/LeA4TTJWjkka74gDF9u8C+bevQClWQggKXU6iiaOqkKZ4tz+ftGsR4dNaI7JLKaWpVfXkeLe3QEHICPnoz4QI5r2juJyt+vQ1rfQukHlICjuPLa9HWzPoT83l/+oSWC2UBWB7eTUcKUbdZ+pGpoPFGUSQCm9JI+NUiRJUKZk/kiQJRxEcYk91iTeWyHqryg/jNf8eGNN2QHIYQj5pBwpL0sylxEEWxkqbJeO0waZKQbrRJd4p3BrvQV/3USmPwB/JUJoBMyR8vqrEpQWFU45vdoNaBqKrlI6mkwTpPA9dkVjM9H6G0fTEIWXvL/X8pxWX6TF6ZRm+HWQSaA4A== 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)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199018)(6486002)(66556008)(41300700001)(52116002)(66476007)(7416002)(478600001)(66946007)(5660300002)(8936002)(8676002)(316002)(44832011)(4326008)(36756003)(86362001)(6506007)(6512007)(186003)(26005)(2616005)(2906002)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KX/9aMnRt+YUwMwwg/9QuNpt98tK/1kz18Eeb/ZgRQ5/Tdg42uufzRU4cooHiuwDOA9eK8TDAKLNJoUZns08EAvR0jhSfds6H8voYA/MmhFANoHKPI3WMWSodhfC7H2zRkaN+xS1F+U6cnQW0SWLeOJaCF4rPxLP6HXHUPa/5Or1C5AH8Mv3kJaCnsIGrrxBozgG2lVttNyb4VE5IBGIbiz5uYOrlrYr43bDiU6w6T43cfqioNG+OfZW0s1HaqiuJMHshEAgZrMEfm+GZkdioDtfeClAFSwsObZoaypH8zq1iT5chrUY+lTzAUpCu17wfg8ahY2zKkdeHes2cg21/Q8GaDuyPK7mgMxTpTY5aWcEvmHRspaCBgavA3tjl4xSO/bhwDmJER8mku3NVDyR16+zS8SiYp/3oek3NS1FNphk5Z5qavkNL61OsUA3R1AwFEYbQwaat9VSzkuK6VCfL4FSrwpl1PPabFYn1dfQ01/oAiRF1yLNzjunumEAgSISD+6RCrKaU3U1i4asSXwGGA+KxMseW+IDoJMUZWgV1+qylM/LcUsfSooat0QSjRNKy290bZAcoiPE0o1Aj3JqBeRUuvMDWo9bS3cgT7H4OT9IONVCXKFYFXh9TPPwVnRDDkMre1jMZoqEGuU0xSbZ2xi7jlhm0HN5UftumjpVxL4OUCLzX7WfQvbSPdeZ/CBfvtcjaiRyLujuSdKeQQAyaDFEiZ2ghmChMamTJ7f1EPwXhcQhF3/gDIjVhWUY6hpuvv1w2ZxzdKRT4dBGll1fBp6+8sZ2fqw9k+yoGMriddj/2cUYUiwTUN84x28x966/D4jr/13Q6qT+ywnyQ9Flise4f9xfxzn9xuR8fLr0xj9LHhTRMMh3NYzsYrcIjOrK5AMhO6FDbbMhgrlqzjOLIj0FLjIkWMjzUJCI7aKOFFnw97nNtxmDr/rbjgGChLu8AhtMtYy6PEuGxalzuYREXoqBpAHkPHZJaodG7JiZES7BZ/n3bsf3h0GTkAZPQnHWv2+KkThCxPO9qzbkTAB3CqjVE8ikth/sKwKP4+KQwo7PZkcTlQrPj5HapX6MVw2ih9lw/9TSCDdLFABNEieNRNoKvSgTgtENTJVyNRvjpT6xgRZAuty46aaudm7y+GcWQ52IdYxbR21ayAFLmt03Q3RaG/e3o6XKLntEfGSrysoE7mXIn/zdRRQqgKyGjqxLCdPY224oVm6EVeB0utX2frlTDdZqmxgx4FBxcEPFuoLrfcXrPfma6orkYItqlwb8GO+Gz/n7CXyWDachyyFFHYiqrRAWoQGlrTcL4WR0iAhZSP689USPhijfdPq0Yh5TsCh1q7nENTNsy7I0JpbQX1jqDNR8+ONomCxCcmOSjCafYDGnW93CjSCJnZHZSa+06u+jS+rLKum6ruy52lPVmdHX6MtihrgcPasNoCO2g8PohdaCqKtJAaD0L93MNpVikI95+4vMOOwu/o4MadL7ZTijCsGNYu3P3PIW5cicHhQ+QTs7Gvut3wKU4gisi2BldCCILBopyGcJmtXrr7IAnncB4ucbi6d+YcCLDZyhvd5D18lhMbL2PBeU+56KTxe2 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5fde2a09-7f84-40fd-30dc-08db2a943fd8 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2023 05:14:01.9435 (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: pKd1Ms+EjE1CdRKJm1wpEPH7e2+9fVgtRK8454//7EGAM4r5lM2d6GVcuu8O6hGnFpmnP1qBtKzDHPMetCaRKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_221404_540000_7A8A9E60 X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org BGR48_12 is a reversed RGB format with 12 bits per component like BGR24, expanded to 16bits. Data in the 12 high bits, zeros in the 4 low bits, arranged in little endian order. Signed-off-by: Ming Qian --- .../userspace-api/media/v4l/pixfmt-rgb.rst | 33 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 ++ 4 files changed, 38 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst index d330aeb4d3eb..779f0bdda642 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst @@ -956,6 +956,39 @@ number of bits for each component. \endgroup +12 Bits Per Component +============================== + +These formats store an RGB triplet in six or eight bytes, with 12 bits per component. +Expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, +arranged in little endian order. + +.. raw:: latex + + \small + +.. flat-table:: RGB Formats With 12 Bits Per Component + :header-rows: 1 + + * - Identifier + - Code + - Byte 1-0 + - Byte 3-2 + - Byte 5-4 + - Byte 7-6 + * .. _V4L2-PIX-FMT-BGR48-12: + + - ``V4L2_PIX_FMT_BGR48_12`` + - 'B312' + + - B\ :sub:`15-4` + - G\ :sub:`15-4` + - R\ :sub:`15-4` + - + +.. raw:: latex + + \normalsize Deprecated RGB Formats ====================== diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index da313a0637de..16d3c91c7da2 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -252,6 +252,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_RGB565, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_BGR48_12, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, /* YUV packed formats */ { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 7225e566c528..3490eb3f42e4 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1302,6 +1302,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_RGBX1010102: descr = "32-bit RGBX 10-10-10-2"; break; case V4L2_PIX_FMT_RGBA1010102: descr = "32-bit RGBA 10-10-10-2"; break; case V4L2_PIX_FMT_ARGB2101010: descr = "32-bit ARGB 2-10-10-10"; break; + case V4L2_PIX_FMT_BGR48_12: descr = "12-bit Depth BGR"; break; case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break; case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break; case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 8a6430bc4a00..3c5acd72606c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -580,6 +580,9 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_RGBA1010102 v4l2_fourcc('R', 'A', '3', '0') /* 32 RGBA-10-10-10-2 */ #define V4L2_PIX_FMT_ARGB2101010 v4l2_fourcc('A', 'R', '3', '0') /* 32 ARGB-2-10-10-10 */ +/* RGB formats (6 or 8 bytes per pixel) */ +#define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ + /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */