aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2015-02-18 18:06:24 -0600
committerMark Lobodzinski <mark@lunarg.com>2015-02-19 08:40:58 -0600
commit7247fac7b22244e4e9dd3a715032e81afb8112dc (patch)
tree806f475180a8d24231dc8543fc4601109498f039
parent394fc0efa0c50bdb995cba26732df77a070a5afa (diff)
downloadusermoji-7247fac7b22244e4e9dd3a715032e81afb8112dc.tar.xz
layers: Fix memtracker reporting related to freeing presentable image memory
Output an error if presentable image memory is explicitly freed, and avoid warnings if it is not.
-rw-r--r--layers/mem_tracker.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/layers/mem_tracker.c b/layers/mem_tracker.c
index f3bddb0c..a24e1a2c 100644
--- a/layers/mem_tracker.c
+++ b/layers/mem_tracker.c
@@ -420,7 +420,13 @@ static bool32_t freeMemNode(XGL_GPU_MEMORY mem)
return XGL_FALSE;
}
else {
- // First clear any CB bindings for completed CBs
+ if (pTrav->allocInfo.allocationSize == 0) {
+ char str[1024];
+ sprintf(str, "Attempting to free memory associated with a Presentable Image, %p, this should not be explicitly freed\n", (void*)mem);
+ layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, mem, 0, MEMTRACK_INVALID_MEM_OBJ, "MEM", str);
+ return XGL_FALSE;
+ }
+ // Clear any CB bindings for completed CBs
// TODO : Is there a better place to do this?
MINI_NODE* pMiniCB = pTrav->pCmdBufferBindings;
while (pMiniCB) {
@@ -805,8 +811,10 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyDevice(XGL_DEVICE device)
// Report any memory leaks
GLOBAL_MEM_OBJ_NODE* pTrav = pGlobalMemObjHead;
while (pTrav) {
- sprintf(str, "Mem Object %p has not been freed. You should clean up this memory by calling xglFreeMemory(%p) prior to xglDestroyDevice().", pTrav->mem, pTrav->mem);
- layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, pTrav->mem, 0, MEMTRACK_MEMORY_LEAK, "MEM", str);
+ if (pTrav->allocInfo.allocationSize != 0) {
+ sprintf(str, "Mem Object %p has not been freed. You should clean up this memory by calling xglFreeMemory(%p) prior to xglDestroyDevice().", pTrav->mem, pTrav->mem);
+ layerCbMsg(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, pTrav->mem, 0, MEMTRACK_MEMORY_LEAK, "MEM", str);
+ }
pTrav = pTrav->pNextGlobalNode;
}
XGL_RESULT result = nextTable.DestroyDevice(device);