From patchwork Tue Nov 29 10:10:30 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: 629343 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 689F8C4332F for ; Tue, 29 Nov 2022 10:13:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232274AbiK2KN0 (ORCPT ); Tue, 29 Nov 2022 05:13:26 -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 ); 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 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" 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 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/2z4VpNUDcxKy2dXxjW6CKA2P0JHApuq3eu0bKD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CSdbyYWiQ2A14/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 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: "Hsia-Jun(Randy) Li" 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 --- 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) + /* * Deprecated: use DRM_FORMAT_MOD_LINEAR instead *