Message ID | 20221129101030.57499-1-randy.li@synaptics.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp245705wrr; Tue, 29 Nov 2022 02:14:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf5QvkxeMCzEYWtNWpOW4GEVsABz9gvTP2MoJxrAHumXKTkk9tWYG6LCU0pYg8vUIw7qHvrj X-Received: by 2002:a05:6402:1802:b0:461:72cb:e5d with SMTP id g2-20020a056402180200b0046172cb0e5dmr42759133edy.410.1669716894007; Tue, 29 Nov 2022 02:14:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669716894; cv=pass; d=google.com; s=arc-20160816; b=GQ8oC+1wuJooTdCn7adnnZc07U6LYdKvZujXkYOFycSW+KEW31bsGuiI7xSTW8qsWk hiiS5jORSSY2FbkfaiNawUpN6LEeua76D71YpVGdvpEQpbdrtTzttQe54nOLJu1ecutI fo1ILgsFXfV6C7/q/tJ56T0YqgDtw4KQdjslNMhYgiM/PLgDWnWotDv72BQrD+DiXEvj Vi0GtPoOU+qT9wQ2BbAap09TJGjs8/TAsV5P2WqtMEO9YM6s/kJd/BCvvLUwsJEF4cx5 ibCYuM/SZ+CN2QUvoHsqRloHguVi6Z1BoTJEBtle9zKes5K8prtyldGHdWbZuz6Fp7A/ 3hZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=8ddCxePYf208LNv13iRvA2SYa5H+1anRlq37hgKMrLo=; b=rFnj2tYKcPr8WowFWJMzn/+PdAtcZDAc8iwl+e5uSXcDyf2ZD9GTLrlz2itlVtpxEp 2QchQjNh5SZsDtBrBtgtoPRo1rDX5hlI87ai7cgcOMdz3Cbgysf0rC89bwOnljlim12q jCDSIDA1913mnP8VvS/O2Sr9jLnteTt1EIRScxWtVOp+1XMAWDF8U1q9muM5vtCWNX8g jKlb9/ClKjfR+Qn4Th0JNFEkDV6zsI8ENYw9SOx3EbO/8/LPhSVpp3tLF6pWnisx/AJo cPp8Jb4pf/ravOnRwNCjVtEkq0U5Ivli2RrphCTqqp2f4NGpnlA2DOdi/jY8sOY1cK+/ X2HQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=nu+GHFM9; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020a056402354f00b004597aa082ddsi11659319edd.257.2022.11.29.02.14.30; Tue, 29 Nov 2022 02:14:53 -0800 (PST) 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; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=nu+GHFM9; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232341AbiK2KN3 (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Tue, 29 Nov 2022 05:13:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232303AbiK2KNF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 29 Nov 2022 05:13:05 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D28F360349; Tue, 29 Nov 2022 02:11:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NstijxWGCpUH5/1HtpXtnHxyxgyC5dD0iao+hkb9sZaUKoC5fTWtp5axmrIJUWpoEyHwcfZgRm/og9Ps/1Pc2HMjEbvXDeJ7O66jjGxOi4GI6htrcKwf877oshLalUMuBix4LzymLYiJLFpBDZYSJbirY4eV93QWbyrncGP83uhkOqkq4RC7I/AjomWhwKDz5iLhssSh07TbWJb85hHpUiMgDh/bNf4tYFJjAGIRYwgXDqIhgnN3aQjOyN6wKr7AmXtzw61XNhv5A7dnT6C30GcMzPBINzRkwHqVtPv01RxEhbO3rL/HpmqYq/WaZ+ddLN6/TW8qglfGaT6sU6tibw== 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=8ddCxePYf208LNv13iRvA2SYa5H+1anRlq37hgKMrLo=; b=eKYWf6qxqgJsevyaOVKcxvmb3xH2dQE3+JBztA96G8d8knd0ybxXjSltBZ+SOtOrZVBMJZjehdkTOTwLRNdZYb93/AeVy09fq2V1iZws8wGiypWwvVRqXfIVORMQp87FIakvQ4BJ9et3IomjTCjv3c+19R9JiKFmEAJL+6ZXhbuUlligBKfg5KIH2DyC9h1elZ0cUHC2LIDq9tQ/zraf9w4+PioVljOiKlBW9ohx/OULV043uM60LEnQtD+pm9OHWPbB2ibEh+xfp1pz1/9kk8qxuiyedw43VWcUh2AFqpqD/Lkh0DgDBE6/YCIT8Rm0xZrQ4isrShSwn2djjPYVjA== 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=8ddCxePYf208LNv13iRvA2SYa5H+1anRlq37hgKMrLo=; b=nu+GHFM97FHinahUY8S4BD4be774Pz5g7Z9c4qOCGH7ouviQiwqdyV+0CteiRoKf3xJk5gvXTlB9g1vNReFEx1U+3osg4k2FS4sbn5nWPtd3BfarondiHwnp/4UQxh8xowM1zAOpqLbSl9Zsg8oHkOPhusS/SOMaza5sS650zlI= 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 PH0PR03MB6368.namprd03.prod.outlook.com (2603:10b6:510:aa::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 10:11:07 +0000 Received: from DM6PR03MB5196.namprd03.prod.outlook.com ([fe80::a132:66d9:ed0f:e5c1]) by DM6PR03MB5196.namprd03.prod.outlook.com ([fe80::a132:66d9:ed0f:e5c1%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 10:11:07 +0000 From: Hsia-Jun Li <randy.li@synaptics.com> To: dri-devel@lists.freedesktop.org Cc: linux-media@vger.kernel.org, hverkuil@xs4all.nl, tfiga@chromium.org, nicolas@ndufresne.ca, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, linux-kernel@vger.kernel.org, ayaka@soulik.info, "Hsia-Jun(Randy) Li" <randy.li@synaptics.com> Subject: [RFC] drm/fourcc: Add a modifier for contiguous memory Date: Tue, 29 Nov 2022 18:10:30 +0800 Message-Id: <20221129101030.57499-1-randy.li@synaptics.com> X-Mailer: git-send-email 2.37.3 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR07CA0018.namprd07.prod.outlook.com (2603:10b6:a02:bc::31) To DM6PR03MB5196.namprd03.prod.outlook.com (2603:10b6:5:24a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR03MB5196:EE_|PH0PR03MB6368:EE_ X-MS-Office365-Filtering-Correlation-Id: 61d9ba93-994f-4932-3351-08dad1f207be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 23gcwD7CyWdgx+z7eDdxI6sDznvAXhWgGRQnB+0Zf+lZ4kpBg0dc4IHu2VVKEBumkPd0DcIyJy2+/jz9LAFNFoGjz341In6cb3ur9MDfPlyDqzqZt59NuhBDTBmon08dSpYCes2vvycyqzyVyRHLdhSTo/6yDOF2RKBC+iMtuR4lSxn4mh3jU3GRu8QMt3PpZI52Y9qNJXj8DSYIEOI44xSNBmpOnwvppKFelAnzy5ZbScDs0EvC1ubXy85dJHNRCJKhj8WzRvO2iaHIo0SWqv9l6sp+sOot/XzqcPkGHv/JzslX4RtJvCu5gV6hVEX1/fwN9g23ra84npirtlLf55H+TUmNmZ5r+TubQnwDqeZ9A81xqA6c84khQnFrqdImqmIgC8Bpb3U/1y+7XHfX9OY5lXqU4mdt82CvC/0HUcG21qSbNxa1xRhSpoXLYZqL3anJjIBjM2Q2Nu5lqEaSpmJaBP86dYHD6/iCFCz9j/0WZxgitsCXWpW2wTjc6JBdJRe5U01eAQMUAWfvBFvcjdoPX5nl5GpoHXiHduXcsV37dsA+3lOa/6kTmZZFzSY2llexkDJXewnmC3yubSIZWq7DsDCGWuRBM9xurr0f7TdpUK5gkyiHPYDboHpEcuRttu2TnfEuyZfoMe+7v21Ux6Zhk4yNBbWfy6BkXsJttV82hPg6j+K1sh/f0pR4q95X 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)(376002)(396003)(39860400002)(346002)(366004)(136003)(451199015)(316002)(2906002)(478600001)(66946007)(86362001)(36756003)(6486002)(6916009)(1076003)(38350700002)(38100700002)(107886003)(6666004)(6506007)(26005)(52116002)(6512007)(186003)(2616005)(5660300002)(7416002)(41300700001)(8936002)(66556008)(66476007)(4326008)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: anIJWs960hbLY/lINvDdJqaD1ftgTWRqzvO57y/Etp+69JZ8HIF9fc0/CY2/OGeMTLvlUqidfMQ4gVnSzKtA9TcjMudA8Tx3Vnj0KnySIGPU55oANj7f4tCPRdUNfuoP2j00SMvj2GaIfYFBQXaP5o+brxDPF6thpdf243P0O/2z4VpNUDcxKy2dXxjW6CKA2P0JHApuq3eu0bKDhiLRJO+S1mqbbhROh1FOcp0wX4u7GN+1QgAOOBPr2X1ugGJsZstU25VEd3zYiwWQAvdIkUibcWnvLOYdsEEipSwa8n+yZrFtHNx/Dmqq5WAAF/Sr4pNrYToYjT1e31UU0FDs6s4K3AAeLiK3V7aRcKD1QqN/PoRW9HheMV4936BWCXXSELd9od0LoqzFkbjZ/4YEqqDUkJHF8chIOoAONDq7fho44ITvO1f9uqoho7md0ngVMO45J7EpNxxb82I08kE+ZdQWGTU0AkI8KzH6PEyIt51w4DwRlPaYzr9h27RWBsaIIqUG7xNFDTUaaLr72StGCZMU9uN2IIrCM6jjieD0MiGcX6obfR1WR/DwPD8oEYXm0oT0G4mFUybl/P3kfn9Irk+0pQxG8HDuIcprQmG3TaUjOCfIkRD/1lVZ3Lrz6BNrHM8PaYqJq4/LObkQPVc5j55WcW8uPkEjRDRXSw1teB7WFAdbgMw31npIRN0uQCv7CyPDDDl/atBYe6sTZs9PfmerqmuKFXl98/0KW4tjKvJpplsUfmvl1PUsiszdOlBaXCQ56w8l4cOlJPYvbdehcQo0PdcKcDVhB6GSiHepN1DM1gR8iR4nSWfc3LUbbnyfv7O6eRaQ8geYDtJGZCovuvwZLzeNjutwYm13ZmYw0PWE+30Xr0RRyVZ4q7x6Rn8gI06/Rc/FLH969A4m1BCJGas2/hgOPqXaMH01Cp+zL3iTITTzTy7sArvI+jFXFBR0CtbuNC4H5drRaP7GhwHY3cXG1uM6z9iGyy1PjXsH0d0usfgnK2Zid8BX/O1BowVdbBz6m+bq3N8m2HEVdFJUCYbR4K+CeZH1WTc3L/RDn/4+skbcU5fZW37KzZpZHzmL/sDYP/w8x2WqASR6cgLm/K2cEP1RlhMgE9JnSF5eHauERNF5qMM5T8q1kWI1dqzVkLjAl8kMM6J8R9FBvbQLe8L6Ct/Y/sWsLuRe/AObRQ/JgNwauYpMJB0IEd/fnisKLnchCPfBOND5YPIQE05EwFBJx4tSJ8109K2o+fZn1ewAFWcUyg9fEYYt2lGulG5nLoI38KCSdbyYWiQ2A14/hVI5vVfVLcifqc7y82NEoAUixc0itoW8uojK5ygqUYiqlUwISgTtqWiKRYz+37Dd9jVz7eRQ6070NxFLENVoK3SYGfD67yi97ZKp0iF4IDcIc/1hoD4tb2C0gqK4jmlyRhgSsexHhOicWQv5dtbT57tAvX5rsxBets8E5zbIND1hg/9641c2d9AFX56XKobdn62nhQfhL0/2P0L2hsjVTHAcOouaenEEPJPGovCmfY/ekFf/HaVh1DfQRnxkHjtmri73ce56t7wm3UyM9NaGRWlB0oHzuOq3iGQlc4wxW0uP X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61d9ba93-994f-4932-3351-08dad1f207be X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB5196.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 10:11:07.1510 (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: ES/9cz5NPmqqO4a8Ax4grkntIKOXnnEFgh42wfq7XTcoa+dFJJHKaqTjEo5bW/OJQELlVZzFmLhKLfhGU8lxpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR03MB6368 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750825061881367202?= X-GMAIL-MSGID: =?utf-8?q?1750825061881367202?= |
Series |
[RFC] drm/fourcc: Add a modifier for contiguous memory
|
|
Commit Message
Hsia-Jun Li
Nov. 29, 2022, 10:10 a.m. UTC
From: "Hsia-Jun(Randy) Li" <randy.li@synaptics.com> Hello All Currently, we assume all the pixel formats are multiple planes, devices could support each component has its own memory plane. But that may not apply for any device in the world. We could have a device without IOMMU then this is not impossible. Besides, when we export an handle through the PRIME, the upstream device(likes a capture card or camera) may not support non-contiguous memory. It would be better to allocate the handle in contiguous memory at the first time. We may think the memory allocation is done in user space, we could do the trick there. But the dumb_create() sometimes is not the right API for that. "Note that userspace is not allowed to use such objects for render acceleration - drivers must create their own private ioctls for such a use case." "Note that dumb objects may not be used for gpu acceleration, as has been attempted on some ARM embedded platforms. Such drivers really must have a hardware-specific ioctl to allocate suitable buffer objects." We need to relay on those device custom APIs then. It would be helpful for their library to calculate the right size for contiguous memory. It would be useful for the driver supports rendering dumb buffer as well. Signed-off-by: Hsia-Jun(Randy) Li <randy.li@synaptics.com> --- include/uapi/drm/drm_fourcc.h | 5 +++++ 1 file changed, 5 insertions(+)
Comments
Format modifiers are for the buffer layout only, not for the allocation parameters, placement, etc. See the doc comment at the top of drm_fourcc.h.
Hi Randy, On Tue, 29 Nov 2022 at 10:11, Hsia-Jun Li <randy.li@synaptics.com> wrote: > Currently, we assume all the pixel formats are multiple planes, devices > could support each component has its own memory plane. > But that may not apply for any device in the world. We could have a > device without IOMMU then this is not impossible. > > Besides, when we export an handle through the PRIME, the upstream > device(likes a capture card or camera) may not support non-contiguous > memory. It would be better to allocate the handle in contiguous memory > at the first time. > > We may think the memory allocation is done in user space, we could do > the trick there. But the dumb_create() sometimes is not the right API > for that. > > "Note that userspace is not allowed to use such objects for render > acceleration - drivers must create their own private ioctls for such a > use case." > "Note that dumb objects may not be used for gpu acceleration, as has > been attempted on some ARM embedded platforms. Such drivers really must > have a hardware-specific ioctl to allocate suitable buffer objects." > > We need to relay on those device custom APIs then. It would be helpful > for their library to calculate the right size for contiguous memory. It > would be useful for the driver supports rendering dumb buffer as well. As a buffer can only have a single modifier, this isn't practical. Contiguous needs to be negotiated separately and out of band. See e.g. dma-heaps for this. Cheers, Daniel
On 11/29/22 18:18, Simon Ser wrote: > CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe. > > > Format modifiers are for the buffer layout only, not for the allocation > parameters, placement, etc. See the doc comment at the top of > drm_fourcc.h. In the v4l2 mail list, we have such proposal that dropping the pixel formats(not the codec formats) from v4l2 header completely, as the growing of tile pixel formats. But we can't get rid of those variants about non-contiguous(the same value FOURCC in v4l2 are all for the contiguous memory). Before I solve this problem, I believe the support for tile formats in v4l2 would never be stable. The most common way here is to hack the pixel format modifier, then userspace library could be aware this in allocation and get properties of the drm_planes. Or another way, we could add a common plane property, indicated that whether the driver requests contiguous memory plane for a format?
On Tue, 29 Nov 2022 18:10:30 +0800 Hsia-Jun Li <randy.li@synaptics.com> wrote: > From: "Hsia-Jun(Randy) Li" <randy.li@synaptics.com> > > Hello All > > Currently, we assume all the pixel formats are multiple planes, Hi, that's not true for any definition of "multiple planes" that I know of. For example, DRM_FORMAT_XRGB8888 is a single-plane format by definition. From below it sounds like you mean "physically non-contiguous". But no, pixel formats make no such assumption at all. Contiguous or not is independent of pixel formats. > devices > could support each component has its own memory plane. > But that may not apply for any device in the world. We could have a > device without IOMMU then this is not impossible. > > Besides, when we export an handle through the PRIME, the upstream > device(likes a capture card or camera) may not support non-contiguous > memory. It would be better to allocate the handle in contiguous memory > at the first time. > > We may think the memory allocation is done in user space, we could do > the trick there. But the dumb_create() sometimes is not the right API > for that. > > "Note that userspace is not allowed to use such objects for render > acceleration - drivers must create their own private ioctls for such a > use case." > "Note that dumb objects may not be used for gpu acceleration, as has > been attempted on some ARM embedded platforms. Such drivers really must > have a hardware-specific ioctl to allocate suitable buffer objects." > > We need to relay on those device custom APIs then. It would be helpful > for their library to calculate the right size for contiguous memory. It > would be useful for the driver supports rendering dumb buffer as well. > > Signed-off-by: Hsia-Jun(Randy) Li <randy.li@synaptics.com> > --- > include/uapi/drm/drm_fourcc.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h > index bc056f2d537d..ec039ced8257 100644 > --- a/include/uapi/drm/drm_fourcc.h > +++ b/include/uapi/drm/drm_fourcc.h > @@ -473,6 +473,11 @@ extern "C" { > */ > #define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) > > +/* > + * Contiguous memory > + */ > +#define DRM_FORMAT_MOD_CONTIG_MEM fourcc_mod_code(NONE, 1) NAK. This is not what modifiers are for. This also would not work in practise, because if this was a modifier, you would not be able to use the actual modifiers. Thanks, pq > + > /* > * Deprecated: use DRM_FORMAT_MOD_LINEAR instead > *
On 11/29/22 18:42, Daniel Stone wrote: > CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe. > > > Hi Randy, > > On Tue, 29 Nov 2022 at 10:11, Hsia-Jun Li <randy.li@synaptics.com> wrote: >> Currently, we assume all the pixel formats are multiple planes, devices >> could support each component has its own memory plane. >> But that may not apply for any device in the world. We could have a >> device without IOMMU then this is not impossible. >> >> Besides, when we export an handle through the PRIME, the upstream >> device(likes a capture card or camera) may not support non-contiguous >> memory. It would be better to allocate the handle in contiguous memory >> at the first time. >> >> We may think the memory allocation is done in user space, we could do >> the trick there. But the dumb_create() sometimes is not the right API >> for that. >> >> "Note that userspace is not allowed to use such objects for render >> acceleration - drivers must create their own private ioctls for such a >> use case." >> "Note that dumb objects may not be used for gpu acceleration, as has >> been attempted on some ARM embedded platforms. Such drivers really must >> have a hardware-specific ioctl to allocate suitable buffer objects." >> >> We need to relay on those device custom APIs then. It would be helpful >> for their library to calculate the right size for contiguous memory. It >> would be useful for the driver supports rendering dumb buffer as well. > > As a buffer can only have a single modifier, this isn't practical. Usually only those legacy or low cost devices would request this modifier. Unlikely they would support tile format(or we would add support for them). But yes, we would be better not set a trap for us. > Contiguous needs to be negotiated separately and out of band. See e.g. > dma-heaps for this. I don't really like the Android way here. If we are in a world of no hot-plug. That would be fine. V4L2 has had a way to negotiate the memory layout it could support. Android gralloc would use the fixed platform sentences to decide the memory layout and buffer size. That is not flexible. So would it be better that I add a common property(a list be the same length of the formats property) in drm_plane ? > > Cheers, > Daniel
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index bc056f2d537d..ec039ced8257 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -473,6 +473,11 @@ extern "C" { */ #define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0) +/* + * Contiguous memory + */ +#define DRM_FORMAT_MOD_CONTIG_MEM fourcc_mod_code(NONE, 1) + /* * Deprecated: use DRM_FORMAT_MOD_LINEAR instead *