RK3368 GPU version: Rogue L 0.22
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue / services / server / devices / rgx / rgxcompute.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          RGX compute functionality
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Header for the RGX compute 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(__RGXCOMPUTE_H__)
45 #define __RGXCOMPUTE_H__
46
47 #include "devicemem.h"
48 #include "device.h"
49 #include "rgxfwutils.h"
50 #include "rgx_fwif_resetframework.h"
51 #include "rgxdebug.h"
52
53 #include "sync_server.h"
54 #include "sync_internal.h"
55 #include "connection_server.h"
56
57 typedef struct _RGX_SERVER_COMPUTE_CONTEXT_ RGX_SERVER_COMPUTE_CONTEXT;
58
59 /*!
60 *******************************************************************************
61  @Function      PVRSRVRGXCreateComputeContextKM
62
63  @Description
64         
65
66  @Input pvDeviceNode 
67  @Input psCmpCCBMemDesc - 
68  @Input psCmpCCBCtlMemDesc - 
69  @Output ppsFWComputeContextMemDesc - 
70
71  @Return   PVRSRV_ERROR
72 ******************************************************************************/
73 IMG_EXPORT
74 PVRSRV_ERROR PVRSRVRGXCreateComputeContextKM(CONNECTION_DATA                    *psConnection,
75                                                                                          PVRSRV_DEVICE_NODE                     *psDeviceNode,
76                                                                                          IMG_UINT32                                     ui32Priority,
77                                                                                          IMG_DEV_VIRTADDR                       sMCUFenceAddr,
78                                                                                          IMG_UINT32                                     ui32FrameworkRegisterSize,
79                                                                                          IMG_PBYTE                                      pbyFrameworkRegisters,
80                                                                                          IMG_HANDLE                                     hMemCtxPrivData,
81                                                                                          RGX_SERVER_COMPUTE_CONTEXT     **ppsComputeContext);
82
83 /*! 
84 *******************************************************************************
85  @Function      PVRSRVRGXDestroyComputeContextKM
86
87  @Description
88         Server-side implementation of RGXDestroyComputeContext
89
90  @Input psCleanupData - 
91
92  @Return   PVRSRV_ERROR
93 ******************************************************************************/
94 IMG_EXPORT
95 PVRSRV_ERROR PVRSRVRGXDestroyComputeContextKM(RGX_SERVER_COMPUTE_CONTEXT *psComputeContext);
96
97
98 /*!
99 *******************************************************************************
100  @Function      PVRSRVRGXKickCDMKM
101
102  @Description
103         Server-side implementation of RGXKickCDM
104
105  @Input psDeviceNode - RGX Device node
106  @Input psFWComputeContextMemDesc - Mem desc for firmware compute context
107  @Input ui32cCCBWoffUpdate - New fw Woff for the client CDM CCB
108
109  @Return   PVRSRV_ERROR
110 ******************************************************************************/
111 IMG_EXPORT
112 PVRSRV_ERROR PVRSRVRGXKickCDMKM(RGX_SERVER_COMPUTE_CONTEXT      *psComputeContext,
113                                                                 IMG_UINT32                                      ui32ClientFenceCount,
114                                                                 SYNC_PRIMITIVE_BLOCK                    **pauiClientFenceUFOSyncPrimBlock,
115                                                                 IMG_UINT32                                      *paui32ClientFenceSyncOffset,
116                                                                 IMG_UINT32                                      *paui32ClientFenceValue,
117                                                                 IMG_UINT32                                      ui32ClientUpdateCount,
118                                                                 SYNC_PRIMITIVE_BLOCK                    **pauiClientUpdateUFOSyncPrimBlock,
119                                                                 IMG_UINT32                                      *paui32ClientUpdateSyncOffset,
120                                                                 IMG_UINT32                                      *paui32ClientUpdateValue,
121                                                                 IMG_UINT32                                      ui32ServerSyncPrims,
122                                                                 IMG_UINT32                                      *paui32ServerSyncFlags,
123                                                                 SERVER_SYNC_PRIMITIVE           **pasServerSyncs,
124                                                                 IMG_UINT32                                      ui32CmdSize,
125                                                                 IMG_PBYTE                                       pui8DMCmd,
126                                                                 IMG_BOOL                                        bPDumpContinuous,
127                                                                 IMG_UINT32                                      ui32ExtJobRef,
128                                                                 IMG_UINT32                                      ui32IntJobRef);
129                                                                 
130 /*!
131 *******************************************************************************
132  @Function      PVRSRVRGXFlushComputeDataKM
133
134  @Description
135         Server-side implementation of RGXFlushComputeData
136
137  @Input psComputeContext - Compute context to flush
138
139  @Return   PVRSRV_ERROR
140 ******************************************************************************/
141 IMG_EXPORT
142 PVRSRV_ERROR PVRSRVRGXFlushComputeDataKM(RGX_SERVER_COMPUTE_CONTEXT *psComputeContext);
143
144 PVRSRV_ERROR PVRSRVRGXSetComputeContextPriorityKM(CONNECTION_DATA *psConnection,
145                                                                                                   RGX_SERVER_COMPUTE_CONTEXT *psComputeContext,
146                                                                                                   IMG_UINT32 ui32Priority);
147
148 /* Debug - check if compute context is waiting on a fence */
149 IMG_VOID CheckForStalledComputeCtxt(PVRSRV_RGXDEV_INFO *psDevInfo,
150                                                                         DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf);
151
152 /* Debug/Watchdog - check if client compute contexts are stalled */
153 IMG_BOOL CheckForStalledClientComputeCtxt(PVRSRV_RGXDEV_INFO *psDevInfo);
154
155 /*!
156 *******************************************************************************
157  @Function      PVRSRVRGXKickSyncCDMKM
158
159  @Description
160         Sending a sync kick command though this CDM context
161
162  @Return   PVRSRV_ERROR
163 ******************************************************************************/
164 IMG_EXPORT PVRSRV_ERROR 
165 PVRSRVRGXKickSyncCDMKM(RGX_SERVER_COMPUTE_CONTEXT  *psComputeContext,
166                        IMG_UINT32                  ui32ClientFenceCount,
167                        SYNC_PRIMITIVE_BLOCK          **pauiClientFenceUFOSyncPrimBlock,
168                        IMG_UINT32                  *paui32ClientFenceSyncOffset,
169                        IMG_UINT32                  *paui32ClientFenceValue,
170                        IMG_UINT32                  ui32ClientUpdateCount,
171                        SYNC_PRIMITIVE_BLOCK           **pauiClientUpdateUFOSyncPrimBlock,
172                        IMG_UINT32                  *paui32ClientUpdateSyncOffset,
173                        IMG_UINT32                  *paui32ClientUpdateValue,
174                        IMG_UINT32                  ui32ServerSyncPrims,
175                        IMG_UINT32                  *paui32ServerSyncFlags,
176                        SERVER_SYNC_PRIMITIVE       **pasServerSyncs,
177                                            IMG_UINT32                              ui32NumFenceFDs,
178                                            IMG_INT32                               *paui32FenceFDs,
179                        IMG_BOOL                    bPDumpContinuous);
180
181 #endif /* __RGXCOMPUTE_H__ */