1
/**********************************************************************
3
* Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
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.
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.
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.
18
* The full GNU General Public License is included in this distribution in
19
* the file called "COPYING".
21
* Contact Information:
22
* Imagination Technologies Ltd. <gpl-support@imgtec.com>
23
* Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25
******************************************************************************/
27
#if !defined (__SERVICESINT_H__)
28
#define __SERVICESINT_H__
30
#if defined (__cplusplus)
37
#define HWREC_DEFAULT_TIMEOUT (500)
39
#define DRIVERNAME_MAXLENGTH (100)
41
typedef enum _PVRSRV_MEMTYPE_
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,
51
typedef struct _PVRSRV_KERNEL_MEM_INFO_
54
IMG_PVOID pvLinAddrKM;
57
IMG_DEV_VIRTADDR sDevVAddr;
63
IMG_SIZE_T ui32AllocSize;
66
PVRSRV_MEMBLK sMemBlk;
69
IMG_PVOID pvSysBackupBuffer;
72
IMG_UINT32 ui32RefCount;
75
IMG_BOOL bPendingFree;
78
#if defined(SUPPORT_MEMINFO_IDS)
79
#if !defined(USE_CODE)
89
struct _PVRSRV_KERNEL_SYNC_INFO_ *psKernelSyncInfo;
91
PVRSRV_MEMTYPE memType;
93
} PVRSRV_KERNEL_MEM_INFO;
96
typedef struct _PVRSRV_KERNEL_SYNC_INFO_
99
PVRSRV_SYNC_DATA *psSyncData;
102
IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr;
105
IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr;
108
PVRSRV_KERNEL_MEM_INFO *psSyncDataMemInfoKM;
115
IMG_UINT32 ui32RefCount;
117
} PVRSRV_KERNEL_SYNC_INFO;
119
typedef struct _PVRSRV_DEVICE_SYNC_OBJECT_
122
IMG_UINT32 ui32ReadOpsPendingVal;
123
IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr;
124
IMG_UINT32 ui32WriteOpsPendingVal;
125
IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr;
126
} PVRSRV_DEVICE_SYNC_OBJECT;
128
typedef struct _PVRSRV_SYNC_OBJECT
130
PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfoKM;
131
IMG_UINT32 ui32WriteOpsPending;
132
IMG_UINT32 ui32ReadOpsPending;
134
}PVRSRV_SYNC_OBJECT, *PPVRSRV_SYNC_OBJECT;
136
typedef struct _PVRSRV_COMMAND
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;
148
}PVRSRV_COMMAND, *PPVRSRV_COMMAND;
151
typedef struct _PVRSRV_QUEUE_INFO_
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;
161
IMG_UINT32 ui32ProcessID;
163
IMG_HANDLE hMemBlock[2];
165
struct _PVRSRV_QUEUE_INFO_ *psNextKM;
168
typedef PVRSRV_ERROR (*PFN_INSERT_CMD) (PVRSRV_QUEUE_INFO*,
173
PVRSRV_KERNEL_SYNC_INFO*[],
175
PVRSRV_KERNEL_SYNC_INFO*[],
177
typedef PVRSRV_ERROR (*PFN_SUBMIT_CMD) (PVRSRV_QUEUE_INFO*, PVRSRV_COMMAND*, IMG_BOOL);
180
typedef struct PVRSRV_DEVICECLASS_BUFFER_TAG
182
PFN_GET_BUFFER_ADDR pfnGetBufferAddr;
183
IMG_HANDLE hDevMemContext;
184
IMG_HANDLE hExtDevice;
185
IMG_HANDLE hExtBuffer;
186
PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
188
} PVRSRV_DEVICECLASS_BUFFER;
191
typedef struct PVRSRV_CLIENT_DEVICECLASS_INFO_TAG
193
IMG_HANDLE hDeviceKM;
194
IMG_HANDLE hServices;
195
} PVRSRV_CLIENT_DEVICECLASS_INFO;
198
#ifdef INLINE_IS_PRAGMA
199
#pragma inline(PVRSRVGetWriteOpsPending)
202
IMG_UINT32 PVRSRVGetWriteOpsPending(PVRSRV_KERNEL_SYNC_INFO *psSyncInfo, IMG_BOOL bIsReadOp)
204
IMG_UINT32 ui32WriteOpsPending;
208
ui32WriteOpsPending = psSyncInfo->psSyncData->ui32WriteOpsPending;
215
ui32WriteOpsPending = psSyncInfo->psSyncData->ui32WriteOpsPending++;
218
return ui32WriteOpsPending;
221
#ifdef INLINE_IS_PRAGMA
222
#pragma inline(PVRSRVGetReadOpsPending)
225
IMG_UINT32 PVRSRVGetReadOpsPending(PVRSRV_KERNEL_SYNC_INFO *psSyncInfo, IMG_BOOL bIsReadOp)
227
IMG_UINT32 ui32ReadOpsPending;
231
ui32ReadOpsPending = psSyncInfo->psSyncData->ui32ReadOpsPending++;
235
ui32ReadOpsPending = psSyncInfo->psSyncData->ui32ReadOpsPending;
238
return ui32ReadOpsPending;
242
PVRSRV_ERROR PVRSRVQueueCommand(IMG_HANDLE hQueueInfo,
243
PVRSRV_COMMAND *psCommand);
247
IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
248
PVRSRVGetMMUContextPDDevPAddr(const PVRSRV_CONNECTION *psConnection,
249
IMG_HANDLE hDevMemContext,
250
IMG_DEV_PHYADDR *sPDDevPAddr);
252
IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
253
PVRSRVAllocSharedSysMem(const PVRSRV_CONNECTION *psConnection,
254
IMG_UINT32 ui32Flags,
256
PVRSRV_CLIENT_MEM_INFO **ppsClientMemInfo);
258
IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
259
PVRSRVFreeSharedSysMem(const PVRSRV_CONNECTION *psConnection,
260
PVRSRV_CLIENT_MEM_INFO *psClientMemInfo);
262
IMG_IMPORT PVRSRV_ERROR
263
PVRSRVUnrefSharedSysMem(const PVRSRV_CONNECTION *psConnection,
264
PVRSRV_CLIENT_MEM_INFO *psClientMemInfo);
266
IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
267
PVRSRVMapMemInfoMem(const PVRSRV_CONNECTION *psConnection,
268
IMG_HANDLE hKernelMemInfo,
269
PVRSRV_CLIENT_MEM_INFO **ppsClientMemInfo);
272
#if defined (__cplusplus)