memtrack: enable memtrack on AndroidP [3/3]

PD#SWPL-14976

Problem:
GFX memtrack is absent

Solution:
Update memtrack from nougat

Verify:
adb shell dumpsys meminfo
Confirm GL / EGL entries

Change-Id: I1aa1ba8b8dab3103d7102ee718732881bec68ca5
Signed-off-by: binqi zhang <binqi.zhang@amlogic.com>
This commit is contained in:
binqi zhang
2019-10-25 15:55:11 +08:00
committed by Luke Go
parent 2863ee62b8
commit d5781ee315

View File

@@ -1275,8 +1275,13 @@ static const struct file_operations ion_fops = {
.compat_ioctl = compat_ion_ioctl,
};
#ifdef CONFIG_AMLOGIC_MODIFY
static size_t ion_debug_heap_total(struct ion_client *client,
unsigned int id, struct seq_file *s)
#else
static size_t ion_debug_heap_total(struct ion_client *client,
unsigned int id)
#endif
{
size_t size = 0;
struct rb_node *n;
@@ -1286,9 +1291,22 @@ static size_t ion_debug_heap_total(struct ion_client *client,
struct ion_handle *handle = rb_entry(n,
struct ion_handle,
node);
#ifdef CONFIG_AMLOGIC_MODIFY
if (handle->buffer->heap->id == id) {
seq_printf(s, "%8s %p %8s %p %8s %u %8s %zu\n",
"handle=", handle,
"buf=", handle->buffer,
"heap_id=", id,
"size=", handle->buffer->size);
size += handle->buffer->size;
}
}
seq_puts(s, "----------------------------------------------------\n");
#else
if (handle->buffer->heap->id == id)
size += handle->buffer->size;
}
#endif
mutex_unlock(&client->lock);
return size;
}
@@ -1300,14 +1318,48 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused)
struct rb_node *n;
size_t total_size = 0;
size_t total_orphaned_size = 0;
#ifdef CONFIG_AMLOGIC_MODIFY
mutex_lock(&dev->buffer_lock);
seq_puts(s, "All allocated buffers listed:\n");
for (n = rb_first(&dev->buffers); n; n = rb_next(n)) {
struct ion_buffer *buffer = rb_entry(n, struct ion_buffer,
node);
if (buffer->heap->id != heap->id)
continue;
seq_printf(s, "%s %p %8s %u %8s %zu %8s %d %8s %d\n",
"buf=", buffer,
"heap_id=", heap->id,
"size=", buffer->size,
"kmap=", buffer->kmap_cnt,
"dmap=", buffer->dmap_cnt);
}
seq_puts(s, "----------------------------------------------------\n");
mutex_unlock(&dev->buffer_lock);
#else
seq_printf(s, "%16s %16s %16s\n", "client", "pid", "size");
seq_puts(s, "----------------------------------------------------\n");
#endif
mutex_lock(&debugfs_mutex);
for (n = rb_first(&dev->clients); n; n = rb_next(n)) {
struct ion_client *client = rb_entry(n, struct ion_client,
node);
#ifdef CONFIG_AMLOGIC_MODIFY
if (client->task) {
char task_comm[TASK_COMM_LEN];
get_task_comm(task_comm, client->task);
seq_printf(s, "%s(%p) %16s %8s(%u)\n",
"client", client, task_comm,
"pid", client->pid);
} else {
seq_printf(s, "%s(%p) %16s %8s(%u)\n",
"client", client, client->name,
"pid", client->pid);
}
ion_debug_heap_total(client, heap->id, s);
}
mutex_unlock(&debugfs_mutex);
#else
size_t size = ion_debug_heap_total(client, heap->id);
if (!size)
@@ -1326,6 +1378,7 @@ static int ion_debug_heap_show(struct seq_file *s, void *unused)
mutex_unlock(&debugfs_mutex);
seq_puts(s, "----------------------------------------------------\n");
#endif
seq_puts(s, "orphaned allocations (info is from last known client):\n");
mutex_lock(&dev->buffer_lock);
for (n = rb_first(&dev->buffers); n; n = rb_next(n)) {