]> git.openpandora.org Git - sgx.git/commitdiff
gpu: pvr: remove sQProcessResource/OSLockResource interface
authorImre Deak <imre.deak@nokia.com>
Mon, 5 Apr 2010 21:24:41 +0000 (00:24 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:40 +0000 (21:09 +0300)
The relevent parts are already protected by pvr_lock(), so no
need for sQProcessResource, which was anyway racy and required
the occasional retrying of any operations performed on the
protected object.

The OSLockResource interface thus becomes unused, so remove it
too.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
pvr/osfunc.c
pvr/osfunc.h
pvr/queue.c
pvr/syscommon.h

index 907ccc63dfd5dc366dc7597ff6d2b320ae5ed3ec..5b2381dfd8939b45efc64d0d0b5ef50d0646d048 100644 (file)
@@ -307,37 +307,6 @@ s32 OSSNPrintf(char *pStr, u32 ui32Size, const char *pszFormat, ...)
        return iCount;
 }
 
-void OSBreakResourceLock(struct PVRSRV_RESOURCE *psResource, u32 ui32ID)
-{
-       volatile u32 *pui32Access = (volatile u32 *)&psResource->ui32Lock;
-
-       if (*pui32Access)
-               if (psResource->ui32ID == ui32ID) {
-                       psResource->ui32ID = 0;
-                       *pui32Access = 0;
-               } else {
-                       PVR_DPF(PVR_DBG_MESSAGE, "OSBreakResourceLock: "
-                               "Resource is not locked for this process.");
-       } else
-               PVR_DPF(PVR_DBG_MESSAGE, "OSBreakResourceLock: "
-                                       "Resource is not locked");
-}
-
-enum PVRSRV_ERROR OSCreateResource(struct PVRSRV_RESOURCE *psResource)
-{
-       psResource->ui32ID = 0;
-       psResource->ui32Lock = 0;
-
-       return PVRSRV_OK;
-}
-
-enum PVRSRV_ERROR OSDestroyResource(struct PVRSRV_RESOURCE *psResource)
-{
-       OSBreakResourceLock(psResource, psResource->ui32ID);
-
-       return PVRSRV_OK;
-}
-
 enum PVRSRV_ERROR OSInitEnvData(void **ppvEnvSpecificData)
 {
        struct ENV_DATA *psEnvData;
@@ -561,55 +530,6 @@ enum PVRSRV_ERROR OSScheduleMISR(void *pvSysData)
 }
 
 
