RK3368 GPU version Rogue M 1.28
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / kernel / drivers / staging / imgtec / services_kernel_client.h
1 /*************************************************************************/ /*!
2 @File           services_kernel_client.h
3 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @License        Dual MIT/GPLv2
5
6 The contents of this file are subject to the MIT license as set out below.
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 Alternatively, the contents of this file may be used under the terms of
19 the GNU General Public License Version 2 ("GPL") in which case the provisions
20 of GPL are applicable instead of those above.
21
22 If you wish to allow use of your version of this file only under the terms of
23 GPL, and not to allow others to use your version of this file under the terms
24 of the MIT license, indicate your decision by deleting the provisions above
25 and replace them with the notice and other provisions required by GPL as set
26 out in the file called "GPL-COPYING" included in this distribution. If you do
27 not delete the provisions above, a recipient may use your version of this file
28 under the terms of either the MIT license or GPL.
29
30 This License is also included in this distribution in the file called
31 "MIT-COPYING".
32
33 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
34 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
35 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 */ /**************************************************************************/
41 /* vi: set ts=8: */
42
43 /* This file contains a partial redefinition of the PowerVR Services 5
44  * interface for use by components which are checkpatch clean. This
45  * header is included by the unrefined, non-checkpatch clean headers
46  * to ensure that prototype/typedef/macro changes break the build.
47  */
48
49 #ifndef __SERVICES_KERNEL_CLIENT__
50 #define __SERVICES_KERNEL_CLIENT__
51
52 #include "debug_request_ids.h"
53 #include "pvrsrv_error.h"
54
55 #include <linux/types.h>
56
57 #ifndef __pvrsrv_defined_struct_enum__
58
59 /* pvrsrv_device_types.h */
60
61 enum PVRSRV_DEVICE_TYPE {
62         PVRSRV_DEVICE_TYPE_RGX = 10,
63 };
64
65 /* sync_external.h */
66
67 struct PVRSRV_CLIENT_SYNC_PRIM {
68         volatile __u32 *pui32LinAddr;
69 };
70
71 struct PVRSRV_CLIENT_SYNC_PRIM_OP {
72         __u32 ui32Flags;
73         struct pvrsrv_sync_prim *psSync;
74         __u32 ui32FenceValue;
75         __u32 ui32UpdateValue;
76 };
77
78 #else /* __pvrsrv_defined_struct_enum__ */
79
80 enum PVRSRV_DEVICE_TYPE;
81 struct PVRSRV_CLIENT_SYNC_PRIM;
82 struct PVRSRV_CLIENT_SYNC_PRIM_OP;
83
84 #endif /* __pvrsrv_defined_struct_enum__ */
85
86 struct SYNC_PRIM_CONTEXT;
87
88 /* pvrsrv.h */
89
90 #define DEBUG_REQUEST_VERBOSITY_LOW    0
91 #define DEBUG_REQUEST_VERBOSITY_MEDIUM 1
92 #define DEBUG_REQUEST_VERBOSITY_HIGH   2
93 #define DEBUG_REQUEST_VERBOSITY_MAX    (DEBUG_REQUEST_VERBOSITY_HIGH)
94
95 typedef void (DUMPDEBUG_PRINTF_FUNC)(const char *fmt, ...) __printf(1, 2);
96
97 extern DUMPDEBUG_PRINTF_FUNC *g_pfnDumpDebugPrintf;
98
99 typedef void (*PFN_CMDCOMP_NOTIFY)(void *hCmdCompHandle);
100 enum PVRSRV_ERROR PVRSRVRegisterCmdCompleteNotify(void **phNotify,
101         PFN_CMDCOMP_NOTIFY pfnCmdCompleteNotify, void *hPrivData);
102 enum PVRSRV_ERROR PVRSRVUnregisterCmdCompleteNotify(void *hNotify);
103
104 typedef void (*PFN_DBGREQ_NOTIFY) (void *hDebugRequestHandle,
105         __u32 ui32VerbLevel);
106 enum PVRSRV_ERROR PVRSRVRegisterDbgRequestNotify(void **phNotify,
107         PFN_DBGREQ_NOTIFY pfnDbgRequestNotify,
108         __u32 ui32RequesterID, void *hDbgReqeustHandle);
109 enum PVRSRV_ERROR PVRSRVUnregisterDbgRequestNotify(void *hNotify);
110
111 enum PVRSRV_ERROR PVRSRVAcquireDeviceDataKM(__u32 ui32DevIndex,
112         enum PVRSRV_DEVICE_TYPE eDeviceType, void **phDevCookie);
113 enum PVRSRV_ERROR PVRSRVReleaseDeviceDataKM(void *hDevCookie);
114 void PVRSRVCheckStatus(void *hCmdCompCallerHandle);
115 enum PVRSRV_ERROR AcquireGlobalEventObjectServer(void **phGlobalEventObject);
116 enum PVRSRV_ERROR ReleaseGlobalEventObjectServer(void *hGlobalEventObject);
117
118 /* sync.h */
119
120 enum PVRSRV_ERROR SyncPrimContextCreate(void *hBridge, void *hDeviceNode,
121         struct SYNC_PRIM_CONTEXT **phSyncPrimContext);
122 void SyncPrimContextDestroy(struct SYNC_PRIM_CONTEXT *hSyncPrimContext);
123
124 enum PVRSRV_ERROR SyncPrimAlloc(struct SYNC_PRIM_CONTEXT *hSyncPrimContext,
125         struct PVRSRV_CLIENT_SYNC_PRIM **ppsSync, const char * pszClassName);
126 void SyncPrimFree(struct PVRSRV_CLIENT_SYNC_PRIM *psSync);
127 __u32 SyncPrimGetFirmwareAddr(struct PVRSRV_CLIENT_SYNC_PRIM *psSync);
128
129 /* pdump_km.h */
130
131 #ifdef PDUMP
132 enum PVRSRV_ERROR __printf(1, 2) PDumpComment(char *fmt, ...);
133 #else
134 static inline enum PVRSRV_ERROR __printf(1, 2) PDumpComment(char *fmt, ...)
135 {
136         return PVRSRV_OK;
137 }
138 #endif
139
140 /* osfunc.h */
141
142 void OSAcquireBridgeLock(void);
143 void OSReleaseBridgeLock(void);
144 enum PVRSRV_ERROR OSEventObjectWait(void *hOSEventKM);
145 enum PVRSRV_ERROR OSEventObjectOpen(void *hEventObject, void **phOSEventKM);
146 enum PVRSRV_ERROR OSEventObjectClose(void *hOSEventKM);
147
148 /* srvkm.h */
149
150 const char *PVRSRVGetErrorStringKM(enum PVRSRV_ERROR eError);
151
152 #endif /* __SERVICES_KERNEL_CLIENT__ */