From patchwork Sat Nov 16 04:44:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yunxiang Li X-Patchwork-Id: 13877490 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 6DBCAD68BE4 for ; Sat, 16 Nov 2024 04:45:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CDA0510E037; Sat, 16 Nov 2024 04:45:17 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="Se7XBrct"; dkim-atps=neutral Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2060.outbound.protection.outlook.com [40.107.223.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id ECB6110E037; Sat, 16 Nov 2024 04:45:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oCLC3CtvZ8g5SgQWGiThv5rr11lQAvV8f+IDqZt90Uw0HD+u9jJkUUkYHU+zxeyO7Sn1JISAqItE5+menD66f/fuxwLg2AhDKjnSEHUVTvbgZunTJ2fKtLgphbAGX7IxhvFBEfyEMsmeQwIq69p7bFET/2tC6Z5Dv/8Q5hQkvAS/Ea2GfytSqNVPavS76CSjhzWW2QCJuGIb6ZRRGn3SY222rDoYTUHNO1/lP5aXElObeVp7KpchyF+cLbmqpVjRMUt01xIovZ60T72jpD5lpvuFFL2aYo0T62i5wEk0aS9nAN0HJCIgrY+xtqfR6FToIMUSonbT2FSsFo8TOEtWTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=xSWAjmpW0RzYA3fPKkCKeVEDXtQcv56hW8REsGhZQAw=; b=J5JSJ5sJgfoK0X9unfL8geNk1kgOH9scMSIgCDRQFnduT4awwz4q49lqMTeETEAkF6NIFisyWhE5AtiBtXdtZoKIqxoQ0RoByY97tqeX2zcLlanf/C2Rrqc9wA7rHjIJQ+huSJBX5cWmC+cnhCB8Xk0UVuzIht9o/0WCoE0o7V8lOmeJusSDq0RoK0TKoz2+0q6BnpsMt5IZ4AgYJIxaagH5gh2sY2k3XHu3q69ifOUJwoCvt/cKSb8pm4Je905bwCV5baHlm4D+G3ddR7F0OUPh8tWejDRL9swYkipIm5flZbT5KOeUfQz9sbCDieASaAon0KTWKJKJ1I256m7azQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xSWAjmpW0RzYA3fPKkCKeVEDXtQcv56hW8REsGhZQAw=; b=Se7XBrct0lpwAlEfaMkT1yDVBDDfx7+25Yr4ojzrdAkZdYx5QrmOXJtNv4use5Tg+DqV92HVH0HLNhgbN3CD9L2OJc8lKleqd8M4P5YmTsBSk4hG5IYn5BzoVO63R6/8Xi6/FUPvqtWORyOcUbENl1vboSBn/aB8OwGevbyzYTg= Received: from MW4PR03CA0150.namprd03.prod.outlook.com (2603:10b6:303:8c::35) by DS7PR12MB6286.namprd12.prod.outlook.com (2603:10b6:8:95::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Sat, 16 Nov 2024 04:45:14 +0000 Received: from SJ5PEPF000001F7.namprd05.prod.outlook.com (2603:10b6:303:8c:cafe::9b) by MW4PR03CA0150.outlook.office365.com (2603:10b6:303:8c::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.18 via Frontend Transport; Sat, 16 Nov 2024 04:45:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by SJ5PEPF000001F7.mail.protection.outlook.com (10.167.242.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Sat, 16 Nov 2024 04:45:13 +0000 Received: from MKM-L10-YUNXIA9.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 15 Nov 2024 22:45:11 -0600 From: Yunxiang Li To: , , CC: , Yunxiang Li , Subject: [PATCH v8 1/5] drm: add drm_memory_stats_is_zero Date: Fri, 15 Nov 2024 23:44:48 -0500 Message-ID: <20241116044452.5925-2-Yunxiang.Li@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241116044452.5925-1-Yunxiang.Li@amd.com> References: <20241116044452.5925-1-Yunxiang.Li@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001F7:EE_|DS7PR12MB6286:EE_ X-MS-Office365-Filtering-Correlation-Id: f55f8679-6d32-413e-d9f5-08dd05f975f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?KD608meUEiXlTrsK4MmwYmEUsQmgmtY?= =?utf-8?q?wHwlHCkao56TeM+uolgipuqCxvsRtW8rgNxay63sJLZukioVLLO1L0mbh52sOSs2Y?= =?utf-8?q?p2Sd76bg2YRxwDjyl+eMv80czaL6K3f6fDdYq/5nWxWvFqB18tbAjadEZUGMSjK7n?= =?utf-8?q?UQoUqO6lYq0S/KeE867+mjpx4mvcc+89AD9HfUtjznr7mT7irPmNA2x4doqZ3hkZe?= =?utf-8?q?raNNiQ62MCvIOtAN+h3Xu8lT3WHR/sw/XfFd8QsagFtsuoyn1l6Aadb6eSTvtNbDH?= =?utf-8?q?ZOSCrVRQkvLWt8bnhTOFDemInQxKdg79xG9h5qir15PBK7hbFaT5XHHx9ha3rRXvN?= =?utf-8?q?OXhwjmiyzOO+9nmvhRl0sKfZaT78BVIo7/qoE7XECi7FI+6O8fLgLDoJA/2k2Uy9W?= =?utf-8?q?tzip6gSPlFvEAe/quEknQaAUxkHbOEHN9wyBTk5ZfExwnPBk+ZVDdiNCDeMiCWhJ9?= =?utf-8?q?V/tDBjEJicA2fU5h6xd+Zb+OSiZzSg8TWfz4YqTe6IuNV0ZLDy6PwWsuA5eN3Kw2x?= =?utf-8?q?e3bX3jxYvzEJRJIn1u3du1rwUCsga/+AKH1j2civbBwIAiPOKkddLxGD6LLkFm0aQ?= =?utf-8?q?Telw1XETMfJA9Da+DGM1d2kUYTrzUe20niYGA+Zu9VU2d4tnSfOygOLqIhU7LWwpx?= =?utf-8?q?BXR/QQ1I9PYzUgZZtLdCk1Wct8xw8SdTzkK3SanWnyRLErl42OPU98CWihKVrs70X?= =?utf-8?q?3ZCm5WeYTvWAJnadTJkzqrDUK5sB1l1qSwMY6N+H1Iyi4bAR0NMltL2EiBzXNS0L6?= =?utf-8?q?V1WWLZKrqSRhBzzVNqUZ8TcFdLjpWwx9SnJkWgCZ+84U5Qww0RWdERN+W1alXc+j9?= =?utf-8?q?b0wy3g/ABr/2kH5qy21VCnv97XNLSgPxLtH6c+9uiR5KFcXf4xhuhG25I4Zy0w+cM?= =?utf-8?q?ilIfemzfnwcWw/WBFp5we2jVEKQnLsjjjfAGMFwaw4xC8yN1EA/z61b3Of4fyz84k?= =?utf-8?q?lcc657Dltnn+SD3T/kWGtdS0Xjo8tLwrPDGlSm8uRBKNu0V6pgu7iA8l+N4jB9U6W?= =?utf-8?q?nrw3uqUtYxo0NIzXGmDdeszMeg50RCBSvKakGvQrytNkdawUFYsS4kZPDaMBSJPal?= =?utf-8?q?8e3Zzlu1OL3VtRkSOkbNpvjvfgs2Qvk/XG9rfEoq8QaXE7ZnttwTOTdbh0jgYBq81?= =?utf-8?q?PMKkN9XHdfrur9+G9Gq6+aWK4DpyFr0HXwj/Iop1k5lJDuYxlttFE+2FBbqbNCH6S?= =?utf-8?q?KDrXndD00B67HoWMAV+ved7FQg5Av0sfvyxWNHeur6rCSufE2AJ4rUmJyS0WIhyUs?= =?utf-8?q?NZTDk1+SuGzeU6sDvGm2qmCdEgnXH6vFrRR3fs4GIWfa5cGd5r2PtFUizguNbjEd/?= =?utf-8?q?WrHdA3hTHrgWDFyID5NCBMlIv/URUIgFIw=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2024 04:45:13.9310 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f55f8679-6d32-413e-d9f5-08dd05f975f8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001F7.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6286 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a helper to check if the memory stats is zero, this will be used to check for memory accounting errors. Signed-off-by: Yunxiang Li Reviewed-by: Christian König CC: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/drm_file.c | 10 ++++++++++ include/drm/drm_file.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index 714e42b051080..e285fcc28c59c 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -859,6 +859,16 @@ static void print_size(struct drm_printer *p, const char *stat, drm_printf(p, "drm-%s-%s:\t%llu%s\n", stat, region, sz, units[u]); } +int drm_memory_stats_is_zero(const struct drm_memory_stats *stats) +{ + return (stats->shared == 0 && + stats->private == 0 && + stats->resident == 0 && + stats->purgeable == 0 && + stats->active == 0); +} +EXPORT_SYMBOL(drm_memory_stats_is_zero); + /** * drm_print_memory_stats - A helper to print memory stats * @p: The printer to print output to diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h index ab230d3af138d..7f91e35d027d9 100644 --- a/include/drm/drm_file.h +++ b/include/drm/drm_file.h @@ -477,6 +477,7 @@ struct drm_memory_stats { enum drm_gem_object_status; +int drm_memory_stats_is_zero(const struct drm_memory_stats *stats); void drm_print_memory_stats(struct drm_printer *p, const struct drm_memory_stats *stats, enum drm_gem_object_status supported_status, From patchwork Sat Nov 16 04:44:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunxiang Li X-Patchwork-Id: 13877491 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 25243D68BE1 for ; Sat, 16 Nov 2024 04:45:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2FED810E182; Sat, 16 Nov 2024 04:45:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="SBpC/SgV"; dkim-atps=neutral Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3990310E11A; Sat, 16 Nov 2024 04:45:20 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AlOA6K79VCg8jOIYVabjKqHUcCoK4skuZCiGgpNjx2oQWFqW+hPid8AYzfbJ9qQI0uRKOlgAXQsscFd1lnyytQC98fhCxcrenai+fHfXbIeMQcHlctRWuR/sq2pcEksAXPYAQbjFZ75gxXccw5H4tpv1pxvof2ZiC8wO5e6shy8TAj5MlDmKhiRsgtKRm7jhsi/B1hHumK31Ac7aQm/fQsm7In+VO5oERaJEgwoQUVDXn137PMucG7HX4H2nRWfJLAyLMC9I4La8cKMMLtI0NeQZmdWc+wN/a/kp61oGY2YaxvMo6Uqc5fFpjSKs6nHTqiIDb7tpqV8MvYQcqwnD9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=G+ihOkrlIkchnLBdgCxgHpbTJFVZ+GSBpFg3OZ/vFVs=; b=eyF+f/xfQUlF6nBu5+Fq3yL4vvXhe134j2IfXmYXkjy1VFnGTpdwl1AfYj2Rx6BaF0iVjJIO1UoQOxoau1wj8A3jwILuTxAMRG6rJrFYCNSb+ODQsc0hTfYTT+IpqSUZw3mGLYWEBBH7TCdkZED1FllO/+GaJx0IfsXBWYo1P7mUmVRZj1nkc85BBbR/Kr9prYN2L5lkvOlnfl3qBa/5s+ywFKZJLJ+9qVcC8KwAP6qukfIOvJaEIr4XZ43zv3rtjD+sR+fWDbJ5NTb3BsEUx1lvovqHRf6fWUg9GCbwtcbjmCikSnTCd7jLs8OR0NMpVj5B4rf8RuQlJHbL5HMayQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G+ihOkrlIkchnLBdgCxgHpbTJFVZ+GSBpFg3OZ/vFVs=; b=SBpC/SgVkFvFf2UGH3LbhYfQz4XKG5zWzdk4xpnnM9vjSjTrSXMYLgtn5bpc7kqzL1iC7J9qN3x5KIB0Xr02hH6XGyXbff3XeYR4doBIBAJTsuiZB1w5a8W4nz6x3oWg0alcNLcdC1Twmqd0/9cD8P6FsaYAhwD3a3svm7CLCqU= Received: from CH0PR03CA0318.namprd03.prod.outlook.com (2603:10b6:610:118::26) by LV2PR12MB5917.namprd12.prod.outlook.com (2603:10b6:408:175::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Sat, 16 Nov 2024 04:45:14 +0000 Received: from CH1PEPF0000A34B.namprd04.prod.outlook.com (2603:10b6:610:118:cafe::10) by CH0PR03CA0318.outlook.office365.com (2603:10b6:610:118::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.18 via Frontend Transport; Sat, 16 Nov 2024 04:45:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CH1PEPF0000A34B.mail.protection.outlook.com (10.167.244.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Sat, 16 Nov 2024 04:45:14 +0000 Received: from MKM-L10-YUNXIA9.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 15 Nov 2024 22:45:11 -0600 From: Yunxiang Li To: , , CC: , Yunxiang Li , , Subject: [PATCH v8 2/5] drm: make drm-active- stats optional Date: Fri, 15 Nov 2024 23:44:49 -0500 Message-ID: <20241116044452.5925-3-Yunxiang.Li@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241116044452.5925-1-Yunxiang.Li@amd.com> References: <20241116044452.5925-1-Yunxiang.Li@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A34B:EE_|LV2PR12MB5917:EE_ X-MS-Office365-Filtering-Correlation-Id: 9fc21e8e-1d1c-42c3-5ac5-08dd05f9762f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: 1pI9uFrYr/CcVDsex/wqJBvmYyPIp852DZjlD0rTjCH+Q9qN5892p7/h9DezGxQ7//4yvsioYQOBMGaHFLrQ64fnUdqxLdi4E1Q8FGj2hu1PdqqXn2D8qu9l3cie8z+WCOq3BFfE1cm+qO8PLWk/5G4rxMownxS0q4noN4WTfYypVZxLEsPIrfrRRi4QhMg9uynDnH3d4Ld1BnSyWbmfN/zv0xE5SA+3fDRk181qlGtKX8U9+7zFolKQ+Ep7SqVfIoU6ozxBogoRi8nxtOVWSQupyRZdCC9IeP0CzfiFELCrsZ3x135GvdJG6frBHelHiF5jxPo6SUnN6oKI7A1/gp8GzV91gDNiCyUX99Ip3uAod2sAE8vPfT1ileKss1Ne17E1Y1xBoFpu1yWWTBjhMP+F46V4DO7f6zi0c1TKS0bNULb4Ltw8AjgbOwvye9MizAGwwT8G87PKplt06YlF4OwDYX/0Fa4/jkpKW9wqpNTvrneQH159GDk8WHzErTnXLr6UPz01uOwOFRwz9kEFLPwsd4Nb8X7KNZHRfSH1+LXpSeshKTxG19+fbTVKVOzI4HjcL7T3bpV7pHsuQ66dJIxKG7xwEVtIERi5oKjo3Yc5Ui3+fnwCVGbcFkuivo9gkCaOCTcV3vRf3D2J2dEOHMhmHlnj6NpZ+PLdaQ6ELmrYRNKQZNQk3tXuVvHEcJRZmIzkWT/bkzpLmzWQn7L9sVsvCR7EatI1BU/NX0KkxMwZjIToLwRKgvQApLEcstukuDJVZzIbiar9ib83vnjQKdH0e+D4H7usPYlZPsEPPSZI/XrTiBVgTKY9LpHHd8FGK1djLnI3AZPKnSJhXa6dpFTNlVbswqHvdrdTkzvPUfj4ikZOtRTihfCQ9GW4OlpAPH1yUK6B1fT1IJ7mOnLAsXvVd4Ff8ZKgbTeOL52LvOpceSVzsvjPU4heBERYY3x6Tyb3jrHW0ISf3xiBbZlOjq8jZ6Mua6CqKTGfufUYCQrBfohhryK6/XNT4XfsRGdvKMAVuh52Ux3bODCC2NG3ttvnd6TByd4ir0M9I0YyyE8IsnHQpSfpFGFG9ESWeJNzPhnmymzA+vnKPIx/17TdJ0+Mcruo3cnMtoVbG+Y/aPljSsJ+cFggcAa0M+qo1RJjAsYOE5Xt2bVPRJGiogKgINfBpmNXuJO9gg/Hshsi0Zi3QtGB3tbtK+g405/EF+cLf4L6riuBiUqZyozENk5Q8dKd2ydhZDiQ1yb/FVs33AeMntemPu7KCmC/45GWWbNmM1pdlyCOzrmtQ1IUKLUmUF4Hdk8LBSKZknwyHgjSJe20k1qnlW6r1oW17frInpuU+6qBtmPkqeu8f064MqCo40yo3rvThf+8FuVHNF7+bE0naaXXM9JszxheyyfniyRogqd1xCOIve05+A4Jzj+SYA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2024 04:45:14.3820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9fc21e8e-1d1c-42c3-5ac5-08dd05f9762f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000A34B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5917 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When memory stats is generated fresh everytime by going though all the BOs, their active information is quite easy to get. But if the stats are tracked with BO's state this becomes harder since the job scheduling part doesn't really deal with individual buffers. Make drm-active- optional to enable amdgpu to switch to the second method. Signed-off-by: Yunxiang Li CC: dri-devel@lists.freedesktop.org CC: intel-gfx@lists.freedesktop.org CC: amd-gfx@lists.freedesktop.org --- drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 1 + drivers/gpu/drm/drm_file.c | 13 +++++++------ drivers/gpu/drm/i915/i915_drm_client.c | 1 + drivers/gpu/drm/xe/xe_drm_client.c | 1 + include/drm/drm_gem.h | 14 ++++++++------ 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c index df2cf5c339255..7717e3e4f05b5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c @@ -97,6 +97,7 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file) drm_print_memory_stats(p, &stats[i].drm, + DRM_GEM_OBJECT_ACTIVE | DRM_GEM_OBJECT_RESIDENT | DRM_GEM_OBJECT_PURGEABLE, pl_name[i]); diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index e285fcc28c59c..fd06671054723 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -884,7 +884,9 @@ void drm_print_memory_stats(struct drm_printer *p, { print_size(p, "total", region, stats->private + stats->shared); print_size(p, "shared", region, stats->shared); - print_size(p, "active", region, stats->active); + + if (supported_status & DRM_GEM_OBJECT_ACTIVE) + print_size(p, "active", region, stats->active); if (supported_status & DRM_GEM_OBJECT_RESIDENT) print_size(p, "resident", region, stats->resident); @@ -917,15 +919,13 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file) if (obj->funcs && obj->funcs->status) { s = obj->funcs->status(obj); - supported_status = DRM_GEM_OBJECT_RESIDENT | - DRM_GEM_OBJECT_PURGEABLE; + supported_status |= s; } - if (drm_gem_object_is_shared_for_memory_stats(obj)) { + if (drm_gem_object_is_shared_for_memory_stats(obj)) status.shared += obj->size; - } else { + else status.private += obj->size; - } if (s & DRM_GEM_OBJECT_RESIDENT) { status.resident += add_size; @@ -938,6 +938,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file) if (!dma_resv_test_signaled(obj->resv, dma_resv_usage_rw(true))) { status.active += add_size; + supported_status |= DRM_GEM_OBJECT_ACTIVE; /* If still active, don't count as purgeable: */ s &= ~DRM_GEM_OBJECT_PURGEABLE; diff --git a/drivers/gpu/drm/i915/i915_drm_client.c b/drivers/gpu/drm/i915/i915_drm_client.c index f586825054918..168d7375304bc 100644 --- a/drivers/gpu/drm/i915/i915_drm_client.c +++ b/drivers/gpu/drm/i915/i915_drm_client.c @@ -102,6 +102,7 @@ static void show_meminfo(struct drm_printer *p, struct drm_file *file) for_each_memory_region(mr, i915, id) drm_print_memory_stats(p, &stats[id], + DRM_GEM_OBJECT_ACTIVE | DRM_GEM_OBJECT_RESIDENT | DRM_GEM_OBJECT_PURGEABLE, mr->uabi_name); diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c index 6a26923fa10e0..54941b4e850c4 100644 --- a/drivers/gpu/drm/xe/xe_drm_client.c +++ b/drivers/gpu/drm/xe/xe_drm_client.c @@ -229,6 +229,7 @@ static void show_meminfo(struct drm_printer *p, struct drm_file *file) if (man) { drm_print_memory_stats(p, &stats[mem_type], + DRM_GEM_OBJECT_ACTIVE | DRM_GEM_OBJECT_RESIDENT | (mem_type != XE_PL_SYSTEM ? 0 : DRM_GEM_OBJECT_PURGEABLE), diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index bae4865b2101a..584ffdf5c2542 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -48,19 +48,21 @@ struct drm_gem_object; * enum drm_gem_object_status - bitmask of object state for fdinfo reporting * @DRM_GEM_OBJECT_RESIDENT: object is resident in memory (ie. not unpinned) * @DRM_GEM_OBJECT_PURGEABLE: object marked as purgeable by userspace + * @DRM_GEM_OBJECT_ACTIVE: object is currently used by an active submission * * Bitmask of status used for fdinfo memory stats, see &drm_gem_object_funcs.status - * and drm_show_fdinfo(). Note that an object can DRM_GEM_OBJECT_PURGEABLE if - * it still active or not resident, in which case drm_show_fdinfo() will not + * and drm_show_fdinfo(). Note that an object can report DRM_GEM_OBJECT_PURGEABLE + * and be active or not resident, in which case drm_show_fdinfo() will not * account for it as purgeable. So drivers do not need to check if the buffer - * is idle and resident to return this bit. (Ie. userspace can mark a buffer - * as purgeable even while it is still busy on the GPU.. it does not _actually_ - * become puregeable until it becomes idle. The status gem object func does - * not need to consider this.) + * is idle and resident to return this bit, i.e. userspace can mark a buffer as + * purgeable even while it is still busy on the GPU. It whill not get reported + * in the puregeable stats until it becomes idle. The status gem object func + * does not need to consider this. */ enum drm_gem_object_status { DRM_GEM_OBJECT_RESIDENT = BIT(0), DRM_GEM_OBJECT_PURGEABLE = BIT(1), + DRM_GEM_OBJECT_ACTIVE = BIT(2), }; /** From patchwork Sat Nov 16 04:44:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunxiang Li X-Patchwork-Id: 13877492 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 AE5FFD68BE3 for ; Sat, 16 Nov 2024 04:45:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0435A10E3D6; Sat, 16 Nov 2024 04:45:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="XS/x5NpK"; dkim-atps=neutral Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2088.outbound.protection.outlook.com [40.107.220.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id B3F3310E185; Sat, 16 Nov 2024 04:45:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XOSa5ddmoiiPS3E4Qh3tENQQ6tGgWOvv2SEoY3CpvWlMkEth9olsTtPtTq2tY//t91/24YoctHlXWW6bqMrCbOvOW7xnNmRn8QzE9HLWbic+DDskfSeZK0U8KiO57yAfPNGI7aqelpkVQeIw8lDEqUmWpfP/f/fbV1swtWOMnQqxSjYT/hQNlu3dAC8P4LPfEIexflDJS4gUQpBjqVvA+Yj9bSXGVKGmLqr+YxP287KapD1QLlLfrnxGFusUsyRd8jcpeSrczk1VlZbRK0QTgduK5bpll79rM3katxfrt5GwaPlRlJKyVvNauE5GPuRDkGuFbIqWK1/WHv/ugeRsjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=szIvitrg0KqNNVTfHED1HC5Qdto6FEbXoYvgdi0YaTc=; b=GM3eOKn/djvD+kdAI1D/GKi0GnQmo9OmCljjjf7SpO8YqcfJiHkpX9AWyn1hcZBo8BgzbBBmIvSoAf2M6dEYmDJGsesS1bywNLBEPjPuJyKvIjb8w0Vw39/DD2kHvs3zZuWhYp0uOQNGsarhsUXO4gsKHM7bbzWZ/JP4u9TOrBEBK/EBtRbUm7QcB642krZrC7g7VaRZNBpUztKG04VmhKkXC6HJLABI+f69rA0aVXqj7OwkDebMWJZnE5p0ARdelmzbJ63uW3jj5na/aP0y3nxixr5duQuHz1IK+qhRREHuCh9872x1IgtkIWLzopOTg/0oZVLYx6rEnj6BtBUJTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=szIvitrg0KqNNVTfHED1HC5Qdto6FEbXoYvgdi0YaTc=; b=XS/x5NpKuCZ0Jb07iPMeqDKwrlBIJOub6U3SGEhIYt13TD4BwYv+p8ssM2LScKSAt9+XIS6rBsxf2RW2ClfqFbQkopQ73O8Vv8TniqCYAH90OtGVeuW7oBkCfW3ujkPpdpHPqJUiRmJ14TMccmvsHbFX4lYqtuz5DPrwB0sgz1Y= Received: from CH0PR03CA0322.namprd03.prod.outlook.com (2603:10b6:610:118::27) by BL3PR12MB6403.namprd12.prod.outlook.com (2603:10b6:208:3b3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.20; Sat, 16 Nov 2024 04:45:15 +0000 Received: from CH1PEPF0000A34B.namprd04.prod.outlook.com (2603:10b6:610:118:cafe::d7) by CH0PR03CA0322.outlook.office365.com (2603:10b6:610:118::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.18 via Frontend Transport; Sat, 16 Nov 2024 04:45:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CH1PEPF0000A34B.mail.protection.outlook.com (10.167.244.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Sat, 16 Nov 2024 04:45:14 +0000 Received: from MKM-L10-YUNXIA9.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 15 Nov 2024 22:45:12 -0600 From: Yunxiang Li To: , , CC: , Yunxiang Li , Subject: [PATCH v8 3/5] Documentation/gpu: Clarify drm memory stats definition Date: Fri, 15 Nov 2024 23:44:50 -0500 Message-ID: <20241116044452.5925-4-Yunxiang.Li@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241116044452.5925-1-Yunxiang.Li@amd.com> References: <20241116044452.5925-1-Yunxiang.Li@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A34B:EE_|BL3PR12MB6403:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ac375a9-2412-47c7-a5ea-08dd05f9767b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: gzzc6Cb51CoeIhJn6kw+H4vtY39+apQB1hUXMV/s1On2L27onqUkyeq2mkmn2/I5ZNO8wERG89c3Mb31bRQazq+TMNsdICSDKWVcm5mNxFlF+TBMgq3NdRF8ICyNTzlPtbaiFfCE+oDhqILk6Dog2zOBgoqevcjqVKobPE6IpIZk98QQ35XuvR6PxWNjiGLXonm1qSDTxl8sDCpWdGgSS93h+yiKyWdrQklcGjplNywZxsSm+9lIwweIrYze4+JXuunzTZ67DQIbRmT4bbzfHnw/7tcGUdpmVCIcqeDfVeK41DSLBWWhlnyqHyZmLv1EOQGiQXF96jzb3brF3MoJDFiMpD37jCTPObZqtrdIASq+JF+qhZS2lgzGtOB3wwKpMPbCOnIHHH2HHm9ra/iyZfr33V9OQSc5rcGvKfhbG9KhogNFt6r/vjoLZ7JRDedSXfyrHw6CwsjyS+aq4SdCL7ePWibNDuVussADosorT3NITPKdFI0lGt5hG5LWzHn8+JkyMMMuNlerOyxjKKv5hZCoy5ncLkaRcGOGsQOQM0WYPMXAJ4ZAP2mM2L8pCl8WSSmZVG1hrxUw0Gx0713a8QUB1/Yzo/rsMBtbRpLcqkD3CuhQV3CmaBx9Cy50HqZSZbZFMTItq0i61OymLNa9W76FxJzn8vnNrkS8Pve5HA1piQ8anMBC0LSQVf80ewnooGtadC3QHThjabkHPBmdFWcPHS1Kq2tgOgenGZD+7lh1vDRbvTj9RYn9PIjmqjTdbE84UiN6xSMfaEmZFlp2yheQDYv+KXkIvSBarqzXCFukRJ1ZLtPMjL8TN3iILqA4CMBt1oPD/yligu83kZSFcB9Ufmowis/qzq3WRuR+42/+NabVIxPCBmoJp9Tmuw90u/jgSfBbolxWnSSeimLYmFCatO1Lk92YpFXCf92LvcuoowTTO6xpG3RQyfrA2Dr4rWa12iaN0RHqxNzUM5dX/aiV31KDOKJ/EYhW7RCvjU3DU9dW3/Axow/2L9/gLPqGg88z9bHpSk/i9UN9gw7pYnOoYi+BqS4ZjIGlIjTpUimD6Q98Ut8RL1x7gk4FASja2eam+TgeMTfF/JTy54N0IkYcXNwCCZ9Jephb4xwcV+dTMZb0JKsuTT5PTZGCS+tjAYHqTNV/SQNroC6oZhktpnSeh+pr45Mb85pOpafp9I3VyNIBafetQYj76sxJn0usAssK2+PJWLI331i0E5qlvl8DQpq/UG95u2oAQGg1RMtXjtiO9guJ1N0cKFAXccNIh81AJRN8CYOcWPUT8lPvnCneBG1XnpjVg4MdhlT2i1TKonDe4emNj4QDwajp0hy2FkkNUrd47evi5QN2WQE3vuLC2Dm787ZgjmO8ni/auxa/vHIKRMig6pFNISfO9rB+FD9piY9knLXazzbbYTcJzg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(1800799024)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2024 04:45:14.8507 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ac375a9-2412-47c7-a5ea-08dd05f9767b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000A34B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6403 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Define how to handle buffers with multiple possible placement so we don't get incompatible implementations. Callout the resident requirement for drm-purgeable- explicitly. Remove the requirement for there to be only drm-memory- or only drm-resident-, it's not what's implemented and having both is better for back-compat. Also re-order the paragraphs to flow better. Signed-off-by: Yunxiang Li CC: dri-devel@lists.freedesktop.org --- Documentation/gpu/drm-usage-stats.rst | 36 ++++++++++++--------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/Documentation/gpu/drm-usage-stats.rst b/Documentation/gpu/drm-usage-stats.rst index ff964c707754a..973663f91a292 100644 --- a/Documentation/gpu/drm-usage-stats.rst +++ b/Documentation/gpu/drm-usage-stats.rst @@ -140,13 +140,9 @@ both. Memory ^^^^^^ -- drm-memory-: [KiB|MiB] - -Each possible memory type which can be used to store buffer objects by the -GPU in question shall be given a stable and unique name to be returned as the -string here. - -The region name "memory" is reserved to refer to normal system memory. +Each possible memory type which can be used to store buffer objects by the GPU +in question shall be given a stable and unique name to be used as the "" +string. The region name "memory" is reserved to refer to normal system memory. Value shall reflect the amount of storage currently consumed by the buffer objects belong to this client, in the respective memory region. @@ -154,31 +150,27 @@ objects belong to this client, in the respective memory region. Default unit shall be bytes with optional unit specifiers of 'KiB' or 'MiB' indicating kibi- or mebi-bytes. -This key is deprecated and is an alias for drm-resident-. Only one of -the two should be present in the output. +- drm-total-: [KiB|MiB] + +The total size of all created buffers including shared and private memory. The +backing store for the buffers does not have to be currently instantiated to +count under this category. To avoid double counting, if a buffer falls under +multiple regions, the implementation should pick only one of the regions, and do +so in a consistent manner. - drm-shared-: [KiB|MiB] The total size of buffers that are shared with another file (e.g., have more -than a single handle). - -- drm-total-: [KiB|MiB] - -The total size of all created buffers including shared and private memory. The -backing store for the buffers does not have to be currently instantiated to be -counted under this category. +than a single handle). Same caveat as drm-total- applies. - drm-resident-: [KiB|MiB] The total size of buffers that are resident (have their backing store present or instantiated) in the specified region. -This is an alias for drm-memory- and only one of the two should be -present in the output. - - drm-purgeable-: [KiB|MiB] -The total size of buffers that are purgeable. +The total size of buffers that are resident and purgeable. For example drivers which implement a form of 'madvise' like functionality can here count buffers which have instantiated backing store, but have been marked @@ -192,6 +184,10 @@ One practical example of this can be presence of unsignaled fences in an GEM buffer reservation object. Therefore the active category is a subset of resident. +- drm-memory-: [KiB|MiB] + +This key is deprecated and is an alias for drm-resident- if present. + Implementation Details ======================