Add imported to geminfo 07/281807/2
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 22 Sep 2022 04:46:13 +0000 (13:46 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 22 Sep 2022 10:20:55 +0000 (19:20 +0900)
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 <sw0312.kim@samsung.com>
memps.c

diff --git a/memps.c b/memps.c
index 2504cd8..787b899 100644 (file)
--- 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;