fixes for bc_cat
[sgx.git] / pvr / resman.h
1 /**********************************************************************
2  *
3  * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful but, except
10  * as otherwise stated in writing, without any warranty; without even the
11  * implied warranty of merchantability or fitness for a particular purpose.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * The full GNU General Public License is included in this distribution in
19  * the file called "COPYING".
20  *
21  * Contact Information:
22  * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23  * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
24  *
25  ******************************************************************************/
26
27 #ifndef __RESMAN_H__
28 #define __RESMAN_H__
29
30 enum {
31         RESMAN_TYPE_SHARED_PB_DESC = 1,
32         RESMAN_TYPE_SHARED_PB_DESC_CREATE_LOCK,
33         RESMAN_TYPE_HW_RENDER_CONTEXT,
34         RESMAN_TYPE_HW_TRANSFER_CONTEXT,
35         RESMAN_TYPE_HW_2D_CONTEXT,
36         RESMAN_TYPE_TRANSFER_CONTEXT,
37
38         RESMAN_TYPE_DISPLAYCLASS_SWAPCHAIN,
39         RESMAN_TYPE_DISPLAYCLASS_DEVICE,
40
41         RESMAN_TYPE_BUFFERCLASS_DEVICE,
42
43         RESMAN_TYPE_OS_USERMODE_MAPPING,
44
45         RESMAN_TYPE_DEVICEMEM_CONTEXT,
46         RESMAN_TYPE_DEVICECLASSMEM_MAPPING,
47         RESMAN_TYPE_DEVICEMEM_MAPPING,
48         RESMAN_TYPE_DEVICEMEM_WRAP,
49         RESMAN_TYPE_DEVICEMEM_ALLOCATION,
50         RESMAN_TYPE_EVENT_OBJECT,
51         RESMAN_TYPE_SHARED_MEM_INFO,
52
53         RESMAN_TYPE_KERNEL_DEVICEMEM_ALLOCATION
54 };
55
56 #define RESMAN_CRITERIA_ALL                             0x00000000
57 #define RESMAN_CRITERIA_RESTYPE                         0x00000001
58 #define RESMAN_CRITERIA_PVOID_PARAM                     0x00000002
59 #define RESMAN_CRITERIA_UI32_PARAM                      0x00000004
60
61 struct RESMAN_ITEM;
62 struct RESMAN_CONTEXT;
63
64 enum PVRSRV_ERROR ResManInit(void);
65 void ResManDeInit(void);
66
67 struct RESMAN_ITEM *ResManRegisterRes(struct RESMAN_CONTEXT *hResManContext,
68                                       u32 ui32ResType, void *pvParam,
69                                       u32 ui32Param,
70                                       enum PVRSRV_ERROR (*pfnFreeResource)
71                                                 (void *pvParam, u32 ui32Param));
72
73 void ResManFreeResByPtr(struct RESMAN_ITEM *psResItem);
74
75 void ResManFreeResByCriteria(struct RESMAN_CONTEXT *hResManContext,
76                 u32 ui32SearchCriteria, u32 ui32ResType, void *pvParam,
77                 u32 ui32Param);
78
79 enum PVRSRV_ERROR ResManDissociateRes(struct RESMAN_ITEM *psResItem,
80                                       struct RESMAN_CONTEXT
81                                       *psNewResManContext);
82
83 enum PVRSRV_ERROR ResManFindResourceByPtr(struct RESMAN_CONTEXT *hResManContext,
84                 struct RESMAN_ITEM *psItem);
85
86 struct RESMAN_CONTEXT *pvr_get_resman_ctx(void *resource);
87 struct PVRSRV_PER_PROCESS_DATA *pvr_get_proc_by_ctx(struct RESMAN_CONTEXT *ctx);
88
89 enum PVRSRV_ERROR PVRSRVResManConnect(void *hPerProc,
90                 struct RESMAN_CONTEXT **phResManContext);
91
92 void PVRSRVResManDisconnect(struct RESMAN_CONTEXT *hResManContext,
93                 IMG_BOOL bKernelContext);
94
95 #endif