gpu: pvr: disable sgx active power management while pvrtune is running
authorAlex Crowther <alex.crowther@imgtec.com>
Mon, 7 Mar 2011 13:14:06 +0000 (13:14 +0000)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:43:03 +0000 (21:43 +0300)
Disable sgx active power management while sgxPerfServer is running.
This enables pvrtune to run correctly without data loss.

Signed-off-by: Alex Crowther <alex.crowther@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/sgx_bridge_km.h
pvr/sgxinit.c
pvr/sgxutils.c

index 2819a7e..fbd3379 100644 (file)
@@ -106,4 +106,7 @@ enum PVRSRV_ERROR SGXGetInternalDevInfoKM(void *hDevCookie,
 
 int sgx_force_reset(void);
 
+IMG_BOOL isSGXPerfServerActive(void);
+void      SGXPerfServerMonitor(u32 u32TimeStamp);
+
 #endif
index f75989b..c551039 100644 (file)
@@ -1785,6 +1785,38 @@ enum PVRSRV_ERROR SGXGetMiscInfoKM(struct PVRSRV_SGXDEV_INFO *psDevInfo,
        }
 }
 
+
+
+static bool sgxps_active;
+static unsigned long sgxps_timeout;
+
+IMG_BOOL isSGXPerfServerActive(void)
+{
+       if (!sgxps_active)
+               return 0;
+
+       if (time_before_eq((unsigned long)OSClockus(), sgxps_timeout))
+               return 1;
+
+       sgxps_active = false;
+       PVR_DPF(DBGPRIV_WARNING, "pvr: perf server inactive\n");
+
+       return 0;
+}
+
+
+void SGXPerfServerMonitor(u32 u32TimeStamp)
+{
+       if (!sgxps_active) {
+               PVR_DPF(DBGPRIV_WARNING, "pvr: perf server active\n");
+               sgxps_active = true;
+       }
+
+       /* turn off after 1 second of inactivity */
+       sgxps_timeout = u32TimeStamp + 1000000;
+}
+
+
 enum PVRSRV_ERROR SGXReadDiffCountersKM(void *hDevHandle, u32 ui32Reg,
                                   u32 *pui32Old, IMG_BOOL bNew, u32 ui32New,
                                   u32 ui32NewReset, u32 ui32CountersReg,
@@ -1830,6 +1862,8 @@ enum PVRSRV_ERROR SGXReadDiffCountersKM(void *hDevHandle, u32 ui32Reg,
                *pui32Time = sNew.ui32Time[0];
                if (sNew.ui32Time[0] != psPrev->ui32Time[0] && bPowered) {
 
+                       SGXPerfServerMonitor(*pui32Time);
+
                        *pui32Old =
                            OSReadHWReg(psDevInfo->pvRegsBaseKM, ui32Reg);
 
index b92d502..2e97811 100644 (file)
@@ -70,6 +70,9 @@ void SGXTestActivePowerEvent(struct PVRSRV_DEVICE_NODE *psDeviceNode)
        struct SGXMKIF_HOST_CTL __iomem *psSGXHostCtl = psDevInfo->psSGXHostCtl;
        u32 l;
 
+       if (isSGXPerfServerActive())
+               return;
+
        l = readl(&psSGXHostCtl->ui32InterruptFlags);
        if (!(l & PVRSRV_USSE_EDM_INTERRUPT_ACTIVE_POWER))
                return;