diff options
Diffstat (limited to 'drivers/gpu/pvr/metrics.h')
-rw-r--r-- | drivers/gpu/pvr/metrics.h | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/drivers/gpu/pvr/metrics.h b/drivers/gpu/pvr/metrics.h new file mode 100644 index 00000000000..2632f8dbe02 --- /dev/null +++ b/drivers/gpu/pvr/metrics.h | |||
@@ -0,0 +1,130 @@ | |||
1 | /********************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful but, except | ||
10 | * as otherwise stated in writing, without any warranty; without even the | ||
11 | * implied warranty of merchantability or fitness for a particular purpose. | ||
12 | * See the GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | * | ||
18 | * The full GNU General Public License is included in this distribution in | ||
19 | * the file called "COPYING". | ||
20 | * | ||
21 | * Contact Information: | ||
22 | * Imagination Technologies Ltd. <gpl-support@imgtec.com> | ||
23 | * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK | ||
24 | * | ||
25 | ******************************************************************************/ | ||
26 | |||
27 | #ifndef _METRICS_ | ||
28 | #define _METRICS_ | ||
29 | |||
30 | |||
31 | #if defined (__cplusplus) | ||
32 | extern "C" { | ||
33 | #endif | ||
34 | |||
35 | |||
36 | #if defined(DEBUG) || defined(TIMING) | ||
37 | |||
38 | |||
39 | typedef struct | ||
40 | { | ||
41 | IMG_UINT32 ui32Start; | ||
42 | IMG_UINT32 ui32Stop; | ||
43 | IMG_UINT32 ui32Total; | ||
44 | IMG_UINT32 ui32Count; | ||
45 | } Temporal_Data; | ||
46 | |||
47 | extern Temporal_Data asTimers[]; | ||
48 | |||
49 | extern IMG_UINT32 PVRSRVTimeNow(IMG_VOID); | ||
50 | extern IMG_VOID PVRSRVSetupMetricTimers(IMG_VOID *pvDevInfo); | ||
51 | extern IMG_VOID PVRSRVOutputMetricTotals(IMG_VOID); | ||
52 | |||
53 | |||
54 | #define PVRSRV_TIMER_DUMMY 0 | ||
55 | |||
56 | #define PVRSRV_TIMER_EXAMPLE_1 1 | ||
57 | #define PVRSRV_TIMER_EXAMPLE_2 2 | ||
58 | |||
59 | |||
60 | #define PVRSRV_NUM_TIMERS (PVRSRV_TIMER_EXAMPLE_2 + 1) | ||
61 | |||
62 | #define PVRSRV_TIME_START(X) { \ | ||
63 | asTimers[X].ui32Count += 1; \ | ||
64 | asTimers[X].ui32Count |= 0x80000000L; \ | ||
65 | asTimers[X].ui32Start = PVRSRVTimeNow(); \ | ||
66 | asTimers[X].ui32Stop = 0; \ | ||
67 | } | ||
68 | |||
69 | #define PVRSRV_TIME_SUSPEND(X) { \ | ||
70 | asTimers[X].ui32Stop += PVRSRVTimeNow() - asTimers[X].ui32Start; \ | ||
71 | } | ||
72 | |||
73 | #define PVRSRV_TIME_RESUME(X) { \ | ||
74 | asTimers[X].ui32Start = PVRSRVTimeNow(); \ | ||
75 | } | ||
76 | |||
77 | #define PVRSRV_TIME_STOP(X) { \ | ||
78 | asTimers[X].ui32Stop += PVRSRVTimeNow() - asTimers[X].ui32Start; \ | ||
79 | asTimers[X].ui32Total += asTimers[X].ui32Stop; \ | ||
80 | asTimers[X].ui32Count &= 0x7FFFFFFFL; \ | ||
81 | } | ||
82 | |||
83 | #define PVRSRV_TIME_RESET(X) { \ | ||
84 | asTimers[X].ui32Start = 0; \ | ||
85 | asTimers[X].ui32Stop = 0; \ | ||
86 | asTimers[X].ui32Total = 0; \ | ||
87 | asTimers[X].ui32Count = 0; \ | ||
88 | } | ||
89 | |||
90 | |||
91 | #if defined(__sh__) | ||
92 | |||
93 | #define TST_REG ((volatile IMG_UINT8 *) (psDevInfo->pvSOCRegsBaseKM)) | ||
94 | |||
95 | #define TCOR_2 ((volatile IMG_UINT *) (psDevInfo->pvSOCRegsBaseKM+28)) | ||
96 | #define TCNT_2 ((volatile IMG_UINT *) (psDevInfo->pvSOCRegsBaseKM+32)) | ||
97 | #define TCR_2 ((volatile IMG_UINT16 *)(psDevInfo->pvSOCRegsBaseKM+36)) | ||
98 | |||
99 | #define TIMER_DIVISOR 4 | ||
100 | |||
101 | #endif | ||
102 | |||
103 | |||
104 | |||
105 | |||
106 | |||
107 | #else | ||
108 | |||
109 | |||
110 | |||
111 | #define PVRSRV_TIME_START(X) | ||
112 | #define PVRSRV_TIME_SUSPEND(X) | ||
113 | #define PVRSRV_TIME_RESUME(X) | ||
114 | #define PVRSRV_TIME_STOP(X) | ||
115 | #define PVRSRV_TIME_RESET(X) | ||
116 | |||
117 | #define PVRSRVSetupMetricTimers(X) | ||
118 | #define PVRSRVOutputMetricTotals() | ||
119 | |||
120 | |||
121 | |||
122 | #endif | ||
123 | |||
124 | #if defined(__cplusplus) | ||
125 | } | ||
126 | #endif | ||
127 | |||
128 | |||
129 | #endif | ||
130 | |||