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: 12938888 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 242D8C00140 for ; Mon, 8 Aug 2022 16:29:51 +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=b2hvvHZCWus9PtOucyGQPoAvGtOdS/jwA2gLs9gMXiU=; b=k9xJdetGNzhh5U N4zOzT6AkqWepOxe59/fpyUd6DyO7yHV5jc3pmVd8ME1638Ga0lPsrC5EKEZU6uMp+lgF+XhyV+jS XvBecMmzeryPsiAxpbx+9qFo9MkOTRC6RuRVL2ND3vcC1zNjy7FYL5nq7v6n2PmqWut9z5mQLeoTw CTF3s7ugH8GPbbNOP9IxE5RDwZZxcD8mYdvZbe+Zw1xucsqCV5OQdAfhSVJMckk5XxFvajb/WP37E nLAzOvhYvPIB9EGNr1ieuyqCTXKAYAnEaj2Ffx0/cYqsQZc7Ej+E/aaf/QGsTM4TcKusN52FbDyi+ zEotHrWDbyGkVuMZXqtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL5cS-00EwTA-Rp; Mon, 08 Aug 2022 16:28:45 +0000 Received: from mail-bn7nam10on2065.outbound.protection.outlook.com ([40.107.92.65] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL5cO-00EwRv-1g for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2022 16:28:41 +0000 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)(2616005)(83380400001)(6512007)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: U2cqyR5ebcI3OgO1/pWRI9G0ZKasxinWYhCC4uMj8zPWGCcKmvU4qBRpXCLmSw6U1yIdmK99tI9IcYv+zJNd+hKoMLLgV3dQLpoC2/r3sQYAFLzODqd/3SMhHPQXKYy/I8ffYysihS9E8jnsqnBf5Oy+7gBaT0xkKhFRK3DX4fV2q0R2Pk7Zh1c7gW7lWIg3zPBlWVQ5LtzC5QrFWNv6ri5uNuw3Jwt6N7oYDwzulkPXb+CREdusXS+F0H+haXjliJFHFQp/pCh0EtfOyWSxgzxEzunyHcOFus9RKt7alQ8kQpPBAbpfWWzEVxwdmoYupDU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BLenYR3Qh5NNs8cZnmuGLle4JiAyCUiqSuzpGFPxnR0rPAiOmZZws6tq8QBx/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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220808_092840_123732_C67ABFAA X-CRM114-Status: GOOD ( 19.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 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