From da0df8a10341b064299fee4c3deb50f4163a4469 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Thu, 22 Sep 2022 13:46:13 +0900 Subject: [PATCH] Add imported to geminfo When imported of geminfo is 1, then it means the gem is not allocated from the gpu driver, instead, it is imported from other driver as dma-buf fd. In render drm driver case, it is usually imported from kms drm driver. The information will be used later. Change-Id: I4f139344e54c7d1ea6c04f2f9d98a1c3ad0bbe9c Signed-off-by: Seung-Woo Kim --- memps.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/memps.c b/memps.c index 2504cd8..787b899 100644 --- a/memps.c +++ b/memps.c @@ -117,6 +117,7 @@ struct geminfo { unsigned rss_size; unsigned pss_size; unsigned hcount; + unsigned int imported; }; static int sum; @@ -224,7 +225,7 @@ static unsigned get_peak_rss(unsigned int pid) return 0; } -#define NUM_GEM_FIELD 6 +#define NUM_GEM_FIELD 7 static geminfo *read_geminfo(FILE *fp) { @@ -232,11 +233,12 @@ static geminfo *read_geminfo(FILE *fp) char line[BUF_MAX]; unsigned int pid, tgid, handle, refcount, hcount; unsigned gem_size; + unsigned int imported; if (fgets(line, BUF_MAX, fp) != NULL) { - if (sscanf(line, "%d %d %d %d %d 0x%x", + if (sscanf(line, "%d %d %d %d %d 0x%x 0x%*x %*d %*d %d", &pid, &tgid, &handle, &refcount, - &hcount, &gem_size) != NUM_GEM_FIELD) + &hcount, &gem_size, &imported) != NUM_GEM_FIELD) return NULL; if (hcount == 0) @@ -248,6 +250,7 @@ static geminfo *read_geminfo(FILE *fp) tgeminfo->hcount = hcount; tgeminfo->rss_size = KB(gem_size); tgeminfo->pss_size = KB(gem_size/tgeminfo->hcount); + tgeminfo->imported = imported; } else return NULL; -- 2.7.4