From: Tobin Ehlis Date: Mon, 23 Feb 2015 23:09:58 +0000 (-0700) Subject: layers: In DrawState correctly clear update chain for Struct Node X-Git-Tag: upstream/1.1.92~6030 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6dc750ce58c77b309f6d55c71e7b7390f07c2e64;p=platform%2Fupstream%2FVulkan-Tools.git layers: In DrawState correctly clear update chain for Struct Node --- diff --git a/layers/draw_state.c b/layers/draw_state.c index 8208241..de9d71c 100644 --- a/layers/draw_state.c +++ b/layers/draw_state.c @@ -765,6 +765,7 @@ static GENERIC_HEADER* shadowUpdateNode(GENERIC_HEADER* pUpdate) size_t baseBuffAddr = 0; XGL_UPDATE_BUFFERS* pUBCI; XGL_UPDATE_IMAGES* pUICI; + char str[1024]; switch (pUpdate->sType) { case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS: @@ -849,14 +850,15 @@ static GENERIC_HEADER* shadowUpdateNode(GENERIC_HEADER* pUpdate) memcpy(pNewNode, pUpdate, sizeof(XGL_UPDATE_AS_COPY)); break; default: - // TODO : Flag specific error for this case + sprintf(str, "Unexpected UPDATE struct of type %s (value %u) in xglUpdateDescriptors() struct tree", string_XGL_STRUCTURE_TYPE(pUpdate->sType), pUpdate->sType); + layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_INVALID_UPDATE_STRUCT, "DS", str); return NULL; } // Make sure that pNext for the end of shadow copy is NULL pNewNode->pNext = NULL; return pNewNode; } -// For given ds, update it's mapping based on pUpdateChain linked-list +// For given ds, update its mapping based on pUpdateChain linked-list static void dsUpdate(XGL_DESCRIPTOR_SET ds, GENERIC_HEADER* pUpdateChain) { SET_NODE* pSet = getSetNode(ds); @@ -920,11 +922,12 @@ static void dsUpdate(XGL_DESCRIPTOR_SET ds, GENERIC_HEADER* pUpdateChain) } loader_platform_thread_unlock_mutex(&globalLock); } -// Free a shadowed update node +// Free the shadowed update node for this Set // NOTE : Calls to this function should be wrapped in mutex -static void freeShadowUpdateTree(GENERIC_HEADER* pUpdate) +static void freeShadowUpdateTree(SET_NODE* pSet) { - GENERIC_HEADER* pShadowUpdate = pUpdate; + GENERIC_HEADER* pShadowUpdate = pSet->pUpdateStructs; + pSet->pUpdateStructs = NULL; GENERIC_HEADER* pFreeUpdate = pShadowUpdate; while(pShadowUpdate) { pFreeUpdate = pShadowUpdate; @@ -1011,7 +1014,7 @@ static void freeRegions() pSet = pSet->pNext; // Freeing layouts handled in freeLayouts() function // Free Update shadow struct tree - freeShadowUpdateTree(pFreeSet->pUpdateStructs); + freeShadowUpdateTree(pFreeSet); if (pFreeSet->ppDescriptors) { #if ALLOC_DEBUG printf("Free35 #%lu pSet->ppDescriptors addr(%p)\n", ++g_free_count, (void*)pFreeSet->ppDescriptors); @@ -1079,7 +1082,7 @@ static void clearDescriptorSet(XGL_DESCRIPTOR_SET set) } else { loader_platform_thread_lock_mutex(&globalLock); - freeShadowUpdateTree(pSet->pUpdateStructs); + freeShadowUpdateTree(pSet); loader_platform_thread_unlock_mutex(&globalLock); } } diff --git a/layers/draw_state.h b/layers/draw_state.h index 18280f7..7466e38 100644 --- a/layers/draw_state.h +++ b/layers/draw_state.h @@ -43,7 +43,8 @@ typedef enum _DRAW_STATE_ERROR DRAWSTATE_OUT_OF_MEMORY, // malloc failed DRAWSTATE_DESCRIPTOR_TYPE_MISMATCH, // Type in layout vs. update are not the same DRAWSTATE_DESCRIPTOR_UPDATE_OUT_OF_BOUNDS, // Descriptors set for update out of bounds for corresponding layout section - DRAWSTATE_INVALID_UPDATE_INDEX // Index of requested update is invalid for specified descriptors set + DRAWSTATE_INVALID_UPDATE_INDEX, // Index of requested update is invalid for specified descriptors set + DRAWSTATE_INVALID_UPDATE_STRUCT // Struct in DS Update tree is of invalid type } DRAW_STATE_ERROR; typedef enum _DRAW_TYPE