~gma500/+junk/emgd152-natty

1 by Luca Forina
Upload Emgd 1.5.2 for Natty (override Maverick)
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
#if !defined (__SERVICESINT_H__)
28
#define __SERVICESINT_H__
29
30
#if defined (__cplusplus)
31
extern "C" {
32
#endif
33
34
#include "services.h"
35
#include "sysinfo.h"
36
37
#define HWREC_DEFAULT_TIMEOUT	(500)
38
39
#define DRIVERNAME_MAXLENGTH	(100)
40
41
typedef enum _PVRSRV_MEMTYPE_
42
{
43
	PVRSRV_MEMTYPE_UNKNOWN		= 0,
44
	PVRSRV_MEMTYPE_DEVICE		= 1,
45
	PVRSRV_MEMTYPE_DEVICECLASS	= 2,
46
	PVRSRV_MEMTYPE_WRAPPED		= 3,
47
	PVRSRV_MEMTYPE_MAPPED		= 4,
48
}
49
PVRSRV_MEMTYPE;
50
51
typedef struct _PVRSRV_KERNEL_MEM_INFO_
52
{
53
	
54
	IMG_PVOID				pvLinAddrKM;
55
	
56
	
57
	IMG_DEV_VIRTADDR		sDevVAddr;
58
										
59
		
60
	IMG_UINT32				ui32Flags;
61
										 
62
	
63
	IMG_SIZE_T				ui32AllocSize;		
64
65
													
66
	PVRSRV_MEMBLK			sMemBlk;
67
	
68
	
69
	IMG_PVOID				pvSysBackupBuffer;	
70
	
71
	
72
	IMG_UINT32				ui32RefCount;
73
74
	
75
	IMG_BOOL				bPendingFree;
76
77
78
	#if defined(SUPPORT_MEMINFO_IDS)
79
	#if !defined(USE_CODE)
80
	
81
	IMG_UINT64				ui64Stamp;
82
	#else 
83
	IMG_UINT32				dummy1;
84
	IMG_UINT32				dummy2;
85
	#endif 
86
	#endif 
87
88
	
89
	struct _PVRSRV_KERNEL_SYNC_INFO_	*psKernelSyncInfo;
90
91
	PVRSRV_MEMTYPE			memType;
92
93
} PVRSRV_KERNEL_MEM_INFO;
94
95
96
typedef struct _PVRSRV_KERNEL_SYNC_INFO_
97
{
98
	
99
	PVRSRV_SYNC_DATA		*psSyncData;
100
	
101
	
102
	IMG_DEV_VIRTADDR		sWriteOpsCompleteDevVAddr;
103
104
	
105
	IMG_DEV_VIRTADDR		sReadOpsCompleteDevVAddr;
106
107
	
108
	PVRSRV_KERNEL_MEM_INFO	*psSyncDataMemInfoKM;
109
110
	
111
	IMG_HANDLE				hResItem;
112
	
113
        
114
        
115
        IMG_UINT32              ui32RefCount;
116
117
} PVRSRV_KERNEL_SYNC_INFO;
118
119
typedef struct _PVRSRV_DEVICE_SYNC_OBJECT_
120
{
121
	
122
	IMG_UINT32			ui32ReadOpsPendingVal;
123
	IMG_DEV_VIRTADDR	sReadOpsCompleteDevVAddr;
124
	IMG_UINT32			ui32WriteOpsPendingVal;
125
	IMG_DEV_VIRTADDR	sWriteOpsCompleteDevVAddr;
126
} PVRSRV_DEVICE_SYNC_OBJECT;
127
128
typedef struct _PVRSRV_SYNC_OBJECT
129
{
130
	PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfoKM;
131
	IMG_UINT32				ui32WriteOpsPending;
132
	IMG_UINT32				ui32ReadOpsPending;
133
134
}PVRSRV_SYNC_OBJECT, *PPVRSRV_SYNC_OBJECT;
135
136
typedef struct _PVRSRV_COMMAND
137
{
138
	IMG_SIZE_T			ui32CmdSize;		
139
	IMG_UINT32			ui32DevIndex;		
140
	IMG_UINT32			CommandType;		
141
	IMG_UINT32			ui32DstSyncCount;	
142
	IMG_UINT32			ui32SrcSyncCount;	
143
	PVRSRV_SYNC_OBJECT	*psDstSync;			
144
	PVRSRV_SYNC_OBJECT	*psSrcSync;			
145
	IMG_SIZE_T			ui32DataSize;		
146
	IMG_UINT32			ui32ProcessID;		
147
	IMG_VOID			*pvData;			
148
}PVRSRV_COMMAND, *PPVRSRV_COMMAND;
149
150
151
typedef struct _PVRSRV_QUEUE_INFO_
152
{
153
	IMG_VOID			*pvLinQueueKM;			
154
	IMG_VOID			*pvLinQueueUM;			
155
	volatile IMG_SIZE_T	ui32ReadOffset;			
156
	volatile IMG_SIZE_T	ui32WriteOffset;		
157
	IMG_UINT32			*pui32KickerAddrKM;		
158
	IMG_UINT32			*pui32KickerAddrUM;		
159
	IMG_SIZE_T			ui32QueueSize;			
160
161
	IMG_UINT32			ui32ProcessID;			
162
163
	IMG_HANDLE			hMemBlock[2];
164
165
	struct _PVRSRV_QUEUE_INFO_ *psNextKM;		 
166
}PVRSRV_QUEUE_INFO;
167
168
typedef PVRSRV_ERROR (*PFN_INSERT_CMD) (PVRSRV_QUEUE_INFO*, 
169
										PVRSRV_COMMAND**,
170
										IMG_UINT32,
171
										IMG_UINT16,
172
										IMG_UINT32,
173
										PVRSRV_KERNEL_SYNC_INFO*[],
174
										IMG_UINT32,
175
										PVRSRV_KERNEL_SYNC_INFO*[],
176
										IMG_UINT32); 
177
typedef PVRSRV_ERROR (*PFN_SUBMIT_CMD) (PVRSRV_QUEUE_INFO*, PVRSRV_COMMAND*, IMG_BOOL);
178
179
180
typedef struct PVRSRV_DEVICECLASS_BUFFER_TAG
181
{	
182
	PFN_GET_BUFFER_ADDR		pfnGetBufferAddr;
183
	IMG_HANDLE				hDevMemContext;
184
	IMG_HANDLE				hExtDevice;
185
	IMG_HANDLE				hExtBuffer;
186
	PVRSRV_KERNEL_SYNC_INFO	*psKernelSyncInfo;
187
188
} PVRSRV_DEVICECLASS_BUFFER;
189
190
		
191
typedef struct PVRSRV_CLIENT_DEVICECLASS_INFO_TAG
192
{
193
	IMG_HANDLE hDeviceKM;
194
	IMG_HANDLE	hServices;
195
} PVRSRV_CLIENT_DEVICECLASS_INFO;
196
197
198
#ifdef INLINE_IS_PRAGMA
199
#pragma inline(PVRSRVGetWriteOpsPending)
200
#endif
201
static INLINE
202
IMG_UINT32 PVRSRVGetWriteOpsPending(PVRSRV_KERNEL_SYNC_INFO *psSyncInfo, IMG_BOOL bIsReadOp)
203
{
204
	IMG_UINT32 ui32WriteOpsPending;			
205
206
	if(bIsReadOp)
207
	{
208
		ui32WriteOpsPending = psSyncInfo->psSyncData->ui32WriteOpsPending;
209
	}
210
	else
211
	{
212
		
213
214
215
		ui32WriteOpsPending = psSyncInfo->psSyncData->ui32WriteOpsPending++;
216
	}
217
218
	return ui32WriteOpsPending;
219
}
220
221
#ifdef INLINE_IS_PRAGMA
222
#pragma inline(PVRSRVGetReadOpsPending)
223
#endif
224
static INLINE
225
IMG_UINT32 PVRSRVGetReadOpsPending(PVRSRV_KERNEL_SYNC_INFO *psSyncInfo, IMG_BOOL bIsReadOp)
226
{
227
	IMG_UINT32 ui32ReadOpsPending;			
228
229
	if(bIsReadOp)
230
	{
231
		ui32ReadOpsPending = psSyncInfo->psSyncData->ui32ReadOpsPending++;
232
	}
233
	else
234
	{
235
		ui32ReadOpsPending = psSyncInfo->psSyncData->ui32ReadOpsPending;
236
	}
237
238
	return ui32ReadOpsPending;
239
}
240
241
IMG_IMPORT
242
PVRSRV_ERROR PVRSRVQueueCommand(IMG_HANDLE hQueueInfo, 
243
								PVRSRV_COMMAND *psCommand);
244
245
246
247
IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
248
PVRSRVGetMMUContextPDDevPAddr(const PVRSRV_CONNECTION *psConnection,
249
                              IMG_HANDLE hDevMemContext,
250
                              IMG_DEV_PHYADDR *sPDDevPAddr);
251
252
IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
253
PVRSRVAllocSharedSysMem(const PVRSRV_CONNECTION *psConnection,
254
						IMG_UINT32 ui32Flags,
255
						IMG_SIZE_T ui32Size,
256
						PVRSRV_CLIENT_MEM_INFO **ppsClientMemInfo);
257
258
IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
259
PVRSRVFreeSharedSysMem(const PVRSRV_CONNECTION *psConnection,
260
					   PVRSRV_CLIENT_MEM_INFO *psClientMemInfo);
261
262
IMG_IMPORT PVRSRV_ERROR
263
PVRSRVUnrefSharedSysMem(const PVRSRV_CONNECTION *psConnection,
264
                        PVRSRV_CLIENT_MEM_INFO *psClientMemInfo);
265
266
IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
267
PVRSRVMapMemInfoMem(const PVRSRV_CONNECTION *psConnection,
268
                    IMG_HANDLE hKernelMemInfo,
269
                    PVRSRV_CLIENT_MEM_INFO **ppsClientMemInfo);
270
271
272
#if defined (__cplusplus)
273
}
274
#endif
275
#endif 
276