From: Alex Crowther Date: Mon, 7 Mar 2011 13:14:06 +0000 (+0000) Subject: gpu: pvr: disable sgx active power management while pvrtune is running X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e80ec76aaae3eb37552a99599fe0b0249e7bec28;p=sgx.git gpu: pvr: disable sgx active power management while pvrtune is running Disable sgx active power management while sgxPerfServer is running. This enables pvrtune to run correctly without data loss. Signed-off-by: Alex Crowther Signed-off-by: Imre Deak --- diff --git a/pvr/sgx_bridge_km.h b/pvr/sgx_bridge_km.h index 2819a7e..fbd3379 100644 --- a/pvr/sgx_bridge_km.h +++ b/pvr/sgx_bridge_km.h @@ -106,4 +106,7 @@ enum PVRSRV_ERROR SGXGetInternalDevInfoKM(void *hDevCookie, int sgx_force_reset(void); +IMG_BOOL isSGXPerfServerActive(void); +void SGXPerfServerMonitor(u32 u32TimeStamp); + #endif diff --git a/pvr/sgxinit.c b/pvr/sgxinit.c index f75989b..c551039 100644 --- a/pvr/sgxinit.c +++ b/pvr/sgxinit.c @@ -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); diff --git a/pvr/sgxutils.c b/pvr/sgxutils.c index b92d502..2e97811 100644 --- a/pvr/sgxutils.c +++ b/pvr/sgxutils.c @@ -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;