MGS-5485-2 [#imx-1870] fix system out of memory in gpu database
gputop patch added gcvDB_CONTIGUOUS and gcvDB_COMMAND_BUFFER types, these need create more system memory to maintain database frequently, gpu out of memory issue happen when run openGL ES CTS on imx6 boards, this patch can avoid system memory allocation for new database types, combine gcvDB_CONTIGUOUS memory type into video memory database, remove gcvDB_COMMAND_BUFFER as not in database counters. Fix "LF-165 [#imx-1870] gputop counter test failed" Signed-off-by: Xianzhong <xianzhong.li@nxp.com>5.4-rM2-2.2.x-imx-squashed
parent
72157df9dd
commit
62b9c2b5a5
|
@ -1408,6 +1408,13 @@ _AllocateLinearMemory(
|
|||
| (type << gcdDB_VIDEO_MEMORY_TYPE_SHIFT)
|
||||
| (pool << gcdDB_VIDEO_MEMORY_POOL_SHIFT);
|
||||
|
||||
gcmkONERROR(gckVIDMEM_NODE_IsContiguous(Kernel, nodeObject, &isContiguous));
|
||||
|
||||
if (isContiguous)
|
||||
{
|
||||
dbType |= (gcvDB_CONTIGUOUS << gcdDB_VIDEO_MEMORY_DBTYPE_SHIFT);
|
||||
}
|
||||
|
||||
/* Record in process db. */
|
||||
gcmkONERROR(
|
||||
gckKERNEL_AddProcessDB(Kernel,
|
||||
|
@ -1417,32 +1424,6 @@ _AllocateLinearMemory(
|
|||
gcvNULL,
|
||||
bytes));
|
||||
|
||||
gcmkONERROR(gckVIDMEM_NODE_IsContiguous(Kernel, nodeObject, &isContiguous));
|
||||
|
||||
if (isContiguous)
|
||||
{
|
||||
/* Record in process db. */
|
||||
gcmkONERROR(
|
||||
gckKERNEL_AddProcessDB(Kernel,
|
||||
ProcessID,
|
||||
gcvDB_CONTIGUOUS,
|
||||
gcmINT2PTR(handle),
|
||||
gcvNULL,
|
||||
bytes));
|
||||
}
|
||||
|
||||
if (type & gcvVIDMEM_TYPE_COMMAND)
|
||||
{
|
||||
/* Record in process db. */
|
||||
gcmkONERROR(
|
||||
gckKERNEL_AddProcessDB(Kernel,
|
||||
ProcessID,
|
||||
gcvDB_COMMAND_BUFFER,
|
||||
gcmINT2PTR(handle),
|
||||
gcvNULL,
|
||||
bytes));
|
||||
}
|
||||
|
||||
/* Return status. */
|
||||
gcmkFOOTER_ARG("pool=%d node=0x%x", pool, handle);
|
||||
return gcvSTATUS_OK;
|
||||
|
@ -1508,32 +1489,19 @@ _ReleaseVideoMemory(
|
|||
| (nodeObject->type << gcdDB_VIDEO_MEMORY_TYPE_SHIFT)
|
||||
| (nodeObject->pool << gcdDB_VIDEO_MEMORY_POOL_SHIFT);
|
||||
|
||||
gcmkONERROR(gckVIDMEM_NODE_IsContiguous(Kernel, nodeObject, &isContiguous));
|
||||
|
||||
if (isContiguous)
|
||||
{
|
||||
type |= (gcvDB_CONTIGUOUS << gcdDB_VIDEO_MEMORY_DBTYPE_SHIFT);
|
||||
}
|
||||
|
||||
gcmkONERROR(
|
||||
gckKERNEL_RemoveProcessDB(Kernel,
|
||||
ProcessID,
|
||||
type,
|
||||
gcmINT2PTR(Handle)));
|
||||
|
||||
gcmkONERROR(gckVIDMEM_NODE_IsContiguous(Kernel, nodeObject, &isContiguous));
|
||||
|
||||
if (isContiguous)
|
||||
{
|
||||
gcmkONERROR(
|
||||
gckKERNEL_RemoveProcessDB(Kernel,
|
||||
ProcessID,
|
||||
gcvDB_CONTIGUOUS,
|
||||
gcmINT2PTR(Handle)));
|
||||
}
|
||||
|
||||
if (nodeObject->type & gcvVIDMEM_TYPE_COMMAND)
|
||||
{
|
||||
gcmkONERROR(
|
||||
gckKERNEL_RemoveProcessDB(Kernel,
|
||||
ProcessID,
|
||||
gcvDB_COMMAND_BUFFER,
|
||||
gcmINT2PTR(Handle)));
|
||||
}
|
||||
|
||||
gckVIDMEM_HANDLE_Dereference(Kernel, ProcessID, Handle);
|
||||
|
||||
gckVIDMEM_NODE_Dereference(Kernel, nodeObject);
|
||||
|
@ -1830,6 +1798,7 @@ _WrapUserMemory(
|
|||
gckVIDMEM_NODE nodeObject = gcvNULL;
|
||||
gceDATABASE_TYPE type;
|
||||
gctUINT32 handle = 0;
|
||||
gctBOOL isContiguous;
|
||||
|
||||
gcmkONERROR(
|
||||
gckVIDMEM_NODE_WrapUserMemory(Kernel,
|
||||
|
@ -1848,6 +1817,13 @@ _WrapUserMemory(
|
|||
| (nodeObject->type << gcdDB_VIDEO_MEMORY_TYPE_SHIFT)
|
||||
| (nodeObject->pool << gcdDB_VIDEO_MEMORY_POOL_SHIFT);
|
||||
|
||||
gcmkONERROR(gckVIDMEM_NODE_IsContiguous(Kernel, nodeObject, &isContiguous));
|
||||
|
||||
if (isContiguous)
|
||||
{
|
||||
type |= (gcvDB_CONTIGUOUS << gcdDB_VIDEO_MEMORY_DBTYPE_SHIFT);
|
||||
}
|
||||
|
||||
gcmkONERROR(
|
||||
gckKERNEL_AddProcessDB(Kernel,
|
||||
ProcessID,
|
||||
|
|
|
@ -253,6 +253,9 @@ gceDATABASE_TYPE;
|
|||
#define gcdDB_VIDEO_MEMORY_POOL_MASK 0x00FF0000
|
||||
#define gcdDB_VIDEO_MEMORY_POOL_SHIFT 16
|
||||
|
||||
#define gcdDB_VIDEO_MEMORY_DBTYPE_MASK 0xFF000000
|
||||
#define gcdDB_VIDEO_MEMORY_DBTYPE_SHIFT 24
|
||||
|
||||
typedef struct _gcsDATABASE_RECORD * gcsDATABASE_RECORD_PTR;
|
||||
typedef struct _gcsDATABASE_RECORD
|
||||
{
|
||||
|
|
|
@ -721,6 +721,7 @@ gckKERNEL_AddProcessDB(
|
|||
gcsDATABASE_COUNTERS * count;
|
||||
gctUINT32 vidMemType;
|
||||
gcePOOL vidMemPool;
|
||||
gceDATABASE_TYPE vidMemDbType;
|
||||
|
||||
gcmkHEADER_ARG("Kernel=%p ProcessID=%d Type=%d Pointer=%p "
|
||||
"Physical=%p Size=%lu",
|
||||
|
@ -732,6 +733,7 @@ gckKERNEL_AddProcessDB(
|
|||
/* Decode type. */
|
||||
vidMemType = (Type & gcdDB_VIDEO_MEMORY_TYPE_MASK) >> gcdDB_VIDEO_MEMORY_TYPE_SHIFT;
|
||||
vidMemPool = (Type & gcdDB_VIDEO_MEMORY_POOL_MASK) >> gcdDB_VIDEO_MEMORY_POOL_SHIFT;
|
||||
vidMemDbType = (Type & gcdDB_VIDEO_MEMORY_DBTYPE_MASK) >> gcdDB_VIDEO_MEMORY_DBTYPE_SHIFT;
|
||||
|
||||
Type &= gcdDATABASE_TYPE_MASK;
|
||||
|
||||
|
@ -879,6 +881,21 @@ gckKERNEL_AddProcessDB(
|
|||
{
|
||||
count->maxBytes = count->bytes;
|
||||
}
|
||||
|
||||
if (vidMemDbType == gcvDB_CONTIGUOUS)
|
||||
{
|
||||
count = &database->contiguous;
|
||||
|
||||
/* Adjust counters. */
|
||||
count->totalBytes += Size;
|
||||
count->bytes += Size;
|
||||
count->allocCount++;
|
||||
|
||||
if (count->bytes > count->maxBytes)
|
||||
{
|
||||
count->maxBytes = count->bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gcmkVERIFY_OK(gckOS_ReleaseMutex(Kernel->os, database->counterMutex));
|
||||
|
@ -929,6 +946,7 @@ gckKERNEL_RemoveProcessDB(
|
|||
gctSIZE_T bytes = 0;
|
||||
gctUINT32 vidMemType;
|
||||
gcePOOL vidMemPool;
|
||||
gceDATABASE_TYPE vidMemDbType;
|
||||
|
||||
gcmkHEADER_ARG("Kernel=%p ProcessID=%d Type=%d Pointer=%p",
|
||||
Kernel, ProcessID, Type, Pointer);
|
||||
|
@ -940,6 +958,7 @@ gckKERNEL_RemoveProcessDB(
|
|||
/* Decode type. */
|
||||
vidMemType = (Type & gcdDB_VIDEO_MEMORY_TYPE_MASK) >> gcdDB_VIDEO_MEMORY_TYPE_SHIFT;
|
||||
vidMemPool = (Type & gcdDB_VIDEO_MEMORY_POOL_MASK) >> gcdDB_VIDEO_MEMORY_POOL_SHIFT;
|
||||
vidMemDbType = (Type & gcdDB_VIDEO_MEMORY_DBTYPE_MASK) >> gcdDB_VIDEO_MEMORY_DBTYPE_SHIFT;
|
||||
|
||||
Type &= gcdDATABASE_TYPE_MASK;
|
||||
|
||||
|
@ -962,6 +981,13 @@ gckKERNEL_RemoveProcessDB(
|
|||
database->vidMemType[vidMemType].freeCount++;
|
||||
database->vidMemPool[vidMemPool].bytes -= bytes;
|
||||
database->vidMemPool[vidMemPool].freeCount++;
|
||||
|
||||
if (vidMemDbType == gcvDB_CONTIGUOUS)
|
||||
{
|
||||
database->contiguous.bytes -= bytes;
|
||||
database->contiguous.freeCount++;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case gcvDB_NON_PAGED:
|
||||
|
|
Loading…
Reference in New Issue