f3e5df6f5e237ca137e23c2fb635015ba920fb70
[profile/ivi/intel-emgd-kmod.git] / pvr / services4 / srvkm / include / queue.h
1 /**********************************************************************
2  Copyright (c) Imagination Technologies Ltd.
3
4  Permission is hereby granted, free of charge, to any person obtaining a copy
5  of this software and associated documentation files (the "Software"), to deal
6  in the Software without restriction, including without limitation the rights
7  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  copies of the Software, and to permit persons to whom the Software is
9  furnished to do so, subject to the following conditions:
10
11  The above copyright notice and this permission notice shall be included in
12  all copies or substantial portions of the Software.
13
14  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  THE SOFTWARE.
21  ******************************************************************************/
22
23 #ifndef QUEUE_H
24 #define QUEUE_H
25
26
27 #if defined(__cplusplus)
28 extern "C" {
29 #endif
30
31 #define UPDATE_QUEUE_ROFF(psQueue, ui32Size)                                            \
32         psQueue->ui32ReadOffset = (psQueue->ui32ReadOffset + ui32Size)  \
33         & (psQueue->ui32QueueSize - 1);
34
35  typedef struct _COMMAND_COMPLETE_DATA_
36  {
37         IMG_BOOL                        bInUse;
38
39         IMG_UINT32                      ui32DstSyncCount;
40         IMG_UINT32                      ui32SrcSyncCount;
41         PVRSRV_SYNC_OBJECT      *psDstSync;
42         PVRSRV_SYNC_OBJECT      *psSrcSync;
43         IMG_UINT32                      ui32AllocSize;
44  }COMMAND_COMPLETE_DATA, *PCOMMAND_COMPLETE_DATA;
45
46 #if !defined(USE_CODE)
47 IMG_VOID QueueDumpDebugInfo(IMG_VOID);
48
49 IMG_IMPORT
50 PVRSRV_ERROR PVRSRVProcessQueues (IMG_UINT32    ui32CallerID,
51                                                                   IMG_BOOL              bFlush);
52
53 #if defined(__linux__) && defined(__KERNEL__)
54 #include <linux/types.h>
55 #include <linux/seq_file.h>
56 off_t
57 QueuePrintQueues (IMG_CHAR * buffer, size_t size, off_t off);
58
59 #ifdef PVR_PROC_USE_SEQ_FILE
60 void* ProcSeqOff2ElementQueue(struct seq_file * sfile, loff_t off);
61 void ProcSeqShowQueue(struct seq_file *sfile,void* el);
62 #endif
63
64 #endif
65
66
67 IMG_IMPORT
68 PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateCommandQueueKM(IMG_SIZE_T ui32QueueSize,
69                                                                                                          PVRSRV_QUEUE_INFO **ppsQueueInfo);
70 IMG_IMPORT
71 PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyCommandQueueKM(PVRSRV_QUEUE_INFO *psQueueInfo);
72
73 IMG_IMPORT
74 PVRSRV_ERROR IMG_CALLCONV PVRSRVInsertCommandKM(PVRSRV_QUEUE_INFO       *psQueue,
75                                                                                                 PVRSRV_COMMAND          **ppsCommand,
76                                                                                                 IMG_UINT32                      ui32DevIndex,
77                                                                                                 IMG_UINT16                      CommandType,
78                                                                                                 IMG_UINT32                      ui32DstSyncCount,
79                                                                                                 PVRSRV_KERNEL_SYNC_INFO *apsDstSync[],
80                                                                                                 IMG_UINT32                      ui32SrcSyncCount,
81                                                                                                 PVRSRV_KERNEL_SYNC_INFO *apsSrcSync[],
82                                                                                                 IMG_SIZE_T                      ui32DataByteSize );
83
84 IMG_IMPORT
85 PVRSRV_ERROR IMG_CALLCONV PVRSRVGetQueueSpaceKM(PVRSRV_QUEUE_INFO *psQueue,
86                                                                                                 IMG_SIZE_T ui32ParamSize,
87                                                                                                 IMG_VOID **ppvSpace);
88
89 IMG_IMPORT
90 PVRSRV_ERROR IMG_CALLCONV PVRSRVSubmitCommandKM(PVRSRV_QUEUE_INFO *psQueue,
91                                                                                                 PVRSRV_COMMAND *psCommand);
92
93 IMG_IMPORT
94 IMG_VOID PVRSRVCommandCompleteKM(IMG_HANDLE hCmdCookie, IMG_BOOL bScheduleMISR);
95
96 IMG_VOID PVRSRVCommandCompleteCallbacks(IMG_VOID);
97
98 IMG_IMPORT
99 PVRSRV_ERROR PVRSRVRegisterCmdProcListKM(IMG_UINT32             ui32DevIndex,
100                                                                                  PFN_CMD_PROC   *ppfnCmdProcList,
101                                                                                  IMG_UINT32             ui32MaxSyncsPerCmd[][2],
102                                                                                  IMG_UINT32             ui32CmdCount);
103 IMG_IMPORT
104 PVRSRV_ERROR PVRSRVRemoveCmdProcListKM(IMG_UINT32       ui32DevIndex,
105                                                                            IMG_UINT32   ui32CmdCount);
106
107 #endif
108
109
110 #if defined (__cplusplus)
111 }
112 #endif
113
114 #endif
115