From: Mark Underwood Date: Mon, 15 Mar 2010 12:01:29 +0000 (+0100) Subject: gpu: pvr: add support for finding the BM context from the DL X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12fe54e715cfe8d7d4e297368359cdf024f86433;p=sgx.git gpu: pvr: add support for finding the BM context from the DL This allows us to find the BM context from the value of the directory list. This is required for the next patch. Signed-off-by: Mark Underwood Signed-off-by: Imre Deak --- diff --git a/pvr/buffer_manager.c b/pvr/buffer_manager.c index 7d633dc..35337aa 100644 --- a/pvr/buffer_manager.c +++ b/pvr/buffer_manager.c @@ -29,6 +29,7 @@ #include "hash.h" #include "ra.h" #include "pdump_km.h" +#include "mmu.h" #define MIN(a, b) (a > b ? b : a) @@ -1484,3 +1485,17 @@ void *BM_GetMappingHandle(struct PVRSRV_KERNEL_MEM_INFO *psMemInfo) return ((struct BM_BUF *) psMemInfo->sMemBlk.hBuffer)->pMapping->hOSMemHandle; } + +struct BM_CONTEXT *bm_find_context(struct BM_CONTEXT *head_context, + u32 page_dir) +{ + struct BM_CONTEXT *context = head_context; + + /* Walk all the contexts until we find the right one */ + while (context) { + if (mmu_get_page_dir(context->psMMUContext) == page_dir) + break; + context = context->psNext; + } + return context; +} diff --git a/pvr/buffer_manager.h b/pvr/buffer_manager.h index 45de4d0..39472b1 100644 --- a/pvr/buffer_manager.h +++ b/pvr/buffer_manager.h @@ -166,4 +166,6 @@ struct PVRSRV_DEVICE_NODE *BM_GetDeviceNode(void *hDevMemContext); void *BM_GetMappingHandle(struct PVRSRV_KERNEL_MEM_INFO *psMemInfo); +struct BM_CONTEXT *bm_find_context(struct BM_CONTEXT *head_context, + u32 page_dir); #endif diff --git a/pvr/mmu.c b/pvr/mmu.c index 3219cb1..1b623a4 100644 --- a/pvr/mmu.c +++ b/pvr/mmu.c @@ -1440,3 +1440,7 @@ void MMU_BIFResetPDFree(struct PVRSRV_SGXDEV_INFO *psDevInfo) } } +u32 mmu_get_page_dir(struct MMU_CONTEXT *psMMUContext) +{ + return psMMUContext->sPDDevPAddr.uiAddr; +} diff --git a/pvr/mmu.h b/pvr/mmu.h index 85d939e..003f0c5 100644 --- a/pvr/mmu.h +++ b/pvr/mmu.h @@ -82,4 +82,5 @@ enum PVRSRV_ERROR MMU_BIFResetPDAlloc(struct PVRSRV_SGXDEV_INFO *psDevInfo); void MMU_BIFResetPDFree(struct PVRSRV_SGXDEV_INFO *psDevInfo); +u32 mmu_get_page_dir(struct MMU_CONTEXT *pMMUContext); #endif