static INLINE IMG_VOID InitParentList(PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHandle) { IMG_UINT32 ui32Parent = HANDLE_PTR_TO_INDEX(psBase, psHandle); HandleListInit(ui32Parent, &psHandle->sChildren, INDEX_TO_HANDLE(psBase, ui32Parent)); }
static INLINE IMG_BOOL NoChildren(PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHandle) { PVR_ASSERT(psHandle->sChildren.hParent == HANDLE_PTR_TO_HANDLE(psBase, psHandle)); return HandleListIsEmpty(HANDLE_PTR_TO_INDEX(psBase, psHandle), &psHandle->sChildren); }
static inline void InitParentList(struct PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHandle) { u32 ui32Parent = HANDLE_PTR_TO_INDEX(psBase, psHandle); HandleListInit(ui32Parent, &psHandle->sChildren, INDEX_TO_HANDLE(psBase, ui32Parent)); }
static INLINE IMG_VOID AdoptChild(PVRSRV_HANDLE_BASE *psBase, struct sHandle *psParent, struct sHandle *psChild) { IMG_UINT32 ui32Parent = HANDLE_TO_INDEX(psBase, psParent->sChildren.hParent); PVR_ASSERT(ui32Parent == HANDLE_PTR_TO_INDEX(psBase, psParent)); HandleListInsertBefore(psBase, ui32Parent, &psParent->sChildren, offsetof(struct sHandle, sChildren), HANDLE_PTR_TO_INDEX(psBase, psChild), &psChild->sSiblings, offsetof(struct sHandle, sSiblings), ui32Parent); }
static inline IMG_BOOL NoParent(struct PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHandle) { if (HandleListIsEmpty (HANDLE_PTR_TO_INDEX(psBase, psHandle), &psHandle->sSiblings)) { PVR_ASSERT(psHandle->sSiblings.hParent == NULL); return IMG_TRUE; } else { PVR_ASSERT(psHandle->sSiblings.hParent != NULL); } return IMG_FALSE; }
static inline void AdoptChild(struct PVRSRV_HANDLE_BASE *psBase, struct sHandle *psParent, struct sHandle *psChild) { u32 ui32Parent = HANDLE_TO_INDEX(psBase, psParent->sChildren.hParent); PVR_ASSERT(ui32Parent == (u32) HANDLE_PTR_TO_INDEX(psBase, psParent)); HandleListInsertBefore(psBase, ui32Parent, &psParent->sChildren, offsetof(struct sHandle, sChildren), HANDLE_PTR_TO_INDEX(psBase, psChild), &psChild->sSiblings, offsetof(struct sHandle, sSiblings), ui32Parent); }
static INLINE IMG_VOID InitChildEntry(PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHandle) { HandleListInit(HANDLE_PTR_TO_INDEX(psBase, psHandle), &psHandle->sSiblings, IMG_NULL); }
PVR_ASSERT(psEntry->hParent != IMG_NULL); psPrev->ui32Next = psEntry->ui32Next; psNext->ui32Prev = psEntry->ui32Prev; HandleListInit(ui32EntryIndex, psEntry, IMG_NULL); } } #ifdef INLINE_IS_PRAGMA #pragma inline(UnlinkFromParent) #endif static INLINE IMG_VOID UnlinkFromParent(PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHandle) { HandleListRemove(psBase, HANDLE_PTR_TO_INDEX(psBase, psHandle), &psHandle->sSiblings, offsetof(struct sHandle, sSiblings), offsetof(struct sHandle, sChildren)); } #ifdef INLINE_IS_PRAGMA #pragma inline(HandleListIterate) #endif static INLINE PVRSRV_ERROR HandleListIterate(PVRSRV_HANDLE_BASE *psBase, struct sHandleList *psHead, IMG_SIZE_T uiParentOffset, IMG_SIZE_T uiEntryOffset, PVRSRV_ERROR (*pfnIterFunc)(PVRSRV_HANDLE_BASE *, struct sHandle *)) { IMG_UINT32 ui32Index; IMG_UINT32 ui32Parent = HANDLE_TO_INDEX(psBase, psHead->hParent); PVR_ASSERT(psHead->hParent != IMG_NULL); for(ui32Index = psHead->ui32Next; ui32Index != ui32Parent; )
static inline void InitChildEntry(struct PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHandle) { HandleListInit(HANDLE_PTR_TO_INDEX(psBase, psHandle), &psHandle->sSiblings, NULL); }
uiParentOffset, uiEntryOffset); PVR_ASSERT(psEntry->hParent != NULL); psPrev->ui32Next = psEntry->ui32Next; psNext->ui32Prev = psEntry->ui32Prev; HandleListInit(ui32EntryIndex, psEntry, NULL); } } static inline void UnlinkFromParent(struct PVRSRV_HANDLE_BASE *psBase, struct sHandle *psHandle) { HandleListRemove(psBase, HANDLE_PTR_TO_INDEX(psBase, psHandle), &psHandle->sSiblings, offsetof(struct sHandle, sSiblings), offsetof(struct sHandle, sChildren)); } static inline enum PVRSRV_ERROR HandleListIterate( struct PVRSRV_HANDLE_BASE *psBase, struct sHandleList *psHead, size_t uiParentOffset, size_t uiEntryOffset, enum PVRSRV_ERROR(*pfnIterFunc)(struct PVRSRV_HANDLE_BASE *, struct sHandle *)) { u32 ui32Index; u32 ui32Parent = HANDLE_TO_INDEX(psBase, psHead->hParent); PVR_ASSERT(psHead->hParent != NULL);