]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/device-ti-proprietary-open.git/blob - omap5/sgx_src/eurasia_km/services4/srvkm/include/resman.h
jacinto6: sgx: add memtrack library
[android-sdk/device-ti-proprietary-open.git] / omap5 / sgx_src / eurasia_km / services4 / srvkm / include / resman.h
1 /*************************************************************************/ /*!
2 @Title          Resource Manager API
3 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @Description    Provide resource management
5 @License        Dual MIT/GPLv2
7 The contents of this file are subject to the MIT license as set out below.
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
19 Alternatively, the contents of this file may be used under the terms of
20 the GNU General Public License Version 2 ("GPL") in which case the provisions
21 of GPL are applicable instead of those above.
23 If you wish to allow use of your version of this file only under the terms of
24 GPL, and not to allow others to use your version of this file under the terms
25 of the MIT license, indicate your decision by deleting the provisions above
26 and replace them with the notice and other provisions required by GPL as set
27 out in the file called "GPL-COPYING" included in this distribution. If you do
28 not delete the provisions above, a recipient may use your version of this file
29 under the terms of either the MIT license or GPL.
31 This License is also included in this distribution in the file called
32 "MIT-COPYING".
34 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
35 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
36 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
38 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 */ /**************************************************************************/
43 #ifndef __RESMAN_H__
44 #define __RESMAN_H__
46 #if defined (__cplusplus)
47 extern "C" {
48 #endif
50 /******************************************************************************
51  * resman definitions 
52  *****************************************************************************/
54 enum {
55         /* SGX: */
56         RESMAN_TYPE_SHARED_PB_DESC = 1,                                 /*!< Parameter buffer kernel stubs */
57         RESMAN_TYPE_SHARED_PB_DESC_CREATE_LOCK,                         /*!< Shared parameter buffer creation lock */
58         RESMAN_TYPE_HW_RENDER_CONTEXT,                                  /*!< Hardware Render Context Resource */
59         RESMAN_TYPE_HW_TRANSFER_CONTEXT,                                /*!< Hardware transfer Context Resource */
60         RESMAN_TYPE_HW_2D_CONTEXT,                                              /*!< Hardware 2D Context Resource */
61         RESMAN_TYPE_TRANSFER_CONTEXT,                                   /*!< Transfer Queue context */
63         /* VGX: */
64         RESMAN_TYPE_DMA_CLIENT_FIFO_DATA,                               /*!< VGX DMA Client FIFO data */
66         /* DISPLAY CLASS: */
67         RESMAN_TYPE_DISPLAYCLASS_SWAPCHAIN_REF,                 /*!< Display Class Swapchain Reference Resource */
68         RESMAN_TYPE_DISPLAYCLASS_DEVICE,                                /*!< Display Class Device Resource */
70         /* BUFFER CLASS: */
71         RESMAN_TYPE_BUFFERCLASS_DEVICE,                                 /*!< Buffer Class Device Resource */
72         
73         /* OS specific User mode Mappings: */
74         RESMAN_TYPE_OS_USERMODE_MAPPING,                                /*!< OS specific User mode mappings */
75         
76         /* COMMON: */
77         RESMAN_TYPE_DEVICEMEM_CONTEXT,                                  /*!< Device Memory Context Resource */
78         RESMAN_TYPE_DEVICECLASSMEM_MAPPING,                             /*!< Device Memory Mapping Resource */
79         RESMAN_TYPE_DEVICEMEM_MAPPING,                                  /*!< Device Memory Mapping Resource */
80         RESMAN_TYPE_DEVICEMEM_WRAP,                                             /*!< Device Memory Wrap Resource */
81         RESMAN_TYPE_DEVICEMEM_ALLOCATION,                               /*!< Device Memory Allocation Resource */
82         RESMAN_TYPE_DEVICEMEM_ION,                                              /*!< Device Memory Ion Resource */
83         RESMAN_TYPE_EVENT_OBJECT,                                               /*!< Event Object */
84     RESMAN_TYPE_SHARED_MEM_INFO,                    /*!< Shared system memory meminfo */
85     RESMAN_TYPE_MODIFY_SYNC_OPS,                                        /*!< Syncobject synchronisation Resource*/
86     RESMAN_TYPE_SYNC_INFO,                                              /*!< Syncobject Resource*/
87         
88         /* KERNEL: */
89         RESMAN_TYPE_KERNEL_DEVICEMEM_ALLOCATION                 /*!< Device Memory Allocation Resource */
90 };
92 #define RESMAN_CRITERIA_ALL                             0x00000000      /*!< match by criteria all */
93 #define RESMAN_CRITERIA_RESTYPE                 0x00000001      /*!< match by criteria type */
94 #define RESMAN_CRITERIA_PVOID_PARAM             0x00000002      /*!< match by criteria param1 */
95 #define RESMAN_CRITERIA_UI32_PARAM              0x00000004      /*!< match by criteria param2 */
97 typedef PVRSRV_ERROR (*RESMAN_FREE_FN)(IMG_PVOID pvParam, IMG_UINT32 ui32Param, IMG_BOOL bForceCleanup); 
99 typedef struct _RESMAN_ITEM_ *PRESMAN_ITEM;
100 typedef struct _RESMAN_CONTEXT_ *PRESMAN_CONTEXT;
102 /******************************************************************************
103  * resman functions 
104  *****************************************************************************/
106 /*
107         Note:
108         Resource cleanup can fail with retry in which case we don't remove
109         it from resman's list and either UM or KM will try to release the
110         resource at a later date (and will keep trying until a non-retry
111         error is returned)
112 */
114 PVRSRV_ERROR ResManInit(IMG_VOID);
115 IMG_VOID ResManDeInit(IMG_VOID);
117 PRESMAN_ITEM ResManRegisterRes(PRESMAN_CONTEXT  hResManContext,
118                                                            IMG_UINT32           ui32ResType, 
119                                                            IMG_PVOID            pvParam, 
120                                                            IMG_UINT32           ui32Param, 
121                                                            RESMAN_FREE_FN       pfnFreeResource);
123 PVRSRV_ERROR ResManFreeResByPtr(PRESMAN_ITEM    psResItem,
124                                                                 IMG_BOOL                bForceCleanup);
126 PVRSRV_ERROR ResManFreeResByCriteria(PRESMAN_CONTEXT    hResManContext,
127                                                                          IMG_UINT32                     ui32SearchCriteria, 
128                                                                          IMG_UINT32                     ui32ResType, 
129                                                                          IMG_PVOID                      pvParam, 
130                                                                          IMG_UINT32                     ui32Param);
132 PVRSRV_ERROR ResManDissociateRes(PRESMAN_ITEM           psResItem,
133                                                          PRESMAN_CONTEXT        psNewResManContext);
135 PVRSRV_ERROR ResManFindResourceByPtr(PRESMAN_CONTEXT    hResManContext,
136                                                                          PRESMAN_ITEM           psItem);
138 PVRSRV_ERROR PVRSRVResManConnect(IMG_HANDLE                     hPerProc,
139                                                                  PRESMAN_CONTEXT        *phResManContext);
140 IMG_VOID PVRSRVResManDisconnect(PRESMAN_CONTEXT hResManContext,
141                                                                 IMG_BOOL                bKernelContext);
143 #if defined (__cplusplus)
145 #endif
147 #endif /* __RESMAN_H__ */
149 /******************************************************************************
150  End of file (resman.h)
151 ******************************************************************************/