-#define        OS_TAS(p)       xchg((p), 1)
-enum PVRSRV_ERROR OSLockResource(struct PVRSRV_RESOURCE *psResource, u32 ui32ID)
-{
-       enum PVRSRV_ERROR eError = PVRSRV_OK;
-
-       if (!OS_TAS(&psResource->ui32Lock))
-               psResource->ui32ID = ui32ID;
-       else
-               eError = PVRSRV_ERROR_GENERIC;
-
-       return eError;
-}
-
-enum PVRSRV_ERROR OSUnlockResource(struct PVRSRV_RESOURCE *psResource,
-                                  u32 ui32ID)
-{
-       volatile u32 *pui32Access = (volatile u32 *)&psResource->ui32Lock;
-       enum PVRSRV_ERROR eError = PVRSRV_OK;
-
-       if (*pui32Access) {
-               if (psResource->ui32ID == ui32ID) {
-                       psResource->ui32ID = 0;
-                       *pui32Access = 0;
-               } else {
-                       PVR_DPF(PVR_DBG_ERROR, "OSUnlockResource: "
-                              "Resource %p is not locked with expected value.",
-                               psResource);
-                       PVR_DPF(PVR_DBG_MESSAGE, "Should be %x is actually %x",
-                                ui32ID, psResource->ui32ID);
-                       eError = PVRSRV_ERROR_GENERIC;
-               }
-       } else {
-               PVR_DPF(PVR_DBG_ERROR,
-                        "OSUnlockResource: Resource %p is not locked",
-                        psResource);
-               eError = PVRSRV_ERROR_GENERIC;
-       }
-
-       return eError;
-}
-
-IMG_BOOL OSIsResourceLocked(struct PVRSRV_RESOURCE *psResource, u32 ui32ID)
-{
-       volatile u32 *pui32Access = (volatile u32 *)&psResource->ui32Lock;
-
-       return (*(volatile u32 *)pui32Access == 1) &&
-               (psResource->ui32ID == ui32ID) ? IMG_TRUE : IMG_FALSE;
-}
-
 struct IMG_CPU_PHYADDR OSMapLinToCPUPhys(void *pvLinAddr)
 {
        struct IMG_CPU_PHYADDR CpuPAddr;
index 0cad290f29233ae5b35541d41b59dda1508c7f4f..afe1ae658da448d4ea4b7caad8b274951e792562 100644 (file)
@@ -171,14 +171,6 @@ enum PVRSRV_ERROR OSMapPhysToUserSpace(void *hDevCookie,
 enum PVRSRV_ERROR OSUnmapPhysToUserSpace(void *hDevCookie, void *pvUserAddr,
                void *pvProcess);
 
-enum PVRSRV_ERROR OSLockResource(struct PVRSRV_RESOURCE *psResource,
-               u32 ui32ID);
-enum PVRSRV_ERROR OSUnlockResource(struct PVRSRV_RESOURCE *psResource,
-               u32 ui32ID);
-IMG_BOOL OSIsResourceLocked(struct PVRSRV_RESOURCE *psResource, u32 ui32ID);
-enum PVRSRV_ERROR OSCreateResource(struct PVRSRV_RESOURCE *psResource);
-enum PVRSRV_ERROR OSDestroyResource(struct PVRSRV_RESOURCE *psResource);
-void OSBreakResourceLock(struct PVRSRV_RESOURCE *psResource, u32 ui32ID);
 void OSWaitus(u32 ui32Timeus);
 void OSReleaseThreadQuanta(void);
 
index 938757fa2aab10c4a33f1c134f9df9c13de614cb..2c633cccc406fd1d2f53c417acc4580b122a75e3 100644 (file)
@@ -146,23 +146,9 @@ enum PVRSRV_ERROR PVRSRVCreateCommandQueueKM(u32 ui32QueueSize,
 
        psQueueInfo->ui32QueueSize = ui32Power2QueueSize;
 
-       if (psSysData->psQueueList == NULL) {
-               eError = OSCreateResource(&psSysData->sQProcessResource);
-               if (eError != PVRSRV_OK)
-                       goto ErrorExit;
-       }
-
-       if (OSLockResource(&psSysData->sQProcessResource,
-                          KERNEL_ID) != PVRSRV_OK)
-               goto ErrorExit;
-
        psQueueInfo->psNextKM = psSysData->psQueueList;
        psSysData->psQueueList = psQueueInfo;
 
-       if (OSUnlockResource(&psSysData->sQProcessResource, KERNEL_ID) !=
-           PVRSRV_OK)
-               goto ErrorExit;
-
        *ppsQueueInfo = psQueueInfo;
 
        return PVRSRV_OK;
@@ -215,10 +201,6 @@ enum PVRSRV_ERROR PVRSRVDestroyCommandQueueKM(
                goto ErrorExit;
        }
 
-       eError = OSLockResource(&psSysData->sQProcessResource, KERNEL_ID);
-       if (eError != PVRSRV_OK)
-               goto ErrorExit;
-
        if (psQueue == psQueueInfo) {
                psSysData->psQueueList = psQueueInfo->psNextKM;
 
@@ -247,26 +229,11 @@ enum PVRSRV_ERROR PVRSRVDestroyCommandQueueKM(
                }
 
                if (!psQueue) {
-                       eError =
-                           OSUnlockResource(&psSysData->sQProcessResource,
-                                            KERNEL_ID);
-                       if (eError != PVRSRV_OK)
-                               goto ErrorExit;
                        eError = PVRSRV_ERROR_INVALID_PARAMS;
                        goto ErrorExit;
                }
        }
 
-       eError = OSUnlockResource(&psSysData->sQProcessResource, KERNEL_ID);
-       if (eError != PVRSRV_OK)
-               goto ErrorExit;
-
-       if (psSysData->psQueueList == NULL) {
-               eError = OSDestroyResource(&psSysData->sQProcessResource);
-               if (eError != PVRSRV_OK)
-                       goto ErrorExit;
-       }
-
 ErrorExit:
 
        return eError;
@@ -530,31 +497,6 @@ enum PVRSRV_ERROR PVRSRVProcessQueues(u32 ui32CallerID, IMG_BOOL bFlush)
        if (eError != PVRSRV_OK)
                return eError;
 
-       eError = OSLockResource(&psSysData->sQProcessResource, ui32CallerID);
-       if (eError != PVRSRV_OK) {
-               if (ui32CallerID == ISR_ID) {
-                       if (bFlush) {
-                               PVR_DPF(PVR_DBG_ERROR, "PVRSRVProcessQueues: "
-                                       "Couldn't acquire queue processing "
-                                       "lock for FLUSH");
-                       } else {
-                               PVR_DPF(PVR_DBG_MESSAGE,
-                                               "PVRSRVProcessQueues: "
-                                               "Couldn't acquire queue "
-                                               "processing lock");
-                       }
-               } else {
-                       PVR_DPF(PVR_DBG_MESSAGE, "PVRSRVProcessQueues: "
-                               "Queue processing lock-acquire failed "
-                               "when called from the Services driver.");
-                       PVR_DPF(PVR_DBG_MESSAGE,
-                               "This is due to MISR queue processing "
-                               "being interrupted by the Services driver.");
-               }
-
-               return PVRSRV_OK;
-       }
-
        psQueue = psSysData->psQueueList;
 
        if (!psQueue) {
@@ -595,8 +537,6 @@ enum PVRSRV_ERROR PVRSRVProcessQueues(u32 ui32CallerID, IMG_BOOL bFlush)
                psDeviceNode = psDeviceNode->psNext;
        }
 
-       OSUnlockResource(&psSysData->sQProcessResource, ui32CallerID);
-
        return PVRSRV_OK;
 }
 
index 9d695bcc25657d14a5751e468ec0bc1d16130f0d..c55ac3893e5f235e925e5bc1fc627c9f459ecec0 100644 (file)
@@ -64,7 +64,6 @@ struct SYS_DATA {
        struct PVRSRV_KERNEL_SYNC_INFO *psSharedSyncInfoList;
        void *pvEnvSpecificData;
        void *pvSysSpecificData;
-       struct PVRSRV_RESOURCE sQProcessResource;
        void *pvSOCRegsBase;
        void *hSOCTimerRegisterOSMemHandle;
        u32 *pvSOCTimerRegisterKM;