bd352d1eb021deea9682b83c413fdeb0636536d8
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue / 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
70 */
71 IMG_EXPORT
72 PVRSRV_ERROR PVRSRVRGXCreateTransferContextKM(CONNECTION_DATA                   *psConnection,
73                                                                                    PVRSRV_DEVICE_NODE           *psDeviceNode,
74                                                                                    IMG_UINT32                           ui32Priority,
75                                                                                    IMG_DEV_VIRTADDR                     sMCUFenceAddr,
76                                                                                    IMG_UINT32                           ui32FrameworkCommandSize,
77                                                                                    IMG_PBYTE                            pabyFrameworkCommand,
78                                                                                    IMG_HANDLE                           hMemCtxPrivData,
79                                                                                    RGX_SERVER_TQ_CONTEXT        **ppsTransferContext);
80
81
82 /*!
83 *******************************************************************************
84
85  @Function      PVRSRVRGXDestroyTransferContextKM
86
87  @Description
88         Server-side implementation of RGXDestroyTransferContext
89
90  @Input psTransferContext - Transfer context
91
92  @Return   PVRSRV_ERROR
93
94 ******************************************************************************/
95 IMG_EXPORT
96 PVRSRV_ERROR PVRSRVRGXDestroyTransferContextKM(RGX_SERVER_TQ_CONTEXT *psTransferContext);
97
98 /*!
99 *******************************************************************************
100
101  @Function      PVRSRVSubmitTransferKM
102
103  @Description
104         Schedules one or more 2D or 3D HW commands on the firmware
105
106
107  @Return   PVRSRV_ERROR
108
109 ******************************************************************************/
110 IMG_EXPORT
111 PVRSRV_ERROR PVRSRVRGXSubmitTransferKM(RGX_SERVER_TQ_CONTEXT    *psTransferContext,
112                                                                         IMG_UINT32                              ui32PrepareCount,
113                                                                         IMG_UINT32                              *paui32ClientFenceCount,
114                                                                         PRGXFWIF_UFO_ADDR               **papauiClientFenceUFOAddress,
115                                                                         IMG_UINT32                              **papaui32ClientFenceValue,
116                                                                         IMG_UINT32                              *paui32ClientUpdateCount,
117                                                                         PRGXFWIF_UFO_ADDR               **papauiClientUpdateUFOAddress,
118                                                                         IMG_UINT32                              **papaui32ClientUpdateValue,
119                                                                         IMG_UINT32                              *paui32ServerSyncCount,
120                                                                         IMG_UINT32                              **papaui32ServerSyncFlags,
121                                                                         SERVER_SYNC_PRIMITIVE   ***papapsServerSyncs,
122                                                                         IMG_UINT32                              ui32NumFenceFDs,
123                                                                         IMG_INT32                               *paui32FenceFDs,
124                                                                         IMG_UINT32                              *paui32FWCommandSize,
125                                                                         IMG_UINT8                               **papaui8FWCommand,
126                                                                         IMG_UINT32                              *pui32TQPrepareFlags,
127                                                                         IMG_UINT32                              ui32ExtJobRef,
128                                                                         IMG_UINT32                              ui32IntJobRef);
129
130 IMG_EXPORT
131 PVRSRV_ERROR PVRSRVRGXSetTransferContextPriorityKM(CONNECTION_DATA *psConnection,
132                                                                                                    RGX_SERVER_TQ_CONTEXT *psTransferContext,
133                                                                                                    IMG_UINT32 ui32Priority);
134
135 /* Debug - check if transfer context is waiting on a fence */
136 IMG_VOID CheckForStalledTransferCtxt(PVRSRV_RGXDEV_INFO *psDevInfo,
137                                                                          DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf);
138
139 /* Debug/Watchdog - check if client transfer contexts are stalled */
140 IMG_BOOL CheckForStalledClientTransferCtxt(PVRSRV_RGXDEV_INFO *psDevInfo);
141
142 PVRSRV_ERROR PVRSRVRGXKickSyncTransferKM(RGX_SERVER_TQ_CONTEXT  *psTransferContext,
143                                                                            IMG_UINT32                           ui32ClientFenceCount,
144                                                                            PRGXFWIF_UFO_ADDR            *pauiClientFenceUFOAddress,
145                                                                            IMG_UINT32                           *paui32ClientFenceValue,
146                                                                            IMG_UINT32                           ui32ClientUpdateCount,
147                                                                            PRGXFWIF_UFO_ADDR            *pauiClientUpdateUFOAddress,
148                                                                            IMG_UINT32                           *paui32ClientUpdateValue,
149                                                                            IMG_UINT32                           ui32ServerSyncCount,
150                                                                            IMG_UINT32                           *pui32ServerSyncFlags,
151                                                                            SERVER_SYNC_PRIMITIVE        **pasServerSyncs,
152                                                                            IMG_UINT32                           ui32NumFenceFDs,
153                                                                            IMG_INT32                            *paui32FenceFDs,
154                                                                            IMG_UINT32                           ui32TQPrepareFlags);
155 #endif /* __RGXTRANSFER_H__ */