From patchwork Mon Aug 8 16:27:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsia-Jun Li X-Patchwork-Id: 12938886 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 B6494C00140 for ; Mon, 8 Aug 2022 16:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244014AbiHHQ2m (ORCPT ); Mon, 8 Aug 2022 12:28:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244019AbiHHQ2k (ORCPT ); Mon, 8 Aug 2022 12:28:40 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2046.outbound.protection.outlook.com [40.107.95.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 599B326D9; Mon, 8 Aug 2022 09:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TbC00M3T8+E4RiyzSLl6WeAJZVLADEa8kK5Uy+hZ3KMIIbJwYGFJQ05AVLGEFkxl6oLhd7fiV7jJM18SeAS6DjEV85ezjWXzxbNtTQP68+bEBklQJdEWPXvIf2JH54kIHTGm2QbBr5EmYqFkYGlYeCy12GcAE93ysslQeY2RVcIgCZNY5ebKCP+UyN/gIlwxmbItowxnDu57aCyWbW1OhVDWZVEociAAEsKTy1I9KuPCwMOAiKyXPi4u1XmRqEO0AvGo8bH0ueoVztcNcA/ukxWC7t5TohYGO+glVcFKJdKTnDpJHGE38FHN54dND0ntk3Kfz0Uvuj96Be6wS7ka3Q== 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=1NLlNYzcOWnRZfC3MTQkb6Nd4TC1RC3rZ25YCxbh3gY=; b=ZcuWKw3rU+EXGCk5dbmlfo2XVuu1e3vW06QwE0V5LyEeCAla4wZ+Iq8/CqGF/4AL7ERVGTaKAB84FvLoHPVkLYoPEzFPmtg5XRoPV6TMb/gQFRrTVnzas+/WunOpCtUGR0cIXdeJin2cwWG+eBqdD8LpIisNeKPlaRIYI/zVfpx8LORbeWAmkDnRjb1ew87UV+zg6PB7KngXotepsBW0uVDv9xKPr2qEJ7638fnLaM8JC8moTKz9yKmJHsJHY97Eeul6jCYlWTHDtUVymuHSACR1D0R49ZOb4SF4eFy15+I/p851EDCdB4ZL/VWfm08B/w2or1q+0vgTCb2YDVqLhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1NLlNYzcOWnRZfC3MTQkb6Nd4TC1RC3rZ25YCxbh3gY=; b=aQ74Qv7iPe/S0wCipgAam0R5OaDofDBDIbonsTAqYqqbFlkRLqbeo7wM++2sAmwMEsOSkXETRLoxjDkUv1BYlptBamauq1riFQqxlNBh1RMHAOxu1/PzqMNqUBpXq7PM9NGbA2JBBtkLF7ZfNOmnYLj8sm9o0HZRntWx6UrKVrU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=synaptics.com; Received: from DM6PR03MB5196.namprd03.prod.outlook.com (2603:10b6:5:24a::19) by BY5PR03MB5153.namprd03.prod.outlook.com (2603:10b6:a03:22c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15; Mon, 8 Aug 2022 16:28:36 +0000 Received: from DM6PR03MB5196.namprd03.prod.outlook.com ([fe80::c832:eea0:1883:a19c]) by DM6PR03MB5196.namprd03.prod.outlook.com ([fe80::c832:eea0:1883:a19c%3]) with mapi id 15.20.5504.020; Mon, 8 Aug 2022 16:28:36 +0000 From: Hsia-Jun Li To: dri-devel@lists.freedesktop.org Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie, daniel@ffwll.ch, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, ezequiel@vanguardiasur.com.ar, sakari.ailus@linux.intel.com, ribalda@chromium.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, tfiga@chromium.org, sebastian.hesselbarth@gmail.com, jszhang@kernel.org, linux-arm-kernel@lists.infradead.org, "Hsia-Jun(Randy) Li" Subject: [PATCH 1/2] drm/fourcc: Add Synaptics VideoSmart tiled modifiers Date: Tue, 9 Aug 2022 00:27:49 +0800 Message-Id: <20220808162750.828001-2-randy.li@synaptics.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220808162750.828001-1-randy.li@synaptics.com> References: <20220808162750.828001-1-randy.li@synaptics.com> X-ClientProxiedBy: BY3PR05CA0043.namprd05.prod.outlook.com (2603:10b6:a03:39b::18) To DM6PR03MB5196.namprd03.prod.outlook.com (2603:10b6:5:24a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a0827cf-1a81-4329-446e-08da795b0ab4 X-MS-TrafficTypeDiagnostic: BY5PR03MB5153:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3X4pZcfruFwZwdkPpghaqXL4XNzPZ0M99AlpP92wkuu1Iv2Yy/PQzYTqHnJkjziApRNpKHpWK8rklUd0z8nYyGxjr+O9GTeWcR9s4OWHNhkn/a0ZuDB8FisjWpUMRqmhwtxDgwUYPBk0XdSW4aa6pjYmDJF6EOel4MHbJiXdxunua+EiLnvpR+oVKLhtepGxZh+MIpmgGbgpBUqRauo5R51vKB9y33RBGIU+eg2sk9QftNKobGo379xMNYY1Ij5elPQ0f/EDW2uyW9xX4q8VnKI3MhfyYJdhZIszskFv/OXKhkbV1Igp6KAHIiZTdS9F/uC9WPZEAarNpvTxUWph4xWtixMICzPSQiqYf/mKXHTPNOVoHyLtjgszAiDhqW2iKFflB0jisEYuLylTHqAKcb5q1o8Q43O44BMUelDWuizEUQ6GL+EQkhrqpwg2zzo1LjXqcU4CrG0dnv0jPC14I90hAOodi2rzJmpi5Svi3qgqitdwrf5ja9rQ1ux1OKtO1GQhYu8ZzwjlqJP6iy6tAvDwRZOeZuVGj+6Lo+eNa9CQzk9g2eRPDJsPCcslErUIAd8s0ulSg5iG5Yig28kQIzB0aFm4CPJ/5a7BCzGYpqFljy8BNWWN7cGkOyvjP8a5hjRTesPx0ag153s4doV6fsD5KdSObIBI10lhX/JMRvQqCClNfkZkxJSeFQeM83awr4TtvJGxGzzaBxeua230b1torWb3KdOonvJV0hpUSPwpNaNi5WHKvoGoibZ63eGLO/TUnEALap+ZGpljEdrxElEFudovSSRUJpCiTsV9SJM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR03MB5196.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(376002)(346002)(39850400004)(396003)(66556008)(36756003)(86362001)(6916009)(66946007)(66476007)(8676002)(4326008)(5660300002)(6486002)(8936002)(478600001)(316002)(38100700002)(107886003)(38350700002)(6666004)(41300700001)(6506007)(52116002)(2906002)(7416002)(1076003)(26005)(2616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kuMrY4b4k/4WlcmRlpkFTs3xWB5gTI2sU0kD+jtsXKe20t+6doh3QNXe8pcFJE0iwRHNw8bVyXYlxG3ma2fEqXEoCj2+bpgzWRULoL8qEpSeiS8ZAJQwgZ1KI52BEdYeIumdcgB6+FLwFBKHVdmiBlNvHDlsKwfWJbEZcZ8gmkWy6N2VjqvZIOjx6VTtSOsYUWJ45N+u1YOlXmvk0EHJtxmf0ZJYOxyv6of7Exu8W+PDKCVhvOviSy80IYrIWco/EP3cf47VG5RTX26FB/wmqxK3HVZCVUPTq2uC710EEiWedN4c9hi6ZQOSoE+HuGCeEF6GKpJQfLc+BfG4hTRuf0PWf3xSOsr3rLi7e36xCrkdCYyDXCzEs9XAuYyWeDxLw4AJEblI003Dno7A4B6ET6+hSfuCH5UXBLenYR3Qh5NNs8cZnmuGLle4JiAyCUiqSuzpGFPxnR0rPAiOmZZws6tq8QBx/YNI82PYgg9mWFO2lO+ouTD22Ta9GJgXvj7sV0hvitGjBkbxvpocah1iK7FZG1yuqKFKtX7S6d8LtVWnFucb/Fn87iE4JHuai+8/keFpqGUvjSDhbDue/Vp69GesIgkB2G8qesZ7+EEGbvwbmyicy6iN X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a0827cf-1a81-4329-446e-08da795b0ab4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB5196.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2022 16:28:36.0223 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dX/O/oY+M0HCMv+gv6T9KL8+I1oLXh1m5exmJop+2fhBaA+lg/Lhgue1cbajrq9pmTN/hncZ73UdZq5D9Ik1Vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR03MB5153 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: "Hsia-Jun(Randy) Li" Memory Traffic Reduction(MTR) is a module in Synaptics VideoSmart platform could process lossless compression image and cache the tile memory line. Those modifiers only record the parameters would effort pixel layout or memory layout. Whether physical memory page mapping is used is not a part of format. We would allocate the same size of memory for uncompressed and compressed luma and chroma data, while the compressed buffer would request two extra planes holding the metadata for the decompression. The reason why we need to allocate the same size of memory for the compressed frame: 1. The compression ratio is not fixed and differnt platforms could use a different compression protocol. These protocols are complete vendor proprietaries, the other device won't be able to use them. It is not necessary to define the version of them here. 2. Video codec could discard the compression attribute when the intra block copy applied to this frame. It would waste lots of time on re-allocation. I am wondering if it is better to add an addtional plane property to describe whether the current framebuffer is compressed? While the compression flag is still a part of format modifier, because it would have two extra meta data planes in the compression version. Signed-off-by: Hsia-Jun(Randy) Li --- include/uapi/drm/drm_fourcc.h | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 0206f812c569..b67884e8bc69 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -381,6 +381,7 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_ARM 0x08 #define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09 #define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a +#define DRM_FORMAT_MOD_VENDOR_SYNAPTICS 0x0b /* add more to the end as needed */ @@ -1452,6 +1453,54 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) #define AMD_FMT_MOD_CLEAR(field) \ (~((__u64)AMD_FMT_MOD_##field##_MASK << AMD_FMT_MOD_##field##_SHIFT)) +/* + * Synaptics VideoSmart modifiers + * + * Macro + * Bits Param Description + * ---- ----- ----------------------------------------------------------------- + * + * 7:0 f Scan direction description. + * + * 0 = Invalid + * 1 = V4, the scan would always start from vertical for 4 pixel + * then move back to the start pixel of the next horizontal + * direction. + * 2 = Reserved for future use. + * + * 15:8 m The times of pattern repeat in the right angle direction from + * the first scan direction. + * + * 19:16 p The padding bits after the whole scan, could be zero. + * + * 35:20 - Reserved for future use. Must be zero. + * + * 36:36 c Compression flag. + * + * 55:37 - Reserved for future use. Must be zero. + * + */ + +#define DRM_FORMAT_MOD_SYNA_V4_TILED fourcc_mod_code(SYNAPTICS, 1) + +#define DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(f, m, p, c) \ + fourcc_mod_code(SYNAPTICS, (((f) & 0xff) | \ + (((m) & 0xff) << 8) | \ + (((p) & 0xf) << 16) | \ + (((c) & 0x1) << 36))) + +#define DRM_FORMAT_MOD_SYNA_V4H1 \ + DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(1, 1, 0, 0) + +#define DRM_FORMAT_MOD_SYNA_V4H3P8 \ + DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(1, 3, 8, 0) + +#define DRM_FORMAT_MOD_SYNA_V4H1_COMPRESSED \ + DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(1, 1, 0, 1) + +#define DRM_FORMAT_MOD_SYNA_V4H3P8_COMPRESSED \ + DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(1, 3, 8, 1) + #if defined(__cplusplus) } #endif From patchwork Mon Aug 8 16:27:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsia-Jun Li X-Patchwork-Id: 12938887 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 DC91DC25B0C for ; Mon, 8 Aug 2022 16:28:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244037AbiHHQ2v (ORCPT ); Mon, 8 Aug 2022 12:28:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244022AbiHHQ2r (ORCPT ); Mon, 8 Aug 2022 12:28:47 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2062.outbound.protection.outlook.com [40.107.100.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B803E38A9; Mon, 8 Aug 2022 09:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eZfN2gWQN2ocTFFqo9HaLjBSkJxVJ6x7XwcJn1SUwPt7nr+7A9UrEWCdwlgHY+wKV2vnOukIFdJLAzasbexBNFbNtqQteaIwQHMyt8aH6OFOFxOYLcvT/nnHL8YKF+NeRSHnNMGih0RMhqNxcH8dxxqnhaUBgxT9K8TUe2ayOgKD/CD/3hCtAvrif5SY7lbPf9MXhy3wCOUnW9UJ7H/LUaSoIqLbdHGh/8fzpzYXBoKm112dzaTJLS64+9PotA24zgOzNT5zmjGDfXfSno6LcdXaO2DO/x7aA/cyB9itSLXaCw9cJjzUwExKJXrFYJulpqJlbJ0+kH2/+FGDg4sbNw== 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=rK80iMTGd1eIHomFhsjpcRaZdqfqiEx88Ue6AouhtXg=; b=iv8Dqble4/bypz8gceYgjzhbo5GeX3Fh7IcNBsxYiIWNwqhI5uw8iRSGh6HPscOc3thvTxsudfjv5YL3LgRHayRkwVkJy74pIuYTPVm5zVMtdFt3Whrnitlxu3OMw9ZdmT2KuDmiZZh/KRq4uBd4PoIu3mzKW+dGGD0kmMZ3feSxe6bO4BbaGxy2jJREMEr5UZlzSCvEk9oG2YH7Tk/IOE8F2h3AP3AZYFrbXpZcIC4FwO/2sVFVKvElZ9XOj+wazi2NvrzH3tBDUuKzroI58bLvaQwBunKZHXqmt/7hltJwRv/dwYY9RYyF1g9yp63vMzWuuvN0KQzhzklWFVIKbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rK80iMTGd1eIHomFhsjpcRaZdqfqiEx88Ue6AouhtXg=; b=Ugdv0H1v1a3AYZWXnUZz2y/Vq8j+JiibbA+j8ICNClWq+WTWA+K1mVMr1axDsKWUq8XNMlruzXhgLrBunSkrz4oSahulrBwdCKmsvwrBrH7vMXb6V/xB7PxL8nq86lJTcb7apgwgtHVBvO/XMSRJhKqUYIBITLOVqkRRL57Jskc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=synaptics.com; Received: from DM6PR03MB5196.namprd03.prod.outlook.com (2603:10b6:5:24a::19) by SJ0PR03MB6389.namprd03.prod.outlook.com (2603:10b6:a03:398::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15; Mon, 8 Aug 2022 16:28:42 +0000 Received: from DM6PR03MB5196.namprd03.prod.outlook.com ([fe80::c832:eea0:1883:a19c]) by DM6PR03MB5196.namprd03.prod.outlook.com ([fe80::c832:eea0:1883:a19c%3]) with mapi id 15.20.5504.020; Mon, 8 Aug 2022 16:28:42 +0000 From: Hsia-Jun Li To: dri-devel@lists.freedesktop.org Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie, daniel@ffwll.ch, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, ezequiel@vanguardiasur.com.ar, sakari.ailus@linux.intel.com, ribalda@chromium.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, tfiga@chromium.org, sebastian.hesselbarth@gmail.com, jszhang@kernel.org, linux-arm-kernel@lists.infradead.org, "Hsia-Jun(Randy) Li" Subject: [PATCH 2/2] [WIP]: media: Add Synaptics compressed tiled format Date: Tue, 9 Aug 2022 00:27:50 +0800 Message-Id: <20220808162750.828001-3-randy.li@synaptics.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220808162750.828001-1-randy.li@synaptics.com> References: <20220808162750.828001-1-randy.li@synaptics.com> X-ClientProxiedBy: BY3PR05CA0043.namprd05.prod.outlook.com (2603:10b6:a03:39b::18) To DM6PR03MB5196.namprd03.prod.outlook.com (2603:10b6:5:24a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38bdbed9-a945-4adc-1855-08da795b0edb X-MS-TrafficTypeDiagnostic: SJ0PR03MB6389:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vb5VzMVn8fZpnWsJbmODZLq5ypMQJCUP7Bq8e5Il+iq7me9DT/k/ArfwRVY/MDXD3LS6qOgmCh+JNLxg2KatoOwFQgN76I8EajQi8C5liOEj2QQQP3riRkW92JC4VRZyp7MUSSuWSAJNG5ARWEZd3LTatprpZGWoehzPT/edMHImFu6l8E25TUC7esOVhfrn2RPwKtt71VX8u5HUms5N6o7EQaXvXjksdEgO1gYc/SDv/pTjDriXToU/kafqVVlPup1OpIkX2lvhHFTZY154GO8SnnsyGk5zxB9cMlk4EWm0BKQNDnrmJ6ujjoGNYI/B/qfh28W0YLucIlRAQBYBAv3OIxlyhFcMkoMfIfq+R0QkWD0uLysf++Sj5EIwN35Kn3WftYX1vtArM2R9lMjex94I2v1jCTGdWRaPcT72flc9dlS5tBD2H4VbAEUoLEkXOcAhtodX8b3zIwFfqUT36GKde7MzZkJLEFW+CikcNXojiq06BBkramr5BTtptbUu7ejQmAvhq+ev8YgTI2EJwE1vDeUujyEiek0xEeCLFMWx7mrM5bbu/fOWVCnp6uRx7PkgGkF+gIq6XztEsjLHQWNRolFnfTFy3sbEdxdPbPKq3m9qIL7+JHxODJKdz75IoKKobUzpUBJY2PzSjVdE5RWpJWyGbX/rJKnCFZlCC5R8aR2DZviJN88LpmfLE6CoAJDN7IC+nhfvOmojPafnVj36yUoJlFXYvlGXCoOArXcDVVwI7HhvxH7e9ClbSqqM5NvJxQuhxz1roEvjW+H+CFNPmTHtu8ydgrBA4LQ/nSXdkLcW2zEjNKioLrDjMGNL/LsWhOn+Eonaf39AinbU6Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR03MB5196.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(136003)(396003)(39860400002)(346002)(376002)(5660300002)(36756003)(6916009)(7416002)(38100700002)(38350700002)(66946007)(4326008)(66476007)(8676002)(66556008)(6666004)(316002)(478600001)(6486002)(41300700001)(966005)(8936002)(1076003)(6512007)(186003)(26005)(107886003)(2906002)(52116002)(2616005)(6506007)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4OFjWOpbKQTMDPxd/58hojKNE/c45X8xHCXAJDyHdS8nCzFL5Q9a+VpQm1Zy9LMT6pv1HPNuNkn1ffFapFKMVjiN+eEcKNqTLMSOo9V/Vxwq5Cvct5o+4tyaqpv6MK1PsH7rjCIdsT+D/F1FQsi9IEGHQ/Deb1haGtwIKtV54Ivxh8FXmFpbUIJymhcXQyfBwRqc9pa0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q90Njcz5eowfvAa2OTAf9D9X7aPQ7GNBLUTieOIGx77nNB+QSTh5Hb/WyMxcJBX2WOVQRV7ZHzqkoEZlwa8JLXIQDYd2yscsyvbC1/OAVQck1EeI8fJj36tdA2kTDOeKBVNLaHVQpBeVtBvXxm2xCZ9U7U5Ag4yolEpUP+ke3yqh7sNLKZ7rs9rpOgyogX61blJQVMXOpmDtRtlQQjgZb6d4gS4DX983BqVGEz0eXUHmdE9KtWqf8P68r+LWN1RZIqmj4VGgcko7/8H/Ps/m9eAn+NoHelkk+TatcquApAy4gczwTpAJx8bccCN/rA/ds X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38bdbed9-a945-4adc-1855-08da795b0edb X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB5196.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2022 16:28:42.8476 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: icVMVvVaXxM05VJ64pVTJf91fEHo7gllzP66rpbZn2ewd/01P9afiwcjU7m1qROZ89LHx3UbQhQNAnUNhO4DrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR03MB6389 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: "Hsia-Jun(Randy) Li" The most of detail has been written in the drm. Please notice that the tiled formats here request one more plane for storing the motion vector metadata. This buffer won't be compressed, so you can't append it to luma or chroma plane. Signed-off-by: Hsia-Jun(Randy) Li --- drivers/media/v4l2-core/v4l2-common.c | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index e0fbe6ba4b6c..f645278b3055 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -314,6 +314,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .format = V4L2_PIX_FMT_SGBRG12, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_SGRBG12, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, { .format = V4L2_PIX_FMT_SRGGB12, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, + { .format = V4L2_PIX_FMT_NV12M_V4H1C, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 5, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2, .block_w = { 128, 128 }, .block_h = { 128, 128 } }, }; unsigned int i; diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index e6fd355a2e92..8f65964aff08 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1497,6 +1497,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break; case V4L2_PIX_FMT_QC08C: descr = "QCOM Compressed 8-bit Format"; break; case V4L2_PIX_FMT_QC10C: descr = "QCOM Compressed 10-bit Format"; break; + case V4L2_PIX_FMT_NV12M_V4H1C: descr = "Synaptics Compressed 8-bit tiled Format";break; + case V4L2_PIX_FMT_NV12M_10_V4H3P8C: descr = "Synaptics Compressed 10-bit tiled Format";break; default: if (fmt->description[0]) return; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 01e630f2ec78..7e928cb69e7c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -661,6 +661,8 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 tiles */ #define V4L2_PIX_FMT_NV12M_8L128 v4l2_fourcc('N', 'A', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */ #define V4L2_PIX_FMT_NV12M_10BE_8L128 v4l2_fourcc_be('N', 'T', '1', '2') /* Y/CbCr 4:2:0 10-bit 8x128 tiles */ +#define V4L2_PIX_FMT_NV12M_V4H1C v4l2_fourcc('S', 'Y', '1', '2') /* 12 Y/CbCr 4:2:0 tiles */ +#define V4L2_PIX_FMT_NV12M_10_V4H3P8C v4l2_fourcc('S', 'Y', '1', '0') /* 12 Y/CbCr 4:2:0 10-bits tiles */ /* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */