RK3368 GPU version Rogue M 1.28
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / services / server / devices / rgx / rgxtransfer.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          RGX Transfer queue Functionality
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Header for the RGX Transfer queue Functionality
6 @License        Dual MIT/GPLv2
7
8 The contents of this file are subject to the MIT license as set out below.
9
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
23
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
31
32 This License is also included in this distribution in the file called
33 "MIT-COPYING".
34
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
43
44 #if !defined(__RGXTRANSFER_H__)
45 #define __RGXTRANSFER_H__
46
47 #include "devicemem.h"
48 #include "device.h"
49 #include "rgxdevice.h"
50 #include "rgxfwutils.h"
51 #include "rgx_fwif_resetframework.h"
52 #include "rgxdebug.h"
53
54 #include "sync_server.h"
55 #include "connection_server.h"
56
57 typedef struct _RGX_SERVER_TQ_CONTEXT_ RGX_SERVER_TQ_CONTEXT;
58
59 /*!
60 *******************************************************************************
61
62  @Function      PVRSRVRGXCreateTransferContextKM
63
64  @Description
65         Server-side implementation of RGXCreateTransferContext
66
67  @Input pvDeviceNode - device node
68  
69 FIXME fill this in
70
71  @Return   PVRSRV_ERROR
72
73 ******************************************************************************/
74 IMG_EXPORT
75 PVRSRV_ERROR PVRSRVRGXCreateTransferContextKM(CONNECTION_DATA                   *psConnection,
76                                                                                    PVRSRV_DEVICE_NODE           *psDeviceNode,
77                                                                                    IMG_UINT32                           ui32Priority,
78                                                                                    IMG_DEV_VIRTADDR                     sMCUFenceAddr,
79                                                                                    IMG_UINT32                           ui32FrameworkCommandSize,
80                                                                                    IMG_PBYTE                            pabyFrameworkCommand,
81                                                                                    IMG_HANDLE                           hMemCtxPrivData,
82                                                                                    RGX_SERVER_TQ_CONTEXT        **ppsTransferContext);
83
84
85 /*!
86 *******************************************************************************
87
88  @Function      PVRSRVRGXDestroyTransferContextKM
89
90  @Description
91         Server-side implementation of RGXDestroyTransferContext
92
93  @Input psTransferContext - Transfer context
94
95  @Return   PVRSRV_ERROR
96
97 ******************************************************************************/
98 IMG_EXPORT
99 PVRSRV_ERROR PVRSRVRGXDestroyTransferContextKM(RGX_SERVER_TQ_CONTEXT *psTransferContext);
100
101 /*!
102 *******************************************************************************
103
104  @Function      PVRSRVSubmitTransferKM
105
106  @Description
107         Schedules one or more 2D or 3D HW commands on the firmware
108
109
110  @Return   PVRSRV_ERROR
111
112 ******************************************************************************/
113 IMG_EXPORT
114 PVRSRV_ERROR PVRSRVRGXSubmitTransferKM(RGX_SERVER_TQ_CONTEXT    *psTransferContext,
115                                                                         IMG_UINT32                              ui32PrepareCount,
116                                                                         IMG_UINT32                              *paui32ClientFenceCount,
117                                                                         SYNC_PRIMITIVE_BLOCK            ***papauiClientFenceUFOSyncPrimBlock,
118                                                                         IMG_UINT32                              **papaui32ClientFenceSyncOffset,
119                                                                         IMG_UINT32                              **papaui32ClientFenceValue,
120                                                                         IMG_UINT32                              *paui32ClientUpdateCount,
121                                                                         SYNC_PRIMITIVE_BLOCK            ***papauiClientUpdateUFOSyncPrimBlock,
122                                                                         IMG_UINT32                              **papaui32ClientUpdateSyncOffset,
123                                                                         IMG_UINT32                              **papaui32ClientUpdateValue,
124                                                                         IMG_UINT32                              *paui32ServerSyncCount,
125                                                                         IMG_UINT32                              **papaui32ServerSyncFlags,
126                                                                         SERVER_SYNC_PRIMITIVE   ***papapsServerSyncs,
127                                                                         IMG_UINT32                              ui32NumCheckFenceFDs,
128                                                                         IMG_INT32                               *paui32CheckFenceFDs,
129                                                                         IMG_INT32                               i32UpdateFenceFD,
130                                                                         IMG_UINT32                              *paui32FWCommandSize,
131                                                                         IMG_UINT8                               **papaui8FWCommand,
132                                                                         IMG_UINT32                              *pui32TQPrepareFlags,
133                                                                         IMG_UINT32                              ui32ExtJobRef,
134                                                                         IMG_UINT32                              ui32IntJobRef);
135
136 IMG_EXPORT
137 PVRSRV_ERROR PVRSRVRGXSetTransferContextPriorityKM(CONNECTION_DATA *psConnection,
138                                                                                                    RGX_SERVER_TQ_CONTEXT *psTransferContext,
139                                                                                                    IMG_UINT32 ui32Priority);
140
141 /* Debug - check if transfer context is waiting on a fence */
142 IMG_VOID CheckForStalledTransferCtxt(PVRSRV_RGXDEV_INFO *psDevInfo,
143                                                                          DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf);
144
145 /* Debug/Watchdog - check if client transfer contexts are stalled */
146 IMG_BOOL CheckForStalledClientTransferCtxt(PVRSRV_RGXDEV_INFO *psDevInfo);
147
148 PVRSRV_ERROR PVRSRVRGXKickSyncTransferKM(RGX_SERVER_TQ_CONTEXT  *psTransferContext,
149                                                                            IMG_UINT32                           ui32ClientFenceCount,
150                                                                            SYNC_PRIMITIVE_BLOCK         **pauiClientFenceUFOSyncPrimBlock,
151                                                                            IMG_UINT32                           *paui32ClientFenceSyncOffset,
152                                                                            IMG_UINT32                           *paui32ClientFenceValue,
153                                                                            IMG_UINT32                           ui32ClientUpdateCount,
154                                                                            SYNC_PRIMITIVE_BLOCK         **pauiClientUpdateUFOSyncPrimBlock,
155                                                                            IMG_UINT32                           *paui32ClientUpdateSyncOffset,
156                                                                            IMG_UINT32                           *paui32ClientUpdateValue,
157                                                                            IMG_UINT32                           ui32ServerSyncCount,
158                                                                            IMG_UINT32                           *pui32ServerSyncFlags,
159                                                                            SERVER_SYNC_PRIMITIVE        **pasServerSyncs,
160                                                                            IMG_UINT32                           ui32NumCheckFenceFDs,
161                                                                            IMG_INT32                            *paui32CheckFenceFDs,
162                                                                            IMG_INT32                            i32UpdateFenceFD,
163                                                                            IMG_UINT32                           ui32TQPrepareFlags);
164 #endif /* __RGXTRANSFER_H__ */