diff options
author | Yunxiang Li <Yunxiang.Li@amd.com> | 2024-12-19 10:14:07 -0500 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2024-12-19 16:56:05 +0100 |
commit | fd265d9e0c3358e6b9fe244d8f5d2824fda1c0dc (patch) | |
tree | 765d6f798b2d5f23356b968144da5f3529dd33d7 /drivers | |
parent | 314d44bc8eaab6e159ebf187356e9bd40e2baf9b (diff) |
drm: add drm_memory_stats_is_zero
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 <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241219151411.1150-2-Yunxiang.Li@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/drm_file.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index cb5f22f5bbb6..f10b6938c577 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -845,6 +845,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 |