Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
pvr upgrade for crespo kernel
diff --git a/drivers/gpu/pvr/Kconfig b/drivers/gpu/pvr/Kconfig
index 9bb3556..aec7c66 100644
--- a/drivers/gpu/pvr/Kconfig
+++ b/drivers/gpu/pvr/Kconfig
@@ -1,3 +1,4 @@
+
config PVR_SGX
tristate "PowerVR SGX support"
depends on ARCH_S5PV210
@@ -8,6 +9,16 @@ config PVR_SGX
this will generate two modules, called pvrsrvkm and s3c_lcd.
choice
+ prompt "PowerVR SGX core"
+ depends on PVR_SGX
+ default PVR_SGXCORE_540
+
+config PVR_SGXCORE_540
+ bool "SGX 540"
+
+endchoice
+
+choice
prompt "PowerVR build type"
depends on PVR_SGX
default PVR_BUILD_RELEASE
diff --git a/drivers/gpu/pvr/Makefile b/drivers/gpu/pvr/Makefile
index 76e553c..d14bfb1 100644
--- a/drivers/gpu/pvr/Makefile
+++ b/drivers/gpu/pvr/Makefile
@@ -19,19 +19,19 @@ ccflags-y += -DLINUX -D__linux__ -DANDROID
ccflags-y += -Idrivers/gpu/pvr
ccflags-y += \
+ -DSUPPORT_SGX \
+ -DTRANSFER_QUEUE \
+ -DSUPPORT_HW_RECOVERY \
+ -DLDM_PLATFORM \
-DSUPPORT_SGX_NEW_STATUS_VALS \
-DSUPPORT_SGX_HWPERF \
-DSYS_USING_INTERRUPTS \
-DPVR_SECURE_HANDLES \
-DSERVICES4 \
-DSUPPORT_SGX_EVENT_OBJECT \
- -DTRANSFER_QUEUE \
- -DSUPPORT_SGX \
-DSUPPORT_SRVINIT \
- -DSUPPORT_HW_RECOVERY \
-DPVR_SECURE_FD_EXPORT \
-DSUPPORT_SGX_EVENT_OBJECT \
- -DLDM_PLATFORM \
-DPVR2D_ALT_2DHW \
-DPVR_LINUX_USING_WORKQUEUES \
-DPVR_LINUX_MISR_USING_PRIVATE_WORKQUEUE \
@@ -41,6 +41,7 @@ ccflags-y += \
-DSYS_SGX_ACTIVE_POWER_LATENCY_MS=100 \
-DPVR_BUILD_DATE="" \
-DPVRSRV_MODNAME="\"pvrsrvkm\"" \
+ -DPVR_LDM_DRIVER_REGISTRATION_NAME="\"pvrsrvkm\"" \
-Idrivers/gpu/pvr/sgx \
-DPVRSRV_RESET_ON_HWTIMEOUT
diff --git a/drivers/gpu/pvr/bridged_pvr_bridge.c b/drivers/gpu/pvr/bridged_pvr_bridge.c
index 71aa71c..44f8e05 100644
--- a/drivers/gpu/pvr/bridged_pvr_bridge.c
+++ b/drivers/gpu/pvr/bridged_pvr_bridge.c
@@ -1,6 +1,6 @@
/**********************************************************************
*
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
+ * Copyright (C) Imagination Technologies Ltd. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -76,7 +76,7 @@ PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY g_BridgeDispatchTable[BRIDGE_DISPATCH_TABLE_E
PVRSRV_BRIDGE_GLOBAL_STATS g_BridgeGlobalStats;
#endif
-#if defined(PVR_SECURE_HANDLES)
+#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
static IMG_BOOL abSharedDeviceMemHeap[PVRSRV_MAX_CLIENT_HEAPS];
static IMG_BOOL *pbSharedDeviceMemHeap = abSharedDeviceMemHeap;
#else
@@ -169,6 +169,9 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
IMG_HANDLE hDevMemContextInt;
IMG_UINT32 i;
IMG_BOOL bCreated;
+#if defined (SUPPORT_SID_INTERFACE)
+ PVRSRV_HEAP_INFO_KM asHeapInfo[PVRSRV_MAX_CLIENT_HEAPS];
+#endif
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_CREATE_DEVMEMCONTEXT);
@@ -190,7 +193,11 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
psPerProc,
&hDevMemContextInt,
&psCreateDevMemContextOUT->ui32ClientHeapCount,
+#if defined (SUPPORT_SID_INTERFACE)
+ &asHeapInfo[0],
+#else
&psCreateDevMemContextOUT->sHeapInfo[0],
+#endif
&bCreated,
pbSharedDeviceMemHeap);
@@ -223,35 +230,61 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
for(i = 0; i < psCreateDevMemContextOUT->ui32ClientHeapCount; i++)
{
+#if defined (SUPPORT_SID_INTERFACE)
+ IMG_SID hDevMemHeapExt;
+#else
IMG_HANDLE hDevMemHeapExt;
+#endif
-#if defined(PVR_SECURE_HANDLES)
+#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
if(abSharedDeviceMemHeap[i])
#endif
{
+#if defined (SUPPORT_SID_INTERFACE)
+ PVRSRVAllocHandleNR(psPerProc->psHandleBase,
+ &hDevMemHeapExt,
+ asHeapInfo[i].hDevMemHeap,
+ PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
+ PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
+#else
PVRSRVAllocHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt,
- psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap,
- PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
- PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
+ psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap,
+ PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
+ PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
+#endif
}
-#if defined(PVR_SECURE_HANDLES)
+#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
else
{
if(bCreated)
{
+#if defined (SUPPORT_SID_INTERFACE)
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &hDevMemHeapExt,
+ asHeapInfo[i].hDevMemHeap,
+ PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
+ PVRSRV_HANDLE_ALLOC_FLAG_NONE,
+ psCreateDevMemContextOUT->hDevMemContext);
+#else
PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt,
psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap,
PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
PVRSRV_HANDLE_ALLOC_FLAG_NONE,
psCreateDevMemContextOUT->hDevMemContext);
+#endif
}
else
{
psCreateDevMemContextOUT->eError =
- PVRSRVFindHandle(psPerProc->psHandleBase, &hDevMemHeapExt,
+ PVRSRVFindHandle(psPerProc->psHandleBase,
+ &hDevMemHeapExt,
+#if defined (SUPPORT_SID_INTERFACE)
+ asHeapInfo[i].hDevMemHeap,
+#else
psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap,
+#endif
PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP);
if(psCreateDevMemContextOUT->eError != PVRSRV_OK)
{
@@ -261,6 +294,13 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
}
#endif
psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap = hDevMemHeapExt;
+#if defined (SUPPORT_SID_INTERFACE)
+ psCreateDevMemContextOUT->sHeapInfo[i].ui32HeapID = asHeapInfo[i].ui32HeapID;
+ psCreateDevMemContextOUT->sHeapInfo[i].sDevVAddrBase = asHeapInfo[i].sDevVAddrBase;
+ psCreateDevMemContextOUT->sHeapInfo[i].ui32HeapByteSize = asHeapInfo[i].ui32HeapByteSize;
+ psCreateDevMemContextOUT->sHeapInfo[i].ui32Attribs = asHeapInfo[i].ui32Attribs;
+ psCreateDevMemContextOUT->sHeapInfo[i].ui32XTileStride = asHeapInfo[i].ui32XTileStride;
+#endif
}
COMMIT_HANDLE_BATCH_OR_ERROR(psCreateDevMemContextOUT->eError, psPerProc)
@@ -329,6 +369,9 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID,
IMG_HANDLE hDevCookieInt;
IMG_HANDLE hDevMemContextInt;
IMG_UINT32 i;
+#if defined (SUPPORT_SID_INTERFACE)
+ PVRSRV_HEAP_INFO_KM asHeapInfo[PVRSRV_MAX_CLIENT_HEAPS];
+#endif
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_GET_DEVMEM_HEAPINFO);
@@ -358,7 +401,11 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID,
PVRSRVGetDeviceMemHeapInfoKM(hDevCookieInt,
hDevMemContextInt,
&psGetDevMemHeapInfoOUT->ui32ClientHeapCount,
+#if defined (SUPPORT_SID_INTERFACE)
+ &asHeapInfo[0],
+#else
&psGetDevMemHeapInfoOUT->sHeapInfo[0],
+#endif
pbSharedDeviceMemHeap);
if(psGetDevMemHeapInfoOUT->eError != PVRSRV_OK)
@@ -368,25 +415,42 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID,
for(i = 0; i < psGetDevMemHeapInfoOUT->ui32ClientHeapCount; i++)
{
+#if defined (SUPPORT_SID_INTERFACE)
+ IMG_SID hDevMemHeapExt;
+#else
IMG_HANDLE hDevMemHeapExt;
+#endif
-#if defined(PVR_SECURE_HANDLES)
+#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
if(abSharedDeviceMemHeap[i])
#endif
{
+#if defined (SUPPORT_SID_INTERFACE)
+ PVRSRVAllocHandleNR(psPerProc->psHandleBase,
+ &hDevMemHeapExt,
+ asHeapInfo[i].hDevMemHeap,
+ PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
+ PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
+#else
PVRSRVAllocHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt,
psGetDevMemHeapInfoOUT->sHeapInfo[i].hDevMemHeap,
PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
+#endif
}
-#if defined(PVR_SECURE_HANDLES)
+#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
else
{
psGetDevMemHeapInfoOUT->eError =
- PVRSRVFindHandle(psPerProc->psHandleBase, &hDevMemHeapExt,
+ PVRSRVFindHandle(psPerProc->psHandleBase,
+ &hDevMemHeapExt,
+#if defined (SUPPORT_SID_INTERFACE)
+ asHeapInfo[i].hDevMemHeap,
+#else
psGetDevMemHeapInfoOUT->sHeapInfo[i].hDevMemHeap,
+#endif
PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP);
if(psGetDevMemHeapInfoOUT->eError != PVRSRV_OK)
{
@@ -395,6 +459,13 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID,
}
#endif
psGetDevMemHeapInfoOUT->sHeapInfo[i].hDevMemHeap = hDevMemHeapExt;
+#if defined (SUPPORT_SID_INTERFACE)
+ psGetDevMemHeapInfoOUT->sHeapInfo[i].ui32HeapID = asHeapInfo[i].ui32HeapID;
+ psGetDevMemHeapInfoOUT->sHeapInfo[i].sDevVAddrBase = asHeapInfo[i].sDevVAddrBase;
+ psGetDevMemHeapInfoOUT->sHeapInfo[i].ui32HeapByteSize = asHeapInfo[i].ui32HeapByteSize;
+ psGetDevMemHeapInfoOUT->sHeapInfo[i].ui32Attribs = asHeapInfo[i].ui32Attribs;
+ psGetDevMemHeapInfoOUT->sHeapInfo[i].ui32XTileStride = asHeapInfo[i].ui32XTileStride;
+#endif
}
COMMIT_HANDLE_BATCH_OR_ERROR(psGetDevMemHeapInfoOUT->eError, psPerProc)
@@ -419,6 +490,8 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
PVRSRV_KERNEL_MEM_INFO *psMemInfo;
IMG_HANDLE hDevCookieInt;
IMG_HANDLE hDevMemHeapInt;
+ IMG_UINT32 ui32ShareIndex;
+ IMG_BOOL bUseShareMemWorkaround;
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_ALLOC_DEVICEMEM);
@@ -444,6 +517,36 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
return 0;
}
+
+
+ bUseShareMemWorkaround = ((psAllocDeviceMemIN->ui32Attribs & PVRSRV_MEM_XPROC) != 0) ? IMG_TRUE : IMG_FALSE;
+ ui32ShareIndex = 7654321;
+
+ if (bUseShareMemWorkaround)
+ {
+
+
+
+ psAllocDeviceMemOUT->eError =
+ BM_XProcWorkaroundFindNewBufferAndSetShareIndex(&ui32ShareIndex);
+ if(psAllocDeviceMemOUT->eError != PVRSRV_OK)
+ {
+ return 0;
+ }
+ }
+
+
+ if(psAllocDeviceMemIN->pvPrivData)
+ {
+ if(!OSAccessOK(PVR_VERIFY_READ,
+ psAllocDeviceMemIN->pvPrivData,
+ psAllocDeviceMemIN->ui32PrivDataLength))
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVAllocDeviceMemBW: Access check failed for pvPrivData"));
+ return -EFAULT;
+ }
+ }
+
psAllocDeviceMemOUT->eError =
PVRSRVAllocDeviceMemKM(hDevCookieInt,
psPerProc,
@@ -451,14 +554,33 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
psAllocDeviceMemIN->ui32Attribs,
psAllocDeviceMemIN->ui32Size,
psAllocDeviceMemIN->ui32Alignment,
+ psAllocDeviceMemIN->pvPrivData,
+ psAllocDeviceMemIN->ui32PrivDataLength,
&psMemInfo,
"" );
+ if (bUseShareMemWorkaround)
+ {
+ PVR_ASSERT(ui32ShareIndex != 7654321);
+ BM_XProcWorkaroundUnsetShareIndex(ui32ShareIndex);
+ }
+
if(psAllocDeviceMemOUT->eError != PVRSRV_OK)
{
return 0;
}
+ psMemInfo->sShareMemWorkaround.bInUse = bUseShareMemWorkaround;
+ if (bUseShareMemWorkaround)
+ {
+ PVR_ASSERT(ui32ShareIndex != 7654321);
+ psMemInfo->sShareMemWorkaround.ui32ShareIndex = ui32ShareIndex;
+ psMemInfo->sShareMemWorkaround.hDevCookieInt = hDevCookieInt;
+ psMemInfo->sShareMemWorkaround.ui32OrigReqAttribs = psAllocDeviceMemIN->ui32Attribs;
+ psMemInfo->sShareMemWorkaround.ui32OrigReqSize = (IMG_UINT32)psAllocDeviceMemIN->ui32Size;
+ psMemInfo->sShareMemWorkaround.ui32OrigReqAlignment = (IMG_UINT32)psAllocDeviceMemIN->ui32Alignment;
+ }
+
OSMemSet(&psAllocDeviceMemOUT->sClientMemInfo,
0,
sizeof(psAllocDeviceMemOUT->sClientMemInfo));
@@ -473,8 +595,12 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
#endif
psAllocDeviceMemOUT->sClientMemInfo.sDevVAddr = psMemInfo->sDevVAddr;
psAllocDeviceMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags;
- psAllocDeviceMemOUT->sClientMemInfo.ui32AllocSize = psMemInfo->ui32AllocSize;
+ psAllocDeviceMemOUT->sClientMemInfo.uAllocSize = psMemInfo->uAllocSize;
+#if defined (SUPPORT_SID_INTERFACE)
+
+#else
psAllocDeviceMemOUT->sClientMemInfo.hMappingInfo = psMemInfo->sMemBlk.hOSMemHandle;
+#endif
PVRSRVAllocHandleNR(psPerProc->psHandleBase,
&psAllocDeviceMemOUT->sClientMemInfo.hKernelMemInfo,
@@ -482,6 +608,24 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
PVRSRV_HANDLE_TYPE_MEM_INFO,
PVRSRV_HANDLE_ALLOC_FLAG_NONE);
+#if defined (SUPPORT_SID_INTERFACE)
+ PVR_ASSERT(psAllocDeviceMemOUT->sClientMemInfo.hKernelMemInfo != 0);
+
+ if (psMemInfo->sMemBlk.hOSMemHandle != IMG_NULL)
+ {
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &psAllocDeviceMemOUT->sClientMemInfo.hMappingInfo,
+ psMemInfo->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_MEM_INFO,
+ PVRSRV_HANDLE_ALLOC_FLAG_NONE,
+ psAllocDeviceMemOUT->sClientMemInfo.hKernelMemInfo);
+ }
+ else
+ {
+ psAllocDeviceMemOUT->sClientMemInfo.hMappingInfo = 0;
+ }
+#endif
+
if(psAllocDeviceMemIN->ui32Attribs & PVRSRV_MEM_NO_SYNCOBJ)
{
@@ -494,15 +638,35 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
{
+#if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS)
psAllocDeviceMemOUT->sClientSyncInfo.psSyncData =
psMemInfo->psKernelSyncInfo->psSyncData;
psAllocDeviceMemOUT->sClientSyncInfo.sWriteOpsCompleteDevVAddr =
psMemInfo->psKernelSyncInfo->sWriteOpsCompleteDevVAddr;
psAllocDeviceMemOUT->sClientSyncInfo.sReadOpsCompleteDevVAddr =
psMemInfo->psKernelSyncInfo->sReadOpsCompleteDevVAddr;
+ psAllocDeviceMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr =
+ psMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
+#if defined (SUPPORT_SID_INTERFACE)
+ if (psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL)
+ {
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &psAllocDeviceMemOUT->sClientSyncInfo.hMappingInfo,
+ psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_SYNC_INFO,
+ PVRSRV_HANDLE_ALLOC_FLAG_NONE,
+ psAllocDeviceMemOUT->sClientMemInfo.hKernelMemInfo);
+ }
+ else
+ {
+ psAllocDeviceMemOUT->sClientSyncInfo.hMappingInfo = 0;
+ }
+#else
psAllocDeviceMemOUT->sClientSyncInfo.hMappingInfo =
psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
+#endif
+#endif
PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
&psAllocDeviceMemOUT->sClientSyncInfo.hKernelSyncInfo,
@@ -513,7 +677,6 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
psAllocDeviceMemOUT->sClientMemInfo.psClientSyncInfo =
&psAllocDeviceMemOUT->sClientSyncInfo;
-
}
COMMIT_HANDLE_BATCH_OR_ERROR(psAllocDeviceMemOUT->eError, psPerProc)
@@ -532,7 +695,6 @@ PVRSRVFreeDeviceMemBW(IMG_UINT32 ui32BridgeID,
IMG_HANDLE hDevCookieInt;
IMG_VOID *pvKernelMemInfo;
-
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_FREE_DEVICEMEM);
psRetOUT->eError =
@@ -546,8 +708,13 @@ PVRSRVFreeDeviceMemBW(IMG_UINT32 ui32BridgeID,
}
psRetOUT->eError =
- PVRSRVLookupHandle(psPerProc->psHandleBase, &pvKernelMemInfo,
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ &pvKernelMemInfo,
+#if defined (SUPPORT_SID_INTERFACE)
+ psFreeDeviceMemIN->hKernelMemInfo,
+#else
psFreeDeviceMemIN->psKernelMemInfo,
+#endif
PVRSRV_HANDLE_TYPE_MEM_INFO);
if(psRetOUT->eError != PVRSRV_OK)
@@ -564,7 +731,11 @@ PVRSRVFreeDeviceMemBW(IMG_UINT32 ui32BridgeID,
psRetOUT->eError =
PVRSRVReleaseHandle(psPerProc->psHandleBase,
+#if defined (SUPPORT_SID_INTERFACE)
+ psFreeDeviceMemIN->hKernelMemInfo,
+#else
psFreeDeviceMemIN->psKernelMemInfo,
+#endif
PVRSRV_HANDLE_TYPE_MEM_INFO);
return 0;
@@ -578,13 +749,20 @@ PVRSRVExportDeviceMemBW(IMG_UINT32 ui32BridgeID,
PVRSRV_PER_PROCESS_DATA *psPerProc)
{
IMG_HANDLE hDevCookieInt;
+#if defined (SUPPORT_SID_INTERFACE)
+ PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = IMG_NULL;
+#else
PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo;
+#endif
- PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_EXPORT_DEVICEMEM);
+ PVR_ASSERT(ui32BridgeID == PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_EXPORT_DEVICEMEM) ||
+ ui32BridgeID == PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_EXPORT_DEVICEMEM_2));
+ PVR_UNREFERENCED_PARAMETER(ui32BridgeID);
psExportDeviceMemOUT->eError =
- PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevCookieInt,
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ &hDevCookieInt,
psExportDeviceMemIN->hDevCookie,
PVRSRV_HANDLE_TYPE_DEV_NODE);
@@ -596,8 +774,13 @@ PVRSRVExportDeviceMemBW(IMG_UINT32 ui32BridgeID,
psExportDeviceMemOUT->eError =
- PVRSRVLookupHandle(psPerProc->psHandleBase, (IMG_PVOID *)&psKernelMemInfo,
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ (IMG_PVOID *)&psKernelMemInfo,
+#if defined (SUPPORT_SID_INTERFACE)
+ psExportDeviceMemIN->hKernelMemInfo,
+#else
psExportDeviceMemIN->psKernelMemInfo,
+#endif
PVRSRV_HANDLE_TYPE_MEM_INFO);
if(psExportDeviceMemOUT->eError != PVRSRV_OK)
@@ -648,7 +831,9 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
PVRSRV_KERNEL_MEM_INFO *psDstKernelMemInfo = IMG_NULL;
IMG_HANDLE hDstDevMemHeap = IMG_NULL;
- PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_MAP_DEV_MEMORY);
+ PVR_ASSERT(ui32BridgeID == PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_MAP_DEV_MEMORY) ||
+ ui32BridgeID == PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_MAP_DEV_MEMORY_2));
+ PVR_UNREFERENCED_PARAMETER(ui32BridgeID);
NEW_HANDLE_BATCH_OR_ERROR(psMapDevMemOUT->eError, psPerProc, 2)
@@ -673,15 +858,68 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
}
- psMapDevMemOUT->eError = PVRSRVMapDeviceMemoryKM(psPerProc,
- psSrcKernelMemInfo,
- hDstDevMemHeap,
- &psDstKernelMemInfo);
- if(psMapDevMemOUT->eError != PVRSRV_OK)
+ if (psSrcKernelMemInfo->sShareMemWorkaround.bInUse)
{
- return 0;
+ PVR_DPF((PVR_DBG_MESSAGE, "using the mem wrap workaround."));
+
+
+
+
+
+
+
+
+
+ psMapDevMemOUT->eError = BM_XProcWorkaroundSetShareIndex(psSrcKernelMemInfo->sShareMemWorkaround.ui32ShareIndex);
+ if(psMapDevMemOUT->eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVMapDeviceMemoryBW(): failed to recycle shared buffer"));
+ return 0;
+ }
+
+ psMapDevMemOUT->eError =
+ PVRSRVAllocDeviceMemKM(psSrcKernelMemInfo->sShareMemWorkaround.hDevCookieInt,
+ psPerProc,
+ hDstDevMemHeap,
+ psSrcKernelMemInfo->sShareMemWorkaround.ui32OrigReqAttribs | PVRSRV_MEM_NO_SYNCOBJ,
+ psSrcKernelMemInfo->sShareMemWorkaround.ui32OrigReqSize,
+ psSrcKernelMemInfo->sShareMemWorkaround.ui32OrigReqAlignment,
+ IMG_NULL,
+ 0,
+ &psDstKernelMemInfo,
+ "" );
+
+
+ BM_XProcWorkaroundUnsetShareIndex(psSrcKernelMemInfo->sShareMemWorkaround.ui32ShareIndex);
+ if(psMapDevMemOUT->eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVMapDeviceMemoryBW: Failed to create allocation for cross-process memory map"));
+ return 0;
+ }
+
+ if(psSrcKernelMemInfo->psKernelSyncInfo)
+ {
+ psSrcKernelMemInfo->psKernelSyncInfo->ui32RefCount++;
+ }
+
+ psDstKernelMemInfo->psKernelSyncInfo = psSrcKernelMemInfo->psKernelSyncInfo;
+ }
+ else
+ {
+
+ psMapDevMemOUT->eError = PVRSRVMapDeviceMemoryKM(psPerProc,
+ psSrcKernelMemInfo,
+ hDstDevMemHeap,
+ &psDstKernelMemInfo);
+ if(psMapDevMemOUT->eError != PVRSRV_OK)
+ {
+ return 0;
+ }
}
+
+ psDstKernelMemInfo->sShareMemWorkaround = psSrcKernelMemInfo->sShareMemWorkaround;
+
OSMemSet(&psMapDevMemOUT->sDstClientMemInfo,
0,
sizeof(psMapDevMemOUT->sDstClientMemInfo));
@@ -695,8 +933,12 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
psMapDevMemOUT->sDstClientMemInfo.pvLinAddr = 0;
psMapDevMemOUT->sDstClientMemInfo.sDevVAddr = psDstKernelMemInfo->sDevVAddr;
psMapDevMemOUT->sDstClientMemInfo.ui32Flags = psDstKernelMemInfo->ui32Flags;
- psMapDevMemOUT->sDstClientMemInfo.ui32AllocSize = psDstKernelMemInfo->ui32AllocSize;
+ psMapDevMemOUT->sDstClientMemInfo.uAllocSize = psDstKernelMemInfo->uAllocSize;
+#if defined (SUPPORT_SID_INTERFACE)
+
+#else
psMapDevMemOUT->sDstClientMemInfo.hMappingInfo = psDstKernelMemInfo->sMemBlk.hOSMemHandle;
+#endif
PVRSRVAllocHandleNR(psPerProc->psHandleBase,
@@ -706,18 +948,56 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
PVRSRV_HANDLE_ALLOC_FLAG_NONE);
psMapDevMemOUT->sDstClientSyncInfo.hKernelSyncInfo = IMG_NULL;
+#if defined (SUPPORT_SID_INTERFACE)
+
+ if (psDstKernelMemInfo->sMemBlk.hOSMemHandle != IMG_NULL)
+ {
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &psMapDevMemOUT->sDstClientMemInfo.hMappingInfo,
+ psDstKernelMemInfo->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_MEM_INFO,
+ PVRSRV_HANDLE_ALLOC_FLAG_NONE,
+ psMapDevMemOUT->sDstClientMemInfo.hKernelMemInfo);
+ }
+ else
+ {
+ psMapDevMemOUT->sDstClientMemInfo.hMappingInfo = 0;
+ }
+#endif
+
if(psDstKernelMemInfo->psKernelSyncInfo)
{
+#if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS)
psMapDevMemOUT->sDstClientSyncInfo.psSyncData =
psDstKernelMemInfo->psKernelSyncInfo->psSyncData;
psMapDevMemOUT->sDstClientSyncInfo.sWriteOpsCompleteDevVAddr =
psDstKernelMemInfo->psKernelSyncInfo->sWriteOpsCompleteDevVAddr;
psMapDevMemOUT->sDstClientSyncInfo.sReadOpsCompleteDevVAddr =
psDstKernelMemInfo->psKernelSyncInfo->sReadOpsCompleteDevVAddr;
+ psMapDevMemOUT->sDstClientSyncInfo.sReadOps2CompleteDevVAddr =
+ psDstKernelMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
+#if defined (SUPPORT_SID_INTERFACE)
+
+ if (psDstKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL)
+ {
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &psMapDevMemOUT->sDstClientSyncInfo.hMappingInfo,
+ psDstKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_MEM_INFO,
+ PVRSRV_HANDLE_ALLOC_FLAG_NONE,
+ psMapDevMemOUT->sDstClientMemInfo.hKernelMemInfo);
+ }
+ else
+ {
+ psMapDevMemOUT->sDstClientSyncInfo.hMappingInfo = 0;
+ }
+#else
psMapDevMemOUT->sDstClientSyncInfo.hMappingInfo =
psDstKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
+#endif
+#endif
psMapDevMemOUT->sDstClientMemInfo.psClientSyncInfo = &psMapDevMemOUT->sDstClientSyncInfo;
@@ -747,21 +1027,41 @@ PVRSRVUnmapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
psRetOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
(IMG_VOID**)&psKernelMemInfo,
+#if defined (SUPPORT_SID_INTERFACE)
+ psUnmapDevMemIN->hKernelMemInfo,
+#else
psUnmapDevMemIN->psKernelMemInfo,
+#endif
PVRSRV_HANDLE_TYPE_MEM_INFO);
if(psRetOUT->eError != PVRSRV_OK)
{
return 0;
}
- psRetOUT->eError = PVRSRVUnmapDeviceMemoryKM(psKernelMemInfo);
- if(psRetOUT->eError != PVRSRV_OK)
+ if (psKernelMemInfo->sShareMemWorkaround.bInUse)
{
- return 0;
+ psRetOUT->eError = PVRSRVFreeDeviceMemKM(psKernelMemInfo->sShareMemWorkaround.hDevCookieInt, psKernelMemInfo);
+ if(psRetOUT->eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVUnmapDeviceMemoryBW: internal error, should expect FreeDeviceMem to fail"));
+ return 0;
+ }
+ }
+ else
+ {
+ psRetOUT->eError = PVRSRVUnmapDeviceMemoryKM(psKernelMemInfo);
+ if(psRetOUT->eError != PVRSRV_OK)
+ {
+ return 0;
+ }
}
psRetOUT->eError = PVRSRVReleaseHandle(psPerProc->psHandleBase,
+#if defined (SUPPORT_SID_INTERFACE)
+ psUnmapDevMemIN->hKernelMemInfo,
+#else
psUnmapDevMemIN->psKernelMemInfo,
+#endif
PVRSRV_HANDLE_TYPE_MEM_INFO);
return 0;
@@ -787,7 +1087,8 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
psMapDevClassMemOUT->eError =
- PVRSRVLookupHandleAnyType(psPerProc->psHandleBase, &hDeviceClassBufferInt,
+ PVRSRVLookupHandleAnyType(psPerProc->psHandleBase,
+ &hDeviceClassBufferInt,
&eHandleType,
psMapDevClassMemIN->hDeviceClassBuffer);
@@ -798,7 +1099,8 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
psMapDevClassMemOUT->eError =
- PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevMemContextInt,
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ &hDevMemContextInt,
psMapDevClassMemIN->hDevMemContext,
PVRSRV_HANDLE_TYPE_DEV_MEM_CONTEXT);
@@ -810,7 +1112,7 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
switch(eHandleType)
{
-#if defined(PVR_SECURE_HANDLES)
+#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
case PVRSRV_HANDLE_TYPE_DISP_BUFFER:
case PVRSRV_HANDLE_TYPE_BUF_BUFFER:
#else
@@ -846,8 +1148,24 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
psMapDevClassMemOUT->sClientMemInfo.pvLinAddr = 0;
psMapDevClassMemOUT->sClientMemInfo.sDevVAddr = psMemInfo->sDevVAddr;
psMapDevClassMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags;
- psMapDevClassMemOUT->sClientMemInfo.ui32AllocSize = psMemInfo->ui32AllocSize;
+ psMapDevClassMemOUT->sClientMemInfo.uAllocSize = psMemInfo->uAllocSize;
+#if defined (SUPPORT_SID_INTERFACE)
+ if (psMemInfo->sMemBlk.hOSMemHandle != 0)
+ {
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &psMapDevClassMemOUT->sClientMemInfo.hMappingInfo,
+ psMemInfo->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_MEM_INFO,
+ PVRSRV_HANDLE_ALLOC_FLAG_NONE,
+ psMapDevClassMemIN->hDeviceClassBuffer);
+ }
+ else
+ {
+ psMapDevClassMemOUT->sClientMemInfo.hMappingInfo = 0;
+ }
+#else
psMapDevClassMemOUT->sClientMemInfo.hMappingInfo = psMemInfo->sMemBlk.hOSMemHandle;
+#endif
PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
&psMapDevClassMemOUT->sClientMemInfo.hKernelMemInfo,
@@ -861,15 +1179,35 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
if(psMemInfo->psKernelSyncInfo)
{
+#if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS)
psMapDevClassMemOUT->sClientSyncInfo.psSyncData =
psMemInfo->psKernelSyncInfo->psSyncData;
psMapDevClassMemOUT->sClientSyncInfo.sWriteOpsCompleteDevVAddr =
psMemInfo->psKernelSyncInfo->sWriteOpsCompleteDevVAddr;
psMapDevClassMemOUT->sClientSyncInfo.sReadOpsCompleteDevVAddr =
psMemInfo->psKernelSyncInfo->sReadOpsCompleteDevVAddr;
+ psMapDevClassMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr =
+ psMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
+#if defined (SUPPORT_SID_INTERFACE)
+ if (psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != 0)
+ {
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &psMapDevClassMemOUT->sClientSyncInfo.hMappingInfo,
+ psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_SYNC_INFO,
+ PVRSRV_HANDLE_ALLOC_FLAG_MULTI,
+ psMapDevClassMemOUT->sClientMemInfo.hKernelMemInfo);
+ }
+ else
+ {
+ psMapDevClassMemOUT->sClientSyncInfo.hMappingInfo = 0;
+ }
+#else
psMapDevClassMemOUT->sClientSyncInfo.hMappingInfo =
psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
+#endif
+#endif
psMapDevClassMemOUT->sClientMemInfo.psClientSyncInfo = &psMapDevClassMemOUT->sClientSyncInfo;
@@ -898,7 +1236,11 @@ PVRSRVUnmapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
psRetOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase, &pvKernelMemInfo,
+#if defined (SUPPORT_SID_INTERFACE)
+ psUnmapDevClassMemIN->hKernelMemInfo,
+#else
psUnmapDevClassMemIN->psKernelMemInfo,
+#endif
PVRSRV_HANDLE_TYPE_MEM_INFO);
if(psRetOUT->eError != PVRSRV_OK)
{
@@ -914,7 +1256,11 @@ PVRSRVUnmapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
psRetOUT->eError =
PVRSRVReleaseHandle(psPerProc->psHandleBase,
+#if defined (SUPPORT_SID_INTERFACE)
+ psUnmapDevClassMemIN->hKernelMemInfo,
+#else
psUnmapDevClassMemIN->psKernelMemInfo,
+#endif
PVRSRV_HANDLE_TYPE_MEM_INFO);
return 0;
@@ -939,7 +1285,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID,
PVRSRV_KERNEL_MEM_INFO *psMemInfo;
IMG_SYS_PHYADDR *psSysPAddr = IMG_NULL;
IMG_UINT32 ui32PageTableSize = 0;
-
+
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_WRAP_EXT_MEMORY);
NEW_HANDLE_BATCH_OR_ERROR(psWrapExtMemOUT->eError, psPerProc, 2)
@@ -987,7 +1333,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID,
return -EFAULT;
}
}
-
+
psWrapExtMemOUT->eError =
PVRSRVWrapExtMemoryKM(hDevCookieInt,
psPerProc,
@@ -1007,7 +1353,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID,
(IMG_VOID *)psSysPAddr, 0);
}
-
+
if(psWrapExtMemOUT->eError != PVRSRV_OK)
{
return 0;
@@ -1020,8 +1366,11 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID,
psWrapExtMemOUT->sClientMemInfo.pvLinAddr = 0;
psWrapExtMemOUT->sClientMemInfo.sDevVAddr = psMemInfo->sDevVAddr;
psWrapExtMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags;
- psWrapExtMemOUT->sClientMemInfo.ui32AllocSize = psMemInfo->ui32AllocSize;
+ psWrapExtMemOUT->sClientMemInfo.uAllocSize = psMemInfo->uAllocSize;
+#if defined (SUPPORT_SID_INTERFACE)
+#else
psWrapExtMemOUT->sClientMemInfo.hMappingInfo = psMemInfo->sMemBlk.hOSMemHandle;
+#endif
PVRSRVAllocHandleNR(psPerProc->psHandleBase,
&psWrapExtMemOUT->sClientMemInfo.hKernelMemInfo,
@@ -1029,16 +1378,54 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID,
PVRSRV_HANDLE_TYPE_MEM_INFO,
PVRSRV_HANDLE_ALLOC_FLAG_NONE);
+#if defined (SUPPORT_SID_INTERFACE)
+
+ if (psMemInfo->sMemBlk.hOSMemHandle != IMG_NULL)
+ {
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &psWrapExtMemOUT->sClientMemInfo.hMappingInfo,
+ psMemInfo->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_MEM_INFO,
+ PVRSRV_HANDLE_ALLOC_FLAG_NONE,
+ psWrapExtMemOUT->sClientMemInfo.hKernelMemInfo);
+ }
+ else
+ {
+ psWrapExtMemOUT->sClientMemInfo.hMappingInfo = 0;
+ }
+#endif
+
+#if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS)
psWrapExtMemOUT->sClientSyncInfo.psSyncData =
psMemInfo->psKernelSyncInfo->psSyncData;
psWrapExtMemOUT->sClientSyncInfo.sWriteOpsCompleteDevVAddr =
psMemInfo->psKernelSyncInfo->sWriteOpsCompleteDevVAddr;
psWrapExtMemOUT->sClientSyncInfo.sReadOpsCompleteDevVAddr =
psMemInfo->psKernelSyncInfo->sReadOpsCompleteDevVAddr;
+ psWrapExtMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr =
+ psMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
+#if defined (SUPPORT_SID_INTERFACE)
+
+ if (psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL)
+ {
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &psWrapExtMemOUT->sClientSyncInfo.hMappingInfo,
+ psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_MEM_INFO,
+ PVRSRV_HANDLE_ALLOC_FLAG_NONE,
+ psWrapExtMemOUT->sClientMemInfo.hKernelMemInfo);
+ }
+ else
+ {
+ psWrapExtMemOUT->sClientSyncInfo.hMappingInfo = 0;
+ }
+#else
psWrapExtMemOUT->sClientSyncInfo.hMappingInfo =
psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
+#endif
+#endif
psWrapExtMemOUT->sClientMemInfo.psClientSyncInfo = &psWrapExtMemOUT->sClientSyncInfo;
@@ -1125,12 +1512,12 @@ PVRMMapOSMemHandleToMMapDataBW(IMG_UINT32 ui32BridgeID,
&psMMapDataOUT->ui32ByteOffset,
&psMMapDataOUT->ui32RealByteSize,
&psMMapDataOUT->ui32UserVAddr);
-#else
+#else
PVR_UNREFERENCED_PARAMETER(psPerProc);
PVR_UNREFERENCED_PARAMETER(psMMapDataIN);
psMMapDataOUT->eError = PVRSRV_ERROR_NOT_SUPPORTED;
-#endif
+#endif
return 0;
}
@@ -1151,15 +1538,58 @@ PVRMMapReleaseMMapDataBW(IMG_UINT32 ui32BridgeID,
&psMMapDataOUT->ui32RealByteSize,
&psMMapDataOUT->ui32UserVAddr);
#else
-
+
PVR_UNREFERENCED_PARAMETER(psPerProc);
PVR_UNREFERENCED_PARAMETER(psMMapDataIN);
psMMapDataOUT->eError = PVRSRV_ERROR_NOT_SUPPORTED;
-#endif
+#endif
+ return 0;
+}
+
+
+#if defined (SUPPORT_SID_INTERFACE)
+static IMG_INT
+PVRSRVChangeDeviceMemoryAttributesBW(IMG_UINT32 ui32BridgeID,
+ PVRSRV_BRIDGE_IN_CHG_DEV_MEM_ATTRIBS *psChgMemAttribIN,
+ PVRSRV_BRIDGE_RETURN *psRetOUT,
+ PVRSRV_PER_PROCESS_DATA *psPerProc)
+{
+ IMG_HANDLE hKernelMemInfo;
+
+ PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_CHG_DEV_MEM_ATTRIBS);
+
+ psRetOUT->eError =
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ &hKernelMemInfo,
+ psChgMemAttribIN->hKernelMemInfo,
+ PVRSRV_HANDLE_TYPE_MEM_INFO);
+
+ if(psRetOUT->eError != PVRSRV_OK)
+ {
+ return 0;
+ }
+
+ psRetOUT->eError =
+ PVRSRVChangeDeviceMemoryAttributesKM(hKernelMemInfo, psChgMemAttribIN->ui32Attribs);
+
return 0;
}
+#else
+static IMG_INT
+PVRSRVChangeDeviceMemoryAttributesBW(IMG_UINT32 ui32BridgeID,
+ PVRSRV_BRIDGE_IN_CHG_DEV_MEM_ATTRIBS *psChgMemAttribIN,
+ PVRSRV_BRIDGE_RETURN *psRetOUT,
+ PVRSRV_PER_PROCESS_DATA *psPerProc)
+{
+ PVR_UNREFERENCED_PARAMETER(ui32BridgeID);
+ PVR_UNREFERENCED_PARAMETER(psChgMemAttribIN);
+ PVR_UNREFERENCED_PARAMETER(psRetOUT);
+ PVR_UNREFERENCED_PARAMETER(psPerProc);
+ return 0;
+}
+#endif
#ifdef PDUMP
static IMG_INT
@@ -1217,9 +1647,9 @@ PDumpRegWithFlagsBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_PDUMP_REG);
psRetOUT->eError =
- PVRSRVLookupHandle(psPerProc->psHandleBase,
- (IMG_VOID **)&psDeviceNode,
- psPDumpRegDumpIN->hDevCookie,
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ (IMG_VOID **)&psDeviceNode,
+ psPDumpRegDumpIN->hDevCookie,
PVRSRV_HANDLE_TYPE_DEV_NODE);
if(psRetOUT->eError != PVRSRV_OK)
{
@@ -1245,9 +1675,9 @@ PDumpRegPolBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_PDUMP_REGPOL);
psRetOUT->eError =
- PVRSRVLookupHandle(psPerProc->psHandleBase,
- (IMG_VOID **)&psDeviceNode,
- psPDumpRegPolIN->hDevCookie,
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ (IMG_VOID **)&psDeviceNode,
+ psPDumpRegPolIN->hDevCookie,
PVRSRV_HANDLE_TYPE_DEV_NODE);
if(psRetOUT->eError != PVRSRV_OK)
{
@@ -1255,12 +1685,13 @@ PDumpRegPolBW(IMG_UINT32 ui32BridgeID,
}
- psRetOUT->eError =
+ psRetOUT->eError =
PDumpRegPolWithFlagsKM(psPDumpRegPolIN->szRegRegion,
- psPDumpRegPolIN->sHWReg.ui32RegAddr,
+ psPDumpRegPolIN->sHWReg.ui32RegAddr,
psPDumpRegPolIN->sHWReg.ui32RegVal,
psPDumpRegPolIN->ui32Mask,
- psPDumpRegPolIN->ui32Flags);
+ psPDumpRegPolIN->ui32Flags,
+ PDUMP_POLL_OPERATOR_EQUAL);
return 0;
}
@@ -1278,7 +1709,11 @@ PDumpMemPolBW(IMG_UINT32 ui32BridgeID,
psRetOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase,
&pvMemInfo,
+#if defined (SUPPORT_SID_INTERFACE)
+ psPDumpMemPolIN->hKernelMemInfo,
+#else
psPDumpMemPolIN->psKernelMemInfo,
+#endif
PVRSRV_HANDLE_TYPE_MEM_INFO);
if(psRetOUT->eError != PVRSRV_OK)
{
@@ -1310,7 +1745,11 @@ PDumpMemBW(IMG_UINT32 ui32BridgeID,
psRetOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase,
&pvMemInfo,
+#if defined (SUPPORT_SID_INTERFACE)
+ psPDumpMemDumpIN->hKernelMemInfo,
+#else
psPDumpMemDumpIN->psKernelMemInfo,
+#endif
PVRSRV_HANDLE_TYPE_MEM_INFO);
if(psRetOUT->eError != PVRSRV_OK)
{
@@ -1338,7 +1777,7 @@ PDumpBitmapBW(IMG_UINT32 ui32BridgeID,
{
PVRSRV_DEVICE_NODE *psDeviceNode;
IMG_HANDLE hDevMemContextInt;
-
+
PVR_UNREFERENCED_PARAMETER(ui32BridgeID);
psRetOUT->eError =
@@ -1356,7 +1795,7 @@ PDumpBitmapBW(IMG_UINT32 ui32BridgeID,
{
return 0;
}
-
+
psRetOUT->eError =
PDumpBitmapKM(psDeviceNode,
&psPDumpBitmapIN->szFileName[0],
@@ -1401,6 +1840,31 @@ PDumpReadRegBW(IMG_UINT32 ui32BridgeID,
}
static IMG_INT
+PDumpMemPagesBW(IMG_UINT32 ui32BridgeID,
+ PVRSRV_BRIDGE_IN_PDUMP_MEMPAGES *psPDumpMemPagesIN,
+ PVRSRV_BRIDGE_RETURN *psRetOUT,
+ PVRSRV_PER_PROCESS_DATA *psPerProc)
+{
+ PVRSRV_DEVICE_NODE *psDeviceNode;
+
+ PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_PDUMP_MEMPAGES);
+
+ psRetOUT->eError =
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ (IMG_VOID **)&psDeviceNode,
+ psPDumpMemPagesIN->hDevCookie,
+ PVRSRV_HANDLE_TYPE_DEV_NODE);
+
+ if(psRetOUT->eError != PVRSRV_OK)
+ {
+ return 0;
+ }
+
+
+ return 0;
+}
+
+static IMG_INT
PDumpDriverInfoBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_IN_PDUMP_DRIVERINFO *psPDumpDriverInfoIN,
PVRSRV_BRIDGE_RETURN *psRetOUT,
@@ -1436,7 +1900,11 @@ PDumpSyncDumpBW(IMG_UINT32 ui32BridgeID,
psRetOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase, &pvSyncInfo,
+#if defined (SUPPORT_SID_INTERFACE)
+ psPDumpSyncDumpIN->hKernelSyncInfo,
+#else
psPDumpSyncDumpIN->psKernelSyncInfo,
+#endif
PVRSRV_HANDLE_TYPE_SYNC_INFO);
if(psRetOUT->eError != PVRSRV_OK)
{
@@ -1464,12 +1932,19 @@ PDumpSyncPolBW(IMG_UINT32 ui32BridgeID,
{
IMG_UINT32 ui32Offset;
IMG_VOID *pvSyncInfo;
+ IMG_UINT32 ui32Value;
+ IMG_UINT32 ui32Mask;
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_PDUMP_SYNCPOL);
psRetOUT->eError =
- PVRSRVLookupHandle(psPerProc->psHandleBase, &pvSyncInfo,
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ &pvSyncInfo,
+#if defined (SUPPORT_SID_INTERFACE)
+ psPDumpSyncPolIN->hKernelSyncInfo,
+#else
psPDumpSyncPolIN->psKernelSyncInfo,
+#endif
PVRSRV_HANDLE_TYPE_SYNC_INFO);
if(psRetOUT->eError != PVRSRV_OK)
{
@@ -1485,11 +1960,30 @@ PDumpSyncPolBW(IMG_UINT32 ui32BridgeID,
ui32Offset = offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete);
}
+
+ if (psPDumpSyncPolIN->bUseLastOpDumpVal)
+ {
+ if(psPDumpSyncPolIN->bIsRead)
+ {
+ ui32Value = ((PVRSRV_KERNEL_SYNC_INFO *)pvSyncInfo)->psSyncData->ui32LastReadOpDumpVal;
+ }
+ else
+ {
+ ui32Value = ((PVRSRV_KERNEL_SYNC_INFO *)pvSyncInfo)->psSyncData->ui32LastOpDumpVal;
+ }
+ ui32Mask = 0xffffffff;
+ }
+ else
+ {
+ ui32Value = psPDumpSyncPolIN->ui32Value;
+ ui32Mask = psPDumpSyncPolIN->ui32Mask;
+ }
+
psRetOUT->eError =
PDumpMemPolKM(((PVRSRV_KERNEL_SYNC_INFO *)pvSyncInfo)->psSyncDataMemInfoKM,
ui32Offset,
- psPDumpSyncPolIN->ui32Value,
- psPDumpSyncPolIN->ui32Mask,
+ ui32Value,
+ ui32Mask,
PDUMP_POLL_OPERATOR_EQUAL,
0,
MAKEUNIQUETAG(((PVRSRV_KERNEL_SYNC_INFO *)pvSyncInfo)->psSyncDataMemInfoKM));
@@ -1505,13 +1999,13 @@ PDumpCycleCountRegReadBW(IMG_UINT32 ui32BridgeID,
PVRSRV_PER_PROCESS_DATA *psPerProc)
{
PVRSRV_DEVICE_NODE *psDeviceNode;
-
+
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_PDUMP_CYCLE_COUNT_REG_READ);
psRetOUT->eError =
- PVRSRVLookupHandle(psPerProc->psHandleBase,
- (IMG_VOID **)&psDeviceNode,
- psPDumpCycleCountRegReadIN->hDevCookie,
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ (IMG_VOID **)&psDeviceNode,
+ psPDumpCycleCountRegReadIN->hDevCookie,
PVRSRV_HANDLE_TYPE_DEV_NODE);
if(psRetOUT->eError != PVRSRV_OK)
{
@@ -1594,13 +2088,30 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_OUT_GET_MISC_INFO *psGetMiscInfoOUT,
PVRSRV_PER_PROCESS_DATA *psPerProc)
{
+#if defined (SUPPORT_SID_INTERFACE)
+ PVRSRV_MISC_INFO_KM sMiscInfo = {0};
+#endif
PVRSRV_ERROR eError;
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_GET_MISC_INFO);
+#if defined (SUPPORT_SID_INTERFACE)
+ sMiscInfo.ui32StateRequest = psGetMiscInfoIN->sMiscInfo.ui32StateRequest;
+ sMiscInfo.ui32StatePresent = psGetMiscInfoIN->sMiscInfo.ui32StatePresent;
+ sMiscInfo.ui32MemoryStrLen = psGetMiscInfoIN->sMiscInfo.ui32MemoryStrLen;
+ sMiscInfo.pszMemoryStr = psGetMiscInfoIN->sMiscInfo.pszMemoryStr;
+
+ OSMemCopy(&sMiscInfo.sCacheOpCtl,
+ &psGetMiscInfoIN->sMiscInfo.sCacheOpCtl,
+ sizeof(sMiscInfo.sCacheOpCtl));
+ OSMemCopy(&sMiscInfo.sGetRefCountCtl,
+ &psGetMiscInfoIN->sMiscInfo.sGetRefCountCtl,
+ sizeof(sMiscInfo.sGetRefCountCtl));
+#else
OSMemCopy(&psGetMiscInfoOUT->sMiscInfo,
- &psGetMiscInfoIN->sMiscInfo,
- sizeof(PVRSRV_MISC_INFO));
+ &psGetMiscInfoIN->sMiscInfo,
+ sizeof(PVRSRV_MISC_INFO));
+#endif
if (((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_MEMSTATS_PRESENT) != 0) &&
((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_DDKVERSION_PRESENT) != 0) &&
@@ -1616,6 +2127,20 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_FREEMEM_PRESENT) != 0))
{
+#if defined (SUPPORT_SID_INTERFACE)
+ ASSIGN_AND_EXIT_ON_ERROR(psGetMiscInfoOUT->eError,
+ OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
+ psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen,
+ (IMG_VOID **)&sMiscInfo.pszMemoryStr, 0,
+ "Output string buffer"));
+ psGetMiscInfoOUT->eError = PVRSRVGetMiscInfoKM(&sMiscInfo);
+
+
+ eError = CopyToUserWrapper(psPerProc, ui32BridgeID,
+ psGetMiscInfoIN->sMiscInfo.pszMemoryStr,
+ sMiscInfo.pszMemoryStr,
+ sMiscInfo.ui32MemoryStrLen);
+#else
ASSIGN_AND_EXIT_ON_ERROR(psGetMiscInfoOUT->eError,
OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen,
@@ -1629,12 +2154,18 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
psGetMiscInfoIN->sMiscInfo.pszMemoryStr,
psGetMiscInfoOUT->sMiscInfo.pszMemoryStr,
psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen);
+#endif
+#if defined (SUPPORT_SID_INTERFACE)
+ OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
+ sMiscInfo.ui32MemoryStrLen,
+ (IMG_VOID *)sMiscInfo.pszMemoryStr, 0);
+#else
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen,
(IMG_VOID *)psGetMiscInfoOUT->sMiscInfo.pszMemoryStr, 0);
- psGetMiscInfoOUT->sMiscInfo.pszMemoryStr = IMG_NULL;
+#endif
psGetMiscInfoOUT->sMiscInfo.pszMemoryStr = psGetMiscInfoIN->sMiscInfo.pszMemoryStr;
@@ -1648,7 +2179,11 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
}
else
{
+#if defined (SUPPORT_SID_INTERFACE)
+ psGetMiscInfoOUT->eError = PVRSRVGetMiscInfoKM(&sMiscInfo);
+#else
psGetMiscInfoOUT->eError = PVRSRVGetMiscInfoKM(&psGetMiscInfoOUT->sMiscInfo);
+#endif
}
@@ -1658,26 +2193,48 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
}
+#if defined (SUPPORT_SID_INTERFACE)
+ if (sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_GLOBALEVENTOBJECT_PRESENT)
+#else
if (psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_GLOBALEVENTOBJECT_PRESENT)
+#endif
{
psGetMiscInfoOUT->eError = PVRSRVAllocHandle(psPerProc->psHandleBase,
&psGetMiscInfoOUT->sMiscInfo.sGlobalEventObject.hOSEventKM,
+#if defined (SUPPORT_SID_INTERFACE)
+ sMiscInfo.sGlobalEventObject.hOSEventKM,
+#else
psGetMiscInfoOUT->sMiscInfo.sGlobalEventObject.hOSEventKM,
+#endif
PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT,
PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
- if (psGetMiscInfoOUT->eError != PVRSRV_OK)
- {
- return 0;
- }
+ if (psGetMiscInfoOUT->eError != PVRSRV_OK)
+ {
+ return 0;
+ }
+
+#if defined (SUPPORT_SID_INTERFACE)
+ OSMemCopy(&psGetMiscInfoOUT->sMiscInfo.sGlobalEventObject.szName,
+ sMiscInfo.sGlobalEventObject.szName,
+ EVENTOBJNAME_MAXLENGTH);
+#endif
}
+#if defined (SUPPORT_SID_INTERFACE)
+ if (sMiscInfo.hSOCTimerRegisterOSMemHandle)
+#else
if (psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle)
+#endif
{
psGetMiscInfoOUT->eError = PVRSRVAllocHandle(psPerProc->psHandleBase,
&psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle,
+#if defined (SUPPORT_SID_INTERFACE)
+ sMiscInfo.hSOCTimerRegisterOSMemHandle,
+#else
psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle,
+#endif
PVRSRV_HANDLE_TYPE_SOC_TIMER,
PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
@@ -1686,6 +2243,32 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
return 0;
}
}
+#if defined (SUPPORT_SID_INTERFACE)
+ else
+ {
+ psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle = 0;
+ }
+
+
+ psGetMiscInfoOUT->sMiscInfo.ui32StateRequest = sMiscInfo.ui32StateRequest;
+ psGetMiscInfoOUT->sMiscInfo.ui32StatePresent = sMiscInfo.ui32StatePresent;
+
+ psGetMiscInfoOUT->sMiscInfo.pvSOCTimerRegisterKM = sMiscInfo.pvSOCTimerRegisterKM;
+ psGetMiscInfoOUT->sMiscInfo.pvSOCTimerRegisterUM = sMiscInfo.pvSOCTimerRegisterUM;
+ psGetMiscInfoOUT->sMiscInfo.pvSOCClockGateRegs = sMiscInfo.pvSOCClockGateRegs;
+
+ psGetMiscInfoOUT->sMiscInfo.ui32SOCClockGateRegsSize = sMiscInfo.ui32SOCClockGateRegsSize;
+
+ OSMemCopy(&psGetMiscInfoOUT->sMiscInfo.aui32DDKVersion,
+ &sMiscInfo.aui32DDKVersion,
+ sizeof(psGetMiscInfoOUT->sMiscInfo.aui32DDKVersion));
+ OSMemCopy(&psGetMiscInfoOUT->sMiscInfo.sCacheOpCtl,
+ &sMiscInfo.sCacheOpCtl,
+ sizeof(psGetMiscInfoOUT->sMiscInfo.sCacheOpCtl));
+ OSMemCopy(&psGetMiscInfoOUT->sMiscInfo.sGetRefCountCtl,
+ &sMiscInfo.sGetRefCountCtl,
+ sizeof(psGetMiscInfoOUT->sMiscInfo.sGetRefCountCtl));
+#endif
return 0;
}
@@ -1700,11 +2283,17 @@ PVRSRVConnectBW(IMG_UINT32 ui32BridgeID,
#if defined(PDUMP)
- psPerProc->bPDumpPersistent |= ( (psConnectServicesIN->ui32Flags & SRV_FLAGS_PERSIST) != 0) ? IMG_TRUE : IMG_FALSE;
+ if ((psConnectServicesIN->ui32Flags & SRV_FLAGS_PERSIST) != 0)
+ {
+ psPerProc->bPDumpPersistent = IMG_TRUE;
+ }
#if defined(SUPPORT_PDUMP_MULTI_PROCESS)
- psPerProc->bPDumpActive |= ( (psConnectServicesIN->ui32Flags & SRV_FLAGS_PDUMP_ACTIVE) != 0) ? IMG_TRUE : IMG_FALSE;
+ if ((psConnectServicesIN->ui32Flags & SRV_FLAGS_PDUMP_ACTIVE) != 0)
+ {
+ psPerProc->bPDumpActive = IMG_TRUE;
+ }
#endif
#else
PVR_UNREFERENCED_PARAMETER(psConnectServicesIN);
@@ -1886,6 +2475,7 @@ PVRSRVEnumDCDimsBW(IMG_UINT32 ui32BridgeID,
return 0;
}
+#if defined(SUPPORT_PVRSRV_GET_DC_SYSTEM_BUFFER)
static IMG_INT
PVRSRVGetDCSystemBufferBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_IN_GET_DISPCLASS_SYSBUFFER *psGetDispClassSysBufferIN,
@@ -1930,6 +2520,7 @@ PVRSRVGetDCSystemBufferBW(IMG_UINT32 ui32BridgeID,
return 0;
}
+#endif
static IMG_INT
PVRSRVGetDCInfoBW(IMG_UINT32 ui32BridgeID,
@@ -2217,6 +2808,9 @@ PVRSRVGetDCBuffersBW(IMG_UINT32 ui32BridgeID,
IMG_VOID *pvDispClassInfo;
IMG_VOID *pvSwapChain;
IMG_UINT32 i;
+#if defined (SUPPORT_SID_INTERFACE)
+ IMG_HANDLE *pahBuffer;
+#endif
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_GET_DISPCLASS_BUFFERS);
@@ -2242,11 +2836,28 @@ PVRSRVGetDCBuffersBW(IMG_UINT32 ui32BridgeID,
return 0;
}
+#if defined (SUPPORT_SID_INTERFACE)
+ psGetDispClassBuffersOUT->eError = OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
+ sizeof(IMG_HANDLE) * PVRSRV_MAX_DC_SWAPCHAIN_BUFFERS,
+ (IMG_PVOID *)&pahBuffer, 0,
+ "Temp Swapchain Buffers");
+
+ if (psGetDispClassBuffersOUT->eError != PVRSRV_OK)
+ {
+ return 0;
+ }
+#endif
+
psGetDispClassBuffersOUT->eError =
PVRSRVGetDCBuffersKM(pvDispClassInfo,
pvSwapChain,
&psGetDispClassBuffersOUT->ui32BufferCount,
- psGetDispClassBuffersOUT->ahBuffer);
+#if defined (SUPPORT_SID_INTERFACE)
+ pahBuffer,
+#else
+ psGetDispClassBuffersOUT->ahBuffer,
+#endif
+ psGetDispClassBuffersOUT->asPhyAddr);
if (psGetDispClassBuffersOUT->eError != PVRSRV_OK)
{
return 0;
@@ -2256,19 +2867,38 @@ PVRSRVGetDCBuffersBW(IMG_UINT32 ui32BridgeID,
for(i = 0; i < psGetDispClassBuffersOUT->ui32BufferCount; i++)
{
+#if defined (SUPPORT_SID_INTERFACE)
+ IMG_SID hBufferExt;
+#else
IMG_HANDLE hBufferExt;
+#endif
-
+
+#if defined (SUPPORT_SID_INTERFACE)
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &hBufferExt,
+ pahBuffer[i],
+ PVRSRV_HANDLE_TYPE_DISP_BUFFER,
+ (PVRSRV_HANDLE_ALLOC_FLAG)(PVRSRV_HANDLE_ALLOC_FLAG_PRIVATE | PVRSRV_HANDLE_ALLOC_FLAG_SHARED),
+ psGetDispClassBuffersIN->hSwapChain);
+#else
PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
&hBufferExt,
psGetDispClassBuffersOUT->ahBuffer[i],
PVRSRV_HANDLE_TYPE_DISP_BUFFER,
(PVRSRV_HANDLE_ALLOC_FLAG)(PVRSRV_HANDLE_ALLOC_FLAG_PRIVATE | PVRSRV_HANDLE_ALLOC_FLAG_SHARED),
psGetDispClassBuffersIN->hSwapChain);
+#endif
psGetDispClassBuffersOUT->ahBuffer[i] = hBufferExt;
}
+#if defined (SUPPORT_SID_INTERFACE)
+ OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
+ sizeof(IMG_HANDLE) * PVRSRV_MAX_DC_SWAPCHAIN_BUFFERS,
+ (IMG_PVOID)pahBuffer, 0);
+#endif
+
COMMIT_HANDLE_BATCH_OR_ERROR(psGetDispClassBuffersOUT->eError, psPerProc)
return 0;
@@ -2282,6 +2912,9 @@ PVRSRVSwapToDCBufferBW(IMG_UINT32 ui32BridgeID,
{
IMG_VOID *pvDispClassInfo;
IMG_VOID *pvSwapChainBuf;
+#if defined (SUPPORT_SID_INTERFACE)
+ IMG_HANDLE hPrivateTag;
+#endif
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER);
@@ -2306,11 +2939,35 @@ PVRSRVSwapToDCBufferBW(IMG_UINT32 ui32BridgeID,
return 0;
}
+#if defined (SUPPORT_SID_INTERFACE)
+ if (psSwapDispClassBufferIN->hPrivateTag != 0)
+ {
+ psRetOUT->eError =
+ PVRSRVLookupSubHandle(psPerProc->psHandleBase,
+ &hPrivateTag,
+ psSwapDispClassBufferIN->hPrivateTag,
+ PVRSRV_HANDLE_TYPE_DISP_BUFFER,
+ psSwapDispClassBufferIN->hDeviceKM);
+ if(psRetOUT->eError != PVRSRV_OK)
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ hPrivateTag = IMG_NULL;
+ }
+#endif
+
psRetOUT->eError =
PVRSRVSwapToDCBufferKM(pvDispClassInfo,
pvSwapChainBuf,
psSwapDispClassBufferIN->ui32SwapInterval,
+#if defined (SUPPORT_SID_INTERFACE)
+ hPrivateTag,
+#else
psSwapDispClassBufferIN->hPrivateTag,
+#endif
psSwapDispClassBufferIN->ui32ClipRectCount,
psSwapDispClassBufferIN->sClipRect);
@@ -2318,6 +2975,136 @@ PVRSRVSwapToDCBufferBW(IMG_UINT32 ui32BridgeID,
}
static IMG_INT
+PVRSRVSwapToDCBuffer2BW(IMG_UINT32 ui32BridgeID,
+ PVRSRV_BRIDGE_IN_SWAP_DISPCLASS_TO_BUFFER2 *psSwapDispClassBufferIN,
+ PVRSRV_BRIDGE_RETURN *psRetOUT,
+ PVRSRV_PER_PROCESS_DATA *psPerProc)
+{
+ IMG_VOID *pvPrivData = IMG_NULL;
+ IMG_VOID *pvDispClassInfo;
+ IMG_VOID *pvSwapChain;
+ IMG_UINT32 i;
+
+ PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER2);
+
+ psRetOUT->eError =
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ &pvDispClassInfo,
+ psSwapDispClassBufferIN->hDeviceKM,
+ PVRSRV_HANDLE_TYPE_DISP_INFO);
+ if(psRetOUT->eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up DISP_INFO handle"));
+ return 0;
+ }
+
+ psRetOUT->eError =
+ PVRSRVLookupSubHandle(psPerProc->psHandleBase,
+ &pvSwapChain,
+ psSwapDispClassBufferIN->hSwapChain,
+ PVRSRV_HANDLE_TYPE_DISP_SWAP_CHAIN,
+ psSwapDispClassBufferIN->hDeviceKM);
+ if(psRetOUT->eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up DISP_BUFFER handle"));
+ return 0;
+ }
+
+ if(!OSAccessOK(PVR_VERIFY_WRITE,
+ psSwapDispClassBufferIN->ppsKernelMemInfos,
+ sizeof(IMG_HANDLE) * psSwapDispClassBufferIN->ui32NumMemInfos))
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Access check failed for ppsKernelMemInfos"));
+ return -EFAULT;
+ }
+
+ if(!OSAccessOK(PVR_VERIFY_WRITE,
+ psSwapDispClassBufferIN->ppsKernelSyncInfos,
+ sizeof(IMG_HANDLE) * psSwapDispClassBufferIN->ui32NumMemInfos))
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Access check failed for ppsKernelSyncInfos"));
+ return -EFAULT;
+ }
+
+ for (i = 0; i < psSwapDispClassBufferIN->ui32NumMemInfos; i++)
+ {
+ PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
+ PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo;
+
+ psRetOUT->eError =
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ (IMG_PVOID *)&psKernelMemInfo,
+ psSwapDispClassBufferIN->ppsKernelMemInfos[i],
+ PVRSRV_HANDLE_TYPE_MEM_INFO);
+ if(psRetOUT->eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up MEM_INFO handle"));
+ return 0;
+ }
+
+ psRetOUT->eError =
+ PVRSRVLookupHandle(psPerProc->psHandleBase,
+ (IMG_PVOID *)&psKernelSyncInfo,
+ psSwapDispClassBufferIN->ppsKernelSyncInfos[i],
+ PVRSRV_HANDLE_TYPE_SYNC_INFO);
+ if(psRetOUT->eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up SYNC_INFO handle"));
+ return 0;
+ }
+
+ psSwapDispClassBufferIN->ppsKernelMemInfos[i] = psKernelMemInfo;
+ psSwapDispClassBufferIN->ppsKernelSyncInfos[i] = psKernelSyncInfo;
+ }
+
+ if(psSwapDispClassBufferIN->ui32PrivDataLength > 0)
+ {
+ if(OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
+ psSwapDispClassBufferIN->ui32PrivDataLength,
+ (IMG_VOID **)&pvPrivData, IMG_NULL,
+ "Swap Command Private Data") != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR,"PVRSRVSwapToDCBuffer2BW: Failed to allocate private data space"));
+ return -ENOMEM;
+ }
+
+ if(CopyFromUserWrapper(psPerProc,
+ ui32BridgeID,
+ pvPrivData,
+ psSwapDispClassBufferIN->pvPrivData,
+ psSwapDispClassBufferIN->ui32PrivDataLength) != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to copy private data"));
+ OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
+ psSwapDispClassBufferIN->ui32PrivDataLength,
+ pvPrivData, IMG_NULL);
+ return -EFAULT;
+ }
+ }
+
+ psRetOUT->eError =
+ PVRSRVSwapToDCBuffer2KM(pvDispClassInfo,
+ pvSwapChain,
+ psSwapDispClassBufferIN->ui32SwapInterval,
+ psSwapDispClassBufferIN->ppsKernelMemInfos,
+ psSwapDispClassBufferIN->ppsKernelSyncInfos,
+ psSwapDispClassBufferIN->ui32NumMemInfos,
+ pvPrivData,
+ psSwapDispClassBufferIN->ui32PrivDataLength);
+
+ if(psRetOUT->eError != PVRSRV_OK)
+ {
+ OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
+ psSwapDispClassBufferIN->ui32PrivDataLength,
+ pvPrivData, IMG_NULL);
+ }
+
+ return 0;
+}
+
+
+
+static IMG_INT
PVRSRVSwapToDCSystemBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_IN_SWAP_DISPCLASS_TO_SYSTEM *psSwapDispClassSystemIN,
PVRSRV_BRIDGE_RETURN *psRetOUT,
@@ -2539,9 +3326,24 @@ PVRSRVAllocSharedSysMemoryBW(IMG_UINT32 ui32BridgeID,
psAllocSharedSysMemOUT->sClientMemInfo.pvLinAddr = 0;
psAllocSharedSysMemOUT->sClientMemInfo.ui32Flags =
psKernelMemInfo->ui32Flags;
- psAllocSharedSysMemOUT->sClientMemInfo.ui32AllocSize =
- psKernelMemInfo->ui32AllocSize;
+ psAllocSharedSysMemOUT->sClientMemInfo.uAllocSize =
+ psKernelMemInfo->uAllocSize;
+#if defined (SUPPORT_SID_INTERFACE)
+ if (psKernelMemInfo->sMemBlk.hOSMemHandle != IMG_NULL)
+ {
+ PVRSRVAllocHandleNR(psPerProc->psHandleBase,
+ &psAllocSharedSysMemOUT->sClientMemInfo.hMappingInfo,
+ psKernelMemInfo->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO,
+ PVRSRV_HANDLE_ALLOC_FLAG_NONE);
+ }
+ else
+ {
+ psAllocSharedSysMemOUT->sClientMemInfo.hMappingInfo = 0;
+ }
+#else
psAllocSharedSysMemOUT->sClientMemInfo.hMappingInfo = psKernelMemInfo->sMemBlk.hOSMemHandle;
+#endif
PVRSRVAllocHandleNR(psPerProc->psHandleBase,
&psAllocSharedSysMemOUT->sClientMemInfo.hKernelMemInfo,
@@ -2567,8 +3369,12 @@ PVRSRVFreeSharedSysMemoryBW(IMG_UINT32 ui32BridgeID,
psFreeSharedSysMemOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase,
(IMG_VOID **)&psKernelMemInfo,
+#if defined (SUPPORT_SID_INTERFACE)
+ psFreeSharedSysMemIN->hKernelMemInfo,
+#else
psFreeSharedSysMemIN->psKernelMemInfo,
- PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO);
+#endif
+ PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO);
if(psFreeSharedSysMemOUT->eError != PVRSRV_OK)
return 0;
@@ -2577,10 +3383,27 @@ PVRSRVFreeSharedSysMemoryBW(IMG_UINT32 ui32BridgeID,
PVRSRVFreeSharedSysMemoryKM(psKernelMemInfo);
if(psFreeSharedSysMemOUT->eError != PVRSRV_OK)
return 0;
+#if defined (SUPPORT_SID_INTERFACE)
+ if (psFreeSharedSysMemIN->hMappingInfo != 0)
+ {
+ psFreeSharedSysMemOUT->eError =
+ PVRSRVReleaseHandle(psPerProc->psHandleBase,
+ psFreeSharedSysMemIN->hMappingInfo,
+ PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO);
+ if(psFreeSharedSysMemOUT->eError != PVRSRV_OK)
+ {
+ return 0;
+ }
+ }
+#endif
psFreeSharedSysMemOUT->eError =
PVRSRVReleaseHandle(psPerProc->psHandleBase,
+#if defined (SUPPORT_SID_INTERFACE)
+ psFreeSharedSysMemIN->hKernelMemInfo,
+#else
psFreeSharedSysMemIN->psKernelMemInfo,
+#endif
PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO);
return 0;
}
@@ -2593,7 +3416,11 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID,
{
PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo;
PVRSRV_HANDLE_TYPE eHandleType;
+#if defined (SUPPORT_SID_INTERFACE)
+ IMG_SID hParent;
+#else
IMG_HANDLE hParent;
+#endif
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_MAP_MEMINFO_MEM);
NEW_HANDLE_BATCH_OR_ERROR(psMapMemInfoMemOUT->eError, psPerProc, 2)
@@ -2610,7 +3437,7 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID,
switch (eHandleType)
{
-#if defined(PVR_SECURE_HANDLES)
+#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
case PVRSRV_HANDLE_TYPE_MEM_INFO:
case PVRSRV_HANDLE_TYPE_MEM_INFO_REF:
case PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO:
@@ -2633,7 +3460,11 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID,
{
return 0;
}
+#if defined (SUPPORT_SID_INTERFACE)
+ if (hParent == 0)
+#else
if (hParent == IMG_NULL)
+#endif
{
hParent = psMapMemInfoMemIN->hKernelMemInfo;
}
@@ -2650,9 +3481,25 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID,
psKernelMemInfo->sDevVAddr;
psMapMemInfoMemOUT->sClientMemInfo.ui32Flags =
psKernelMemInfo->ui32Flags;
- psMapMemInfoMemOUT->sClientMemInfo.ui32AllocSize =
- psKernelMemInfo->ui32AllocSize;
+ psMapMemInfoMemOUT->sClientMemInfo.uAllocSize =
+ psKernelMemInfo->uAllocSize;
+#if defined (SUPPORT_SID_INTERFACE)
+ if (psKernelMemInfo->sMemBlk.hOSMemHandle != IMG_NULL)
+ {
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &psMapMemInfoMemOUT->sClientMemInfo.hMappingInfo,
+ psKernelMemInfo->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_MEM_INFO_REF,
+ PVRSRV_HANDLE_ALLOC_FLAG_MULTI,
+ hParent);
+ }
+ else
+ {
+ psMapMemInfoMemOUT->sClientMemInfo.hMappingInfo = 0;
+ }
+#else
psMapMemInfoMemOUT->sClientMemInfo.hMappingInfo = psKernelMemInfo->sMemBlk.hOSMemHandle;
+#endif
PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
&psMapMemInfoMemOUT->sClientMemInfo.hKernelMemInfo,
@@ -2671,15 +3518,37 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID,
else
{
+#if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS)
psMapMemInfoMemOUT->sClientSyncInfo.psSyncData =
psKernelMemInfo->psKernelSyncInfo->psSyncData;
psMapMemInfoMemOUT->sClientSyncInfo.sWriteOpsCompleteDevVAddr =
psKernelMemInfo->psKernelSyncInfo->sWriteOpsCompleteDevVAddr;
psMapMemInfoMemOUT->sClientSyncInfo.sReadOpsCompleteDevVAddr =
psKernelMemInfo->psKernelSyncInfo->sReadOpsCompleteDevVAddr;
+ psMapMemInfoMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr =
+ psKernelMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
+ psMapMemInfoMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr =
+ psKernelMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
+#if defined (SUPPORT_SID_INTERFACE)
+ if (psKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL)
+ {
+ PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
+ &psMapMemInfoMemOUT->sClientSyncInfo.hMappingInfo,
+ psKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
+ PVRSRV_HANDLE_TYPE_SYNC_INFO,
+ PVRSRV_HANDLE_ALLOC_FLAG_MULTI,
+ psMapMemInfoMemOUT->sClientMemInfo.hKernelMemInfo);
+ }
+ else
+ {
+ psMapMemInfoMemOUT->sClientSyncInfo.hMappingInfo = 0;
+ }
+#else
psMapMemInfoMemOUT->sClientSyncInfo.hMappingInfo =
psKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
+#endif
+#endif
psMapMemInfoMemOUT->sClientMemInfo.psClientSyncInfo = &psMapMemInfoMemOUT->sClientSyncInfo;
@@ -2899,7 +3768,7 @@ PVRSRVEventObjectWaitBW(IMG_UINT32 ui32BridgeID,
return 0;
}
- psRetOUT->eError = OSEventObjectWait(hOSEventKM);
+ psRetOUT->eError = OSEventObjectWaitKM(hOSEventKM);
return 0;
}
@@ -2911,6 +3780,10 @@ PVRSRVEventObjectOpenBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_OUT_EVENT_OBJECT_OPEN *psEventObjectOpenOUT,
PVRSRV_PER_PROCESS_DATA *psPerProc)
{
+#if defined (SUPPORT_SID_INTERFACE)
+ PVRSRV_EVENTOBJECT_KM sEventObject;
+ IMG_HANDLE hOSEvent;
+#endif
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_EVENT_OBJECT_OPEN);
@@ -2918,7 +3791,11 @@ PVRSRVEventObjectOpenBW(IMG_UINT32 ui32BridgeID,
psEventObjectOpenOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase,
+#if defined (SUPPORT_SID_INTERFACE)
+ &sEventObject.hOSEventKM,
+#else
&psEventObjectOpenIN->sEventObject.hOSEventKM,
+#endif
psEventObjectOpenIN->sEventObject.hOSEventKM,
PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT);
@@ -2927,18 +3804,36 @@ PVRSRVEventObjectOpenBW(IMG_UINT32 ui32BridgeID,
return 0;
}
- psEventObjectOpenOUT->eError = OSEventObjectOpen(&psEventObjectOpenIN->sEventObject, &psEventObjectOpenOUT->hOSEvent);
+#if defined (SUPPORT_SID_INTERFACE)
+ OSMemCopy(&sEventObject.szName,
+ &psEventObjectOpenIN->sEventObject.szName,
+ EVENTOBJNAME_MAXLENGTH);
+
+ psEventObjectOpenOUT->eError = OSEventObjectOpenKM(&sEventObject, &hOSEvent);
+#else
+ psEventObjectOpenOUT->eError = OSEventObjectOpenKM(&psEventObjectOpenIN->sEventObject, &psEventObjectOpenOUT->hOSEvent);
+#endif
if(psEventObjectOpenOUT->eError != PVRSRV_OK)
{
return 0;
}
+#if defined (SUPPORT_SID_INTERFACE)
+#if !defined (WINXP) && !defined(SUPPORT_VISTA)
+ PVRSRVAllocHandleNR(psPerProc->psHandleBase,
+ &psEventObjectOpenOUT->hOSEvent,
+ hOSEvent,
+ PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT,
+ PVRSRV_HANDLE_ALLOC_FLAG_MULTI);
+#endif
+#else
PVRSRVAllocHandleNR(psPerProc->psHandleBase,
&psEventObjectOpenOUT->hOSEvent,
psEventObjectOpenOUT->hOSEvent,
PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT,
PVRSRV_HANDLE_ALLOC_FLAG_MULTI);
+#endif
COMMIT_HANDLE_BATCH_OR_ERROR(psEventObjectOpenOUT->eError, psPerProc)
@@ -2953,12 +3848,19 @@ PVRSRVEventObjectCloseBW(IMG_UINT32 ui32BridgeID,
PVRSRV_PER_PROCESS_DATA *psPerProc)
{
IMG_HANDLE hOSEventKM;
+#if defined (SUPPORT_SID_INTERFACE)
+ PVRSRV_EVENTOBJECT_KM sEventObject;
+#endif
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_EVENT_OBJECT_CLOSE);
psRetOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase,
+#if defined (SUPPORT_SID_INTERFACE)
+ &sEventObject.hOSEventKM,
+#else
&psEventObjectCloseIN->sEventObject.hOSEventKM,
+#endif
psEventObjectCloseIN->sEventObject.hOSEventKM,
PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT);
if(psRetOUT->eError != PVRSRV_OK)
@@ -2976,7 +3878,20 @@ PVRSRVEventObjectCloseBW(IMG_UINT32 ui32BridgeID,
return 0;
}
- psRetOUT->eError = OSEventObjectClose(&psEventObjectCloseIN->sEventObject, hOSEventKM);
+#if defined (SUPPORT_SID_INTERFACE)
+ if(CopyFromUserWrapper(psPerProc, ui32BridgeID,
+ &sEventObject.szName,
+ &psEventObjectCloseIN->sEventObject.szName,
+ EVENTOBJNAME_MAXLENGTH) != PVRSRV_OK)
+ {
+
+ return -EFAULT;
+ }
+
+ psRetOUT->eError = OSEventObjectCloseKM(&sEventObject, hOSEventKM);
+#else
+ psRetOUT->eError = OSEventObjectCloseKM(&psEventObjectCloseIN->sEventObject, hOSEventKM);
+#endif
return 0;
}
@@ -2989,45 +3904,72 @@ typedef struct _MODIFY_SYNC_OP_INFO
IMG_UINT32 ui32ModifyFlags;
IMG_UINT32 ui32ReadOpsPendingSnapShot;
IMG_UINT32 ui32WriteOpsPendingSnapShot;
+ IMG_UINT32 ui32ReadOps2PendingSnapShot;
} MODIFY_SYNC_OP_INFO;
-static PVRSRV_ERROR DoQuerySyncOpsSatisfied(MODIFY_SYNC_OP_INFO *psModSyncOpInfo)
+static PVRSRV_ERROR DoQuerySyncOpsSatisfied(PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo,
+ IMG_UINT32 ui32ReadOpsPendingSnapShot,
+ IMG_UINT32 ui32WriteOpsPendingSnapShot,
+ IMG_UINT32 ui32ReadOps2PendingSnapShot)
{
- PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
-
- psKernelSyncInfo = psModSyncOpInfo->psKernelSyncInfo;
+ IMG_UINT32 ui32WriteOpsPending;
+ IMG_UINT32 ui32ReadOpsPending;
+ IMG_UINT32 ui32ReadOps2Pending;
+
if (!psKernelSyncInfo)
{
return PVRSRV_ERROR_INVALID_PARAMS;
}
- if((psModSyncOpInfo->ui32WriteOpsPendingSnapShot == psKernelSyncInfo->psSyncData->ui32WriteOpsComplete)
- && (psModSyncOpInfo->ui32ReadOpsPendingSnapShot == psKernelSyncInfo->psSyncData->ui32ReadOpsComplete))
+
+
+
+
+
+
+
+
+
+
+ ui32WriteOpsPending = psKernelSyncInfo->psSyncData->ui32WriteOpsPending;
+ ui32ReadOpsPending = psKernelSyncInfo->psSyncData->ui32ReadOpsPending;
+ ui32ReadOps2Pending = psKernelSyncInfo->psSyncData->ui32ReadOps2Pending;
+
+ if((ui32WriteOpsPending - ui32WriteOpsPendingSnapShot >=
+ ui32WriteOpsPending - psKernelSyncInfo->psSyncData->ui32WriteOpsComplete) &&
+ (ui32ReadOpsPending - ui32ReadOpsPendingSnapShot >=
+ ui32ReadOpsPending - psKernelSyncInfo->psSyncData->ui32ReadOpsComplete) &&
+ (ui32ReadOps2Pending - ui32ReadOps2PendingSnapShot >=
+ ui32ReadOps2Pending - psKernelSyncInfo->psSyncData->ui32ReadOps2Complete))
{
-#if defined(PDUMP)
+#if defined(PDUMP) && !defined(SUPPORT_VGX)
-
-
- PDumpComment("Poll for read ops complete to reach value (%u)", psModSyncOpInfo->ui32ReadOpsPendingSnapShot);
+ PDumpComment("Poll for read ops complete to reach value (pdump: %u, actual snapshot: %u)",
+ psKernelSyncInfo->psSyncData->ui32LastReadOpDumpVal,
+ ui32ReadOpsPendingSnapShot);
PDumpMemPolKM(psKernelSyncInfo->psSyncDataMemInfoKM,
- offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete),
- psModSyncOpInfo->ui32ReadOpsPendingSnapShot,
- 0xFFFFFFFF,
- PDUMP_POLL_OPERATOR_EQUAL,
- 0,
- MAKEUNIQUETAG(psKernelSyncInfo->psSyncDataMemInfoKM));
-
+ offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete),
+ psKernelSyncInfo->psSyncData->ui32LastReadOpDumpVal,
+ 0xFFFFFFFF,
+ PDUMP_POLL_OPERATOR_EQUAL,
+ 0,
+ MAKEUNIQUETAG(psKernelSyncInfo->psSyncDataMemInfoKM));
+
- PDumpComment("Poll for write ops complete to reach value (%u)", psModSyncOpInfo->ui32WriteOpsPendingSnapShot);
+ PDumpComment("Poll for write ops complete to reach value (pdump: %u, actual snapshot: %u)",
+ psKernelSyncInfo->psSyncData->ui32LastOpDumpVal,
+ ui32WriteOpsPendingSnapShot);
PDumpMemPolKM(psKernelSyncInfo->psSyncDataMemInfoKM,
- offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete),
- psModSyncOpInfo->ui32WriteOpsPendingSnapShot,
- 0xFFFFFFFF,
- PDUMP_POLL_OPERATOR_EQUAL,
- 0,
- MAKEUNIQUETAG(psKernelSyncInfo->psSyncDataMemInfoKM));
+ offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete),
+ psKernelSyncInfo->psSyncData->ui32LastOpDumpVal,
+ 0xFFFFFFFF,
+ PDUMP_POLL_OPERATOR_EQUAL,
+ 0,
+ MAKEUNIQUETAG(psKernelSyncInfo->psSyncDataMemInfoKM));
+
+
#endif
return PVRSRV_OK;
}
@@ -3037,6 +3979,7 @@ static PVRSRV_ERROR DoQuerySyncOpsSatisfied(MODIFY_SYNC_OP_INFO *psModSyncOpInfo
}
}
+
static PVRSRV_ERROR DoModifyCompleteSyncOps(MODIFY_SYNC_OP_INFO *psModSyncOpInfo)
{
PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
@@ -3054,13 +3997,13 @@ static PVRSRV_ERROR DoModifyCompleteSyncOps(MODIFY_SYNC_OP_INFO *psModSyncOpInfo
{
return PVRSRV_ERROR_BAD_SYNC_STATE;
}
-
+
if(psModSyncOpInfo->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_WO_INC)
{
psKernelSyncInfo->psSyncData->ui32WriteOpsComplete++;
}
-
+
if(psModSyncOpInfo->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_RO_INC)
{
@@ -3072,11 +4015,13 @@ static PVRSRV_ERROR DoModifyCompleteSyncOps(MODIFY_SYNC_OP_INFO *psModSyncOpInfo
static PVRSRV_ERROR ModifyCompleteSyncOpsCallBack(IMG_PVOID pvParam,
- IMG_UINT32 ui32Param)
+ IMG_UINT32 ui32Param,
+ IMG_BOOL bDummy)
{
MODIFY_SYNC_OP_INFO *psModSyncOpInfo;
PVR_UNREFERENCED_PARAMETER(ui32Param);
+ PVR_UNREFERENCED_PARAMETER(bDummy);
if (!pvParam)
{
@@ -3091,26 +4036,30 @@ static PVRSRV_ERROR ModifyCompleteSyncOpsCallBack(IMG_PVOID pvParam,
LOOP_UNTIL_TIMEOUT(MAX_HW_TIME_US)
{
- if (DoQuerySyncOpsSatisfied(psModSyncOpInfo) == PVRSRV_OK)
+ if (DoQuerySyncOpsSatisfied(psModSyncOpInfo->psKernelSyncInfo,
+ psModSyncOpInfo->ui32ReadOpsPendingSnapShot,
+ psModSyncOpInfo->ui32WriteOpsPendingSnapShot,
+ psModSyncOpInfo->ui32ReadOps2PendingSnapShot) == PVRSRV_OK)
{
goto OpFlushedComplete;
}
PVR_DPF((PVR_DBG_WARNING, "ModifyCompleteSyncOpsCallBack: waiting for current Ops to flush"));
- OSSleepms(1);
+ OSSleepms(1);
} END_LOOP_UNTIL_TIMEOUT();
-
+
PVR_DPF((PVR_DBG_ERROR, "ModifyCompleteSyncOpsCallBack: timeout whilst waiting for current Ops to flush."));
PVR_DPF((PVR_DBG_ERROR, " Write ops pending snapshot = %d, write ops complete = %d",
psModSyncOpInfo->ui32WriteOpsPendingSnapShot,
psModSyncOpInfo->psKernelSyncInfo->psSyncData->ui32WriteOpsComplete));
- PVR_DPF((PVR_DBG_ERROR, " Read ops pending snapshot = %d, write ops complete = %d",
+ PVR_DPF((PVR_DBG_ERROR, " Read ops pending snapshot = %d, read ops complete = %d",
psModSyncOpInfo->ui32ReadOpsPendingSnapShot,
psModSyncOpInfo->psKernelSyncInfo->psSyncData->ui32ReadOpsComplete));
-
+ PVR_DPF((PVR_DBG_ERROR, " Read ops pending snapshot = %d, read ops2 complete = %d",
+ psModSyncOpInfo->ui32ReadOps2PendingSnapShot,
+ psModSyncOpInfo->psKernelSyncInfo->psSyncData->ui32ReadOps2Complete));
return PVRSRV_ERROR_TIMEOUT;
-
- OpFlushedComplete:
-
+
+OpFlushedComplete:
DoModifyCompleteSyncOps(psModSyncOpInfo);
}
@@ -3206,7 +4155,7 @@ PVRSRVDestroySyncInfoModObjBW(IMG_UINT32
return 0;
}
- psDestroySyncInfoModObjOUT->eError = ResManFreeResByPtr(psModSyncOpInfo->hResItem);
+ psDestroySyncInfoModObjOUT->eError = ResManFreeResByPtr(psModSyncOpInfo->hResItem, CLEANUP_WITH_POLL);
if (psDestroySyncInfoModObjOUT->eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR, "PVRSRVDestroySyncInfoModObjBW: ResManFreeResByPtr failed"));
@@ -3215,7 +4164,7 @@ PVRSRVDestroySyncInfoModObjBW(IMG_UINT32
return 0;
}
-
+
static IMG_INT
PVRSRVModifyPendingSyncOpsBW(IMG_UINT32 ui32BridgeID,
@@ -3261,11 +4210,13 @@ PVRSRVModifyPendingSyncOpsBW(IMG_UINT32 ui32BridgeID,
psModSyncOpInfo->ui32ModifyFlags = psModifySyncOpsIN->ui32ModifyFlags;
psModSyncOpInfo->ui32ReadOpsPendingSnapShot = psKernelSyncInfo->psSyncData->ui32ReadOpsPending;
psModSyncOpInfo->ui32WriteOpsPendingSnapShot = psKernelSyncInfo->psSyncData->ui32WriteOpsPending;
+ psModSyncOpInfo->ui32ReadOps2PendingSnapShot = psKernelSyncInfo->psSyncData->ui32ReadOps2Pending;
psModifySyncOpsOUT->ui32ReadOpsPending = psKernelSyncInfo->psSyncData->ui32ReadOpsPending;
psModifySyncOpsOUT->ui32WriteOpsPending = psKernelSyncInfo->psSyncData->ui32WriteOpsPending;
+ psModifySyncOpsOUT->ui32ReadOps2Pending = psKernelSyncInfo->psSyncData->ui32ReadOps2Pending;
if(psModifySyncOpsIN->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_WO_INC)
{
@@ -3336,6 +4287,78 @@ PVRSRVModifyCompleteSyncOpsBW(IMG_UINT32 ui32BridgeID,
static IMG_INT
+PVRSRVSyncOpsTakeTokenBW(IMG_UINT32 ui32BridgeID,
+ PVRSRV_BRIDGE_IN_SYNC_OPS_TAKE_TOKEN *psSyncOpsTakeTokenIN,
+ PVRSRV_BRIDGE_OUT_SYNC_OPS_TAKE_TOKEN *psSyncOpsTakeTokenOUT,
+ PVRSRV_PER_PROCESS_DATA *psPerProc)
+{
+ PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
+
+ PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SYNC_OPS_TAKE_TOKEN);
+
+ psSyncOpsTakeTokenOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
+ (IMG_VOID**)&psKernelSyncInfo,
+ psSyncOpsTakeTokenIN->hKernelSyncInfo,
+ PVRSRV_HANDLE_TYPE_SYNC_INFO);
+ if (psSyncOpsTakeTokenOUT->eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSyncOpsTakeTokenBW: PVRSRVLookupHandle failed"));
+ return 0;
+ }
+
+
+
+ psSyncOpsTakeTokenOUT->ui32ReadOpsPending = psKernelSyncInfo->psSyncData->ui32ReadOpsPending;
+ psSyncOpsTakeTokenOUT->ui32WriteOpsPending = psKernelSyncInfo->psSyncData->ui32WriteOpsPending;
+ psSyncOpsTakeTokenOUT->ui32ReadOps2Pending = psKernelSyncInfo->psSyncData->ui32ReadOps2Pending;
+
+ return 0;
+}
+
+
+static IMG_INT
+PVRSRVSyncOpsFlushToTokenBW(IMG_UINT32 ui32BridgeID,
+ PVRSRV_BRIDGE_IN_SYNC_OPS_FLUSH_TO_TOKEN *psSyncOpsFlushToTokenIN,
+ PVRSRV_BRIDGE_RETURN *psSyncOpsFlushToTokenOUT,
+ PVRSRV_PER_PROCESS_DATA *psPerProc)
+{
+ PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
+ IMG_UINT32 ui32ReadOpsPendingSnapshot;
+ IMG_UINT32 ui32WriteOpsPendingSnapshot;
+ IMG_UINT32 ui32ReadOps2PendingSnapshot;
+
+ PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SYNC_OPS_FLUSH_TO_TOKEN);
+
+ psSyncOpsFlushToTokenOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
+ (IMG_VOID**)&psKernelSyncInfo,
+ psSyncOpsFlushToTokenIN->hKernelSyncInfo,
+ PVRSRV_HANDLE_TYPE_SYNC_INFO);
+ if (psSyncOpsFlushToTokenOUT->eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSyncOpsFlushToTokenBW: PVRSRVLookupHandle failed"));
+ return 0;
+ }
+
+ ui32ReadOpsPendingSnapshot = psSyncOpsFlushToTokenIN->ui32ReadOpsPendingSnapshot;
+ ui32WriteOpsPendingSnapshot = psSyncOpsFlushToTokenIN->ui32WriteOpsPendingSnapshot;
+ ui32ReadOps2PendingSnapshot = psSyncOpsFlushToTokenIN->ui32ReadOps2PendingSnapshot;
+
+ psSyncOpsFlushToTokenOUT->eError = DoQuerySyncOpsSatisfied(psKernelSyncInfo,
+ ui32ReadOpsPendingSnapshot,
+ ui32WriteOpsPendingSnapshot,
+ ui32ReadOps2PendingSnapshot);
+
+ if (psSyncOpsFlushToTokenOUT->eError != PVRSRV_OK && psSyncOpsFlushToTokenOUT->eError != PVRSRV_ERROR_RETRY)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSyncOpsFlushToTokenBW: DoQuerySyncOpsSatisfied failed"));
+ return 0;
+ }
+
+ return 0;
+}
+
+
+static IMG_INT
PVRSRVSyncOpsFlushToModObjBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_IN_SYNC_OPS_FLUSH_TO_MOD_OBJ *psSyncOpsFlushToModObjIN,
PVRSRV_BRIDGE_RETURN *psSyncOpsFlushToModObjOUT,
@@ -3362,7 +4385,10 @@ PVRSRVSyncOpsFlushToModObjBW(IMG_UINT32
return 0;
}
- psSyncOpsFlushToModObjOUT->eError = DoQuerySyncOpsSatisfied(psModSyncOpInfo);
+ psSyncOpsFlushToModObjOUT->eError = DoQuerySyncOpsSatisfied(psModSyncOpInfo->psKernelSyncInfo,
+ psModSyncOpInfo->ui32ReadOpsPendingSnapShot,
+ psModSyncOpInfo->ui32WriteOpsPendingSnapShot,
+ psModSyncOpInfo->ui32ReadOps2PendingSnapShot);
if (psSyncOpsFlushToModObjOUT->eError != PVRSRV_OK && psSyncOpsFlushToModObjOUT->eError != PVRSRV_ERROR_RETRY)
{
@@ -3396,24 +4422,13 @@ PVRSRVSyncOpsFlushToDeltaBW(IMG_UINT32 u
return 0;
}
+
ui32DeltaRead = psSyncInfo->psSyncData->ui32ReadOpsPending - psSyncInfo->psSyncData->ui32ReadOpsComplete;
ui32DeltaWrite = psSyncInfo->psSyncData->ui32WriteOpsPending - psSyncInfo->psSyncData->ui32WriteOpsComplete;
if (ui32DeltaRead <= psSyncOpsFlushToDeltaIN->ui32Delta && ui32DeltaWrite <= psSyncOpsFlushToDeltaIN->ui32Delta)
{
-#if defined(PDUMP)
- IMG_UINT32 ui32MinimumReadOpsComplete;
-
- ui32MinimumReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending;
- if (ui32MinimumReadOpsComplete < psSyncOpsFlushToDeltaIN->ui32Delta)
- {
- ui32MinimumReadOpsComplete = 0;
- }
- else
- {
- ui32MinimumReadOpsComplete = ui32MinimumReadOpsComplete - psSyncOpsFlushToDeltaIN->ui32Delta;
- }
-
+#if defined(PDUMP) && !defined(SUPPORT_VGX)
PDumpComment("Poll for read ops complete to delta (%u)",
psSyncOpsFlushToDeltaIN->ui32Delta);
@@ -3452,12 +4467,14 @@ PVRSRVSyncOpsFlushToDeltaBW(IMG_UINT32 u
static PVRSRV_ERROR
FreeSyncInfoCallback(IMG_PVOID pvParam,
- IMG_UINT32 ui32Param)
+ IMG_UINT32 ui32Param,
+ IMG_BOOL bDummy)
{
PVRSRV_KERNEL_SYNC_INFO *psSyncInfo;
PVRSRV_ERROR eError;
PVR_UNREFERENCED_PARAMETER(ui32Param);
+ PVR_UNREFERENCED_PARAMETER(bDummy);
psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)pvParam;
@@ -3466,7 +4483,7 @@ FreeSyncInfoCallback(IMG_PVOID pvParam,
{
return eError;
}
-
+
return PVRSRV_OK;
}
@@ -3481,7 +4498,7 @@ PVRSRVAllocSyncInfoBW(IMG_UINT32 ui32Bri
PVRSRV_ERROR eError;
PVRSRV_DEVICE_NODE *psDeviceNode;
IMG_HANDLE hDevMemContext;
-
+
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_ALLOC_SYNC_INFO);
NEW_HANDLE_BATCH_OR_ERROR(psAllocSyncInfoOUT->eError, psPerProc, 1)
@@ -3496,11 +4513,11 @@ PVRSRVAllocSyncInfoBW(IMG_UINT32 ui32Bri
}
hDevMemContext = psDeviceNode->sDevMemoryInfo.pBMKernelContext;
-
+
eError = PVRSRVAllocSyncInfoKM(psDeviceNode,
hDevMemContext,
&psSyncInfo);
-
+
if (eError != PVRSRV_OK)
{
goto allocsyncinfo_errorexit;
@@ -3525,7 +4542,7 @@ PVRSRVAllocSyncInfoBW(IMG_UINT32 ui32Bri
goto allocsyncinfo_commit;
-
+
allocsyncinfo_errorexit_freesyncinfo:
PVRSRVFreeSyncInfoKM(psSyncInfo);
@@ -3536,7 +4553,7 @@ PVRSRVAllocSyncInfoBW(IMG_UINT32 ui32Bri
allocsyncinfo_commit:
psAllocSyncInfoOUT->eError = eError;
COMMIT_HANDLE_BATCH_OR_ERROR(eError, psPerProc);
-
+
return 0;
}
@@ -3574,7 +4591,7 @@ PVRSRVFreeSyncInfoBW(IMG_UINT32 ui32Bri
return 0;
}
- eError = ResManFreeResByPtr(psSyncInfo->hResItem);
+ eError = ResManFreeResByPtr(psSyncInfo->hResItem, CLEANUP_WITH_POLL);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR, "PVRSRVFreeSyncInfoBW: ResManFreeResByPtr failed"));
@@ -3619,6 +4636,9 @@ CommonBridgeInit(IMG_VOID)
SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_MEM_INFO_FROM_USER, DummyBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_EXPORT_DEVICEMEM, PVRSRVExportDeviceMemBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_RELEASE_MMAP_DATA, PVRMMapReleaseMMapDataBW);
+ SetDispatchTableEntry(PVRSRV_BRIDGE_CHG_DEV_MEM_ATTRIBS, PVRSRVChangeDeviceMemoryAttributesBW);
+ SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEV_MEMORY_2, PVRSRVMapDeviceMemoryBW);
+ SetDispatchTableEntry(PVRSRV_BRIDGE_EXPORT_DEVICEMEM_2, PVRSRVExportDeviceMemBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_PROCESS_SIMISR_EVENT, DummyBW);
@@ -3657,6 +4677,7 @@ CommonBridgeInit(IMG_VOID)
SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_DUMPREADREG, PDumpReadRegBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_SYNCPOL, PDumpSyncPolBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_DUMPSYNC, PDumpSyncDumpBW);
+ SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_MEMPAGES, PDumpMemPagesBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_DRIVERINFO, PDumpDriverInfoBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_DUMPPDDEVPADDR, PDumpPDDevPAddrBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_PDUMP_CYCLE_COUNT_REG_READ, PDumpCycleCountRegReadBW);
@@ -3675,7 +4696,11 @@ CommonBridgeInit(IMG_VOID)
SetDispatchTableEntry(PVRSRV_BRIDGE_CLOSE_DISPCLASS_DEVICE, PVRSRVCloseDCDeviceBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_DISPCLASS_FORMATS, PVRSRVEnumDCFormatsBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_DISPCLASS_DIMS, PVRSRVEnumDCDimsBW);
+#if defined(SUPPORT_PVRSRV_GET_DC_SYSTEM_BUFFER)
SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_SYSBUFFER, PVRSRVGetDCSystemBufferBW);
+#else
+ SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_SYSBUFFER, DummyBW);
+#endif
SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_INFO, PVRSRVGetDCInfoBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_CREATE_DISPCLASS_SWAPCHAIN, PVRSRVCreateDCSwapChainBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_DESTROY_DISPCLASS_SWAPCHAIN, PVRSRVDestroyDCSwapChainBW);
@@ -3685,6 +4710,7 @@ CommonBridgeInit(IMG_VOID)
SetDispatchTableEntry(PVRSRV_BRIDGE_SET_DISPCLASS_SRCCOLOURKEY, PVRSRVSetDCSrcColourKeyBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_BUFFERS, PVRSRVGetDCBuffersBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER, PVRSRVSwapToDCBufferBW);
+ SetDispatchTableEntry(PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER2, PVRSRVSwapToDCBuffer2BW);
SetDispatchTableEntry(PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_SYSTEM, PVRSRVSwapToDCSystemBW);
@@ -3702,7 +4728,7 @@ CommonBridgeInit(IMG_VOID)
SetDispatchTableEntry(PVRSRV_BRIDGE_FREE_SHARED_SYS_MEM, PVRSRVFreeSharedSysMemoryBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_MEMINFO_MEM, PVRSRVMapMemInfoMemBW);
-
+
SetDispatchTableEntry(PVRSRV_BRIDGE_GETMMU_PD_DEVPADDR, MMU_GetPDDevPAddrBW);
@@ -3718,6 +4744,8 @@ CommonBridgeInit(IMG_VOID)
SetDispatchTableEntry(PVRSRV_BRIDGE_DESTROY_SYNC_INFO_MOD_OBJ, PVRSRVDestroySyncInfoModObjBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_MODIFY_PENDING_SYNC_OPS, PVRSRVModifyPendingSyncOpsBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_MODIFY_COMPLETE_SYNC_OPS, PVRSRVModifyCompleteSyncOpsBW);
+ SetDispatchTableEntry(PVRSRV_BRIDGE_SYNC_OPS_TAKE_TOKEN, PVRSRVSyncOpsTakeTokenBW);
+ SetDispatchTableEntry(PVRSRV_BRIDGE_SYNC_OPS_FLUSH_TO_TOKEN, PVRSRVSyncOpsFlushToTokenBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_SYNC_OPS_FLUSH_TO_MOD_OBJ, PVRSRVSyncOpsFlushToModObjBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_SYNC_OPS_FLUSH_TO_DELTA, PVRSRVSyncOpsFlushToDeltaBW);
SetDispatchTableEntry(PVRSRV_BRIDGE_ALLOC_SYNC_INFO, PVRSRVAllocSyncInfoBW);
@@ -3733,7 +4761,6 @@ CommonBridgeInit(IMG_VOID)
SetMSVDXDispatchTableEntry();
#endif
-
for(i=0;i<BRIDGE_DISPATCH_TABLE_ENTRY_COUNT;i++)
@@ -3757,7 +4784,6 @@ CommonBridgeInit(IMG_VOID)
IMG_INT BridgedDispatchKM(PVRSRV_PER_PROCESS_DATA * psPerProc,
PVRSRV_BRIDGE_PACKAGE * psBridgePackageKM)
{
-
IMG_VOID * psBridgeIn;
IMG_VOID * psBridgeOut;
BridgeWrapperFunction pfBridgeHandler;
@@ -3813,8 +4839,6 @@ IMG_INT BridgedDispatchKM(PVRSRV_PER_PROCESS_DATA * psPerProc,
}
}
-
-
#if defined(__linux__)
{
@@ -3876,7 +4900,6 @@ IMG_INT BridgedDispatchKM(PVRSRV_PER_PROCESS_DATA * psPerProc,
goto return_fault;
}
-
#if defined(__linux__)
if(CopyToUserWrapper(psPerProc,
@@ -3892,6 +4915,7 @@ IMG_INT BridgedDispatchKM(PVRSRV_PER_PROCESS_DATA * psPerProc,
err = 0;
return_fault:
+
ReleaseHandleBatch(psPerProc);
return err;
}
diff --git a/drivers/gpu/pvr/bridged_pvr_bridge.h b/drivers/gpu/pvr/bridged_pvr_bridge.h
index 0042574..6b0dd88 100644
--- a/drivers/gpu/pvr/bridged_pvr_bridge.h
+++ b/drivers/gpu/pvr/bridged_pvr_bridge.h
@@ -1,6 +1,6 @@
/**********************************************************************
*
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
+ * Copyright (C) Imagination Technologies Ltd. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -83,7 +83,7 @@ CopyToUserWrapper(PVRSRV_PER_PROCESS_DATA *pProcData,
#define ASSIGN_AND_EXIT_ON_ERROR(error, src) \
ASSIGN_AND_RETURN_ON_ERROR(error, src, 0)
-#if defined (PVR_SECURE_HANDLES)
+#if defined (PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
#ifdef INLINE_IS_PRAGMA
#pragma inline(NewHandleBatch)
#endif
diff --git a/drivers/gpu/pvr/bridged_support.c b/drivers/gpu/pvr/bridged_support.c
index e10e577..dad0800 100644
--- a/drivers/gpu/pvr/bridged_support.c
+++ b/drivers/gpu/pvr/bridged_support.c
@@ -1,6 +1,6 @@
/**********************************************************************
*
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
+ * Copyright (C) Imagination Technologies Ltd. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -30,7 +30,11 @@
PVRSRV_ERROR
+#if defined (SUPPORT_SID_INTERFACE)
+PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHandle, IMG_SID hMHandle)
+#else
PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHandle, IMG_HANDLE hMHandle)
+#endif
{
IMG_HANDLE hMHandleInt;
PVRSRV_HANDLE_TYPE eHandleType;
@@ -47,7 +51,7 @@ PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHan
switch(eHandleType)
{
-#if defined(PVR_SECURE_HANDLES)
+#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
case PVRSRV_HANDLE_TYPE_MEM_INFO:
case PVRSRV_HANDLE_TYPE_MEM_INFO_REF:
case PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO:
diff --git a/drivers/gpu/pvr/bridged_support.h b/drivers/gpu/pvr/bridged_support.h
index 371715d..d027290 100644
--- a/drivers/gpu/pvr/bridged_support.h
+++ b/drivers/gpu/pvr/bridged_support.h
@@ -1,6 +1,6 @@
/**********************************************************************
*
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
+ * Copyright (C) Imagination Technologies Ltd. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -33,7 +33,11 @@
extern "C" {
#endif
+#if defined (SUPPORT_SID_INTERFACE)
+PVRSRV_ERROR PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phOSMemHandle, IMG_SID hMHandle);
+#else
PVRSRV_ERROR PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psBase, IMG_HANDLE *phOSMemHandle, IMG_HANDLE hMHandle);
+#endif
#if defined (__cplusplus)
}
diff --git a/drivers/gpu/pvr/buffer_manager.c b/drivers/gpu/pvr/buffer_manager.c
index 854fbef..8907e22 100644
--- a/drivers/gpu/pvr/buffer_manager.c
+++ b/drivers/gpu/pvr/buffer_manager.c
@@ -1,6 +1,6 @@
/**********************************************************************
*
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
+ * Copyright (C) Imagination Technologies Ltd. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -38,8 +38,9 @@ static IMG_VOID
BM_FreeMemory (IMG_VOID *pH, IMG_UINTPTR_T base, BM_MAPPING *psMapping);
static IMG_BOOL
BM_ImportMemory(IMG_VOID *pH, IMG_SIZE_T uSize,
- IMG_SIZE_T *pActualSize, BM_MAPPING **ppsMapping,
- IMG_UINT32 uFlags, IMG_UINTPTR_T *pBase);
+ IMG_SIZE_T *pActualSize, BM_MAPPING **ppsMapping,
+ IMG_UINT32 uFlags, IMG_PVOID pvPrivData,
+ IMG_UINT32 ui32PrivDataLength, IMG_UINTPTR_T *pBase);
static IMG_BOOL
DevMemoryAlloc (BM_CONTEXT *pBMContext,
@@ -52,13 +53,15 @@ static IMG_VOID
DevMemoryFree (BM_MAPPING *pMapping);
static IMG_BOOL
-AllocMemory (BM_CONTEXT *pBMContext,
- BM_HEAP *psBMHeap,
- IMG_DEV_VIRTADDR *psDevVAddr,
- IMG_SIZE_T uSize,
- IMG_UINT32 uFlags,
- IMG_UINT32 uDevVAddrAlignment,
- BM_BUF *pBuf)
+AllocMemory (BM_CONTEXT *pBMContext,
+ BM_HEAP *psBMHeap,
+ IMG_DEV_VIRTADDR *psDevVAddr,
+ IMG_SIZE_T uSize,
+ IMG_UINT32 uFlags,
+ IMG_UINT32 uDevVAddrAlignment,
+ IMG_PVOID pvPrivData,
+ IMG_UINT32 ui32PrivDataLength,
+ BM_BUF *pBuf)
{
BM_MAPPING *pMapping;
IMG_UINTPTR_T uOffset;
@@ -105,6 +108,8 @@ AllocMemory (BM_CONTEXT *pBMContext,
uFlags,
uDevVAddrAlignment,
0,
+ pvPrivData,
+ ui32PrivDataLength,
(IMG_UINTPTR_T *)&(pBuf->DevVAddr.uiAddr)))
{
PVR_DPF((PVR_DBG_ERROR, "AllocMemory: RA_Alloc(0x%x) FAILED", uSize));
@@ -175,15 +180,22 @@ AllocMemory (BM_CONTEXT *pBMContext,
}
else
{
+ IMG_BOOL bResult;
- pBMContext->psDeviceNode->pfnMMUAlloc (psBMHeap->pMMUHeap,
+ bResult = pBMContext->psDeviceNode->pfnMMUAlloc (psBMHeap->pMMUHeap,
uSize,
IMG_NULL,
0,
uDevVAddrAlignment,
&pBuf->DevVAddr);
+
+ if(!bResult)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "AllocMemory: MMUAlloc failed"));
+ return IMG_FALSE;
+ }
}
@@ -526,6 +538,7 @@ static IMG_VOID
FreeBuf (BM_BUF *pBuf, IMG_UINT32 ui32Flags, IMG_BOOL bFromAllocator)
{
BM_MAPPING *pMapping;
+ PVRSRV_DEVICE_NODE *psDeviceNode;
PVR_DPF ((PVR_DBG_MESSAGE,
"FreeBuf: pBuf=0x%x: DevVAddr=%08X CpuVAddr=0x%x CpuPAddr=%08X",
@@ -535,6 +548,12 @@ FreeBuf (BM_BUF *pBuf, IMG_UINT32 ui32Flags, IMG_BOOL bFromAllocator)
pMapping = pBuf->pMapping;
+ psDeviceNode = pMapping->pBMHeap->pBMContext->psDeviceNode;
+ if (psDeviceNode->pfnCacheInvalidate)
+ {
+ psDeviceNode->pfnCacheInvalidate(psDeviceNode);
+ }
+
if(ui32Flags & PVRSRV_MEM_USER_SUPPLIED_DEVVADDR)
{
@@ -695,7 +714,7 @@ BM_DestroyContext(IMG_HANDLE hBMContext,
else
{
- eError = ResManFreeResByPtr(pBMContext->hResItem);
+ eError = ResManFreeResByPtr(pBMContext->hResItem, CLEANUP_WITH_POLL);
if(eError != PVRSRV_OK)
{
PVR_DPF ((PVR_DBG_ERROR, "BM_DestroyContext: ResManFreeResByPtr failed %d",eError));
@@ -745,13 +764,15 @@ static PVRSRV_ERROR BM_DestroyContextCallBack_AnyVaCb(BM_HEAP *psBMHeap, va_list
}
-static PVRSRV_ERROR BM_DestroyContextCallBack(IMG_PVOID pvParam,
- IMG_UINT32 ui32Param)
+static PVRSRV_ERROR BM_DestroyContextCallBack(IMG_PVOID pvParam,
+ IMG_UINT32 ui32Param,
+ IMG_BOOL bDummy)
{
BM_CONTEXT *pBMContext = pvParam;
PVRSRV_DEVICE_NODE *psDeviceNode;
PVRSRV_ERROR eError;
PVR_UNREFERENCED_PARAMETER(ui32Param);
+ PVR_UNREFERENCED_PARAMETER(bDummy);
@@ -787,8 +808,11 @@ static PVRSRV_ERROR BM_DestroyContextCallBack(IMG_PVOID pvParam,
}
else
{
-
- List_BM_CONTEXT_Remove(pBMContext);
+ if (pBMContext->ppsThis != IMG_NULL)
+ {
+
+ List_BM_CONTEXT_Remove(pBMContext);
+ }
}
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(BM_CONTEXT), pBMContext, IMG_NULL);
@@ -966,7 +990,7 @@ BM_CreateContext(PVRSRV_DEVICE_NODE *psDeviceNode,
return (IMG_HANDLE)pBMContext;
cleanup:
- (IMG_VOID)BM_DestroyContextCallBack(pBMContext, 0);
+ (IMG_VOID)BM_DestroyContextCallBack(pBMContext, 0, CLEANUP_WITH_POLL);
return IMG_NULL;
}
@@ -1006,6 +1030,11 @@ BM_CreateHeap (IMG_HANDLE hBMContext,
psDeviceNode = pBMContext->psDeviceNode;
+
+ PVR_ASSERT((psDevMemHeapInfo->ui32HeapSize & (psDevMemHeapInfo->ui32DataPageSize - 1)) == 0);
+ PVR_ASSERT(psDevMemHeapInfo->ui32HeapSize > 0);
+
+
@@ -1042,6 +1071,9 @@ BM_CreateHeap (IMG_HANDLE hBMContext,
psBMHeap->sDevArena.ui32DataPageSize = psDevMemHeapInfo->ui32DataPageSize;
psBMHeap->sDevArena.psDeviceMemoryHeapInfo = psDevMemHeapInfo;
psBMHeap->ui32Attribs = psDevMemHeapInfo->ui32Attribs;
+#if defined(SUPPORT_MEMORY_TILING)
+ psBMHeap->ui32XTileStride = psDevMemHeapInfo->ui32XTileStride;
+#endif
psBMHeap->pBMContext = pBMContext;
@@ -1096,7 +1128,7 @@ ErrorExit:
if (psBMHeap->pMMUHeap != IMG_NULL)
{
psDeviceNode->pfnMMUDelete (psBMHeap->pMMUHeap);
- psDeviceNode->pfnMMUFinalise (pBMContext->psMMUContext);
+
}
@@ -1165,6 +1197,8 @@ BM_Alloc ( IMG_HANDLE hDevMemHeap,
IMG_SIZE_T uSize,
IMG_UINT32 *pui32Flags,
IMG_UINT32 uDevVAddrAlignment,
+ IMG_PVOID pvPrivData,
+ IMG_UINT32 ui32PrivDataLength,
BM_HANDLE *phBuf)
{
BM_BUF *pBuf;
@@ -1214,6 +1248,8 @@ BM_Alloc ( IMG_HANDLE hDevMemHeap,
uSize,
uFlags,
uDevVAddrAlignment,
+ pvPrivData,
+ ui32PrivDataLength,
pBuf) != IMG_TRUE)
{
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof (BM_BUF), pBuf, IMG_NULL);
@@ -1379,6 +1415,11 @@ BM_Wrap ( IMG_HANDLE hDevMemHeap,
return IMG_TRUE;
}
+ else
+ {
+
+ HASH_Remove(psBMContext->pBufferHash, (IMG_UINTPTR_T)sHashAddress.uiAddr);
+ }
}
@@ -1567,7 +1608,7 @@ DevMemoryAlloc (BM_CONTEXT *pBMContext,
{
PVRSRV_DEVICE_NODE *psDeviceNode;
#ifdef PDUMP
- IMG_UINT32 ui32PDumpSize = pMapping->uSize;
+ IMG_UINT32 ui32PDumpSize = (IMG_UINT32)pMapping->uSize;
#endif
psDeviceNode = pBMContext->psDeviceNode;
@@ -1677,41 +1718,337 @@ static IMG_VOID
DevMemoryFree (BM_MAPPING *pMapping)
{
PVRSRV_DEVICE_NODE *psDeviceNode;
+ IMG_DEV_PHYADDR sDevPAddr;
#ifdef PDUMP
IMG_UINT32 ui32PSize;
#endif
+ psDeviceNode = pMapping->pBMHeap->pBMContext->psDeviceNode;
+ sDevPAddr = psDeviceNode->pfnMMUGetPhysPageAddr(pMapping->pBMHeap->pMMUHeap, pMapping->DevVAddr);
+
+ if (sDevPAddr.uiAddr != 0)
+ {
#ifdef PDUMP
+
+ if(pMapping->ui32Flags & PVRSRV_MEM_DUMMY)
+ {
+
+ ui32PSize = pMapping->pBMHeap->sDevArena.ui32DataPageSize;
+ }
+ else
+ {
+ ui32PSize = (IMG_UINT32)pMapping->uSize;
+ }
- if(pMapping->ui32Flags & PVRSRV_MEM_DUMMY)
+ PDUMPFREEPAGES(pMapping->pBMHeap,
+ pMapping->DevVAddr,
+ ui32PSize,
+ pMapping->pBMHeap->sDevArena.ui32DataPageSize,
+ (IMG_HANDLE)pMapping,
+ (pMapping->ui32Flags & PVRSRV_MEM_INTERLEAVED) ? IMG_TRUE : IMG_FALSE);
+#endif
+ }
+ psDeviceNode->pfnMMUFree (pMapping->pBMHeap->pMMUHeap, pMapping->DevVAddr, IMG_CAST_TO_DEVVADDR_UINT(pMapping->uSize));
+}
+
+#ifndef XPROC_WORKAROUND_NUM_SHAREABLES
+#define XPROC_WORKAROUND_NUM_SHAREABLES 200
+#endif
+
+#define XPROC_WORKAROUND_BAD_SHAREINDEX 0773407734
+
+static IMG_UINT32 gXProcWorkaroundShareIndex = XPROC_WORKAROUND_BAD_SHAREINDEX;
+
+
+static struct {
+ IMG_UINT32 ui32RefCount;
+ IMG_UINT32 ui32AllocFlags;
+ IMG_UINT32 ui32Size;
+ IMG_UINT32 ui32PageSize;
+ RA_ARENA *psArena;
+ IMG_SYS_PHYADDR sSysPAddr;
+ IMG_VOID *pvCpuVAddr;
+ IMG_HANDLE hOSMemHandle;
+} gXProcWorkaroundShareData[XPROC_WORKAROUND_NUM_SHAREABLES] = {{0}};
+
+PVRSRV_ERROR BM_XProcWorkaroundSetShareIndex(IMG_UINT32 ui32Index)
+{
+
+
+
+ if (gXProcWorkaroundShareIndex != XPROC_WORKAROUND_BAD_SHAREINDEX)
{
-
- ui32PSize = pMapping->pBMHeap->sDevArena.ui32DataPageSize;
+ PVR_DPF((PVR_DBG_ERROR, "No, it's already set!"));
+ return PVRSRV_ERROR_INVALID_PARAMS;
+ }
+
+ gXProcWorkaroundShareIndex = ui32Index;
+
+ return PVRSRV_OK;
+}
+
+PVRSRV_ERROR BM_XProcWorkaroundUnsetShareIndex(IMG_UINT32 ui32Index)
+{
+
+
+
+ if (gXProcWorkaroundShareIndex == XPROC_WORKAROUND_BAD_SHAREINDEX)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "huh? how can it be bad??"));
+ return PVRSRV_ERROR_INVALID_PARAMS;
+ }
+ if (gXProcWorkaroundShareIndex != ui32Index)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "gXProcWorkaroundShareIndex == 0x%08x != 0x%08x == ui32Index", gXProcWorkaroundShareIndex, ui32Index));
+ return PVRSRV_ERROR_INVALID_PARAMS;
+ }
+
+ gXProcWorkaroundShareIndex = XPROC_WORKAROUND_BAD_SHAREINDEX;
+
+ return PVRSRV_OK;
+}
+
+PVRSRV_ERROR BM_XProcWorkaroundFindNewBufferAndSetShareIndex(IMG_UINT32 *pui32Index)
+{
+
+
+
+ if (gXProcWorkaroundShareIndex != XPROC_WORKAROUND_BAD_SHAREINDEX)
+ {
+ return PVRSRV_ERROR_INVALID_PARAMS;
+ }
+
+ for (*pui32Index = 0; *pui32Index < XPROC_WORKAROUND_NUM_SHAREABLES; (*pui32Index)++)
+ {
+ if (gXProcWorkaroundShareData[*pui32Index].ui32RefCount == 0)
+ {
+ gXProcWorkaroundShareIndex = *pui32Index;
+ return PVRSRV_OK;
+ }
+ }
+
+ PVR_DPF((PVR_DBG_ERROR, "ran out of shared buffers"));
+ return PVRSRV_ERROR_OUT_OF_MEMORY;
+}
+
+static PVRSRV_ERROR
+XProcWorkaroundAllocShareable(RA_ARENA *psArena,
+ IMG_UINT32 ui32AllocFlags,
+ IMG_UINT32 ui32Size,
+ IMG_UINT32 ui32PageSize,
+ IMG_PVOID pvPrivData,
+ IMG_UINT32 ui32PrivDataLength,
+ IMG_VOID **ppvCpuVAddr,
+ IMG_HANDLE *phOSMemHandle)
+{
+ if ((ui32AllocFlags & PVRSRV_MEM_XPROC) == 0)
+ {
+ PVR_DPF((PVR_DBG_VERBOSE, "XProcWorkaroundAllocShareable: bad flags"));
+ return PVRSRV_ERROR_INVALID_PARAMS;
+ }
+
+ if (gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32RefCount > 0)
+ {
+ PVR_DPF((PVR_DBG_VERBOSE,
+ "XProcWorkaroundAllocShareable: re-using previously allocated pages"));
+
+ ui32AllocFlags &= ~PVRSRV_HAP_MAPTYPE_MASK;
+ ui32AllocFlags |= PVRSRV_HAP_SINGLE_PROCESS;
+
+ if (ui32AllocFlags != gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32AllocFlags)
+ {
+ PVR_DPF((PVR_DBG_ERROR,
+ "Can't! Flags don't match! (I had 0x%08x, you gave 0x%08x)",
+ gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32AllocFlags,
+ ui32AllocFlags));
+ return PVRSRV_ERROR_INVALID_PARAMS;
+ }
+
+ if (ui32Size != gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32Size)
+ {
+ PVR_DPF((PVR_DBG_ERROR,
+ "Can't! Size doesn't match!"));
+ return PVRSRV_ERROR_INVALID_PARAMS;
+ }
+
+ if (ui32PageSize != gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32PageSize)
+ {
+ PVR_DPF((PVR_DBG_ERROR,
+ "Can't! Page Size doesn't match!"));
+ return PVRSRV_ERROR_INVALID_PARAMS;
+ }
+
+ *ppvCpuVAddr = gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].pvCpuVAddr;
+ *phOSMemHandle = gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].hOSMemHandle;
+
+ gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32RefCount ++;
+
+ return PVRSRV_OK;
}
else
{
- ui32PSize = pMapping->uSize;
+ if (psArena != IMG_NULL)
+ {
+ IMG_CPU_PHYADDR sCpuPAddr;
+ IMG_SYS_PHYADDR sSysPAddr;
+
+ PVR_DPF((PVR_DBG_VERBOSE,
+ "XProcWorkaroundAllocShareable: making a NEW allocation from local mem"));
+
+ if (!RA_Alloc (psArena,
+ ui32Size,
+ IMG_NULL,
+ IMG_NULL,
+ 0,
+ ui32PageSize,
+ 0,
+ pvPrivData,
+ ui32PrivDataLength,
+ (IMG_UINTPTR_T *)&sSysPAddr.uiAddr))
+ {
+ PVR_DPF((PVR_DBG_ERROR, "XProcWorkaroundAllocShareable: RA_Alloc(0x%x) FAILED", ui32Size));
+ return PVRSRV_ERROR_OUT_OF_MEMORY;
+ }
+
+ sCpuPAddr = SysSysPAddrToCpuPAddr(sSysPAddr);
+ if(OSReservePhys(sCpuPAddr,
+ ui32Size,
+ ui32AllocFlags,
+ (IMG_VOID **)&gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].pvCpuVAddr,
+ &gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].hOSMemHandle) != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "XProcWorkaroundAllocShareable: OSReservePhys failed"));
+ return PVRSRV_ERROR_OUT_OF_MEMORY;
+ }
+ gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].sSysPAddr = sSysPAddr;
+ }
+ else
+ {
+ PVR_DPF((PVR_DBG_VERBOSE,
+ "XProcWorkaroundAllocShareable: making a NEW allocation from OS"));
+
+ ui32AllocFlags &= ~PVRSRV_HAP_MAPTYPE_MASK;
+ ui32AllocFlags |= PVRSRV_HAP_SINGLE_PROCESS;
+
+
+ if (OSAllocPages(ui32AllocFlags,
+ ui32Size,
+ ui32PageSize,
+ pvPrivData,
+ ui32PrivDataLength,
+ (IMG_VOID **)&gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].pvCpuVAddr,
+ &gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].hOSMemHandle) != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR,
+ "XProcWorkaroundAllocShareable: OSAllocPages(0x%x) failed",
+ ui32PageSize));
+ return PVRSRV_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].psArena = psArena;
+ gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32AllocFlags = ui32AllocFlags;
+ gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32Size = ui32Size;
+ gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32PageSize = ui32PageSize;
+
+ *ppvCpuVAddr = gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].pvCpuVAddr;
+ *phOSMemHandle = gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].hOSMemHandle;
+
+ gXProcWorkaroundShareData[gXProcWorkaroundShareIndex].ui32RefCount ++;
+
+ return PVRSRV_OK;
}
+}
- PDUMPFREEPAGES(pMapping->pBMHeap,
- pMapping->DevVAddr,
- ui32PSize,
- pMapping->pBMHeap->sDevArena.ui32DataPageSize,
- (IMG_HANDLE)pMapping,
- (pMapping->ui32Flags & PVRSRV_MEM_INTERLEAVED) ? IMG_TRUE : IMG_FALSE);
-#endif
+static PVRSRV_ERROR XProcWorkaroundHandleToSI(IMG_HANDLE hOSMemHandle, IMG_UINT32 *pui32SI)
+{
+
+ IMG_UINT32 ui32SI;
+ IMG_BOOL bFound;
+ IMG_BOOL bErrorDups;
- psDeviceNode = pMapping->pBMHeap->pBMContext->psDeviceNode;
+ bFound = IMG_FALSE;
+ bErrorDups = IMG_FALSE;
- psDeviceNode->pfnMMUFree (pMapping->pBMHeap->pMMUHeap, pMapping->DevVAddr, IMG_CAST_TO_DEVVADDR_UINT(pMapping->uSize));
+ for (ui32SI = 0; ui32SI < XPROC_WORKAROUND_NUM_SHAREABLES; ui32SI++)
+ {
+ if (gXProcWorkaroundShareData[ui32SI].ui32RefCount>0 && gXProcWorkaroundShareData[ui32SI].hOSMemHandle == hOSMemHandle)
+ {
+ if (bFound)
+ {
+ bErrorDups = IMG_TRUE;
+ }
+ else
+ {
+ *pui32SI = ui32SI;
+ bFound = IMG_TRUE;
+ }
+ }
+ }
+
+ if (bErrorDups || !bFound)
+ {
+ return PVRSRV_ERROR_BM_BAD_SHAREMEM_HANDLE;
+ }
+
+ return PVRSRV_OK;
}
+static IMG_VOID XProcWorkaroundFreeShareable(IMG_HANDLE hOSMemHandle)
+{
+ IMG_UINT32 ui32SI = (IMG_UINT32)((IMG_UINTPTR_T)hOSMemHandle & 0xffffU);
+ PVRSRV_ERROR eError;
+
+ eError = XProcWorkaroundHandleToSI(hOSMemHandle, &ui32SI);
+ if (eError != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "bad handle"));
+ return;
+ }
+
+ gXProcWorkaroundShareData[ui32SI].ui32RefCount --;
+
+ PVR_DPF((PVR_DBG_VERBOSE, "Reduced refcount of SI[%d] from %d to %d",
+ ui32SI, gXProcWorkaroundShareData[ui32SI].ui32RefCount+1, gXProcWorkaroundShareData[ui32SI].ui32RefCount));
+
+ if (gXProcWorkaroundShareData[ui32SI].ui32RefCount == 0)
+ {
+ if (gXProcWorkaroundShareData[ui32SI].psArena != IMG_NULL)
+ {
+ IMG_SYS_PHYADDR sSysPAddr;
+
+ if (gXProcWorkaroundShareData[ui32SI].pvCpuVAddr != IMG_NULL)
+ {
+ OSUnReservePhys(gXProcWorkaroundShareData[ui32SI].pvCpuVAddr,
+ gXProcWorkaroundShareData[ui32SI].ui32Size,
+ gXProcWorkaroundShareData[ui32SI].ui32AllocFlags,
+ gXProcWorkaroundShareData[ui32SI].hOSMemHandle);
+ }
+ sSysPAddr = gXProcWorkaroundShareData[ui32SI].sSysPAddr;
+ RA_Free (gXProcWorkaroundShareData[ui32SI].psArena,
+ sSysPAddr.uiAddr,
+ IMG_FALSE);
+ }
+ else
+ {
+ PVR_DPF((PVR_DBG_VERBOSE, "freeing OS memory"));
+ OSFreePages(gXProcWorkaroundShareData[ui32SI].ui32AllocFlags,
+ gXProcWorkaroundShareData[ui32SI].ui32PageSize,
+ gXProcWorkaroundShareData[ui32SI].pvCpuVAddr,
+ gXProcWorkaroundShareData[ui32SI].hOSMemHandle);
+ }
+ }
+}
+
+
static IMG_BOOL
BM_ImportMemory (IMG_VOID *pH,
IMG_SIZE_T uRequestSize,
IMG_SIZE_T *pActualSize,
BM_MAPPING **ppsMapping,
IMG_UINT32 uFlags,
+ IMG_PVOID pvPrivData,
+ IMG_UINT32 ui32PrivDataLength,
IMG_UINTPTR_T *pBase)
{
BM_MAPPING *pMapping;
@@ -1720,7 +2057,7 @@ BM_ImportMemory (IMG_VOID *pH,
IMG_BOOL bResult;
IMG_SIZE_T uSize;
IMG_SIZE_T uPSize;
- IMG_UINT32 uDevVAddrAlignment = 0;
+ IMG_SIZE_T uDevVAddrAlignment = 0;
PVR_DPF ((PVR_DBG_MESSAGE,
"BM_ImportMemory (pBMContext=0x%x, uRequestSize=0x%x, uFlags=0x%x, uAlign=0x%x)",
@@ -1771,6 +2108,113 @@ BM_ImportMemory (IMG_VOID *pH,
uPSize = pMapping->uSize;
}
+ if (uFlags & PVRSRV_MEM_XPROC)
+ {
+ IMG_UINT32 ui32Attribs = pBMHeap->ui32Attribs | PVRSRV_MEM_XPROC;
+ IMG_BOOL bBadBackingStoreType;
+
+
+ if(uFlags & PVRSRV_MEM_ION)
+ {
+ ui32Attribs |= PVRSRV_MEM_ION;
+ }
+
+ bBadBackingStoreType = IMG_TRUE;
+
+ if ((ui32Attribs & PVRSRV_BACKINGSTORE_SYSMEM_NONCONTIG) != 0)
+ {
+#ifndef MAX
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+ uDevVAddrAlignment = MAX(pBMHeap->sDevArena.ui32DataPageSize, HOST_PAGESIZE());
+
+
+ if (uPSize % uDevVAddrAlignment != 0)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "Cannot use use this memory sharing workaround with allocations that might be suballocated"));
+ goto fail_mapping_alloc;
+ }
+ uDevVAddrAlignment = 0;
+
+
+ if (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK)
+ {
+ ui32Attribs &= ~PVRSRV_HAP_CACHETYPE_MASK;
+ ui32Attribs |= (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK);
+ }
+
+
+ if (XProcWorkaroundAllocShareable(IMG_NULL,
+ ui32Attribs,
+ (IMG_UINT32)uPSize,
+ pBMHeap->sDevArena.ui32DataPageSize,
+ pvPrivData,
+ ui32PrivDataLength,
+ (IMG_VOID **)&pMapping->CpuVAddr,
+ &pMapping->hOSMemHandle) != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR,
+ "BM_ImportMemory: XProcWorkaroundAllocShareable(0x%x) failed",
+ uPSize));
+ goto fail_mapping_alloc;
+ }
+
+
+
+
+ pMapping->eCpuMemoryOrigin = hm_env;
+ bBadBackingStoreType = IMG_FALSE;
+ }
+
+ if ((ui32Attribs & PVRSRV_BACKINGSTORE_LOCALMEM_CONTIG) != 0)
+ {
+ uDevVAddrAlignment = pBMHeap->sDevArena.ui32DataPageSize;
+
+ if (uPSize % uDevVAddrAlignment != 0)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "Cannot use use this memory sharing workaround with allocations that might be suballocated"));
+ goto fail_mapping_alloc;
+ }
+ uDevVAddrAlignment = 0;
+
+
+ if (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK)
+ {
+ ui32Attribs &= ~PVRSRV_HAP_CACHETYPE_MASK;
+ ui32Attribs |= (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK);
+ }
+
+
+ if (XProcWorkaroundAllocShareable(pBMHeap->pLocalDevMemArena,
+ ui32Attribs,
+ (IMG_UINT32)uPSize,
+ pBMHeap->sDevArena.ui32DataPageSize,
+ pvPrivData,
+ ui32PrivDataLength,
+ (IMG_VOID **)&pMapping->CpuVAddr,
+ &pMapping->hOSMemHandle) != PVRSRV_OK)
+ {
+ PVR_DPF((PVR_DBG_ERROR,
+ "BM_ImportMemory: XProcWorkaroundAllocShareable(0x%x) failed",
+ uPSize));
+ goto fail_mapping_alloc;
+ }
+
+
+
+
+ pMapping->eCpuMemoryOrigin = hm_env;
+ bBadBackingStoreType = IMG_FALSE;
+ }
+
+ if (bBadBackingStoreType)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "Cannot use this memory sharing workaround with this type of backing store"));
+ goto fail_mapping_alloc;
+ }
+ }
+ else
+
if(pBMHeap->ui32Attribs & PVRSRV_BACKINGSTORE_SYSMEM_NONCONTIG)
@@ -1783,11 +2227,19 @@ BM_ImportMemory (IMG_VOID *pH,
ui32Attribs &= ~PVRSRV_HAP_CACHETYPE_MASK;
ui32Attribs |= (pMapping->ui32Flags & PVRSRV_HAP_CACHETYPE_MASK);
}
-
+
+ if (pMapping->ui32Flags & PVRSRV_MEM_ALLOCATENONCACHEDMEM)
+ {
+ ui32Attribs &= ~PVRSRV_MEM_ALLOCATENONCACHEDMEM;
+ ui32Attribs |= (pMapping->ui32Flags & PVRSRV_MEM_ALLOCATENONCACHEDMEM);