1 /*************************************************************************/ /*!
3 @Title RGX Circular Command Buffer functionality.
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Header for the RGX Circular Command Buffer functionality.
6 @License Dual MIT/GPLv2
8 The contents of this file are subject to the MIT license as set out below.
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:
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
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.
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.
32 This License is also included in this distribution in the file called
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 */ /**************************************************************************/
44 #if !defined(__RGXCCB_H__)
47 #include "devicemem.h"
49 #include "rgxdevice.h"
50 #include "sync_server.h"
51 #include "connection_server.h"
52 #include "rgx_fwif_shared.h"
55 #define MAX_CLIENT_CCB_NAME 30
57 typedef struct _RGX_CLIENT_CCB_ RGX_CLIENT_CCB;
60 This structure is declared here as it's allocated on the heap by
64 typedef struct _RGX_CCB_CMD_HELPER_DATA_ {
65 /* Data setup at command init time */
66 RGX_CLIENT_CCB *psClientCCB;
67 IMG_CHAR *pszCommandName;
68 IMG_BOOL bPDumpContinuous;
70 IMG_UINT32 ui32ClientFenceCount;
71 PRGXFWIF_UFO_ADDR *pauiFenceUFOAddress;
72 IMG_UINT32 *paui32FenceValue;
73 IMG_UINT32 ui32ClientUpdateCount;
74 PRGXFWIF_UFO_ADDR *pauiUpdateUFOAddress;
75 IMG_UINT32 *paui32UpdateValue;
77 IMG_UINT32 ui32ServerSyncCount;
78 IMG_UINT32 *paui32ServerSyncFlags;
79 SERVER_SYNC_PRIMITIVE **papsServerSyncs;
81 RGXFWIF_CCB_CMD_TYPE eType;
82 IMG_UINT32 ui32CmdSize;
84 IMG_UINT32 ui32FenceCmdSize;
85 IMG_UINT32 ui32DMCmdSize;
86 IMG_UINT32 ui32UpdateCmdSize;
87 IMG_UINT32 ui32UnfencedUpdateCmdSize;
89 /* timestamp commands */
90 RGXFWIF_DEV_VIRTADDR pPreTimestamp;
91 IMG_UINT32 ui32PreTimeStampCmdSize;
92 RGXFWIF_DEV_VIRTADDR pPostTimestamp;
93 IMG_UINT32 ui32PostTimeStampCmdSize;
94 PRGXFWIF_UFO_ADDR pRMWUFOAddr;
95 IMG_UINT32 ui32RMWUFOCmdSize;
97 /* Data setup at command acquire time */
98 IMG_UINT8 *pui8StartPtr;
99 IMG_UINT8 *pui8ServerUpdateStart;
100 IMG_UINT8 *pui8ServerUnfencedUpdateStart;
101 IMG_UINT8 *pui8ServerFenceStart;
102 IMG_UINT32 ui32ServerFenceCount;
103 IMG_UINT32 ui32ServerUpdateCount;
104 IMG_UINT32 ui32ServerUnfencedUpdateCount;
106 } RGX_CCB_CMD_HELPER_DATA;
108 #define PADDING_COMMAND_SIZE (sizeof(RGXFWIF_CCB_CMD_HEADER))
110 PVRSRV_ERROR RGXCreateCCB(PVRSRV_DEVICE_NODE *psDeviceNode,
111 IMG_UINT32 ui32CCBSizeLog2,
112 CONNECTION_DATA *psConnectionData,
113 const IMG_CHAR *pszName,
114 RGX_SERVER_COMMON_CONTEXT *psServerCommonContext,
115 RGX_CLIENT_CCB **ppsClientCCB,
116 DEVMEM_MEMDESC **ppsClientCCBMemDesc,
117 DEVMEM_MEMDESC **ppsClientCCBCtlMemDesc);
119 IMG_VOID RGXDestroyCCB(RGX_CLIENT_CCB *psClientCCB);
121 PVRSRV_ERROR RGXAcquireCCB(RGX_CLIENT_CCB *psClientCCB,
122 IMG_UINT32 ui32CmdSize,
123 IMG_PVOID *ppvBufferSpace,
124 IMG_BOOL bPDumpContinuous);
126 IMG_INTERNAL IMG_VOID RGXReleaseCCB(RGX_CLIENT_CCB *psClientCCB,
127 IMG_UINT32 ui32CmdSize,
128 IMG_BOOL bPDumpContinuous);
130 IMG_UINT32 RGXGetHostWriteOffsetCCB(RGX_CLIENT_CCB *psClientCCB);
132 PVRSRV_ERROR RGXCmdHelperInitCmdCCB(RGX_CLIENT_CCB *psClientCCB,
133 IMG_UINT32 ui32ClientFenceCount,
134 PRGXFWIF_UFO_ADDR *pauiFenceUFOAddress,
135 IMG_UINT32 *paui32FenceValue,
136 IMG_UINT32 ui32ClientUpdateCount,
137 PRGXFWIF_UFO_ADDR *pauiUpdateUFOAddress,
138 IMG_UINT32 *paui32UpdateValue,
139 IMG_UINT32 ui32ServerSyncCount,
140 IMG_UINT32 *paui32ServerSyncFlags,
141 SERVER_SYNC_PRIMITIVE **pasServerSyncs,
142 IMG_UINT32 ui32CmdSize,
143 IMG_UINT8 *pui8DMCmd,
144 RGXFWIF_DEV_VIRTADDR *ppPreTimestamp,
145 RGXFWIF_DEV_VIRTADDR *ppPostTimestamp,
146 RGXFWIF_DEV_VIRTADDR *ppRMWUFOAddr,
147 RGXFWIF_CCB_CMD_TYPE eType,
148 IMG_BOOL bPDumpContinuous,
149 IMG_CHAR *pszCommandName,
150 RGX_CCB_CMD_HELPER_DATA *psCmdHelperData);
152 PVRSRV_ERROR RGXCmdHelperAcquireCmdCCB(IMG_UINT32 ui32CmdCount,
153 RGX_CCB_CMD_HELPER_DATA *asCmdHelperData,
154 IMG_BOOL *pbKickRequired);
156 IMG_VOID RGXCmdHelperReleaseCmdCCB(IMG_UINT32 ui32CmdCount,
157 RGX_CCB_CMD_HELPER_DATA *asCmdHelperData,
158 const IMG_CHAR *pcszDMName,
159 IMG_UINT32 ui32CtxAddr);
161 IMG_UINT32 RGXCmdHelperGetCommandSize(IMG_UINT32 ui32CmdCount,
162 RGX_CCB_CMD_HELPER_DATA *asCmdHelperData);
164 IMG_VOID DumpStalledCCBCommand(PRGXFWIF_FWCOMMONCONTEXT sFWCommonContext, RGX_CLIENT_CCB *psCurrentClientCCB, DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf);
165 #if defined(PVRSRV_ENABLE_FULL_SYNC_TRACKING) || defined(PVRSRV_ENABLE_FULL_CCB_DUMP)
166 IMG_VOID DumpCCB(PRGXFWIF_FWCOMMONCONTEXT sFWCommonContext, RGX_CLIENT_CCB *psCurrentClientCCB, DUMPDEBUG_PRINTF_FUNC *pfnDumpDebugPrintf);
169 PVRSRV_ERROR CheckForStalledCCB(RGX_CLIENT_CCB *psCurrentClientCCB);
170 #endif /* __RGXCCB_H__ */