From patchwork Tue Dec 20 03:11:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13077478 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 D0615C4332F for ; Tue, 20 Dec 2022 03:17:14 +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=yzBtQ0aXb8eYgsO/0wTeLF/pQYq4avWmixJmyXWSI9k=; b=dhaqZ/l6Pni15P HXc7VRPUQiIhxSXfdpaOWb2qh7EVE2AvLoFeLYy7i23n5mI2ZATh6Rn8WQi6B0FAVkTTFf6ibS3r/ l2NS3uKOuot88Kiqk5t+S/SkmQKb6Dg4MdMOVa8hm72H7i6/QD8NvB/h0guErzFJEOi0Sdz33Sr/o 10tSv0kNL84UI5mzlORQd5VJxkV190vNbFALXYUuw8CoV3NlRrT808WQIaZk32BvdMDJ5+OkeAzVe 3WeUEDrGc12AQfTOa2P1iCswSF4vvGpAe4t3f/NYp8Qo8gb9obgI3xv0wtlFkU1ZCPuAplkxekzTU qP+WsSFz7SPVFhG4/bBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7T6a-008Rje-Jo; Tue, 20 Dec 2022 03:15:49 +0000 Received: from mail-db5eur01on2078.outbound.protection.outlook.com ([40.107.15.78] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7T3a-008P2p-H7 for linux-arm-kernel@lists.infradead.org; Tue, 20 Dec 2022 03:12:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wj06yuuK7kOhtlHwm2hO2nlnA7Qzy326xJ1prgFG5WgNVv5FZcLzDADlLFZpD3q7gnfWlG0HOI8tyEemk+Xbk00cwAjFnVjHFtmDon/i2WjvhpLLwSbYClV0rlMuBKfsI2ssntsWLh6twSYkG3IR7uA5+8vbQBCP59H2kxbiXXaNfKzOXM69OwDGmJkS7bA6cLTI++UicX+tnvC84C+irngpXAfqISZZxBqBp1wipaND0MaIEHVpnMObnkD79OqujaVEi7pyidSvUnaryuO2xBY7FE5eoBTTwI2lXgMocdHqulgQNwOnewRd04f9W7ddlh0zwAPK1f/y9q49rVA1pg== 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=y5EcEWx+58L+wG2ipe/BlV2BSRVp6Bv8Ai9LEw9dMAg=; b=PoeaedfCVQ6qurghj6b105NpCwUciqu092jeBNNkQbJgZKohhAjsPU4ORUj35w0VeaQdn9GUC/35/l52WGYsiG93JVtFRs9SVE2oBrWNFzlrV/sXYH8znOLgnPG1QF47kR+/4wjfJNjpU86vz7NsLvS4jp0ViTEgf/uBsmdI1IA13QbL9U1tOhQN0nvVAXg1ZMsdo+7pqcs6QlpjW/SDdZ0r4VIqifsHFiQJp9/WsD8hKmMMvkzDjNdRLe8b+C2wmOAT8rC671w44cE0IcFKRtYtKixBXE3gxgmo7Mn15f4JLo/g3gqjhzMXzsAetDj4nS8IT/25E22IxY8KcXB9dg== 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=y5EcEWx+58L+wG2ipe/BlV2BSRVp6Bv8Ai9LEw9dMAg=; b=F3utPRgyDroXt4T8oxVaaA/OacfBBUNsZd7z/hrIc2wGIxcLAy28gzmMAI4B8dzH7yaL9ajt2vEGJ+OvDhtBxJnbMMZ7yTpwgoLdt7+gVzNpmHiIxJuT+muBIaqzRkY9QwMSuPEOxaMg8A1DXSzEBCfJHNCL9NCFV6zTEYsos9U= 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 AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:36 +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.5924.016; Tue, 20 Dec 2022 03:12:36 +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 05/10] media: Add B312 video format Date: Tue, 20 Dec 2022 11:11:35 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 345d7bb0-c469-4602-4025-08dae2380b0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FMi5Cf7fBc+MI+QqFHyKqrHjxOJ86edkaHcSLUlL+Db3zXg8wisFGsyxwSbEJZCFzewGse0RuCzft7Ekr1PWda5tPeZOB0ZP8fArOGzmpXp8VDSYjBVUCE3ubX8urq+UOQYUHgF65tjWuog61ohaSK0O4VdJihriu43NWcAne4GYCI0TV2YYCKYJQu7hJrYnCbiWMNn8fQbkU2BB4ToLy22MBjkmxqriS6HH10R2UitYySI33k3mw9k7GK+467JDfct9GrAjiF5oHmNNUtoHr4SZCFebSGx/yq2QQ1HfAZTbDYosHMAhkamui3BE/bpzUUqdUcNFmnNRHyRyUflg77H7n2n/gjbUCAzbWQTFsnOILt+ez3sqzR+OwV9HsQTJT8smKXyK2g1WXGrpKGV/FYUn44WMrvi2odxvi1zrtPNbm6lRa4LtoqwjB/uJiUAbLJj8icuJYvuSZ6mcmP5SdC9SnbiVJH+Gku4aPvQKJ3hYRYMsx+7729rMkVqxlK79/jmwpl1nRoZgQkSg/r/bNrMLT9/gqtqs1ZpMBS7VwfeGbtPkBqf5mH51wACmy3SW+HbbbhMul9ICNYqfNyR/PnE9kbIGQ1t35e23RDgF/JJF1ufwpIU0DvuWkjredHS9k6u2/LF7pre+4He3hFPfkmTj3zvtCEaxzNUiXvYQqzj2lzJNS1AodWV3f97nJK1nQ9G94libdstLhRmQxNdl3w== 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:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FJ6gJQQJV/HHUNhVl0xl7FgbJ3mHBk/v3AluAvncmweP3s8BsMeuj3Vnv/4nldo+XZqPhNaXbksYzVNFBo7/PJhwqLEKyLnjqXO8t+URNSB//rkecLd4W46bVm6qmC/SkNl9Ibmr6voJ12ifuwIPqdwdf34pGsEHk4ualV0iHyKqndq45sdUq6COWA9qd6W/jZwdsj6m54rNDMyDNcmgM1Ud95cP81HBbkF9T64Xz6MObUNqW+XPZe1LCrtTYyXSH3A+kTdcQyVTQXBPA+HAmDTTtflm6mzpibvwbjKTCQv3ZCXIIC6HDgQK6CZYVLXXgKYai/w8fJmLj6oy0qmztjAQNmkxBrNn1/FanoUCndKI+MhVYGlKElzdbfBrUDKNuBupoAhWSIikwHJCuCEh1I391txzPQ+xZw91hmAB39G0KY/gQcULJDvC65nkl62lpz7I12L+/cv0kDllF8dvjeil8sm/hRPSKIlimKhYEsdET27kpY6FZAX0sPOsINikIGKfBHEuLBpXh/qEGelCAzjCM/ALsxdot5dzzibQg4asnivd/0PJe2mc0b2K+AE5On3jRXmPX+n3P7CZX07rB5eDWR/pcQ8yOVJC2I1yB/b5LOlknr+0UxiXdqWoj86IE8dw49AW+f0GqqtQ/aJnkpi0cveZrq+AKCdIzMuY+VlQc55jUykrqhEJW1ObAHt4oEehEX70PTn+HbFhUr/ayvNibrOA2kOtnzNmM6+QjTILsiIDAmGuq5YNzBuByvOUlza4YypOmOSxeM6MCYwEcXwwrikZOUuJ1kPEx3vbD7DyPtP/sgchDLco5lnxZ+xWCAKDd6WwsMqrv608yV2rwTk8bdpWLmFI6//YoepQ6pgCCJkhn6L9oqgkTObtEC9WO4NUnxXecQ2MKXiq+tNr13xQxa8V48qgvVmXOvUS78S6EQ9pO8ipnc4xoCKWZRDU6PHUS/cFqN6+Vr/fUS+qZofRsjRMdS1Q4kSTOa/DxtOW1Cz3exh6NIVIx48GTaqBP5tVjo5eedMjPn30OtaODnE7Tf3EIQfrBLfSzSFFUwuuBLsKZaNUr7ozEbjwciea7gkXw8ZHrpodf2pgid04MH0SNj9BwwYLKuAruXPFaQzmMYtkn3+U2hqkqqoly1aGzfLWmd251pNjCz6hrieuqODMRyvV+9xW9Gw0yabUpXUl92h0dAzOn5KK7v0ke9hb1HxhflFHwPJgh/DKgo7dAq0m2cwLajScjqyw/8MKbAe82FyMigfETBUBkOgX1EuW2NUHHa4/hxcYqkA/MN46Hd/sIL0k+gsMvOUPce83qA9Gt9oQxG/B5HlBul8PkB8yzUwBBDd1kLTdgW3SSP1wF0O4e5Y1l35RG7AYaZ0iFWLB+YtROb0isjpF4kQ6XIqvVpSUA3GeFIPNHmxv4QNPBrsJLQxhCpv9G+NYGt3TX1f5Rn0RzyhxCYFNfh8HrKvR9RghRcpCwZUzTVf+VKJbuxjw70/4Ih1KhkhcK1PL5Tfif4a9EspqshAcxDRris9d9fFYeulPb0TaY5RvUJ8Vbbj/9XwSg3S6Yphm6jpWsJ8xsFX0ccAPsoRUZCOOBtcq X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 345d7bb0-c469-4602-4025-08dae2380b0b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:36.0022 (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: kZyj0k0QlehAW1RoNg8r5bSc4VEOJG7QN0zudh+cKWjN9kSHuz+A1Okt54RGY7C1mhoEsepBC9pVdLSLYiEV0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221219_191242_621107_7FA569A7 X-CRM114-Status: GOOD ( 12.03 ) 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 B312 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..f7785c93292a 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-B312: + + - ``V4L2_PIX_FMT_B312`` + - '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 332d4b11bc1b..0cc58abae562 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_B312, .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 5b97d7e5dbbf..8c3d40d3acf5 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1298,6 +1298,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_BGRX32: descr = "32-bit XBGR 8-8-8-8"; break; case V4L2_PIX_FMT_RGBA32: descr = "32-bit RGBA 8-8-8-8"; break; case V4L2_PIX_FMT_RGBX32: descr = "32-bit RGBX 8-8-8-8"; break; + case V4L2_PIX_FMT_B312: 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 3475331737af..c67f895210de 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_B312 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 */