gpu: pvr: add support for finding the BM context from the DL
authorMark Underwood <mark.underwood@imgtec.com>
Mon, 15 Mar 2010 12:01:29 +0000 (13:01 +0100)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:40 +0000 (21:09 +0300)
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 <mark.underwood@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/buffer_manager.c
pvr/buffer_manager.h
pvr/mmu.c
pvr/mmu.h

index 7d633dc..35337aa 100644 (file)
@@ -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;
+}
index 45de4d0..39472b1 100644 (file)
@@ -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
index 3219cb1..1b623a4 100644 (file)
--- 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;
+}
index 85d939e..003f0c5 100644 (file)
--- 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