1. Reopen bEnableRDPowIsland since it doesn't appear splash screen when click the drawerbutton.
2. Remove hGPUUtilLock to avoid dead lock.
3. Get raw ion_device by IonDevAcquire.
4. Merge 1.5_ED3830101 DDK code.
Change-Id: I9b8cef3ddf13dac65663827b88609bfab812e573
Signed-off-by: zxl <zhuangxl@rock-chips.com>
and timing data for more detailed page fault analysis._\
))
+$(eval $(call TunableKernelConfigC,PVR_DISABLE_KMALLOC_MEMSTATS,,\
+Set to avoid gathering statistical information about kmalloc and vmalloc_\
+allocations._\
+))
+
$(eval $(call TunableBothConfigC,PVRSRV_ENABLE_MEMORY_STATS,,\
Enable Memory allocations to be recorded and published via Process Statistics._\
))
include ../common/pvrgdb.mk
include ../common/3rdparty.mk
include ../common/testchip.mk
+
+# For VP this needs to be external visible options
+$(eval $(call KernelConfigC,TC_APOLLO_ES2,))
+$(eval $(call TunableKernelConfigC,VIRTUAL_PLATFORM,))
#ifndef _RGXCORE_KM_1_33_2_5_H_
#define _RGXCORE_KM_1_33_2_5_H_
-/***** Automatically generated file (3/4/2015 2:27:36 PM): Do not edit manually ********************/
-/***** Timestamp: (3/4/2015 2:27:36 PM)************************************************************/
+/***** Automatically generated file (26/08/2015 09:15:02): Do not edit manually ********************/
+/***** Timestamp: (26/08/2015 09:15:02)************************************************************/
/***** CS: @2106753 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_37918
#define FIX_HW_BRN_38344
+#define FIX_HW_BRN_42321
+#define FIX_HW_BRN_44455
+#define FIX_HW_BRN_54441
#ifndef _RGXCORE_KM_1_39_4_19_H_
#define _RGXCORE_KM_1_39_4_19_H_
-/***** Automatically generated file (3/4/2015 2:27:37 PM): Do not edit manually ********************/
-/***** Timestamp: (3/4/2015 2:27:37 PM)************************************************************/
+/***** Automatically generated file (26/08/2015 09:15:02): Do not edit manually ********************/
+/***** Timestamp: (26/08/2015 09:15:02)************************************************************/
/***** CS: @2784771 ******************************************************************/
*****************************************************************************/
#define FIX_HW_BRN_38344
+#define FIX_HW_BRN_42321
+#define FIX_HW_BRN_44455
+#define FIX_HW_BRN_54441
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_1_48_2_0_H_
#define _RGXCORE_KM_1_48_2_0_H_
-/***** Automatically generated file (3/4/2015 2:27:36 PM): Do not edit manually ********************/
-/***** Timestamp: (3/4/2015 2:27:36 PM)************************************************************/
+/***** Automatically generated file (26/08/2015 09:15:02): Do not edit manually ********************/
+/***** Timestamp: (26/08/2015 09:15:02)************************************************************/
/***** CS: @2523218 ******************************************************************/
*****************************************************************************/
#define FIX_HW_BRN_38344
+#define FIX_HW_BRN_42321
+#define FIX_HW_BRN_44455
+#define FIX_HW_BRN_54441
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_1_72_4_12_H_
#define _RGXCORE_KM_1_72_4_12_H_
-/***** Automatically generated file (3/4/2015 2:27:34 PM): Do not edit manually ********************/
-/***** Timestamp: (3/4/2015 2:27:34 PM)************************************************************/
+/***** Automatically generated file (26/08/2015 09:15:06): Do not edit manually ********************/
+/***** Timestamp: (26/08/2015 09:15:06)************************************************************/
/***** CS: @2646650 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_44455
+#define FIX_HW_BRN_54441
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_1_75_2_20_H_
#define _RGXCORE_KM_1_75_2_20_H_
-/***** Automatically generated file (3/4/2015 2:27:36 PM): Do not edit manually ********************/
-/***** Timestamp: (3/4/2015 2:27:36 PM)************************************************************/
+/***** Automatically generated file (26/08/2015 09:15:07): Do not edit manually ********************/
+/***** Timestamp: (26/08/2015 09:15:07)************************************************************/
/***** CS: @2309075 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_42321
+#define FIX_HW_BRN_44455
+#define FIX_HW_BRN_54441
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_1_75_2_30_H_
#define _RGXCORE_KM_1_75_2_30_H_
-/***** Automatically generated file (3/4/2015 2:27:33 PM): Do not edit manually ********************/
-/***** Timestamp: (3/4/2015 2:27:33 PM)************************************************************/
+/***** Automatically generated file (26/08/2015 09:15:07): Do not edit manually ********************/
+/***** Timestamp: (26/08/2015 09:15:07)************************************************************/
/***** CS: @2309075 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_42321
+#define FIX_HW_BRN_44455
+#define FIX_HW_BRN_54441
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_1_76_4_6_H_
#define _RGXCORE_KM_1_76_4_6_H_
-/***** Automatically generated file (3/4/2015 2:27:34 PM): Do not edit manually ********************/
-/***** Timestamp: (3/4/2015 2:27:34 PM)************************************************************/
+/***** Automatically generated file (23/07/2015 09:37:59): Do not edit manually ********************/
+/***** Timestamp: (23/07/2015 09:37:59)************************************************************/
/***** CS: @2318404 ******************************************************************/
#define FIX_HW_BRN_38344
#define FIX_HW_BRN_42480
+#define FIX_HW_BRN_44455
+#define FIX_HW_BRN_54441
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_1_81_4_15_H_
#define _RGXCORE_KM_1_81_4_15_H_
-/***** Automatically generated file (3/4/2015 2:27:36 PM): Do not edit manually ********************/
-/***** Timestamp: (3/4/2015 2:27:36 PM)************************************************************/
+/***** Automatically generated file (26/08/2015 09:15:07): Do not edit manually ********************/
+/***** Timestamp: (26/08/2015 09:15:07)************************************************************/
/***** CS: @2373516 ******************************************************************/
*****************************************************************************/
#define FIX_HW_BRN_38344
+#define FIX_HW_BRN_42321
+#define FIX_HW_BRN_44455
+#define FIX_HW_BRN_54441
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_1_82_4_5_H_
#define _RGXCORE_KM_1_82_4_5_H_
-/***** Automatically generated file (3/4/2015 2:27:34 PM): Do not edit manually ********************/
-/***** Timestamp: (3/4/2015 2:27:34 PM)************************************************************/
+/***** Automatically generated file (26/08/2015 09:15:07): Do not edit manually ********************/
+/***** Timestamp: (26/08/2015 09:15:07)************************************************************/
/***** CS: @2503111 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_44455
+#define FIX_HW_BRN_54441
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_12_5_1_20_H_
#define _RGXCORE_KM_12_5_1_20_H_
-/***** Automatically generated file (4/27/2015 2:03:36 PM): Do not edit manually ********************/
-/***** Timestamp: (4/27/2015 2:03:36 PM)************************************************************/
+/***** Automatically generated file (23/07/2015 09:38:00): Do not edit manually ********************/
+/***** Timestamp: (23/07/2015 09:38:00)************************************************************/
/***** CS: @3146507 ******************************************************************/
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_4_29_2_51_H_
#define _RGXCORE_KM_4_29_2_51_H_
-/***** Automatically generated file (3/2/2015 6:26:08 PM): Do not edit manually ********************/
-/***** Timestamp: (3/2/2015 6:26:08 PM)************************************************************/
+/***** Automatically generated file (07/09/2015 09:24:24): Do not edit manually ********************/
+/***** Timestamp: (07/09/2015 09:24:24)************************************************************/
/***** CS: @2944502 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_50767
+#define FIX_HW_BRN_54441
#define FIX_HW_BRN_57193
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
+#define HW_ERN_42290
+#define HW_ERN_42606
#ifndef _RGXCORE_KM_4_32_2_52_H_
#define _RGXCORE_KM_4_32_2_52_H_
-/***** Automatically generated file (3/2/2015 6:26:04 PM): Do not edit manually ********************/
-/***** Timestamp: (3/2/2015 6:26:04 PM)************************************************************/
+/***** Automatically generated file (07/09/2015 09:24:24): Do not edit manually ********************/
+/***** Timestamp: (07/09/2015 09:24:24)************************************************************/
/***** CS: @2966609 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_50767
+#define FIX_HW_BRN_54441
#define FIX_HW_BRN_57193
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
+#define HW_ERN_42290
+#define HW_ERN_42606
#ifndef _RGXCORE_KM_4_40_2_51_H_
#define _RGXCORE_KM_4_40_2_51_H_
-/***** Automatically generated file (3/2/2015 6:26:02 PM): Do not edit manually ********************/
-/***** Timestamp: (3/2/2015 6:26:02 PM)************************************************************/
+/***** Automatically generated file (07/09/2015 09:24:25): Do not edit manually ********************/
+/***** Timestamp: (07/09/2015 09:24:25)************************************************************/
/***** CS: @3254374 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_50767
+#define FIX_HW_BRN_54441
#define FIX_HW_BRN_57193
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
+#define HW_ERN_42290
+#define HW_ERN_42606
#ifndef _RGXCORE_KM_4_41_2_57_H_
#define _RGXCORE_KM_4_41_2_57_H_
-/***** Automatically generated file (3/2/2015 6:26:02 PM): Do not edit manually ********************/
-/***** Timestamp: (3/2/2015 6:26:02 PM)************************************************************/
+/***** Automatically generated file (07/09/2015 09:24:25): Do not edit manually ********************/
+/***** Timestamp: (07/09/2015 09:24:25)************************************************************/
/***** CS: @3254338 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_50767
+#define FIX_HW_BRN_54441
#define FIX_HW_BRN_57193
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
+#define HW_ERN_42290
+#define HW_ERN_42606
#ifndef _RGXCORE_KM_4_42_4_53_H_
#define _RGXCORE_KM_4_42_4_53_H_
-/***** Automatically generated file (3/2/2015 6:26:02 PM): Do not edit manually ********************/
-/***** Timestamp: (3/2/2015 6:26:02 PM)************************************************************/
+/***** Automatically generated file (07/09/2015 09:24:25): Do not edit manually ********************/
+/***** Timestamp: (07/09/2015 09:24:25)************************************************************/
/***** CS: @3250390 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_50767
+#define FIX_HW_BRN_54441
#define FIX_HW_BRN_57193
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
+#define HW_ERN_42290
+#define HW_ERN_42606
#ifndef _RGXCORE_KM_4_43_6_62_H_
#define _RGXCORE_KM_4_43_6_62_H_
-/***** Automatically generated file (3/2/2015 6:26:02 PM): Do not edit manually ********************/
-/***** Timestamp: (3/2/2015 6:26:02 PM)************************************************************/
+/***** Automatically generated file (07/09/2015 09:24:25): Do not edit manually ********************/
+/***** Timestamp: (07/09/2015 09:24:25)************************************************************/
/***** CS: @3253129 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_50767
+#define FIX_HW_BRN_54441
#define FIX_HW_BRN_57193
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
+#define HW_ERN_42290
+#define HW_ERN_42606
#ifndef _RGXCORE_KM_5_11_1_46_H_
#define _RGXCORE_KM_5_11_1_46_H_
-/***** Automatically generated file (4/2/2015 11:53:03 AM): Do not edit manually ********************/
-/***** Timestamp: (4/2/2015 11:53:03 AM)************************************************************/
+/***** Automatically generated file (26/08/2015 09:15:10): Do not edit manually ********************/
+/***** Timestamp: (26/08/2015 09:15:10)************************************************************/
/***** CS: @3485232 ******************************************************************/
* Errata
*****************************************************************************/
-#define FIX_HW_BRN_42480
+#define FIX_HW_BRN_42321
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_5_9_1_46_H_
#define _RGXCORE_KM_5_9_1_46_H_
-/***** Automatically generated file (3/4/2015 2:27:37 PM): Do not edit manually ********************/
-/***** Timestamp: (3/4/2015 2:27:37 PM)************************************************************/
+/***** Automatically generated file (26/08/2015 09:15:08): Do not edit manually ********************/
+/***** Timestamp: (26/08/2015 09:15:08)************************************************************/
/***** CS: @2967148 ******************************************************************/
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
#ifndef _RGXCORE_KM_8_21_2_34_H_
#define _RGXCORE_KM_8_21_2_34_H_
-/***** Automatically generated file (21/04/2015 18:47:55): Do not edit manually ********************/
-/***** Timestamp: (21/04/2015 18:47:55)************************************************************/
+/***** Automatically generated file (23/07/2015 09:38:01): Do not edit manually ********************/
+/***** Timestamp: (23/07/2015 09:38:01)************************************************************/
/***** CS: @3480967 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_54441
+#define FIX_HW_BRN_55091
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
+#define HW_ERN_42290
+#define HW_ERN_42606
#define HW_ERN_45914
+#define HW_ERN_46066
+#define HW_ERN_47025
#ifndef _RGXCORE_KM_8_41_4_38_H_
#define _RGXCORE_KM_8_41_4_38_H_
-/***** Automatically generated file (5/12/2015 5:46:10 AM): Do not edit manually ********************/
-/***** Timestamp: (5/12/2015 5:46:10 AM)************************************************************/
+/***** Automatically generated file (23/07/2015 09:38:02): Do not edit manually ********************/
+/***** Timestamp: (23/07/2015 09:38:02)************************************************************/
/***** CS: @3498807 ******************************************************************/
* Errata
*****************************************************************************/
+#define FIX_HW_BRN_54441
+#define FIX_HW_BRN_55091
/******************************************************************************
* Enhancements
*****************************************************************************/
+#define HW_ERN_36400
+#define HW_ERN_42290
+#define HW_ERN_42606
#define HW_ERN_45914
+#define HW_ERN_46066
+#define HW_ERN_47025
* Merge 1.5_ED3653583 DDK code.
* M 1.28:
* Merge 1.5_ED3776568 DDK code.
+ * M 1.29
+ * 1. Reopen bEnableRDPowIsland since it doesn't appear splash screen when click the drawerbutton.
+ * 2. Don't set PVR_ANDROID_HAS_SET_BUFFERS_DATASPACE by default.
+ * 3. Remove hGPUUtilLock to avoid dead lock.
+ * 4. Get raw ion_device by IonDevAcquire.
+ * M 1.31
+ * 1. Merge 1.5_ED3830101 DDK code.
*/
#define PVR_STR(X) #X
#define PVRVERSION_FAMILY "rogueddk"
#define PVRVERSION_BRANCHNAME "1.5"
-#define PVRVERSION_BUILD 3776568
+#define PVRVERSION_BUILD 3830101
#define PVRVERSION_BSCONTROL "Rogue_DDK_Android"
#define PVRVERSION_STRING "Rogue_DDK_Android rogueddk 1.5@" PVR_STR2(PVRVERSION_BUILD)
#define COPYRIGHT_TXT "Copyright (c) Imagination Technologies Ltd. All Rights Reserved."
-#define PVRVERSION_BUILD_HI 377
-#define PVRVERSION_BUILD_LO 6568
+#define PVRVERSION_BUILD_HI 383
+#define PVRVERSION_BUILD_LO 101
#define PVRVERSION_STRING_NUMERIC PVR_STR2(PVRVERSION_MAJ) "." PVR_STR2(PVRVERSION_MIN) "." PVR_STR2(PVRVERSION_BUILD_HI) "." PVR_STR2(PVRVERSION_BUILD_LO)
#define PVRVERSION_PACK(MAJ,MIN) ((((MAJ)&0xFFFF) << 16) | (((MIN)&0xFFFF) << 0))
#define PVRVERSION_UNPACK_MIN(VERSION) (((VERSION) >> 0) & 0xFFFF)
//chenli:define rockchip version
-#define RKVERSION "KM M 1.28"
+#define RKVERSION "Rogue M 1.31"
#endif /* _PVRVERSION_H_ */
#define SYNC_MAX_CLASS_NAME_LEN 32
+#define PVRSRV_MAX_SYNC_PRIMS 32 /*!< number of sync primitives in operations */
+
+
typedef IMG_HANDLE SYNC_BRIDGE_HANDLE;
typedef struct SYNC_PRIM_CONTEXT *PSYNC_PRIM_CONTEXT;
typedef struct _SYNC_OP_COOKIE_ *PSYNC_OP_COOKIE;
IMG_DEVMEM_OFFSET_T uiSymbolicAddrOffset,
#endif
MMU_FLAGS_T uiProtFlags,
- IMG_UINT8 uiLog2PageSize)
+ IMG_UINT32 uiLog2PageSize)
{
PVRSRV_DEVICE_NODE *psDevNode = psMMUContext->psDevNode;
MMU_MEMORY_DESC *psMemDesc = &psLevel->sMemDesc;
PVRSRV_ERROR eError;
IMG_UINT32 (*pfnDerivePxEProt4)(IMG_UINT32);
- IMG_UINT64 (*pfnDerivePxEProt8)(IMG_UINT32, IMG_UINT8);
+ IMG_UINT64 (*pfnDerivePxEProt8)(IMG_UINT32, IMG_UINT32);
if (!psDevPAddr)
{
const MMU_PxE_CONFIG *psConfig = apsConfig[uiThisLevel];
IMG_UINT32 i;
IMG_BOOL bFreed = IMG_FALSE;
- IMG_UINT8 uiLog2PageSize;
/* Sanity check */
PVR_ASSERT(*pui32CurrentLevel < MMU_MAX_LEVEL);
if (aeMMULevel[uiThisLevel] != MMU_LEVEL_1)
{
PVRSRV_ERROR eError;
- /* Take the page size from the page table configs.
- Calculate array entry for PT config dependent on max MMU level */
- uiLog2PageSize = apsConfig[MMU_MAX_LEVEL-1]->uiLog2Align;
+
/* Un-wire the entry */
eError = _SetupPxE(psMMUContext,
psLevel,
0, /* Only required for data page */
#endif
MMU_PROTFLAGS_INVALID,
- uiLog2PageSize);
+ GET_LOG2_PAGESIZE());
PVR_ASSERT(eError == PVRSRV_OK);
}
IMG_UINT32 uiNextEndIndex;
IMG_BOOL bNextFirst;
IMG_BOOL bNextLast;
- IMG_UINT8 uiLog2PageSize;
/* If there is already a next Px level existing, do not allocate it */
if (!psLevel->apsNextLevel[i])
goto e0;
}
- uiLog2PageSize = apsConfig[MMU_MAX_LEVEL-1]->uiLog2Align;
/* Wire up the entry */
eError = _SetupPxE(psMMUContext,
psLevel,
0, /* Only required for data page */
#endif
0,
- uiLog2PageSize);
+ GET_LOG2_PAGESIZE());
if (eError != PVRSRV_OK)
{
OSDivide64(uiChunkSize, (1<< uiLog2ContiguityGuarantee), &ui32Remainder);
if (ui32Remainder)
{
+ PVR_DPF((PVR_DBG_ERROR,
+ "%s: Bad chunk size, must me a multiple of the contiguity "
+ "(uiChunkSize = 0x%llx, uiLog2ContiguityGuarantee = %u)",
+ __FUNCTION__,
+ (unsigned long long) uiChunkSize,
+ uiLog2ContiguityGuarantee));
return PVRSRV_ERROR_PMR_BAD_CHUNK_SIZE;
}
PVRSRV_DATA* psPVRSRVData = PVRSRVGetPVRSRVData();
PVRSRV_DEV_POWER_STATE eOldPowerState;
+ if (PVRSRV_SYS_POWER_STATE_ON != psPVRSRVData->eCurrentPowerState)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "PVRSRVSetDevicePowerStateKM: System power state is not ON"));
+ return PVRSRV_ERROR_DEVICE_POWER_CHANGE_DENIED;
+ }
+
eError = PVRSRVGetDevicePowerState(ui32DeviceIndex, &eOldPowerState);
if (eError != PVRSRV_OK)
{
"FreeListGrowRequestsByFirmware %10d\n", /* PVRSRV_PROCESS_STAT_TYPE_FREELIST_GROW_REQS_BY_FW */
"FreeListInitialPages %10d\n", /* PVRSRV_PROCESS_STAT_TYPE_FREELIST_PAGES_INIT */
"FreeListMaxPages %10d\n", /* PVRSRV_PROCESS_STAT_TYPE_FREELIST_MAX_PAGES */
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
"MemoryUsageKMalloc %10d\n", /* PVRSRV_STAT_TYPE_KMALLOC */
"MemoryUsageKMallocMax %10d\n", /* PVRSRV_STAT_TYPE_MAX_KMALLOC */
"MemoryUsageVMalloc %10d\n", /* PVRSRV_STAT_TYPE_VMALLOC */
"MemoryUsageVMallocMax %10d\n", /* PVRSRV_STAT_TYPE_MAX_VMALLOC */
+#else
+ "","","","", /* Empty strings if these stats are not logged */
+#endif
"MemoryUsageAllocPTMemoryUMA %10d\n", /* PVRSRV_STAT_TYPE_ALLOC_PAGES_PT_UMA */
"MemoryUsageAllocPTMemoryUMAMax %10d\n", /* PVRSRV_STAT_TYPE_MAX_ALLOC_PAGES_PT_UMA */
"MemoryUsageVMapPTUMA %10d\n", /* PVRSRV_STAT_TYPE_VMAP_PT_UMA */
"MemoryUsageTotalMapMax %10d\n", /* PVRSRV_PROCESS_STAT_TYPE_MAX_TOTAL_MAP */
};
+/* structure used in hash table to track vmalloc statistic entries */
+typedef struct{
+ IMG_SIZE_T uiSizeInBytes;
+ IMG_PID uiPid;
+}_PVR_STATS_VMALLOC_HASH_ENTRY;
+
+/* Function used internally to decrement per-process vmalloc statistic entries */
+static IMG_VOID _StatsDecrMemVAllocStat(_PVR_STATS_VMALLOC_HASH_ENTRY *psVmallocHashEntry);
/*
* Functions for printing the information stored...
{
switch (eAllocType)
{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
DECREASE_GLOBAL_STAT_VALUE(gsGlobalStats.ui32MemoryUsageKMalloc, uiBytes);
break;
case PVRSRV_MEM_ALLOC_TYPE_VMALLOC:
DECREASE_GLOBAL_STAT_VALUE(gsGlobalStats.ui32MemoryUsageVMalloc, uiBytes);
break;
-
+#else
+ case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
+ case PVRSRV_MEM_ALLOC_TYPE_VMALLOC:
+ break;
+#endif
case PVRSRV_MEM_ALLOC_TYPE_ALLOC_PAGES_PT_UMA:
DECREASE_GLOBAL_STAT_VALUE(gsGlobalStats.ui32MemoryUsageAllocPTMemoryUMA, uiBytes);
break;
{
switch (eAllocType)
{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
INCREASE_GLOBAL_STAT_VALUE(gsGlobalStats.ui32MemoryUsageKMalloc, uiBytes);
break;
case PVRSRV_MEM_ALLOC_TYPE_VMALLOC:
INCREASE_GLOBAL_STAT_VALUE(gsGlobalStats.ui32MemoryUsageVMalloc, uiBytes);
break;
-
+#else
+ case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
+ case PVRSRV_MEM_ALLOC_TYPE_VMALLOC:
+ break;
+#endif
case PVRSRV_MEM_ALLOC_TYPE_ALLOC_PAGES_PT_UMA:
INCREASE_GLOBAL_STAT_VALUE(gsGlobalStats.ui32MemoryUsageAllocPTMemoryUMA, uiBytes);
break;
*/
/* Allocate the memory record... */
+#if defined(__linux__)
psRecord = OSAllocMemstatMem(sizeof(PVRSRV_MEM_ALLOC_REC));
+#else
+ psRecord = OSAllocMem(sizeof(PVRSRV_MEM_ALLOC_REC));
+#endif
if (psRecord == IMG_NULL)
{
return;
OSLockRelease(psLinkedListLock);
if (psRecord != IMG_NULL)
{
+#if defined(__linux__)
OSFreeMemstatMem(psRecord);
+#else
+ OSFreeMem(psRecord);
+#endif
}
return;
}
/* Update the memory watermarks... */
switch (eAllocType)
{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
{
if (psRecord != IMG_NULL)
INCREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_VMALLOC, uiBytes);
}
break;
-
+#else
+ case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
+ case PVRSRV_MEM_ALLOC_TYPE_VMALLOC:
+ break;
+#endif
case PVRSRV_MEM_ALLOC_TYPE_ALLOC_PAGES_PT_UMA:
{
if (psRecord != IMG_NULL)
switch (eAllocType)
{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
{
DECREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_KMALLOC, psRecord->uiBytes);
DECREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_VMALLOC, psRecord->uiBytes);
}
break;
-
+#else
+ case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
+ case PVRSRV_MEM_ALLOC_TYPE_VMALLOC:
+ break;
+#endif
case PVRSRV_MEM_ALLOC_TYPE_ALLOC_PAGES_PT_UMA:
{
DECREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_ALLOC_PAGES_PT_UMA, psRecord->uiBytes);
*/
if (psRecord != IMG_NULL)
{
+#if defined(__linux__)
OSFreeMemstatMem(psRecord);
+#else
+ OSFreeMem(psRecord);
+#endif
}
#else
PVR_UNREFERENCED_PARAMETER(eAllocType);
IMG_SIZE_T uiBytes,
IMG_UINT64 uiCpuVAddr)
{
- IMG_BOOL bRes;
+ IMG_BOOL bRes = IMG_FALSE;
+ _PVR_STATS_VMALLOC_HASH_ENTRY *psNewVmallocHashEntry = NULL;
if (!bProcessStatsInitialised || (gpsVmallocSizeHashTable == NULL) )
{
}
OSLockAcquire(gpsVmallocSizeHashTableLock);
- bRes = HASH_Insert(gpsVmallocSizeHashTable, uiCpuVAddr, uiBytes);
+ /* Alloc untracked memory for the new hash table entry */
+#if defined(__linux__)
+ psNewVmallocHashEntry = OSAllocMemstatMem(sizeof(*psNewVmallocHashEntry));
+#else
+ psNewVmallocHashEntry = OSAllocMem(sizeof(*psNewVmallocHashEntry));
+#endif
+ if (psNewVmallocHashEntry)
+ {
+ /* Fill-in the size of the vmalloc and PID of the allocating process */
+ psNewVmallocHashEntry->uiSizeInBytes = uiBytes;
+ psNewVmallocHashEntry->uiPid = OSGetCurrentProcessID();
+ /* Insert address of the new struct into the hash table */
+ bRes = HASH_Insert(gpsVmallocSizeHashTable, uiCpuVAddr, (uintptr_t)psNewVmallocHashEntry);
+ }
OSLockRelease(gpsVmallocSizeHashTableLock);
- if (bRes)
+ if (psNewVmallocHashEntry)
{
- PVRSRVStatsIncrMemAllocStat(eAllocType, uiBytes);
+ if (bRes)
+ {
+ PVRSRVStatsIncrMemAllocStat(eAllocType, uiBytes);
+ }
+ else
+ {
+ PVR_DPF((PVR_DBG_ERROR, "*** %s : @ line %d HASH_Insert() failed!!", __FUNCTION__, __LINE__));
+ }
}
else
{
- PVR_DPF((PVR_DBG_ERROR, "*** %s : @ line %d HASH_Insert() failed!!", __FUNCTION__, __LINE__));
+ PVR_DPF((PVR_DBG_ERROR, "*** %s : @ line %d Failed to alloc memory for psNewVmallocHashEntry!!", __FUNCTION__, __LINE__));
}
}
/* Update the memory watermarks... */
switch (eAllocType)
{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
{
INCREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_KMALLOC, uiBytes);
INCREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_VMALLOC, uiBytes);
}
break;
-
+#else
+ case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
+ case PVRSRV_MEM_ALLOC_TYPE_VMALLOC:
+ break;
+#endif
case PVRSRV_MEM_ALLOC_TYPE_ALLOC_PAGES_PT_UMA:
{
INCREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_ALLOC_PAGES_PT_UMA, uiBytes);
OSLockRelease(psLinkedListLock);
}
+void
+PVRSRVStatsDecrMemKAllocStat(IMG_SIZE_T uiBytes,
+ IMG_PID decrPID)
+{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
+ PVRSRV_PROCESS_STATS* psProcessStats;
+
+ /* Don't do anything if we are not initialised or we are shutting down! */
+ if (!bProcessStatsInitialised)
+ {
+ return;
+ }
+
+ _decrease_global_stat(PVRSRV_MEM_ALLOC_TYPE_KMALLOC, uiBytes);
+
+ OSLockAcquire(psLinkedListLock);
+
+ psProcessStats = _FindProcessStats(decrPID);
+
+ if (psProcessStats != NULL)
+ {
+ /* Decrement the kmalloc memory stat... */
+ DECREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_KMALLOC, uiBytes);
+ }
+
+ OSLockRelease(psLinkedListLock);
+#endif
+}
+
+static void
+_StatsDecrMemVAllocStat(_PVR_STATS_VMALLOC_HASH_ENTRY *psVmallocHashEntry)
+{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
+ PVRSRV_PROCESS_STATS* psProcessStats;
+
+ /* Don't do anything if we are not initialised or we are shutting down! */
+ if (!bProcessStatsInitialised)
+ {
+ return;
+ }
+
+ _decrease_global_stat(PVRSRV_MEM_ALLOC_TYPE_VMALLOC, psVmallocHashEntry->uiSizeInBytes);
+
+ OSLockAcquire(psLinkedListLock);
+
+ psProcessStats = _FindProcessStats(psVmallocHashEntry->uiPid);
+
+ if (psProcessStats != NULL)
+ {
+ /* Decrement the kmalloc memory stat... */
+ DECREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_VMALLOC, psVmallocHashEntry->uiSizeInBytes);
+ }
+
+ OSLockRelease(psLinkedListLock);
+#endif
+}
+
IMG_VOID
PVRSRVStatsDecrMemAllocStatAndUntrack(PVRSRV_MEM_ALLOC_TYPE eAllocType,
IMG_UINT64 uiCpuVAddr)
{
- IMG_SIZE_T uiBytes;
+ _PVR_STATS_VMALLOC_HASH_ENTRY *psVmallocHashEntry = NULL;
if (!bProcessStatsInitialised || (gpsVmallocSizeHashTable == NULL) )
{
}
OSLockAcquire(gpsVmallocSizeHashTableLock);
- uiBytes = HASH_Remove(gpsVmallocSizeHashTable, uiCpuVAddr);
+ psVmallocHashEntry = (_PVR_STATS_VMALLOC_HASH_ENTRY *)HASH_Remove(gpsVmallocSizeHashTable, uiCpuVAddr);
+ if (psVmallocHashEntry)
+ {
+ _StatsDecrMemVAllocStat(psVmallocHashEntry);
+#if defined(__linux__)
+ OSFreeMemstatMem(psVmallocHashEntry);
+#else
+ OSFreeMem(psVmallocHashEntry);
+#endif
+ }
OSLockRelease(gpsVmallocSizeHashTableLock);
-
- PVRSRVStatsDecrMemAllocStat(eAllocType, uiBytes);
}
IMG_VOID
/* Update the memory watermarks... */
switch (eAllocType)
{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
{
DECREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_KMALLOC, uiBytes);
DECREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_VMALLOC, uiBytes);
}
break;
-
+#else
+ case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
+ case PVRSRV_MEM_ALLOC_TYPE_VMALLOC:
+ break;
+#endif
case PVRSRV_MEM_ALLOC_TYPE_ALLOC_PAGES_PT_UMA:
{
DECREASE_STAT_VALUE(psProcessStats, PVRSRV_PROCESS_STAT_TYPE_ALLOC_PAGES_PT_UMA, uiBytes);
while (psRecord != IMG_NULL)
{
+ IMG_BOOL bPrintStat = IMG_TRUE;
+
switch (psRecord->eAllocType)
{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
case PVRSRV_MEM_ALLOC_TYPE_KMALLOC: pfnOSStatsPrintf(pvFilePtr, "KMALLOC "); break;
case PVRSRV_MEM_ALLOC_TYPE_VMALLOC: pfnOSStatsPrintf(pvFilePtr, "VMALLOC "); break;
case PVRSRV_MEM_ALLOC_TYPE_ALLOC_PAGES_PT_LMA: pfnOSStatsPrintf(pvFilePtr, "ALLOC_PAGES_PT_LMA "); break;
+#else
+ case PVRSRV_MEM_ALLOC_TYPE_KMALLOC:
+ case PVRSRV_MEM_ALLOC_TYPE_VMALLOC:
+ bPrintStat = IMG_FALSE; break;
+#endif
case PVRSRV_MEM_ALLOC_TYPE_ALLOC_PAGES_PT_UMA: pfnOSStatsPrintf(pvFilePtr, "ALLOC_PAGES_PT_UMA "); break;
case PVRSRV_MEM_ALLOC_TYPE_IOREMAP_PT_LMA: pfnOSStatsPrintf(pvFilePtr, "IOREMAP_PT_LMA "); break;
case PVRSRV_MEM_ALLOC_TYPE_VMAP_PT_UMA: pfnOSStatsPrintf(pvFilePtr, "VMAP_PT_UMA "); break;
default: pfnOSStatsPrintf(pvFilePtr, "INVALID "); break;
}
- for (ui32ItemNumber = 0; ui32ItemNumber < ui32VAddrFields; ui32ItemNumber++)
+ if (bPrintStat)
{
- pfnOSStatsPrintf(pvFilePtr, "%08x", *(((IMG_UINT32*) &psRecord->pvCpuVAddr) + ui32VAddrFields - ui32ItemNumber - 1));
- }
- pfnOSStatsPrintf(pvFilePtr, " ");
-
- for (ui32ItemNumber = 0; ui32ItemNumber < ui32PAddrFields; ui32ItemNumber++)
- {
- pfnOSStatsPrintf(pvFilePtr, "%08x", *(((IMG_UINT32*) &psRecord->sCpuPAddr.uiAddr) + ui32PAddrFields - ui32ItemNumber - 1));
- }
+ for (ui32ItemNumber = 0; ui32ItemNumber < ui32VAddrFields; ui32ItemNumber++)
+ {
+ pfnOSStatsPrintf(pvFilePtr, "%08x", *(((IMG_UINT32*) &psRecord->pvCpuVAddr) + ui32VAddrFields - ui32ItemNumber - 1));
+ }
+ pfnOSStatsPrintf(pvFilePtr, " ");
- pfnOSStatsPrintf(pvFilePtr, " %u\n", psRecord->uiBytes);
+ for (ui32ItemNumber = 0; ui32ItemNumber < ui32PAddrFields; ui32ItemNumber++)
+ {
+ pfnOSStatsPrintf(pvFilePtr, "%08x", *(((IMG_UINT32*) &psRecord->sCpuPAddr.uiAddr) + ui32PAddrFields - ui32ItemNumber - 1));
+ }
+ pfnOSStatsPrintf(pvFilePtr, " %u\n", psRecord->uiBytes);
+ }
/* Move to next record... */
psRecord = psRecord->psNext;
}
if (pfnOSGetStatsPrintf != IMG_NULL)
{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
pfnOSGetStatsPrintf(pvFilePtr, "MemoryUsageKMalloc %10d\n", gsGlobalStats.ui32MemoryUsageKMalloc);
pfnOSGetStatsPrintf(pvFilePtr, "MemoryUsageKMallocMax %10d\n", gsGlobalStats.ui32MemoryUsageKMallocMax);
pfnOSGetStatsPrintf(pvFilePtr, "MemoryUsageVMalloc %10d\n", gsGlobalStats.ui32MemoryUsageVMalloc);
pfnOSGetStatsPrintf(pvFilePtr, "MemoryUsageVMallocMax %10d\n", gsGlobalStats.ui32MemoryUsageVMallocMax);
+#endif
pfnOSGetStatsPrintf(pvFilePtr, "MemoryUsageAllocPTMemoryUMA %10d\n", gsGlobalStats.ui32MemoryUsageAllocPTMemoryUMA);
pfnOSGetStatsPrintf(pvFilePtr, "MemoryUsageAllocPTMemoryUMAMax %10d\n", gsGlobalStats.ui32MemoryUsageAllocPTMemoryUMAMax);
pfnOSGetStatsPrintf(pvFilePtr, "MemoryUsageVMapPTUMA %10d\n", gsGlobalStats.ui32MemoryUsageVMapPTUMA);
OSPanic();
#endif
PVR_LOG(("HW operation timeout, dump server info"));
- PVRSRVDebugRequest(DEBUG_REQUEST_VERBOSITY_LOW,IMG_NULL);
+ PVRSRVDebugRequest(DEBUG_REQUEST_VERBOSITY_MEDIUM, IMG_NULL);
return PVRSRV_OK;
}
static PVRSRV_ERROR SyncAddrListGrow(SYNC_ADDR_LIST *psList, IMG_UINT32 ui32NumSyncs)
{
+ PVR_ASSERT(ui32NumSyncs <= PVRSRV_MAX_SYNC_PRIMS);
+
if(ui32NumSyncs > psList->ui32NumSyncs)
{
- OSFreeMem(psList->pasFWAddrs);
- psList->pasFWAddrs = OSAllocMem(sizeof(PRGXFWIF_UFO_ADDR) * ui32NumSyncs);
if(psList->pasFWAddrs == IMG_NULL)
{
- return PVRSRV_ERROR_OUT_OF_MEMORY;
+ psList->pasFWAddrs = OSAllocMem(sizeof(PRGXFWIF_UFO_ADDR) * PVRSRV_MAX_SYNC_PRIMS);
+ if(psList->pasFWAddrs == NULL)
+ {
+ return PVRSRV_ERROR_OUT_OF_MEMORY;
+ }
}
psList->ui32NumSyncs = ui32NumSyncs;
SyncAddrListInit(SYNC_ADDR_LIST *psList)
{
psList->ui32NumSyncs = 0;
+ psList->pasFWAddrs = NULL;
}
/*!
IMG_VOID
SyncAddrListDeinit(SYNC_ADDR_LIST *psList)
{
- if(psList->ui32NumSyncs != 0)
+ if(psList->pasFWAddrs != NULL)
{
OSFreeMem(psList->pasFWAddrs);
}
#endif
};
+IMG_EXPORT PVRSRV_ERROR RGXCCBPDumpDrainCCB(RGX_CLIENT_CCB *psClientCCB,
+ IMG_BOOL bPDumpContinuous)
+{
+ IMG_UINT32 ui32PDumpFlags;
+
+ ui32PDumpFlags = bPDumpContinuous ? PDUMP_FLAGS_CONTINUOUS : 0;
+
+ PDUMPCOMMENTWITHFLAGS(ui32PDumpFlags,
+ "cCCB(%s@%p): Draining CCB rgxfw_roff == woff (%d)",
+ psClientCCB->szName,
+ psClientCCB,
+ psClientCCB->ui32LastPDumpWriteOffset);
+
+ return DevmemPDumpDevmemPol32(psClientCCB->psClientCCBCtrlMemDesc,
+ offsetof(RGXFWIF_CCCB_CTL, ui32ReadOffset),
+ psClientCCB->ui32LastPDumpWriteOffset,
+ 0xffffffff,
+ PDUMP_POLL_OPERATOR_EQUAL,
+ ui32PDumpFlags);
+}
+
static PVRSRV_ERROR _RGXCCBPDumpTransition(IMG_PVOID *pvData, IMG_BOOL bInto, IMG_BOOL bContinuous)
{
RGX_CLIENT_CCB *psClientCCB = (RGX_CLIENT_CCB *) pvData;
thus we have no way of knowing if we can skip drain and the sync
prim dump or not.
*/
- PDUMPCOMMENTWITHFLAGS(ui32PDumpFlags,
- "cCCB(%s@%p): Draining rgxfw_roff == woff (%d)",
- psClientCCB->szName,
- psClientCCB,
- psClientCCB->ui32LastPDumpWriteOffset);
-
- eError = DevmemPDumpDevmemPol32(psClientCCB->psClientCCBCtrlMemDesc,
- offsetof(RGXFWIF_CCCB_CTL, ui32ReadOffset),
- psClientCCB->ui32LastPDumpWriteOffset,
- 0xffffffff,
- PDUMP_POLL_OPERATOR_EQUAL,
- ui32PDumpFlags);
+
+ eError = RGXCCBPDumpDrainCCB(psClientCCB, bContinuous);
+
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_WARNING, "_RGXCCBPDumpTransition: problem pdumping POL for cCCBCtl (%d)", eError));
#define PADDING_COMMAND_SIZE (sizeof(RGXFWIF_CCB_CMD_HEADER))
+PVRSRV_ERROR RGXCCBPDumpDrainCCB(RGX_CLIENT_CCB *psClientCCB,
+ IMG_UINT32 ui32PDumpContinuous);
+
PVRSRV_ERROR RGXCreateCCB(PVRSRV_DEVICE_NODE *psDeviceNode,
IMG_UINT32 ui32CCBSizeLog2,
CONNECTION_DATA *psConnectionData,
/* Check if the FW has finished with this resource ... */
eError = RGXFWRequestCommonContextCleanUp(psComputeContext->psDeviceNode,
- FWCommonContextGetFWAddress(psComputeContext->psServerCommonContext),
+ psComputeContext->psServerCommonContext,
psComputeContext->psSync,
RGXFWIF_DM_CDM);
/* Dump the IRQ info */
{
- PVR_DUMPDEBUG_LOG(("RGX FW IRQ count = %d, last sampled in MISR = %d",
+ PVR_DUMPDEBUG_LOG(("RGX FW IRQ count = %d, last sampled in LISR = %d",
psDevInfo->psRGXFWIfTraceBuf->ui32InterruptCount,
g_ui32HostSampleIRQCount));
}
}
/* Record this context so we can refer to it if the FW needs to tell us it was reset. */
- psServerCommonContext->eLastResetReason = RGXFWIF_CONTEXT_RESET_REASON_NONE;
- psServerCommonContext->ui32ContextID = psDevInfo->ui32CommonCtxtCurrentID++;
- dllist_add_to_tail(&(psDevInfo->sCommonCtxtListHead), &(psServerCommonContext->sListNode));
+ psServerCommonContext->eLastResetReason = RGXFWIF_CONTEXT_RESET_REASON_NONE;
+ psServerCommonContext->ui32ContextID = psDevInfo->ui32CommonCtxtCurrentID++;
/* Allocate the client CCB */
eError = RGXCreateCCB(psDeviceNode,
pszContextName,
psServerCommonContext->sFWCommonContextFWAddr.ui32Addr);
#endif
+ /*Add the node to the list when finalised */
+ dllist_add_to_tail(&(psDevInfo->sCommonCtxtListHead), &(psServerCommonContext->sListNode));
*ppsServerCommonContext = psServerCommonContext;
return PVRSRV_OK;
IMG_VOID FWCommonContextFree(RGX_SERVER_COMMON_CONTEXT *psServerCommonContext)
{
+
+ /* Remove the context from the list of all contexts. */
+ dllist_remove_node(&psServerCommonContext->sListNode);
+
/*
Unmap the context itself and then all it's resources
*/
/* Destroy the client CCB */
RGXDestroyCCB(psServerCommonContext->psClientCCB);
- /* Remove the context from the list of all contexts. */
- dllist_remove_node(&psServerCommonContext->sListNode);
/* Free the FW common context (if there was one) */
if (!psServerCommonContext->bCommonContextMemProvided)
RGXRequestCommonContextCleanUp
*/
PVRSRV_ERROR RGXFWRequestCommonContextCleanUp(PVRSRV_DEVICE_NODE *psDeviceNode,
- PRGXFWIF_FWCOMMONCONTEXT psFWCommonContextFWAddr,
+ RGX_SERVER_COMMON_CONTEXT *psServerCommonContext,
PVRSRV_CLIENT_SYNC_PRIM *psSyncPrim,
RGXFWIF_DM eDM)
{
RGXFWIF_KCCB_CMD sRCCleanUpCmd = {0};
PVRSRV_ERROR eError;
+ PRGXFWIF_FWCOMMONCONTEXT psFWCommonContextFWAddr;
+
+ psFWCommonContextFWAddr = FWCommonContextGetFWAddress(psServerCommonContext);
+
+ PDUMPCOMMENT("Common ctx cleanup Request DM%d [context = 0x%08x]",
+ eDM, psFWCommonContextFWAddr.ui32Addr);
+ PDUMPCOMMENT("Wait for CCB to be empty before common ctx cleanup");
+
+ RGXCCBPDumpDrainCCB(FWCommonContextGetClientCCB(psServerCommonContext), IMG_FALSE);
- PDUMPCOMMENT("Common ctx cleanup Request DM%d [context = 0x%08x]", eDM, psFWCommonContextFWAddr.ui32Addr);
/* Setup our command data, the cleanup call will fill in the rest */
sRCCleanUpCmd.uCmdData.sCleanupData.uCleanupData.psContext = psFWCommonContextFWAddr;
******************************************************************************/
PVRSRV_ERROR RGXFWRequestCommonContextCleanUp(PVRSRV_DEVICE_NODE *psDeviceNode,
- PRGXFWIF_FWCOMMONCONTEXT psFWContext,
+ RGX_SERVER_COMMON_CONTEXT *psServerCommonContext,
PVRSRV_CLIENT_SYNC_PRIM *psSyncPrim,
RGXFWIF_DM eDM);
/***** (2) Get latest data from shared area *****/
-
- OSLockAcquire(psDevInfo->hGPUUtilLock);
+ //zxl: Remove hGPUUtilLock to avoid dead lock.
+ //OSLockAcquire(psDevInfo->hGPUUtilLock);
/* Read the timer before reading the latest stats from the shared
* area, discard it later in case of state updates after this point.
psReturnStats->ui32GpuEnergy = psDevInfo->psRGXFWIfTraceBuf->ui32PowMonEnergy;
#endif
- OSLockRelease(psDevInfo->hGPUUtilLock);
+ //OSLockRelease(psDevInfo->hGPUUtilLock);
if (i == MAX_ITERATIONS)
{
/* Forward declaration of protection bits derivation functions, for
the following structure */
-static IMG_UINT64 RGXDerivePCEProt8(IMG_UINT32 uiProtFlags, IMG_UINT8 ui8Log2PageSize);
+static IMG_UINT64 RGXDerivePCEProt8(IMG_UINT32 uiProtFlags, IMG_UINT32 ui32Log2PageSize);
static IMG_UINT32 RGXDerivePCEProt4(IMG_UINT32 uiProtFlags);
-static IMG_UINT64 RGXDerivePDEProt8(IMG_UINT32 uiProtFlags, IMG_UINT8 ui8Log2PageSize);
+static IMG_UINT64 RGXDerivePDEProt8(IMG_UINT32 uiProtFlags, IMG_UINT32 ui32Log2PageSize);
static IMG_UINT32 RGXDerivePDEProt4(IMG_UINT32 uiProtFlags);
-static IMG_UINT64 RGXDerivePTEProt8(IMG_UINT32 uiProtFlags, IMG_UINT8 ui8Log2PageSize);
+static IMG_UINT64 RGXDerivePTEProt8(IMG_UINT32 uiProtFlags, IMG_UINT32 ui32Log2PageSize);
static IMG_UINT32 RGXDerivePTEProt4(IMG_UINT32 uiProtFlags);
static PVRSRV_ERROR RGXGetPageSizeConfigCB(IMG_UINT32 uiLog2DataPageSize,
@Description calculate the PCE protection flags based on an 8 byte entry
@Return PVRSRV_ERROR
*/ /**************************************************************************/
-static IMG_UINT64 RGXDerivePCEProt8(IMG_UINT32 uiProtFlags, IMG_UINT8 ui8Log2PageSize)
+static IMG_UINT64 RGXDerivePCEProt8(IMG_UINT32 uiProtFlags, IMG_UINT32 ui32Log2PageSize)
{
PVR_UNREFERENCED_PARAMETER(uiProtFlags);
- PVR_UNREFERENCED_PARAMETER(ui8Log2PageSize);
+ PVR_UNREFERENCED_PARAMETER(ui32Log2PageSize);
PVR_DPF((PVR_DBG_ERROR, "8-byte PCE not supported on this device"));
return 0;
@Return PVRSRV_ERROR
*/ /**************************************************************************/
-static IMG_UINT64 RGXDerivePDEProt8(IMG_UINT32 uiProtFlags, IMG_UINT8 ui8Log2PageSize)
+static IMG_UINT64 RGXDerivePDEProt8(IMG_UINT32 uiProtFlags, IMG_UINT32 ui32Log2PageSize)
{
IMG_UINT64 ret_value = 0; // 0 means invalid
if (! (uiProtFlags & MMU_PROTFLAGS_INVALID)) // if not invalid
{
- switch (ui8Log2PageSize)
+ switch (ui32Log2PageSize)
{
case 12:
ret_value = RGX_MMUCTRL_PD_DATA_VALID_EN | RGX_MMUCTRL_PD_DATA_PAGE_SIZE_4KB;
default:
PVR_DPF((PVR_DBG_ERROR,
"%s:%d: in function<%s>: Invalid parameter log2_page_size. Expected {12, 14, 16, 18, 20, 21}. Got [%u]",
- __FILE__, __LINE__, __FUNCTION__, ui8Log2PageSize));
+ __FILE__, __LINE__, __FUNCTION__, ui32Log2PageSize));
}
}
return ret_value;
@Description calculate the PTE protection flags based on an 8 byte entry
@Return PVRSRV_ERROR
*/ /**************************************************************************/
-static IMG_UINT64 RGXDerivePTEProt8(IMG_UINT32 uiProtFlags, IMG_UINT8 ui8Log2PageSize)
+static IMG_UINT64 RGXDerivePTEProt8(IMG_UINT32 uiProtFlags, IMG_UINT32 ui32Log2PageSize)
{
IMG_UINT64 ui64MMUFlags=0;
- PVR_UNREFERENCED_PARAMETER(ui8Log2PageSize);
+ PVR_UNREFERENCED_PARAMETER(ui32Log2PageSize);
if(((MMU_PROTFLAGS_READABLE|MMU_PROTFLAGS_WRITEABLE) & uiProtFlags) == (MMU_PROTFLAGS_READABLE|MMU_PROTFLAGS_WRITEABLE))
{
/* Check if the FW has finished with this resource ... */
eError = RGXFWRequestCommonContextCleanUp(psDeviceNode,
- FWCommonContextGetFWAddress(psTAData->psServerCommonContext),
+ psTAData->psServerCommonContext,
psCleanupSync,
RGXFWIF_DM_TA);
if (eError == PVRSRV_ERROR_RETRY)
#endif
FWCommonContextFree(psTAData->psServerCommonContext);
DevmemFwFree(psTAData->psContextStateMemDesc);
+ psTAData->psServerCommonContext = NULL;
return PVRSRV_OK;
}
/* Check if the FW has finished with this resource ... */
eError = RGXFWRequestCommonContextCleanUp(psDeviceNode,
- FWCommonContextGetFWAddress(ps3DData->psServerCommonContext),
+ ps3DData->psServerCommonContext,
psCleanupSync,
RGXFWIF_DM_3D);
if (eError == PVRSRV_ERROR_RETRY)
FWCommonContextFree(ps3DData->psServerCommonContext);
DevmemFwFree(ps3DData->psContextStateMemDesc);
+ ps3DData->psServerCommonContext = NULL;
return PVRSRV_OK;
}
RGX_SERVER_RC_3D_DATA *psRenderCtx3DData = &(psCurrentServerRenderCtx->s3DData);
RGX_SERVER_COMMON_CONTEXT *psCurrentServer3DCommonCtx = psRenderCtx3DData->psServerCommonContext;
- if (PVRSRV_ERROR_CCCB_STALLED == CheckStalledClientCommonContext(psCurrentServerTACommonCtx))
+ if (psCurrentServerTACommonCtx && (PVRSRV_ERROR_CCCB_STALLED == CheckStalledClientCommonContext(psCurrentServerTACommonCtx)))
{
*peError = PVRSRV_ERROR_CCCB_STALLED;
}
- if (PVRSRV_ERROR_CCCB_STALLED == CheckStalledClientCommonContext(psCurrentServer3DCommonCtx))
+ if (psCurrentServer3DCommonCtx && (PVRSRV_ERROR_CCCB_STALLED == CheckStalledClientCommonContext(psCurrentServer3DCommonCtx)))
{
*peError = PVRSRV_ERROR_CCCB_STALLED;
}
/* Check if the FW has finished with this resource ... */
eError = RGXFWRequestCommonContextCleanUp(psDeviceNode,
- FWCommonContextGetFWAddress(ps2DData->psServerCommonContext),
+ ps2DData->psServerCommonContext,
psCleanupSync,
RGXFWIF_DM_2D);
if (eError == PVRSRV_ERROR_RETRY)
/* ... it has so we can free it's resources */
FWCommonContextFree(ps2DData->psServerCommonContext);
+ ps2DData->psServerCommonContext = NULL;
return PVRSRV_OK;
}
/* Check if the FW has finished with this resource ... */
eError = RGXFWRequestCommonContextCleanUp(psDeviceNode,
- FWCommonContextGetFWAddress(ps3DData->psServerCommonContext),
+ ps3DData->psServerCommonContext,
psCleanupSync,
RGXFWIF_DM_3D);
if (eError == PVRSRV_ERROR_RETRY)
/* ... it has so we can free it's resources */
DevmemFwFree(ps3DData->psFWContextStateMemDesc);
FWCommonContextFree(ps3DData->psServerCommonContext);
-
+ ps3DData->psServerCommonContext = NULL;
return PVRSRV_OK;
}
RGX_SERVER_TQ_3D_DATA *psTransferCtx3DData = &(psCurrentServerTransferCtx->s3DData);
RGX_SERVER_COMMON_CONTEXT *psCurrentServerTQ3DCommonCtx = psTransferCtx3DData->psServerCommonContext;
- if (PVRSRV_ERROR_CCCB_STALLED == CheckStalledClientCommonContext(psCurrentServerTQ2DCommonCtx))
+ if (psCurrentServerTQ2DCommonCtx && (PVRSRV_ERROR_CCCB_STALLED == CheckStalledClientCommonContext(psCurrentServerTQ2DCommonCtx)))
{
*peError = PVRSRV_ERROR_CCCB_STALLED;
}
- if (PVRSRV_ERROR_CCCB_STALLED == CheckStalledClientCommonContext(psCurrentServerTQ3DCommonCtx))
+ if (psCurrentServerTQ3DCommonCtx && (PVRSRV_ERROR_CCCB_STALLED == CheckStalledClientCommonContext(psCurrentServerTQ3DCommonCtx)))
{
*peError = PVRSRV_ERROR_CCCB_STALLED;
}
#if defined(PVRSRV_ENABLE_PROCESS_STATS)
#include "process_stats.h"
#endif
-
+#include "osfunc.h"
IMG_INTERNAL IMG_PVOID OSAllocMem(IMG_UINT32 ui32Size)
{
IMG_PVOID pvRet = IMG_NULL;
}
if (pvRet == IMG_NULL)
{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
+ /* Allocate an additional 4 bytes to store the PID of the allocating process */
+ pvRet = kmalloc(ui32Size + sizeof(IMG_UINT32), GFP_KERNEL);
+#else
pvRet = kmalloc(ui32Size, GFP_KERNEL);
+#endif
}
#if defined(PVRSRV_ENABLE_PROCESS_STATS)
if (!is_vmalloc_addr(pvRet))
{
#if !defined(PVRSRV_ENABLE_MEMORY_STATS)
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
+ {
+ /* Store the PID in the final additional 4 bytes allocated */
+ IMG_UINT32 *puiTemp = (IMG_UINT32*) (((IMG_BYTE*)pvRet) + (ksize(pvRet) - sizeof(IMG_UINT32)));
+ *puiTemp = OSGetCurrentProcessID();
+ }
PVRSRVStatsIncrMemAllocStat(PVRSRV_MEM_ALLOC_TYPE_KMALLOC, ksize(pvRet));
+#endif
#else
{
IMG_CPU_PHYADDR sCpuPAddr;
else
{
#if !defined(PVRSRV_ENABLE_MEMORY_STATS)
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
PVRSRVStatsIncrMemAllocStatAndTrack(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
((ui32Size + PAGE_SIZE -1) & ~(PAGE_SIZE-1)),
(IMG_UINT64)(IMG_UINTPTR_T) pvRet);
+#endif
#else
{
IMG_CPU_PHYADDR sCpuPAddr;
}
if (pvRet == IMG_NULL)
{
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
+ /* Allocate an additional 4 bytes to store the PID of the allocating process */
+ pvRet = kzalloc(ui32Size + sizeof(IMG_UINT32), GFP_KERNEL);
+#else
pvRet = kzalloc(ui32Size, GFP_KERNEL);
+#endif
}
#if defined(PVRSRV_ENABLE_PROCESS_STATS)
if (!is_vmalloc_addr(pvRet))
{
#if !defined(PVRSRV_ENABLE_MEMORY_STATS)
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
+ {
+ /* Store the PID in the final additional 4 bytes allocated */
+ IMG_UINT32 *puiTemp = (IMG_UINT32*) (((IMG_BYTE*)pvRet) + (ksize(pvRet) - sizeof(IMG_UINT32)));
+ *puiTemp = OSGetCurrentProcessID();
+ }
PVRSRVStatsIncrMemAllocStat(PVRSRV_MEM_ALLOC_TYPE_KMALLOC, ksize(pvRet));
+#endif
#else
{
IMG_CPU_PHYADDR sCpuPAddr;
else
{
#if !defined(PVRSRV_ENABLE_MEMORY_STATS)
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
PVRSRVStatsIncrMemAllocStatAndTrack(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
((ui32Size + PAGE_SIZE -1) & ~(PAGE_SIZE-1)),
(IMG_UINT64)(IMG_UINTPTR_T) pvRet);
+#endif
#else
{
IMG_CPU_PHYADDR sCpuPAddr;
if (pvMem != IMG_NULL)
{
#if !defined(PVRSRV_ENABLE_MEMORY_STATS)
- PVRSRVStatsDecrMemAllocStat(PVRSRV_MEM_ALLOC_TYPE_KMALLOC, ksize(pvMem));
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
+ PVRSRVStatsDecrMemKAllocStat(ksize(pvMem), *((IMG_UINT32*) (((IMG_BYTE*)pvMem) + (ksize(pvMem) - sizeof(IMG_UINT32)))));
+#endif
#else
PVRSRVStatsRemoveMemAllocRecord(PVRSRV_MEM_ALLOC_TYPE_KMALLOC,
(IMG_UINT64)(IMG_UINTPTR_T) pvMem);
if (pvMem != IMG_NULL)
{
#if !defined(PVRSRV_ENABLE_MEMORY_STATS)
+#if !defined(PVR_DISABLE_KMALLOC_MEMSTATS)
PVRSRVStatsDecrMemAllocStatAndUntrack(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
- (IMG_UINT64)(IMG_UINTPTR_T) pvMem);
+ (IMG_UINT64)(IMG_UINTPTR_T) pvMem);
+#endif
#else
PVRSRVStatsRemoveMemAllocRecord(PVRSRV_MEM_ALLOC_TYPE_VMALLOC,
(IMG_UINT64)(IMG_UINTPTR_T) pvMem);
return PVRSRV_ERROR_UNABLE_TO_SET_CACHE_MODE;
}
}
-#endif
-#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) || defined (CONFIG_METAG)
+#else
{
IMG_CPU_PHYADDR sCPUPhysAddrStart, sCPUPhysAddrEnd;
IMG_PVOID pvPageVAddr = kmap(psPage);
pvPageVAddr + PAGE_SIZE,
sCPUPhysAddrStart,
sCPUPhysAddrEnd);
+ kunmap(psPage);
}
#endif
#include "pvr_drm.h"
#endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
+#define get_unused_fd() get_unused_fd_flags(0)
+#endif
+
PVRSRV_ERROR OSSecureExport(CONNECTION_DATA *psConnection,
IMG_PVOID pvData,
IMG_SECURE_TYPE *phSecure,
static void _RefDirEntry(PVR_DEBUGFS_DIR_DATA *psDirEntry);
static void _UnrefAndMaybeDestroyDirEntry(PVR_DEBUGFS_DIR_DATA *psDirEntry);
static void _UnrefAndMaybeDestroyDirEntryWhileLocked(PVR_DEBUGFS_DIR_DATA *psDirEntry);
-static IMG_BOOL _RefDebugFSEntry(PVR_DEBUGFS_ENTRY_DATA *psDebugFSEntry);
+static IMG_BOOL _RefDebugFSEntryNoLock(PVR_DEBUGFS_ENTRY_DATA *psDebugFSEntry);
static void _UnrefAndMaybeDestroyDebugFSEntry(PVR_DEBUGFS_ENTRY_DATA *psDebugFSEntry);
static IMG_BOOL _RefStatEntry(PVR_DEBUGFS_DRIVER_STAT *psStatEntry);
static IMG_BOOL _UnrefAndMaybeDestroyStatEntry(PVR_DEBUGFS_DRIVER_STAT *psStatEntry);
IMG_BOOL bRefRet = IMG_FALSE;
PVR_DEBUGFS_ENTRY_DATA *psDebugFSEntry = NULL;
+ mutex_lock(&gDebugFSLock);
+
PVR_ASSERT(psINode);
psPrivData = (PVR_DEBUGFS_PRIV_DATA *)psINode->i_private;
*/
if (psDebugFSEntry)
{
- bRefRet = _RefDebugFSEntry(psDebugFSEntry);
+ bRefRet = _RefDebugFSEntryNoLock(psDebugFSEntry);
+ mutex_unlock(&gDebugFSLock);
if (bRefRet)
{
iResult = seq_open(psFile, psPrivData->psReadOps);
}
}
}
+ else
+ {
+ mutex_unlock(&gDebugFSLock);
+ }
+ }
+ else
+ {
+ mutex_unlock(&gDebugFSLock);
}
}
+ else
+ {
+ mutex_unlock(&gDebugFSLock);
+ }
return iResult;
}
mutex_unlock(&gDebugFSLock);
}
-static IMG_BOOL _RefDebugFSEntry(PVR_DEBUGFS_ENTRY_DATA *psDebugFSEntry)
+static IMG_BOOL _RefDebugFSEntryNoLock(PVR_DEBUGFS_ENTRY_DATA *psDebugFSEntry)
{
IMG_BOOL bResult = IMG_FALSE;
PVR_ASSERT(psDebugFSEntry != NULL);
- mutex_lock(&gDebugFSLock);
-
bResult = (psDebugFSEntry->ui32RefCount > 0);
if (bResult)
{
psDebugFSEntry->ui32RefCount++;
}
- mutex_unlock(&gDebugFSLock);
-
return bResult;
}
psPrivData->bValid = IMG_FALSE;
psPrivData->psDebugFSEntry = NULL;
OSFreeMemstatMem(psEntry->d_inode->i_private);
+ psEntry->d_inode->i_private = IMG_NULL;
}
debugfs_remove(psEntry);
}
const struct _MMU_DEVVADDR_CONFIG_ *psTopLevelDevVAddrConfig;
/*! Callback for creating protection bits for the page catalogue entry with 8 byte entry */
- IMG_UINT64 (*pfnDerivePCEProt8)(IMG_UINT32, IMG_UINT8);
+ IMG_UINT64 (*pfnDerivePCEProt8)(IMG_UINT32, IMG_UINT32);
/*! Callback for creating protection bits for the page catalogue entry with 4 byte entry */
IMG_UINT32 (*pfnDerivePCEProt4)(IMG_UINT32);
/*! Callback for creating protection bits for the page directory entry with 8 byte entry */
- IMG_UINT64 (*pfnDerivePDEProt8)(IMG_UINT32, IMG_UINT8);
+ IMG_UINT64 (*pfnDerivePDEProt8)(IMG_UINT32, IMG_UINT32);
/*! Callback for creating protection bits for the page directory entry with 4 byte entry */
IMG_UINT32 (*pfnDerivePDEProt4)(IMG_UINT32);
/*! Callback for creating protection bits for the page table entry with 8 byte entry */
- IMG_UINT64 (*pfnDerivePTEProt8)(IMG_UINT32, IMG_UINT8);
+ IMG_UINT64 (*pfnDerivePTEProt8)(IMG_UINT32, IMG_UINT32);
/*! Callback for creating protection bits for the page table entry with 4 byte entry */
IMG_UINT32 (*pfnDerivePTEProt4)(IMG_UINT32);
IMG_VOID PVRSRVStatsDecrMemAllocStat(PVRSRV_MEM_ALLOC_TYPE eAllocType,
IMG_SIZE_T uiBytes);
+IMG_VOID PVRSRVStatsDecrMemKAllocStat(IMG_SIZE_T uiBytes,
+ IMG_PID decrPID);
+
/*
* Decrease the memory stat for eAllocType. Takes the allocation size value from the
* hash table with uiCpuVAddr as key. Pair with PVRSRVStatsIncrMemAllocStatAndTrack().
failMemDescAlloc:
failParams:
PVR_ASSERT(eError != PVRSRV_OK);
+ PVR_DPF((PVR_DBG_ERROR,
+ "%s: Failed! Error is %s. Allocation size: %#llX",
+ __func__,
+ PVRSRVGETERRORSTRING(eError),
+ (unsigned long long) uiSize));
return eError;
}
failMemDescAlloc:
failParams:
PVR_ASSERT(eError != PVRSRV_OK);
+ PVR_DPF((PVR_DBG_ERROR,
+ "%s: Failed! Error is %s. Allocation size: %#llX",
+ __func__,
+ PVRSRVGETERRORSTRING(eError),
+ (unsigned long long) uiSize));
return eError;
}
failMemDescAlloc:
failParams:
PVR_ASSERT(eError != PVRSRV_OK);
+ PVR_DPF((PVR_DBG_ERROR,
+ "%s: Failed! Error is %s. Allocation size: %#llX",
+ __func__,
+ PVRSRVGETERRORSTRING(eError),
+ (unsigned long long) uiSize));
return eError;
}
struct ion_device *IonDevAcquire(IMG_VOID)
{
- return g_psIonDev;
+ return rockchip_ion_dev;
}
IMG_VOID IonDevRelease(struct ion_device *psIonDev)
{
/* Nothing to do, sanity check the pointer we're passed back */
- PVR_ASSERT(psIonDev == g_psIonDev);
+ PVR_ASSERT(psIonDev == rockchip_ion_dev);
}
IMG_UINT32 IonPhysHeapID(IMG_VOID)
*/
gsRGXTimingInfo.ui32CoreClockSpeed = RGX_RK_CORE_CLOCK_SPEED;
gsRGXTimingInfo.bEnableActivePM = IMG_TRUE;
- gsRGXTimingInfo.bEnableRDPowIsland = IMG_FALSE;
+ gsRGXTimingInfo.bEnableRDPowIsland = IMG_TRUE;
gsRGXTimingInfo.ui32ActivePMLatencyms = SYS_RGX_ACTIVE_POWER_LATENCY_MS;
/*