RK3368 GPU version Rogue M 1.28
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / services / server / include / connection_server.h
1 /**************************************************************************/ /*!
2 @File
3 @Title          Server side connection management
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    API for server side connection management
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(_CONNECTION_SERVER_H_)
45 #define _CONNECTION_SERVER_H_
46
47
48 #include "img_types.h"
49 #include "handle.h"
50 #include "pvrsrv_cleanup.h"
51
52 /* Variable used to hold in memory the timeout for the current time slice*/
53 extern IMG_UINT64 gui64TimesliceLimit;
54 /* Counter number of handle data freed during the current time slice */
55 extern IMG_UINT32 gui32HandleDataFreeCounter;
56 /* Set the maximum time the freeing of the resources can keep the lock */
57 #define CONNECTION_DEFERRED_CLEANUP_TIMESLICE_NS 3000 * 1000 /* 3ms */
58
59 typedef struct _CONNECTION_DATA_
60 {
61         PVRSRV_HANDLE_BASE              *psHandleBase;
62         struct _SYNC_CONNECTION_DATA_   *psSyncConnectionData;
63         struct _PDUMP_CONNECTION_DATA_  *psPDumpConnectionData;
64
65         /* Holds the client flags supplied at connection time */
66         IMG_UINT32                      ui32ClientFlags;
67
68         /*
69          * OS specific data can be stored via this handle.
70          * See osconnection_server.h for a generic mechanism
71          * for initialising this field.
72          */
73         IMG_HANDLE                      hOsPrivateData;
74
75         IMG_PID                         pid;
76
77         IMG_PVOID                       hSecureData;
78
79         IMG_HANDLE                      hProcessStats;
80
81         /* Structure which is hooked into the cleanup thread work list */
82         PVRSRV_CLEANUP_THREAD_WORK sCleanupThreadFn;
83
84         /* List navigation for deferred freeing of connection data */
85         struct _CONNECTION_DATA_        **ppsThis;
86         struct _CONNECTION_DATA_        *psNext;
87 } CONNECTION_DATA;
88
89 PVRSRV_ERROR PVRSRVConnectionConnect(IMG_PVOID *ppvPrivData, IMG_PVOID pvOSData);
90 void PVRSRVConnectionDisconnect(IMG_PVOID pvPrivData);
91
92 PVRSRV_ERROR PVRSRVConnectionInit(void);
93 PVRSRV_ERROR PVRSRVConnectionDeInit(void);
94
95 IMG_PID PVRSRVGetPurgeConnectionPid(void);
96
97 #ifdef INLINE_IS_PRAGMA
98 #pragma inline(PVRSRVConnectionPrivateData)
99 #endif
100 static INLINE
101 IMG_HANDLE PVRSRVConnectionPrivateData(CONNECTION_DATA *psConnection)
102 {
103         return (psConnection != IMG_NULL) ? psConnection->hOsPrivateData : IMG_NULL;
104 }
105
106
107 #endif /* !defined(_CONNECTION_SERVER_H_) */