From patchwork Wed Nov 23 09:19:57 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: 13053282 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 09D7CC433FE for ; Wed, 23 Nov 2022 09:21:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237498AbiKWJVD (ORCPT ); Wed, 23 Nov 2022 04:21:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237417AbiKWJUi (ORCPT ); Wed, 23 Nov 2022 04:20:38 -0500 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2062.outbound.protection.outlook.com [40.107.95.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 744108FE74; Wed, 23 Nov 2022 01:20:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y/7MSF+96YqP3yqWbDbZY/l4j8tQu8Zegy7g853avB0Ji+fnEOV3h6WySqAV2aU9Q0XJp8+Y2gU1c153AUGG4Us7IUHA5suRIHheyzSzfzZOZ2qo/LgmOi8Z2SQ7Vnzpnsacphu/stOWjOBBJzh2oa9ejb4wZ2Kf5Nw3b7Q2Dra7paeAvait33QUndDvKLjQL0MstUsluGqgxllUfTAV12pU2CNIO8isOg+fnn2xom5jQrI5nrZ1/YIDkfRRQXAX+/mwvVw4R+fIjm7AHNUrYaS1oQaKsbGuLyP58y/4b59RgF6cD9brOIWI2zpM5cIWs8AKI+KceacVTiDYsr5QaA== 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=V9nxb7J9kIIeH/n/FLXw3QUOA6jjKpMU+gpq28t8f7c=; b=bqf3nasCKvhwDJ6AHLlT9/QoSBhuSLuow3iM1vUBV7Bo9xJOKG8fjTnt2nlJa9M9/GrtUgn/HIIt50mtuKIQr3icS/PNLEYZPM581WFt6bvo1WDd7DP4fQS39FHKFSRc1c+iK3zJkKJMT0UrOiilqK14cAPtAE0jfggplfDF96ESat+1HCXSxMjEeCFOGAAH3viYcoAub5SvSFNCoQMNym2j22/yNUIbSw4S1Lbkf9h9HKDE1R6zyUl2Xej0XFzWHLFzgze/ohKd3M+RWp90kV5nMbN55KpbZlUobwOUXd1P3KfPTueoBaVMYns7yNH3WA+UNUuEx8Iw2+cUxgrU6Q== 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=V9nxb7J9kIIeH/n/FLXw3QUOA6jjKpMU+gpq28t8f7c=; b=U/ZiurlUqIfgnjSNfoDlCnIpzIrXdAcAw9XpVmcwuXnDQmmXXnlp28R/16B7G1hftdEcQlEq3oXWMz1qH0NG0WeXXK3GRH46YfxtVaMXHCSWHavIHtneBGGnlFx4ml5rdW8DK0BgBgAbu5oT7P1CUE7Heyzr+9ntSeUBLv7iHIo= 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 CO1PR03MB5682.namprd03.prod.outlook.com (2603:10b6:303:94::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.17; Wed, 23 Nov 2022 09:20:34 +0000 Received: from DM6PR03MB5196.namprd03.prod.outlook.com ([fe80::a132:66d9:ed0f:e5c1]) by DM6PR03MB5196.namprd03.prod.outlook.com ([fe80::a132:66d9:ed0f:e5c1%6]) with mapi id 15.20.5834.015; Wed, 23 Nov 2022 09:20:34 +0000 From: Hsia-Jun Li To: dri-devel@lists.freedesktop.org Cc: airlied@linux.ie, daniel@ffwll.ch, ezequiel@vanguardiasur.com.ar, helen.koike@collabora.com, jszhang@kernel.org, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, maarten.lankhorst@linux.intel.com, mchehab@kernel.org, mripard@kernel.org, nicolas@ndufresne.ca, ribalda@chromium.org, sakari.ailus@linux.intel.com, sebastian.hesselbarth@gmail.com, tfiga@chromium.org, tzimmermann@suse.de, ayaka@soulik.info, "Hsia-Jun(Randy) Li" Subject: [PATCH v4] drm/fourcc: Add Synaptics VideoSmart tiled modifiers Date: Wed, 23 Nov 2022 17:19:57 +0800 Message-Id: <20221123091957.75967-1-randy.li@synaptics.com> X-Mailer: git-send-email 2.37.3 X-ClientProxiedBy: SJ0PR13CA0053.namprd13.prod.outlook.com (2603:10b6:a03:2c2::28) To DM6PR03MB5196.namprd03.prod.outlook.com (2603:10b6:5:24a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR03MB5196:EE_|CO1PR03MB5682:EE_ X-MS-Office365-Filtering-Correlation-Id: 614fc8ce-3403-4f5f-8e02-08dacd33f858 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uHLhaFLCZGgmIKGmrAnLN8fqtFGcO755GSriGlXJPlY3XLSbBaOEWk/EWX9Qy2o5B8LCWhgcgBNIcxlPwV9jfVZtwOa1B8Rpnc0wJ+MQJoN0ItZ8HWi9uEpJhuCGAJZPlBOFs1bjOX4f6EaRHsaUjgv4ZcxZtnx9W2EEBqNbXj9jng+dfcHf0lhMPZhkIJF8R2dSRHeLS4aL45Lx00K9tS+N1v5R+X0yqhdRgrZy1WRkt6Vhzj1NVPHs7vYCF+cPO2luW2mYNfGPxShJPuLswBq8AzFq+c3F5t35g8x52ORJ/lzYsQrc1UaFf3IXXgPO5FyknwHeuBPtp0Puohk7fI4JlS/YisJua2oZ1XzxLygZhjNY0DWmhACdnHx5jCo4oeqmUbV2cVclBC/La2nViBHHlBkE+yMi8S3w6SXnUsab3KzPuNDDaYD0550xjkbWz2cvl1zUrUjVaxZQ698hSYMml7FvsuSZomd+89pq54VBwBuWQwC0LJIK3z0J3RyDZzdMFMJjI+7fZD/1VB0ipQLHx896lP7bAb5HoDjPVa5ecDjdASTmQutdYhnEUfPp5siO8cZn33USsX5hwc5PaP/k50xIgK552Q/YdZfwlq/P2pw+iXmWtkyVZMyjnYRAOxB4BTP7i5UodeAPt3egj59CBrJ0f5+zW58b0WzwsZBq8zw6vu7uC/7A2fmBMQ9EAQPlgyYaPPIzDv8hLPd9ww== 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:(13230022)(366004)(376002)(39860400002)(136003)(346002)(396003)(451199015)(36756003)(2906002)(5660300002)(316002)(8936002)(66476007)(86362001)(186003)(2616005)(66556008)(6916009)(7416002)(83380400001)(4326008)(478600001)(26005)(6512007)(66946007)(1076003)(6486002)(8676002)(107886003)(6666004)(38350700002)(38100700002)(52116002)(6506007)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSp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hc6LaBVqVDPYlUbNOMfDdLmejAlv2kzULLxu8EmHcGvI3ElwELcHGcZaJHVs2wG/bsk52mRZbWEwgrPqdeojgzLVh/8GTMhqgbyVOF0wst0DEcjmck4ghtYkCceZIRpqYb0CZoaYDK90DInll/oEWQi3I9xQaUSODrv1IbX4JGHvnyey4LdCoSmsVoK2G0a5M4++bS5s5k88s03HPWDheiB51feSJf0AuGcrnn+24RT40NUXXbxpLXtFc0x1luhnt97+hEnKUrg8Qlq/UFAYO5zRHjR8KoGn1kuPuevA9Dm4Bo6N70zT8wwT44LDYTYZL6KXz/9DOya45s59zMJoL5p5XLJ5hMIIo7+NYOzwlAgfBgSIO3N3RarJp3qZ71BLi6M29bIhgCuebLS2vztC6YvNvcp4cu/SZXj7i9AP48+fHahMZY4bPYJQ2tofbf2W/v6NJ0A6+aEXfFaeVtxXbLHJDWGvgLBnWhbdKTadUXYviHWOjGixUOAUXtNd7MD0YKtwjdVQ/j X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 614fc8ce-3403-4f5f-8e02-08dacd33f858 X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB5196.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2022 09:20:34.3672 (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: UUAVmx351ZAIgStjztlRHUwi9bUBgWPLKlOVz8ng/T/8xZnnI+Jyum/fD3NhiSan1zNAWwiTKK10f+tx4H/CVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR03MB5682 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. Signed-off-by: Hsia-Jun(Randy) Li --- include/uapi/drm/drm_fourcc.h | 75 +++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index bc056f2d537d..ca0b4ca70b36 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -407,6 +407,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 */ @@ -1507,6 +1508,80 @@ 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 + * + * Tiles could be arranged in Groups of Tiles (GOTs), it is a small tile + * within a tile. GOT size and layout varies based on platform and + * performance concern. When the compression is applied, it is possible + * that we would have two tile type in the GOT, these parameters can't + * tell the secondary tile type. + * + * Besides, an 8 size 4 bytes arrary (32 bytes) would be need to store + * some compression parameters for a compression meta data plane. + * + * 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. + * + * 20:20 g GOT packing flag. + * + * 23:21 - Reserved for future use. Must be zero. + * + * 27:24 h log2(horizontal) of bytes, in GOTs. + * + * 31:28 v log2(vertical) of bytes, in GOTs. + * + * 35:32 - 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, g, h, v, c) \ + fourcc_mod_code(SYNAPTICS, ((__u64)((f) & 0xff) | \ + ((__u64)((m) & 0xff) << 8) | \ + ((__u64)((p) & 0xf) << 16) | \ + ((__u64)((g) & 0x1) << 20) | \ + ((__u64)((h) & 0xf) << 24) | \ + ((__u64)((v) & 0xf) << 28) | \ + ((__u64)((c) & 0x1) << 36))) + +#define DRM_FORMAT_MOD_SYNA_V4H1 \ + DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(1, 1, 0, 0, 0, 0, 0) + +#define DRM_FORMAT_MOD_SYNA_V4H3P8 \ + DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(1, 3, 8, 0, 0, 0, 0) + +#define DRM_FORMAT_MOD_SYNA_V4H1_64L4_COMPRESSED \ + DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(1, 1, 0, 1, 6, 2, 1) + +#define DRM_FORMAT_MOD_SYNA_V4H3P8_64L4_COMPRESSED \ + DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(1, 3, 8, 1, 6, 2, 1) + +#define DRM_FORMAT_MOD_SYNA_V4H1_128L128_COMPRESSED \ + DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(1, 1, 0, 1, 7, 7, 1) + +#define DRM_FORMAT_MOD_SYNA_V4H3P8_128L128_COMPRESSED \ + DRM_FORMAT_MOD_SYNA_MTR_LINEAR_2D(1, 3, 8, 1, 7, 7, 1) + #if defined(__cplusplus) } #endif