libmemtrack: fix ion memory tracking

Use 2 new columns from the kgsl debugfs mem file:
 egl_surface_count: # of buffer attachments with usage=egl_surface
 egl_image_count:   # of buffer attachments with usage=egl_image

If an ion buffer is mapped with usage=egl_surface, the entire size will
be counted towards the egl_surface. The assumption is that the buffer
will be freed if the producer process is killed.

To handle buffers such as the wallpaper and texture atlas which have
no producer and are potentially mapped multiple times, assign each
process where usage=egl_image a size of "size / egl_image_count". This
ensures that the total memory usage is correct, while still assigning
some memory to each process which maps the buffer.

The above replaces the attempts to avoid double counting buffers using
the "is_surfaceflinger" check.

CRs-Fixed: 1087134
Change-Id: I4e001f4a613520585be8799d7269aafe6140d7a6
Signed-off-by: Santhosh Punugu <spunug@codeaurora.org>
1 file changed