diff options
author | Xianzhong <b07117@freescale.com> | 2013-09-04 00:35:48 +0800 |
---|---|---|
committer | Xianzhong <b07117@freescale.com> | 2013-09-12 03:18:00 +0800 |
commit | b7d1aaa501b1f4f694c6f6b0816ec88ae01c398f (patch) | |
tree | 01a3a62b38ffc9c8dc13135b4c5a6b8c5a884382 | |
parent | 02965f5f7558e6201d51857ed80875ba7f770af6 (diff) |
ENGR00278179 query gpu memory with seperate types
In this new implementation, gpu memory can be queried with seperate types,
root@sabresd_6dq:/ # ./gmem_info
Pid Total Reserved Contiguous Virtual Nonpaged Name
2367 143,845,248 42,575,232 98,124,288 0 3,145,728 /system/bin/surfaceflinger
3870 46,297,952 19,706,720 26,066,944 0 524,288 com.android.email
2794 32,802,656 9,753,952 22,524,416 0 524,288 com.android.inputmethod.latin
2844 21,292,240 20,767,952 0 0 524,288 com.android.launcher
2735 15,037,248 14,512,960 0 0 524,288 com.android.systemui
2658 13,812,480 10,273,536 0 0 3,538,944 system_server
3706 10,759,776 10,235,488 0 0 524,288 com.android.settings
3654 10,742,656 10,218,368 0 0 524,288 com.android.contacts
3725 10,719,552 10,195,264 0 0 524,288 com.android.gallery3d
3793 10,715,456 10,191,168 0 0 524,288 com.android.calendar
3837 10,707,904 10,183,616 0 0 524,288 com.android.mms
3774 10,707,072 10,182,784 0 0 524,288 com.android.calculator2
2370 262,144 0 0 0 262,144 /system/bin/mediaserver
------------------------------------------------------------------------------
13 337,702,384 178,797,040 146,715,648 0 12,189,696 Summary
- - 5,752,336 - - - Availabe
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
-rw-r--r-- | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c | 76 | ||||
-rw-r--r-- | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h | 8 | ||||
-rw-r--r-- | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | 56 | ||||
-rw-r--r-- | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c | 27 | ||||
-rw-r--r-- | drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h | 20 |
5 files changed, 186 insertions, 1 deletions
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c index 299162cef050..800800290209 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c @@ -1188,10 +1188,37 @@ gckKERNEL_Dispatch( if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) { bytes = node->VidMem.bytes; + + gcmkONERROR( + gckKERNEL_AddProcessDB(Kernel, + processID, gcvDB_VIDEO_MEMORY_RESERVED, + node, + gcvNULL, + bytes)); } else { bytes = node->Virtual.bytes; + + if(node->Virtual.contiguous) + { + gcmkONERROR( + gckKERNEL_AddProcessDB(Kernel, + processID, gcvDB_VIDEO_MEMORY_CONTIGUOUS, + node, + gcvNULL, + bytes)); + } + else + { + gcmkONERROR( + gckKERNEL_AddProcessDB(Kernel, + processID, gcvDB_VIDEO_MEMORY_VIRTUAL, + node, + gcvNULL, + bytes)); + } + } gcmkONERROR( @@ -1228,6 +1255,28 @@ gckKERNEL_Dispatch( processID, gcvDB_VIDEO_MEMORY, node)); + if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) + { + gcmkONERROR( + gckKERNEL_RemoveProcessDB(Kernel, + processID, gcvDB_VIDEO_MEMORY_RESERVED, + node)); + } + else if(node->Virtual.contiguous) + { + gcmkONERROR( + gckKERNEL_RemoveProcessDB(Kernel, + processID, gcvDB_VIDEO_MEMORY_CONTIGUOUS, + node)); + } + else + { + gcmkONERROR( + gckKERNEL_RemoveProcessDB(Kernel, + processID, gcvDB_VIDEO_MEMORY_VIRTUAL, + node)); + } + break; case gcvHAL_LOCK_VIDEO_MEMORY: @@ -1900,6 +1949,33 @@ gckKERNEL_Dispatch( &Interface->u.Database.gpuIdle)); break; + case gcvHAL_VIDMEM_DATABASE: + /* Query reserved video memory. */ + gcmkONERROR( + gckKERNEL_QueryProcessDB(Kernel, + Interface->u.VidMemDatabase.processID, + !Interface->u.VidMemDatabase.validProcessID, + gcvDB_VIDEO_MEMORY_RESERVED, + &Interface->u.VidMemDatabase.vidMemResv)); + + /* Query contiguous video memory. */ + gcmkONERROR( + gckKERNEL_QueryProcessDB(Kernel, + Interface->u.VidMemDatabase.processID, + !Interface->u.VidMemDatabase.validProcessID, + gcvDB_VIDEO_MEMORY_CONTIGUOUS, + &Interface->u.VidMemDatabase.vidMemCont)); + + /* Query virtual video memory. */ + gcmkONERROR( + gckKERNEL_QueryProcessDB(Kernel, + Interface->u.VidMemDatabase.processID, + !Interface->u.VidMemDatabase.validProcessID, + gcvDB_VIDEO_MEMORY_VIRTUAL, + &Interface->u.VidMemDatabase.vidMemVirt)); + + break; + case gcvHAL_VERSION: Interface->u.Version.major = gcvVERSION_MAJOR; Interface->u.Version.minor = gcvVERSION_MINOR; diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h index 5896e93f5c34..96c5966eebad 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h @@ -141,7 +141,10 @@ typedef enum _gceDATABASE_TYPE gcvDB_IDLE, /* GPU idle. */ gcvDB_MAP_MEMORY, /* Map memory */ gcvDB_SHARED_INFO, /* Private data */ - gcvDB_MAP_USER_MEMORY /* Map user memory */ + gcvDB_MAP_USER_MEMORY, /* Map user memory */ + gcvDB_VIDEO_MEMORY_RESERVED, /* Reserved video memory */ + gcvDB_VIDEO_MEMORY_CONTIGUOUS, /* Contiguous video memory */ + gcvDB_VIDEO_MEMORY_VIRTUAL, /* Virtual video memory */ } gceDATABASE_TYPE; @@ -180,6 +183,9 @@ typedef struct _gcsDATABASE gcsDATABASE_COUNTERS contiguous; gcsDATABASE_COUNTERS mapUserMemory; gcsDATABASE_COUNTERS mapMemory; + gcsDATABASE_COUNTERS vidMemResv; + gcsDATABASE_COUNTERS vidMemCont; + gcsDATABASE_COUNTERS vidMemVirt; /* Idle time management. */ gctUINT64 lastIdle; diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c index 673d4f72cce7..4f10cd5e36cf 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c @@ -689,6 +689,15 @@ gckKERNEL_CreateProcessDB( database->mapUserMemory.bytes = 0; database->mapUserMemory.maxBytes = 0; database->mapUserMemory.totalBytes = 0; + database->vidMemResv.bytes = 0; + database->vidMemResv.maxBytes = 0; + database->vidMemResv.totalBytes = 0; + database->vidMemCont.bytes = 0; + database->vidMemCont.maxBytes = 0; + database->vidMemCont.totalBytes = 0; + database->vidMemVirt.bytes = 0; + database->vidMemVirt.maxBytes = 0; + database->vidMemVirt.totalBytes = 0; for (i = 0; i < gcmCOUNTOF(database->list); i++) { @@ -905,6 +914,18 @@ gckKERNEL_AddProcessDB( count = &database->mapUserMemory; break; + case gcvDB_VIDEO_MEMORY_RESERVED: + count = &database->vidMemResv; + break; + + case gcvDB_VIDEO_MEMORY_CONTIGUOUS: + count = &database->vidMemCont; + break; + + case gcvDB_VIDEO_MEMORY_VIRTUAL: + count = &database->vidMemVirt; + break; + default: count = gcvNULL; break; @@ -1004,6 +1025,18 @@ gckKERNEL_RemoveProcessDB( database->mapUserMemory.bytes -= bytes; break; + case gcvDB_VIDEO_MEMORY_RESERVED: + database->vidMemResv.bytes -= bytes; + break; + + case gcvDB_VIDEO_MEMORY_CONTIGUOUS: + database->vidMemCont.bytes -= bytes; + break; + + case gcvDB_VIDEO_MEMORY_VIRTUAL: + database->vidMemVirt.bytes -= bytes; + break; + default: break; } @@ -1307,6 +1340,11 @@ gckKERNEL_DestroyProcessDB( status = gckOS_FreeMemory(Kernel->os, record->physical); break; + case gcvDB_VIDEO_MEMORY_RESERVED: + case gcvDB_VIDEO_MEMORY_CONTIGUOUS: + case gcvDB_VIDEO_MEMORY_VIRTUAL: + break;//Nothing to do + default: gcmkTRACE_ZONE(gcvLEVEL_ERROR, gcvZONE_DATABASE, "DB: Correcupted record=0x%08x type=%d", @@ -1424,6 +1462,24 @@ gckKERNEL_QueryProcessDB( gcmSIZEOF(database->mapUserMemory)); break; + case gcvDB_VIDEO_MEMORY_RESERVED: + gckOS_MemCopy(&Info->counters, + &database->vidMemResv, + gcmSIZEOF(database->vidMemResv)); + break; + + case gcvDB_VIDEO_MEMORY_CONTIGUOUS: + gckOS_MemCopy(&Info->counters, + &database->vidMemCont, + gcmSIZEOF(database->vidMemCont)); + break; + + case gcvDB_VIDEO_MEMORY_VIRTUAL: + gckOS_MemCopy(&Info->counters, + &database->vidMemVirt, + gcmSIZEOF(database->vidMemVirt)); + break; + default: break; } diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c index 217f7f18c2f2..f883c3d90453 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c @@ -323,6 +323,33 @@ __RemoveRecordFromProcessDB( Record->processID, gcvDB_VIDEO_MEMORY, gcmUINT64_TO_PTR(Record->info.u.FreeVideoMemory.node))); + + { + gcuVIDMEM_NODE_PTR node = (gcuVIDMEM_NODE_PTR)(gcmUINT64_TO_PTR(Record->info.u.FreeVideoMemory.node)); + + if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) + { + gcmkVERIFY_OK(gckKERNEL_RemoveProcessDB(Event->kernel, + Record->processID, + gcvDB_VIDEO_MEMORY_RESERVED, + node)); + } + else if(node->Virtual.contiguous) + { + gcmkVERIFY_OK(gckKERNEL_RemoveProcessDB(Event->kernel, + Record->processID, + gcvDB_VIDEO_MEMORY_CONTIGUOUS, + node)); + } + else + { + gcmkVERIFY_OK(gckKERNEL_RemoveProcessDB(Event->kernel, + Record->processID, + gcvDB_VIDEO_MEMORY_VIRTUAL, + node)); + } + } + break; case gcvHAL_UNLOCK_VIDEO_MEMORY: diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h index b056c52191ea..53e0ce506a4c 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h @@ -166,6 +166,9 @@ typedef enum _gceHAL_COMMAND_CODES /* Reset time stamp. */ gcvHAL_QUERY_RESET_TIME_STAMP, + + /* Video memory database */ + gcvHAL_VIDMEM_DATABASE, } gceHAL_COMMAND_CODES; @@ -837,6 +840,23 @@ typedef struct _gcsHAL_INTERFACE } Database; + /* gcvHAL_VIDMEM_DATABASE */ + struct _gcsHAL_VIDMEM_DATABASE + { + /* Set to gcvTRUE if you want to query a particular process ID. + ** Set to gcvFALSE to query the last detached process. */ + IN gctBOOL validProcessID; + + /* Process ID to query. */ + IN gctUINT32 processID; + + /* Information. */ + OUT gcuDATABASE_INFO vidMemResv; + OUT gcuDATABASE_INFO vidMemCont; + OUT gcuDATABASE_INFO vidMemVirt; + } + VidMemDatabase; + /* gcvHAL_VERSION */ struct _gcsHAL_VERSION { |