summaryrefslogtreecommitdiff
path: root/sgx/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c
diff options
context:
space:
mode:
Diffstat (limited to 'sgx/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c')
-rw-r--r--sgx/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c290
1 files changed, 176 insertions, 114 deletions
diff --git a/sgx/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c b/sgx/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c
index c7472f0..625705b 100644
--- a/sgx/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c
+++ b/sgx/services4/srvkm/bridged/sgx/bridged_sgx_bridge.c
@@ -1,28 +1,46 @@
-/**********************************************************************
- *
- * 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,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
+/*************************************************************************/ /*!
+@Title SGX Common Bridge Module (kernel side)
+@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
+@Description Receives calls from the user portion of services and
+ despatches them to functions in the kernel portion.
+@License Dual MIT/GPLv2
+
+The contents of this file are subject to the MIT license as set out below.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+Alternatively, the contents of this file may be used under the terms of
+the GNU General Public License Version 2 ("GPL") in which case the provisions
+of GPL are applicable instead of those above.
+
+If you wish to allow use of your version of this file only under the terms of
+GPL, and not to allow others to use your version of this file under the terms
+of the MIT license, indicate your decision by deleting the provisions above
+and replace them with the notice and other provisions required by GPL as set
+out in the file called "GPL-COPYING" included in this distribution. If you do
+not delete the provisions above, a recipient may use your version of this file
+under the terms of either the MIT license or GPL.
+
+This License is also included in this distribution in the file called
+"MIT-COPYING".
+
+EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
+PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*/ /**************************************************************************/
@@ -103,7 +121,9 @@ SGXReleaseClientInfoBW(IMG_UINT32 ui32BridgeID,
PVR_ASSERT(psDevInfo->ui32ClientRefCount > 0);
-
+ /*
+ * psDevInfo->ui32ClientRefCount can be zero if an error occurred before SGXGetClientInfo is called
+ */
if (psDevInfo->ui32ClientRefCount > 0)
{
psDevInfo->ui32ClientRefCount--;
@@ -146,7 +166,10 @@ SGXGetInternalDevInfoBW(IMG_UINT32 ui32BridgeID,
&psSGXGetInternalDevInfoOUT->sSGXInternalDevInfo);
#endif
-
+ /*
+ * Handle is not allocated in batch mode, as there is no resource
+ * allocation to undo if the handle allocation fails.
+ */
psSGXGetInternalDevInfoOUT->eError =
PVRSRVAllocHandle(psPerProc->psHandleBase,
&psSGXGetInternalDevInfoOUT->sSGXInternalDevInfo.hHostCtlKernelMemInfoHandle,
@@ -259,7 +282,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID,
}
#if defined(FIX_HW_BRN_31620)
-
+ /* We need to lookup the mem context and pass it through */
psRetOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase,
&psDoKickIN->sCCBKick.hDevMemContext,
@@ -296,7 +319,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID,
#if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS)
-
+ /* SRC and DST sync details */
if (psDoKickIN->sCCBKick.ui32NumTASrcSyncs > SGX_MAX_TA_SRC_SYNCS)
{
psRetOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
@@ -377,9 +400,9 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID,
return 0;
}
}
-#else
-
- if (psDoKickIN->sCCBKick.ui32NumSrcSyncs > SGX_MAX_SRC_SYNCS)
+#else/* #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) */
+ /* texture dependency details */
+ if (psDoKickIN->sCCBKick.ui32NumSrcSyncs > SGX_MAX_SRC_SYNCS_TA)
{
psRetOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
return 0;
@@ -405,7 +428,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID,
return 0;
}
}
-#endif
+#endif/* #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) */
if (psDoKickIN->sCCBKick.ui32NumTAStatusVals > SGX_MAX_TA_STATUS_VALS)
{
@@ -519,7 +542,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID,
goto PVRSRV_BRIDGE_SGX_DOKICK_RETURN_RESULT;
}
-
+ /* Set sCCBKick.pahDstSyncHandles to point to the local memory */
psDoKickIN->sCCBKick.pahDstSyncHandles = phKernelSyncInfoHandles;
#endif
@@ -578,7 +601,7 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID,
#if defined(NO_HARDWARE)
sCCBKickKM.ui32WriteOpsPendingVal = psDoKickIN->sCCBKick.ui32WriteOpsPendingVal;
#endif
-#endif
+#endif /* #if defined (SUPPORT_SID_INTERFACE) */
psRetOUT->eError =
SGXDoKickKM(hDevCookieInt,
#if defined (SUPPORT_SID_INTERFACE)
@@ -589,13 +612,14 @@ SGXDoKickBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_SGX_DOKICK_RETURN_RESULT:
+//#if (!defined(_UITRON_) && !defined(UNDER_VISTA)) || defined (SUPPORT_SID_INTERFACE)
if(phKernelSyncInfoHandles)
{
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
ui32NumDstSyncs * sizeof(IMG_HANDLE),
(IMG_VOID *)phKernelSyncInfoHandles,
0);
-
+ /*not nulling pointer, out of scope*/
}
return ret;
}
@@ -648,7 +672,7 @@ SGXSubmitTransferBW(IMG_UINT32 ui32BridgeID,
psKick = &psSubmitTransferIN->sKick;
#if defined(FIX_HW_BRN_31620)
-
+ /* We need to lookup the mem context and pass it through */
psRetOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase,
&psKick->hDevMemContext,
@@ -887,7 +911,7 @@ SGXSubmit2DBW(IMG_UINT32 ui32BridgeID,
psKick = &psSubmit2DIN->sKick;
#if defined(FIX_HW_BRN_31620)
-
+ /* We need to lookup the mem context and pass it through */
psRetOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase,
&psKick->hDevMemContext,
@@ -1039,7 +1063,7 @@ SGXSubmit2DBW(IMG_UINT32 ui32BridgeID,
sKickKM.hDstSyncInfo = IMG_NULL;
}
-
+ /* copy common members across */
sKickKM.ui32SharedCmdCCBOffset = psKick->ui32SharedCmdCCBOffset;
sKickKM.ui32NumSrcSync = psKick->ui32NumSrcSync;
sKickKM.ui32PDumpFlags = psKick->ui32PDumpFlags;
@@ -1058,8 +1082,8 @@ SGXSubmit2DBW(IMG_UINT32 ui32BridgeID,
return 0;
}
-#endif
-#endif
+#endif /* #if defined(SGX_FEATURE_2D_HARDWARE) */
+#endif /* #if defined(TRANSFER_QUEUE) */
static IMG_INT
@@ -1088,7 +1112,7 @@ SGXGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
}
#if defined(SUPPORT_SGX_EDM_MEMORY_DEBUG)
-
+ /* Lookup handle for dev mem context */
if (psSGXGetMiscInfoIN->psMiscInfo->eRequest == SGX_MISC_INFO_REQUEST_MEMREAD)
{
psRetOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
@@ -1102,7 +1126,7 @@ SGXGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
}
}
#endif
-
+ /* device node is required for scheduling a CCB command */
psDeviceNode = hDevCookieInt;
PVR_ASSERT(psDeviceNode != IMG_NULL);
if (psDeviceNode == IMG_NULL)
@@ -1112,7 +1136,7 @@ SGXGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
psDevInfo = psDeviceNode->pvDevice;
-
+ /* Copy psMiscInfo to kernel space */
psRetOUT->eError = CopyFromUserWrapper(psPerProc,
ui32BridgeID,
&sMiscInfo,
@@ -1132,7 +1156,7 @@ SGXGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
}
}
-
+ /* Copy back misc info to user address space */
psRetOUT->eError = CopyToUserWrapper(psPerProc,
ui32BridgeID,
psSGXGetMiscInfoIN->psMiscInfo,
@@ -1197,7 +1221,7 @@ SGXReadHWPerfCBBW(IMG_UINT32 ui32BridgeID,
ui32AllocatedSize,
psAllocated,
hAllocatedHandle);
-
+ /*not nulling pointer, out of scope*/
return 0;
}
@@ -1226,7 +1250,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SGX_DEVINITPART2);
-
+ /* Report the kernel-side build options to UM */
psSGXDevInitPart2OUT->ui32KMBuildOptions = SGX_BUILD_OPTIONS;
if(!psPerProc->bInitProcess)
@@ -1245,7 +1269,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
return 0;
}
-
+ /* Check all the meminfo handles */
eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
&hDummy,
psSGXDevInitPart2IN->sInitInfo.hKernelCCBMemInfo,
@@ -1374,7 +1398,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
#endif
-#if defined(FIX_HW_BRN_31542)
+#if defined(FIX_HW_BRN_31542) || defined(FIX_HW_BRN_36513)
eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
&hDummy,
psSGXDevInitPart2IN->sInitInfo.hKernelClearClipWAVDMStreamMemInfo,
@@ -1442,7 +1466,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
}
#endif
-#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31425)
+#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31559)
eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
&hDummy,
psSGXDevInitPart2IN->sInitInfo.hKernelVDMSnapShotBufferMemInfo,
@@ -1518,7 +1542,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
return 0;
}
-
+ /* Lookup and release the device memory handles */
eError = PVRSRVLookupAndReleaseHandle(psPerProc->psHandleBase,
#if defined (SUPPORT_SID_INTERFACE)
&asInitInfoKM.hKernelCCBMemInfo,
@@ -1701,7 +1725,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
#endif
-#if defined(FIX_HW_BRN_31542)
+#if defined(FIX_HW_BRN_31542) || defined(FIX_HW_BRN_36513)
eError = PVRSRVLookupAndReleaseHandle(psPerProc->psHandleBase,
#if defined (SUPPORT_SID_INTERFACE)
&asInitInfoKM.hKernelClearClipWAVDMStreamMemInfo,
@@ -1799,7 +1823,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
bReleaseFailed = IMG_TRUE;
}
#endif
-#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31425)
+#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31559)
eError = PVRSRVLookupAndReleaseHandle(psPerProc->psHandleBase,
&psSGXDevInitPart2IN->sInitInfo.hKernelVDMSnapShotBufferMemInfo,
psSGXDevInitPart2IN->sInitInfo.hKernelVDMSnapShotBufferMemInfo,
@@ -1878,12 +1902,15 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
{
PVR_DPF((PVR_DBG_ERROR, "DevInitSGXPart2BW: A handle release failed"));
psSGXDevInitPart2OUT->eError = PVRSRV_ERROR_INIT2_PHASE_FAILED;
-
+ /*
+ * Given that we checked the handles before release, a release
+ * failure is unexpected.
+ */
PVR_DBG_BREAK;
return 0;
}
-
+ /* Dissociate device memory from caller */
#if defined (SUPPORT_SID_INTERFACE)
eError = PVRSRVDissociateDeviceMemKM(hDevCookieInt, asInitInfoKM.hKernelCCBMemInfo);
#else
@@ -1946,7 +1973,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
}
#endif
-
+ /* Dissociate SGX MiscInfo buffer from user space */
#if defined (SUPPORT_SID_INTERFACE)
eError = PVRSRVDissociateDeviceMemKM(hDevCookieInt, asInitInfoKM.hKernelSGXMiscMemInfo);
#else
@@ -2029,7 +2056,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
#endif
#endif
-#if defined(FIX_HW_BRN_31542)
+#if defined(FIX_HW_BRN_31542) || defined(FIX_HW_BRN_36513)
#if defined (SUPPORT_SID_INTERFACE)
eError = PVRSRVDissociateDeviceMemKM(hDevCookieInt, asInitInfoKM.hKernelClearClipWAVDMStreamMemInfo);
if (eError != PVRSRV_OK)
@@ -2112,7 +2139,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
#endif
#endif
-#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31425)
+#if defined(SGX_FEATURE_VDM_CONTEXT_SWITCH) && defined(FIX_HW_BRN_31559)
eError = PVRSRVDissociateDeviceMemKM(hDevCookieInt, psSGXDevInitPart2IN->sInitInfo.hKernelVDMSnapShotBufferMemInfo);
bDissociateFailed |= (IMG_BOOL)(eError != PVRSRV_OK);
@@ -2156,7 +2183,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
}
}
-
+ /* If any dissociations failed, free all the device memory passed in */
if(bDissociateFailed)
{
#if defined (SUPPORT_SID_INTERFACE)
@@ -2200,7 +2227,7 @@ SGXDevInitPart2BW(IMG_UINT32 ui32BridgeID,
psSGXDevInitPart2OUT->eError = PVRSRV_ERROR_INIT2_PHASE_FAILED;
-
+ /* A dissociation failure is unexpected */
PVR_DBG_BREAK;
return 0;
}
@@ -2244,6 +2271,7 @@ SGXRegisterHWRenderContextBW(IMG_UINT32 ui32BridgeID,
PVRSRV_PER_PROCESS_DATA *psPerProc)
{
IMG_HANDLE hDevCookieInt;
+// PVRSRV_SGXDEV_INFO *psDevInfo;
IMG_HANDLE hHWRenderContextInt;
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SGX_REGISTER_HW_RENDER_CONTEXT);
@@ -2498,7 +2526,7 @@ SGXUnregisterHW2DContextBW(IMG_UINT32 ui32BridgeID,
return 0;
}
-#endif
+#endif /* #if defined(SGX_FEATURE_2D_HARDWARE) */
static IMG_INT
SGXFlushHWRenderTargetBW(IMG_UINT32 ui32BridgeID,
@@ -2507,6 +2535,8 @@ SGXFlushHWRenderTargetBW(IMG_UINT32 ui32BridgeID,
PVRSRV_PER_PROCESS_DATA *psPerProc)
{
IMG_HANDLE hDevCookieInt;
+// PVRSRV_SGXDEV_INFO *psDevInfo;
+
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SGX_FLUSH_HW_RENDER_TARGET);
psRetOUT->eError =
@@ -2519,6 +2549,8 @@ SGXFlushHWRenderTargetBW(IMG_UINT32 ui32BridgeID,
return 0;
}
+// psDevInfo = (PVRSRV_SGXDEV_INFO *)((PVRSRV_DEVICE_NODE *)hDevCookieInt)->pvDevice;
+
psRetOUT->eError = SGXFlushHWRenderTargetKM(hDevCookieInt, psSGXFlushHWRenderTargetIN->sHWRTDataSetDevVAddr, IMG_FALSE);
return 0;
@@ -2621,7 +2653,8 @@ SGXFindSharedPBDescBW(IMG_UINT32 ui32BridgeID,
if(hSharedPBDesc == IMG_NULL)
{
psSGXFindSharedPBDescOUT->hSharedPBDescKernelMemInfoHandle = 0;
-
+ /* It's not an error if we don't find a buffer,
+ * we just return NULL */
goto PVRSRV_BRIDGE_SGX_FINDSHAREDPBDESC_EXIT;
}
@@ -2631,7 +2664,12 @@ SGXFindSharedPBDescBW(IMG_UINT32 ui32BridgeID,
PVRSRV_HANDLE_TYPE_SHARED_PB_DESC,
PVRSRV_HANDLE_ALLOC_FLAG_NONE);
-
+ /*
+ * We allocate handles of type PVRSRV_HANDLE_TYPE_MEM_INFO_REF here,
+ * as the process doesn't own the underlying memory, and so should
+ * only be allowed a restricted set of operations on it, such as
+ * mapping it into its address space.
+ */
PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
&psSGXFindSharedPBDescOUT->hSharedPBDescKernelMemInfoHandle,
psSharedPBDescKernelMemInfo,
@@ -2868,26 +2906,30 @@ SGXAddSharedPBDescBW(IMG_UINT32 ui32BridgeID,
}
}
-
-
+ /*
+ * Release all the handles we've just looked up, as none
+ * of the associated resources will be valid for access via
+ * those handles once we return from SGXAddSharedPBDesc.
+ */
+ /* PRQA S 3198 2 */ /* override redundant warning as PVR_ASSERT is ignored by QAC */
eError = PVRSRVReleaseHandle(psPerProc->psHandleBase,
psSGXAddSharedPBDescIN->hSharedPBDescKernelMemInfo,
PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO);
PVR_ASSERT(eError == PVRSRV_OK);
-
+ /* PRQA S 3198 2 */ /* override redundant warning as PVR_ASSERT is ignored by QAC */
eError = PVRSRVReleaseHandle(psPerProc->psHandleBase,
psSGXAddSharedPBDescIN->hHWPBDescKernelMemInfo,
PVRSRV_HANDLE_TYPE_MEM_INFO);
PVR_ASSERT(eError == PVRSRV_OK);
-
+ /* PRQA S 3198 2 */ /* override redundant warning as PVR_ASSERT is ignored by QAC */
eError = PVRSRVReleaseHandle(psPerProc->psHandleBase,
psSGXAddSharedPBDescIN->hBlockKernelMemInfo,
PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO);
PVR_ASSERT(eError == PVRSRV_OK);
-
+ /* PRQA S 3198 2 */ /* override redundant warning as PVR_ASSERT is ignored by QAC */
eError = PVRSRVReleaseHandle(psPerProc->psHandleBase,
psSGXAddSharedPBDescIN->hHWBlockKernelMemInfo,
PVRSRV_HANDLE_TYPE_MEM_INFO);
@@ -2895,7 +2937,7 @@ SGXAddSharedPBDescBW(IMG_UINT32 ui32BridgeID,
for(i=0; i<ui32KernelMemInfoHandlesCount; i++)
{
-
+ /* PRQA S 3198 2 */ /* override redundant warning as PVR_ASSERT is ignored by QAC */
eError = PVRSRVReleaseHandle(psPerProc->psHandleBase,
phKernelMemInfoHandles[i],
PVRSRV_HANDLE_TYPE_MEM_INFO);
@@ -3007,7 +3049,7 @@ SGXGetInfoForSrvinitBW(IMG_UINT32 ui32BridgeID,
if ((asHeapInfo[i].ui32HeapID != (IMG_UINT32)SGX_UNDEFINED_HEAP_ID) &&
(asHeapInfo[i].hDevMemHeap != IMG_NULL))
{
-
+ /* Allocate heap handle */
PVRSRVAllocHandleNR(psPerProc->psHandleBase,
&psHeapInfo->hDevMemHeap,
asHeapInfo[i].hDevMemHeap,
@@ -3031,7 +3073,7 @@ SGXGetInfoForSrvinitBW(IMG_UINT32 ui32BridgeID,
if (psHeapInfo->hDevMemHeap != IMG_NULL)
{
-
+ /* Allocate heap handle */
PVRSRVAllocHandleNR(psPerProc->psHandleBase,
&hDevMemHeapExt,
psHeapInfo->hDevMemHeap,
@@ -3049,6 +3091,13 @@ SGXGetInfoForSrvinitBW(IMG_UINT32 ui32BridgeID,
}
#if defined(PDUMP)
+// PRQA S 5120++
+/*****************************************************************************
+ FUNCTION : DumpBufferArray
+ PURPOSE : PDUMP information in stored buffer array
+ PARAMETERS :
+ RETURNS :
+*****************************************************************************/
static IMG_VOID
DumpBufferArray(PVRSRV_PER_PROCESS_DATA *psPerProc,
#if defined (SUPPORT_SID_INTERFACE)
@@ -3116,7 +3165,9 @@ DumpBufferArray(PVRSRV_PER_PROCESS_DATA *psPerProc,
}
else
{
-
+ /*
+ Range of data wraps the end of the buffer so it needs to be dumped in two sections
+ */
if (bDumpPolls)
{
@@ -3181,6 +3232,11 @@ SGXPDumpBufferArrayBW(IMG_UINT32 ui32BridgeID,
SGX_KICKTA_DUMP_BUFFER *psUMPtr;
SGX_KICKTA_DUMP_BUFFER_KM *psKickTADumpBufferKM, *psKMPtr;
#else
+#if defined(__QNXNTO__)
+ const IMG_UINT32 NAME_BUFFER_SIZE = 30;
+ IMG_PCHAR pszNameBuffer, pszName;
+ IMG_UINT32 ui32NameBufferArraySize, ui32NameLength;
+#endif
SGX_KICKTA_DUMP_BUFFER *psKickTADumpBuffer;
#endif
IMG_UINT32 ui32BufferArrayLength =
@@ -3189,12 +3245,6 @@ SGXPDumpBufferArrayBW(IMG_UINT32 ui32BridgeID,
ui32BufferArrayLength * sizeof(SGX_KICKTA_DUMP_BUFFER);
PVRSRV_ERROR eError = PVRSRV_ERROR_TOO_FEW_BUFFERS;
-#if defined (__QNXNTO__)
- const IMG_UINT32 MAX_BUFFER_NAME_SIZE = 30;
- IMG_PCHAR pszNamesBuffer, pszName;
- IMG_UINT32 ui32NameBufferArraySize;
-#endif
-
PVR_UNREFERENCED_PARAMETER(psBridgeOut);
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SGX_PDUMP_BUFFER_ARRAY);
@@ -3222,39 +3272,49 @@ SGXPDumpBufferArrayBW(IMG_UINT32 ui32BridgeID,
ui32BufferArraySize) != PVRSRV_OK)
{
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, ui32BufferArraySize, psKickTADumpBuffer, 0);
-
+ /*not nulling pointer, out of scope*/
return -EFAULT;
}
-#endif
#if defined (__QNXNTO__)
- ui32NameBufferArraySize = ui32BufferArrayLength * MAX_BUFFER_NAME_SIZE;
+ ui32NameBufferArraySize = ui32BufferArrayLength * NAME_BUFFER_SIZE;
if (OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, ui32NameBufferArraySize,
- (IMG_PVOID *)&pszNamesBuffer, 0,
+ (IMG_PVOID *)&pszNameBuffer, 0,
"Kick Tile Accelerator Dump Buffer names") != PVRSRV_OK)
{
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, ui32BufferArraySize, psKickTADumpBuffer, 0);
return -ENOMEM;
}
- pszName = pszNamesBuffer;
+ pszName = pszNameBuffer;
+
for (i=0; i<ui32BufferArrayLength; i++)
{
- if (CopyFromUserWrapper(psPerProc, ui32BridgeID,
- pszName, psKickTADumpBuffer[i].pszName,
- MAX_BUFFER_NAME_SIZE) != PVRSRV_OK)
+ if (psKickTADumpBuffer[i].pszName)
{
- PVR_DPF((PVR_DBG_WARNING, "Failed to read pdump buffer name"));
- psKickTADumpBuffer[i].pszName = 0;
+ ui32NameLength = psKickTADumpBuffer[i].ui32NameLength;
+ if (ui32NameLength >= NAME_BUFFER_SIZE)
+ {
+ ui32NameLength = NAME_BUFFER_SIZE - 1;
+ }
+
+ if (ui32NameLength &&
+ (CopyFromUserWrapper(psPerProc, ui32BridgeID, pszName,
+ psKickTADumpBuffer[i].pszName, ui32NameLength + 1) == PVRSRV_OK))
+ {
+ pszName[NAME_BUFFER_SIZE - 1] = 0;
+ psKickTADumpBuffer[i].pszName = pszName;
+ pszName += NAME_BUFFER_SIZE;
+ }
+ else
+ {
+ PVR_DPF((PVR_DBG_WARNING, "Failed to read PDUMP buffer name"));
+ psKickTADumpBuffer[i].pszName = 0;
+ }
}
- else
- {
- pszName[MAX_BUFFER_NAME_SIZE-1] = 0;
- psKickTADumpBuffer[i].pszName = pszName;
- }
- pszName += MAX_BUFFER_NAME_SIZE;
}
#endif
+#endif
for(i = 0; i < ui32BufferArrayLength; i++)
{
@@ -3339,12 +3399,11 @@ SGXPDumpBufferArrayBW(IMG_UINT32 ui32BridgeID,
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, ui32BufferArraySize, psKickTADumpBufferKM, 0);
#else
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, ui32BufferArraySize, psKickTADumpBuffer, 0);
-#endif
-
-
#if defined (__QNXNTO__)
- OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, ui32NameBufferArraySize, pszNamesBuffer, 0);
+ OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, ui32NameBufferArraySize, pszNameBuffer, 0);
#endif
+#endif
+ /*not nulling pointer, out of scope*/
return 0;
}
@@ -3389,7 +3448,7 @@ SGXPDump3DSignatureRegistersBW(IMG_UINT32 ui32BridgeID,
psDevInfo = (PVRSRV_SGXDEV_INFO*)psDeviceNode->pvDevice;
#if defined(SGX_FEATURE_MP) && defined(FIX_HW_BRN_27270)
-
+ /* Enable all cores available */
ui32RegVal = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_CORE);
OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_CORE, (SGX_FEATURE_MP_CORE_COUNT - 1) << EUR_CR_MASTER_CORE_ENABLE_SHIFT);
#if defined(PDUMP)
@@ -3433,8 +3492,8 @@ SGXPDump3DSignatureRegistersBW(IMG_UINT32 ui32BridgeID,
return 0;
}
-
- PVR_ASSERT(psDeviceNode->pfnMMUGetContextID != IMG_NULL)
+ /* look up the MMU context ID */
+ PVR_ASSERT(psDeviceNode->pfnMMUGetContextID != IMG_NULL);
ui32MMUContextID = psDeviceNode->pfnMMUGetContextID((IMG_HANDLE)psDeviceNode->sDevMemoryInfo.pBMKernelContext);
PDumpSignatureBuffer(&psDeviceNode->sDevId,
@@ -3442,13 +3501,13 @@ SGXPDump3DSignatureRegistersBW(IMG_UINT32 ui32BridgeID,
psDevInfo->psKernelTASigBufferMemInfo->sDevVAddr,
(IMG_UINT32)psDevInfo->psKernelTASigBufferMemInfo->uAllocSize,
ui32MMUContextID,
- 0 );
+ 0 /*ui32PDumpFlags*/);
PDumpSignatureBuffer(&psDeviceNode->sDevId,
"out.3dsig", "3D", 0,
psDevInfo->psKernel3DSigBufferMemInfo->sDevVAddr,
(IMG_UINT32)psDevInfo->psKernel3DSigBufferMemInfo->uAllocSize,
ui32MMUContextID,
- 0 );
+ 0 /*ui32PDumpFlags*/);
ExitNoError:
psRetOUT->eError = PVRSRV_OK;
@@ -3578,7 +3637,7 @@ SGXPDumpTASignatureRegistersBW(IMG_UINT32 ui32BridgeID,
psDevInfo = (PVRSRV_SGXDEV_INFO*)psDeviceNode->pvDevice;
-
+ /* Enable all cores available */
ui32RegVal = OSReadHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_CORE);
OSWriteHWReg(psDevInfo->pvRegsBaseKM, EUR_CR_MASTER_CORE, (SGX_FEATURE_MP_CORE_COUNT - 1) << EUR_CR_MASTER_CORE_ENABLE_SHIFT);
#if defined(PDUMP)
@@ -3636,6 +3695,9 @@ Exit:
return ret;
}
+//PRQA S 5120--
+
+
static IMG_INT
SGXPDumpHWPerfCBBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_IN_PDUMP_HWPERFCB *psPDumpHWPerfCBIN,
@@ -3672,8 +3734,8 @@ SGXPDumpHWPerfCBBW(IMG_UINT32 ui32BridgeID,
return 0;
}
-
- PVR_ASSERT(psDeviceNode->pfnMMUGetContextID != IMG_NULL)
+ /* look up the MMU context ID */
+ PVR_ASSERT(psDeviceNode->pfnMMUGetContextID != IMG_NULL);
ui32MMUContextID = psDeviceNode->pfnMMUGetContextID(hDevMemContextInt);
PDumpHWPerfCBKM(&psDeviceNode->sDevId,
@@ -3691,14 +3753,14 @@ SGXPDumpHWPerfCBBW(IMG_UINT32 ui32BridgeID,
PVR_UNREFERENCED_PARAMETER(psRetOUT);
PVR_UNREFERENCED_PARAMETER(psPerProc);
return 0;
-#endif
+#endif /* defined(LINUX) || defined(UNDER_XP) */
#else
PVR_UNREFERENCED_PARAMETER(ui32BridgeID);
PVR_UNREFERENCED_PARAMETER(psPDumpHWPerfCBIN);
PVR_UNREFERENCED_PARAMETER(psRetOUT);
PVR_UNREFERENCED_PARAMETER(psPerProc);
return -EFAULT;
-#endif
+#endif /* defined(SUPPORT_SGX_HWPERF) */
}
@@ -3734,8 +3796,8 @@ SGXPDumpSaveMemBW(IMG_UINT32 ui32BridgeID,
return 0;
}
-
- PVR_ASSERT(psDeviceNode->pfnMMUGetContextID != IMG_NULL)
+ /* look up the MMU context ID */
+ PVR_ASSERT(psDeviceNode->pfnMMUGetContextID != IMG_NULL);
ui32MMUContextID = psDeviceNode->pfnMMUGetContextID(hDevMemContextInt);
PDumpSaveMemKM(&psDeviceNode->sDevId,
@@ -3748,10 +3810,10 @@ SGXPDumpSaveMemBW(IMG_UINT32 ui32BridgeID,
return 0;
}
-#endif
+#endif /* PDUMP */
-
+/* PRQA S 0313,3635 END_SET_SGX */ /* function macro required this format */
IMG_VOID SetSGXDispatchTableEntry(IMG_VOID)
{
@@ -3800,6 +3862,6 @@ IMG_VOID SetSGXDispatchTableEntry(IMG_VOID)
SetDispatchTableEntry(PVRSRV_BRIDGE_SGX_PDUMP_SAVEMEM, SGXPDumpSaveMemBW);
#endif
}
-
+/* PRQA L:END_SET_SGX */ /* end of setup overrides */
-#endif
+#endif /* SUPPORT_SGX */