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 struct _PVRSRV_KERNEL_MEM_INFO_ {
43 IMG_PVOID pvLinAddrKM;
45 IMG_DEV_VIRTADDR sDevVAddr;
49 IMG_UINT32 ui32AllocSize;
51 PVRSRV_MEMBLK sMemBlk;
53 struct _PVRSRV_KERNEL_SYNC_INFO_ *psKernelSyncInfo;
55 } PVRSRV_KERNEL_MEM_INFO;
57 typedef struct _PVRSRV_KERNEL_SYNC_INFO_ {
59 PVRSRV_SYNC_DATA *psSyncData;
61 IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr;
63 IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr;
65 PVRSRV_KERNEL_MEM_INFO *psSyncDataMemInfoKM;
67 } PVRSRV_KERNEL_SYNC_INFO;
69 typedef struct _PVRSRV_DEVICE_SYNC_OBJECT_ {
70 IMG_UINT32 ui32ReadOpPendingVal;
71 IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr;
72 IMG_UINT32 ui32WriteOpPendingVal;
73 IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr;
74 } PVRSRV_DEVICE_SYNC_OBJECT;
76 typedef struct _PVRSRV_SYNC_OBJECT {
77 PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfoKM;
78 IMG_UINT32 ui32WriteOpsPending;
79 IMG_UINT32 ui32ReadOpsPending;
81 } PVRSRV_SYNC_OBJECT, *PPVRSRV_SYNC_OBJECT;
83 typedef struct _PVRSRV_COMMAND {
84 IMG_UINT32 ui32CmdSize;
85 IMG_UINT32 ui32DevIndex;
86 IMG_UINT32 CommandType;
87 IMG_UINT32 ui32DstSyncCount;
88 IMG_UINT32 ui32SrcSyncCount;
89 PVRSRV_SYNC_OBJECT *psDstSync;
90 PVRSRV_SYNC_OBJECT *psSrcSync;
91 IMG_UINT32 ui32DataSize;
92 IMG_UINT32 ui32ProcessID;
94 } PVRSRV_COMMAND, *PPVRSRV_COMMAND;
96 typedef struct _PVRSRV_QUEUE_INFO_ {
97 IMG_VOID *pvLinQueueKM;
98 IMG_VOID *pvLinQueueUM;
99 volatile IMG_UINT32 ui32ReadOffset;
100 volatile IMG_UINT32 ui32WriteOffset;
101 IMG_UINT32 *pui32KickerAddrKM;
102 IMG_UINT32 *pui32KickerAddrUM;
103 IMG_UINT32 ui32QueueSize;
105 IMG_UINT32 ui32ProcessID;
107 IMG_HANDLE hMemBlock[2];
109 struct _PVRSRV_QUEUE_INFO_ *psNextKM;
112 typedef PVRSRV_ERROR(*PFN_INSERT_CMD) (PVRSRV_QUEUE_INFO *,
117 PVRSRV_KERNEL_SYNC_INFO *[],
119 PVRSRV_KERNEL_SYNC_INFO *[],
121 typedef PVRSRV_ERROR(*PFN_SUBMIT_CMD) (PVRSRV_QUEUE_INFO *,
122 PVRSRV_COMMAND *, IMG_BOOL);
124 typedef struct PVRSRV_DEVICECLASS_BUFFER_TAG {
125 PFN_GET_BUFFER_ADDR pfnGetBufferAddr;
126 IMG_HANDLE hDevMemContext;
127 IMG_HANDLE hExtDevice;
128 IMG_HANDLE hExtBuffer;
129 PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
131 } PVRSRV_DEVICECLASS_BUFFER;
133 typedef struct PVRSRV_CLIENT_DEVICECLASS_INFO_TAG {
134 IMG_HANDLE hDeviceKM;
135 IMG_HANDLE hServices;
136 } PVRSRV_CLIENT_DEVICECLASS_INFO;
138 #ifdef INLINE_IS_PRAGMA
139 #pragma inline(PVRSRVGetWriteOpsPending)
142 IMG_UINT32 PVRSRVGetWriteOpsPending(PVRSRV_KERNEL_SYNC_INFO *
144 IMG_BOOL bIsReadOp) {
145 IMG_UINT32 ui32WriteOpsPending;
148 ui32WriteOpsPending =
149 psSyncInfo->psSyncData->ui32WriteOpsPending;
152 ui32WriteOpsPending =
153 psSyncInfo->psSyncData->ui32WriteOpsPending++;
156 return ui32WriteOpsPending;
159 #ifdef INLINE_IS_PRAGMA
160 #pragma inline(PVRSRVGetReadOpsPending)
163 IMG_UINT32 PVRSRVGetReadOpsPending(PVRSRV_KERNEL_SYNC_INFO *
164 psSyncInfo, IMG_BOOL bIsReadOp) {
165 IMG_UINT32 ui32ReadOpsPending;
169 psSyncInfo->psSyncData->ui32ReadOpsPending++;
172 psSyncInfo->psSyncData->ui32ReadOpsPending;
175 return ui32ReadOpsPending;
179 PVRSRV_ERROR PVRSRVQueueCommand(IMG_HANDLE hQueueInfo,
180 PVRSRV_COMMAND * psCommand);
182 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
183 PVRSRVGetMMUContextPDDevPAddr(const PVRSRV_CONNECTION *
185 IMG_HANDLE hDevMemContext,
186 IMG_DEV_PHYADDR * sPDDevPAddr);
188 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
189 PVRSRVAllocSharedSysMem(const PVRSRV_CONNECTION * psConnection,
190 IMG_UINT32 ui32Flags,
192 PVRSRV_CLIENT_MEM_INFO ** ppsClientMemInfo);
194 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
195 PVRSRVFreeSharedSysMem(const PVRSRV_CONNECTION * psConnection,
196 PVRSRV_CLIENT_MEM_INFO * psClientMemInfo);
198 IMG_IMPORT PVRSRV_ERROR
199 PVRSRVUnrefSharedSysMem(const PVRSRV_CONNECTION * psConnection,
200 PVRSRV_CLIENT_MEM_INFO * psClientMemInfo);
202 IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV
203 PVRSRVMapMemInfoMem(const PVRSRV_CONNECTION * psConnection,
204 IMG_HANDLE hKernelMemInfo,
205 PVRSRV_CLIENT_MEM_INFO ** ppsClientMemInfo);
207 #if defined (__cplusplus)