From patchwork Sun Apr 2 15:33:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randy Li X-Patchwork-Id: 78262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1806276vqo; Sun, 2 Apr 2023 08:56:51 -0700 (PDT) X-Google-Smtp-Source: AKy350bgS8gvHqzgTBvuyeMFOK920Je0cZosvXhsiNktw66/eUgqLaYICqWjcsBe+gxqwuMpScHI X-Received: by 2002:a05:6402:445:b0:502:3ff1:2fcc with SMTP id p5-20020a056402044500b005023ff12fccmr21983858edw.35.1680451010988; Sun, 02 Apr 2023 08:56:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680451010; cv=none; d=google.com; s=arc-20160816; b=NVxfy8eiC6oAUhSGz1E51z28yUNSYfhpOdnLWeDR+GTBkFrILNZ1nw2Ey23Tdjbf4B PBsR2mbWfiu/h1XbILUoj/HuFPOZltXerKlq7o1IMrPUZtOVksYbQ36KGpsvP37vaz/a Y2CLwYdDplibTYzKnPcxAOq69o2lopZEsYXuWhACY4ENpcvd50ppUCWg5RLJI7nXWq8/ CO+mJa+qxAUDQsHZEU7ALx73gsq95Xhgn+QUR1Codz+suOsKo5PFD1nldnuz7KY+QVir pBpkdlrpdbJZusLPe3jYYH0vDv4lOadY2V+dy4C27iYLsWklC3cvwK75VlaK8Dj8Rut6 G0Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ioVX8Nr4TqnSberjTsFA4ntPWzO6kbSyjkG3QrIiV+A=; b=s6RQggWWnBgQkBBaZkSHf1VY7qVQhRpgS8oa2QwCBuplavF1MA1ArjIl2So0j+L0ZP VZIiNVW48yyd7S/g8H3j7ENiLmOflY+kwyP9wlc5qUDS8rlFavE0p6GRqope/6XEbPTt ZaQPWsh5waZ2GOJ+yuT/QmGUTil3/JwbaR7w4njDZRwIobS47llCVCx7IzZ8shZ+s3gv hOA7p66MqNsjeQm30wuxwDf8ud6aGXKrENEafFu09uA+R0Ax299gvKkwvEERsVK1FBOf 0PEtJqKP1EWn982hJytZO5byk57qiXectXLrSeD/mzwx0lv5044riDt2xq+KwVHUfaZw RGNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r6-20020aa7d586000000b004fadb35d2ddsi3946827edq.431.2023.04.02.08.56.27; Sun, 02 Apr 2023 08:56:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbjDBPlj (ORCPT + 99 others); Sun, 2 Apr 2023 11:41:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbjDBPle (ORCPT ); Sun, 2 Apr 2023 11:41:34 -0400 X-Greylist: delayed 422 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 02 Apr 2023 08:41:27 PDT Received: from kozue.soulik.info (kozue.soulik.info [108.61.200.231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50ED47282 for ; Sun, 2 Apr 2023 08:41:27 -0700 (PDT) Received: from ritsuko.sh.sumomo.pri (unknown [112.64.60.49]) by kozue.soulik.info (Postfix) with ESMTPSA id 46CBA100C93; Mon, 3 Apr 2023 00:34:18 +0900 (JST) From: Randy Li To: dri-devel@lists.freedesktop.org Cc: "Hsia-Jun(Randy) Li" , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, linux-kernel@vger.kernel.org, tfiga@chromium.org, nicolas@ndufresne.ca, laurent.pinchart@ideasonboard.com, ribalda@chromium.org Subject: [PATCH v7 1/2] drm/fourcc: Add Synaptics VideoSmart tiled modifiers Date: Sun, 2 Apr 2023 23:33:57 +0800 Message-Id: <20230402153358.32948-2-ayaka@soulik.info> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230402153358.32948-1-ayaka@soulik.info> References: <20230402153358.32948-1-ayaka@soulik.info> MIME-Version: 1.0 X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762080599209115005?= X-GMAIL-MSGID: =?utf-8?q?1762080599209115005?= From: "Hsia-Jun(Randy) Li" 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. 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 de703c6be969..ee13250f06f4 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -419,6 +419,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 */ @@ -1519,6 +1520,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 From patchwork Sun Apr 2 15:33:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Randy Li X-Patchwork-Id: 78261 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1805833vqo; Sun, 2 Apr 2023 08:55:29 -0700 (PDT) X-Google-Smtp-Source: AKy350bz8BAWv8RYyW3laHWx6tguXc6OLqFeV57NjiQ1Kio7zzTp/7ONpMyegUHGmNvaei7GqGiT X-Received: by 2002:a62:2905:0:b0:62d:e5eb:2d73 with SMTP id p5-20020a622905000000b0062de5eb2d73mr8926890pfp.34.1680450929558; Sun, 02 Apr 2023 08:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680450929; cv=none; d=google.com; s=arc-20160816; b=LR5qVhqTq+V8vYPQhw7q55QANJHTuA9DtzVdoOOO+VucqyBO+l/MRRjNUfvtSlDJiJ 08afdRDV0SBSLA32+5V94Xe7HsbEFGXzw78zjkAFP6mebIO8hXxaBy42rpymPdVr+8b+ fFtZl1QWxoDoXK9LTNiSZq8z4GDkN5QrzcFU+WBNUO4umuiCAvo137c2deYeBYT4Odbi 8iiz6rTrOrnIHCEYO5EWZ6PK5+8p5uIWiYVm0p78K2pgN+rTFG54H+q8eoMQ6Ip9DnRZ s7rXwowW/VsaV6D8sqQnGuQdINVQqrw2qOYmi+YRyzgVgBrao7Fro4lXn3eYv6EFKAye 8/Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6VLOzuO4oXu4UtrAZOh0L4SBReLnviqGLYFzHOYZnzs=; b=vVyqygkbN/pfjvsjQulO3sjus0CPT040hBsIZshSDn44XLMBDvmK47sbU8HL8IEUpK UniIOH5ALkozsquTxiGu0uAuJqJ33zHVkVX9nb3G01ZglxbRQIkPI+AS6TX/FyBJej0D rt1LSfvbuhXuOdLuLM/D2Tw8R6SXW/oUtrqsummksT3EEGadNMzgy7U++W4SeEEM/vVo GNIWudJExhzRnue1G7wXE4CvqXQYUX8ta0yo/yn9Stg6xuCmllQlhzS6Jw4pmi/BvfFu FO7EfFvJywAN0YKRoQVW6cGDtoLlD+eZgtg3k755Aj7reFQkN01u2U9otToXdCM1WY9S jcVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z24-20020a63e558000000b00513232c46e6si6568556pgj.283.2023.04.02.08.55.17; Sun, 02 Apr 2023 08:55:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231178AbjDBPlg (ORCPT + 99 others); Sun, 2 Apr 2023 11:41:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230498AbjDBPle (ORCPT ); Sun, 2 Apr 2023 11:41:34 -0400 X-Greylist: delayed 423 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 02 Apr 2023 08:41:27 PDT Received: from kozue.soulik.info (kozue.soulik.info [IPv6:2001:19f0:7000:8404:5054:ff:fe75:428f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50DE26A68 for ; Sun, 2 Apr 2023 08:41:26 -0700 (PDT) Received: from ritsuko.sh.sumomo.pri (unknown [112.64.60.49]) by kozue.soulik.info (Postfix) with ESMTPSA id A709B101DA9; Mon, 3 Apr 2023 00:34:27 +0900 (JST) From: Randy Li To: dri-devel@lists.freedesktop.org Cc: Randy Li , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, linux-kernel@vger.kernel.org, tfiga@chromium.org, nicolas@ndufresne.ca, laurent.pinchart@ideasonboard.com, ribalda@chromium.org, Hsia-Jun Li Subject: [PATCH v7 2/2] Documentation/gpu: Add Synaptics tiling formats documentation Date: Sun, 2 Apr 2023 23:33:58 +0800 Message-Id: <20230402153358.32948-3-ayaka@soulik.info> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230402153358.32948-1-ayaka@soulik.info> References: <20230402153358.32948-1-ayaka@soulik.info> MIME-Version: 1.0 X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762080513968592823?= X-GMAIL-MSGID: =?utf-8?q?1762080513968592823?= Signed-off-by: Randy Li Signed-off-by: Hsia-Jun(Randy) Li --- Documentation/gpu/drivers.rst | 1 + Documentation/gpu/synaptics.rst | 81 +++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 Documentation/gpu/synaptics.rst diff --git a/Documentation/gpu/drivers.rst b/Documentation/gpu/drivers.rst index 3a52f48215a3..7e820c93d994 100644 --- a/Documentation/gpu/drivers.rst +++ b/Documentation/gpu/drivers.rst @@ -18,6 +18,7 @@ GPU Driver Documentation xen-front afbc komeda-kms + synaptics .. only:: subproject and html diff --git a/Documentation/gpu/synaptics.rst b/Documentation/gpu/synaptics.rst new file mode 100644 index 000000000000..a3b24c297186 --- /dev/null +++ b/Documentation/gpu/synaptics.rst @@ -0,0 +1,81 @@ +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later + +================ +Synaptics Tiling +================ + +The tiling pixel formats in Synpatics Video Smart platform have +many variants. Tiles could form the group of tiles, pixels within +the group (nearest) width and height are stored into tile. +Meanwhile, the tile in a group may not follow dimension layout, +tile could form a small group of tiles, then that (sub)group +of tiles would form a bigger group. We won't describe the dimension +layout inside the group of tiles here. The layout of the group +of tiles is fixed with the group width and height parameters +in the same generation of the platform. + +Compression +=========== +The proprietary lossless image compression protocol in Synaptics +could minimizes the amount of data transferred (less memory bandwidth +consumption) between devices. It would usually apply to the tiling +pixel format. + +Each component would request an extra page aligned length buffer +for storing the compression meta data. Also a 32 bytes parameters +set would come with a compression meta data buffer. + +The component here corresponds to a signal type (i.e. Luma, chroma). +They could be encoded into one or multiple metadata planes, but +their compression parameters still would be individual. + +Pixel format modifiers +====================== +Addition alignment requirement for stride and size of a memory plane +could apply beyond what has been mentioned below. Remember always +negotiating with all the devices in pipeline before allocation. + +.. flat-table:: Synpatics Image Format Modifiers + + * - Identifier + - Fourcc + - Details + + * - DRM_FORMAT_MOD_SYNA_V4H1 + - DRM_FORMAT_NV12 + - The plain uncompressed 8 bits tile format. It sounds similar to + Intel's Y-tile. but it won't take any pixel from the next X direction + in a tile group. The line stride and image height must be aligned to + a multiple of 16. The height of chrominance plane would plus 8. + + * - DRM_FORMAT_MOD_SYNA_V4H3P8 + - DRM_FORMAT_NV15 + - The plain uncompressed 10 bits tile format. It stores pixel in 2D + 3x4 tiles with a 8bits padding to each of tile. Then a tile is in a + 128 bits cache line. + + * - DRM_FORMAT_MOD_SYNA_V4H1_64L4_COMPRESSED + - DRM_FORMAT_NV12 + - Group of tiles and compressed variant of ``DRM_FORMAT_MOD_SYNA_V4H1``. + A group of tiles would contain 64x4 pixels, where a tile has 1x4 + pixel. + + * - DRM_FORMAT_MOD_SYNA_V4H3P8_64L4_COMPRESSED + - DRM_FORMAT_NV15 + - Group of tiles and compressed variant of ``DRM_FORMAT_MOD_SYNA_V4H3P8``. + A group of tiles would contains 48x4 pixels, where a tile has 3x4 pixels + and a 8 bits padding in the end of a tile. A group of tiles would + be 256 bytes. + + * - ``DRM_FORMAT_MOD_SYNA_V4H1_128L128_COMPRESSED`` + - DRM_FORMAT_NV12 + - Group of tiles and compressed variant of ``DRM_FORMAT_MOD_SYNA_V4H1``. + A group of tiles would contain 128x32 pixels, where a tile has 1x4 + pixel. + + * - ``DRM_FORMAT_MOD_SYNA_V4H3P8_128L128_COMPRESSED`` + - DRM_FORMAT_NV15 + - Group of tiles and compressed variant of ``DRM_FORMAT_MOD_SYNA_V4H3P8``. + A group of tiles would contains 96x128 pixels, where a tile has 3x4 pixels + and a 8 bits padding in the end of a tile. A group of tiles would + be 16 KiB.