1 /**********************************************************************
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
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.
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.
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.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25 ******************************************************************************/
27 #ifndef __PVR_BRIDGE_KM_H_
28 #define __PVR_BRIDGE_KM_H_
30 #include <linux/fs.h> /* for struct file */
32 #include "pvr_bridge.h"
35 extern struct mutex gPVRSRVLock;
37 static inline void pvr_lock(void)
39 mutex_lock(&gPVRSRVLock);
42 static inline void pvr_unlock(void)
44 mutex_unlock(&gPVRSRVLock);
47 static inline void pvr_init_lock(void)
49 mutex_init(&gPVRSRVLock);
52 enum PVRSRV_ERROR LinuxBridgeInit(void);
53 void LinuxBridgeDeInit(void);
55 enum PVRSRV_ERROR PVRSRVEnumerateDevicesKM(u32 *pui32NumDevices,
56 struct PVRSRV_DEVICE_IDENTIFIER *psDevIdList);
58 enum PVRSRV_ERROR PVRSRVAcquireDeviceDataKM(u32 uiDevIndex,
59 enum PVRSRV_DEVICE_TYPE eDeviceType,
62 enum PVRSRV_ERROR PVRSRVCreateCommandQueueKM(u32 ui32QueueSize,
63 struct PVRSRV_QUEUE_INFO **ppsQueueInfo);
65 enum PVRSRV_ERROR PVRSRVDestroyCommandQueueKM(
66 struct PVRSRV_QUEUE_INFO *psQueueInfo);
68 enum PVRSRV_ERROR PVRSRVGetDeviceMemHeapsKM(void *hDevCookie,
69 struct PVRSRV_HEAP_INFO *psHeapInfo);
71 enum PVRSRV_ERROR PVRSRVCreateDeviceMemContextKM(void *hDevCookie,
72 struct PVRSRV_PER_PROCESS_DATA *psPerProc,
73 void **phDevMemContext, u32 *pui32ClientHeapCount,
74 struct PVRSRV_HEAP_INFO *psHeapInfo, IMG_BOOL *pbCreated,
77 enum PVRSRV_ERROR PVRSRVDestroyDeviceMemContextKM(void *hDevCookie,
78 void *hDevMemContext, IMG_BOOL *pbCreated);
80 enum PVRSRV_ERROR PVRSRVGetDeviceMemHeapInfoKM(void *hDevCookie,
81 void *hDevMemContext, u32 *pui32ClientHeapCount,
82 struct PVRSRV_HEAP_INFO *psHeapInfo, IMG_BOOL *pbShared);
84 enum PVRSRV_ERROR PVRSRVAllocDeviceMemKM(void *hDevCookie,
85 struct PVRSRV_PER_PROCESS_DATA *psPerProc, void *hDevMemHeap,
86 u32 ui32Flags, u32 ui32Size, u32 ui32Alignment,
87 struct PVRSRV_KERNEL_MEM_INFO **ppsMemInfo);
89 enum PVRSRV_ERROR PVRSRVFreeDeviceMemKM(void *hDevCookie,
90 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo);
92 enum PVRSRV_ERROR PVRSRVDissociateDeviceMemKM(void *hDevCookie,
93 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo);
95 enum PVRSRV_ERROR PVRSRVReserveDeviceVirtualMemKM(void *hDevMemHeap,
96 struct IMG_DEV_VIRTADDR *psDevVAddr, u32 ui32Size,
97 u32 ui32Alignment, struct PVRSRV_KERNEL_MEM_INFO **ppsMemInfo);
99 enum PVRSRV_ERROR PVRSRVFreeDeviceVirtualMemKM(
100 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo);
102 enum PVRSRV_ERROR PVRSRVMapDeviceMemoryKM(
103 struct PVRSRV_PER_PROCESS_DATA *psPerProc,
104 struct PVRSRV_KERNEL_MEM_INFO *psSrcMemInfo,
105 void *hDstDevMemHeap,
106 struct PVRSRV_KERNEL_MEM_INFO **ppsDstMemInfo);
108 enum PVRSRV_ERROR PVRSRVUnmapDeviceMemoryKM(
109 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo);
111 enum PVRSRV_ERROR PVRSRVWrapExtMemoryKM(void *hDevCookie,
112 struct PVRSRV_PER_PROCESS_DATA *psPerProc, void *hDevMemContext,
113 u32 ui32ByteSize, u32 ui32PageOffset, IMG_BOOL bPhysContig,
114 struct IMG_SYS_PHYADDR *psSysAddr, void *pvLinAddr,
115 struct PVRSRV_KERNEL_MEM_INFO **ppsMemInfo);
117 enum PVRSRV_ERROR PVRSRVUnwrapExtMemoryKM(struct PVRSRV_KERNEL_MEM_INFO
120 enum PVRSRV_ERROR PVRSRVEnumerateDCKM(enum PVRSRV_DEVICE_CLASS DeviceClass,
121 u32 *pui32DevCount, u32 *pui32DevID);
123 enum PVRSRV_ERROR PVRSRVOpenDCDeviceKM(
124 struct PVRSRV_PER_PROCESS_DATA *psPerProc,
125 u32 ui32DeviceID, void *hDevCookie, void **phDeviceKM);
127 enum PVRSRV_ERROR PVRSRVCloseDCDeviceKM(void *hDeviceKM,
128 IMG_BOOL bResManCallback);
130 enum PVRSRV_ERROR PVRSRVEnumDCFormatsKM(void *hDeviceKM, u32 *pui32Count,
131 struct DISPLAY_FORMAT *psFormat);
133 enum PVRSRV_ERROR PVRSRVEnumDCDimsKM(void *hDeviceKM,
134 struct DISPLAY_FORMAT *psFormat, u32 *pui32Count,
135 struct DISPLAY_DIMS *psDim);
137 enum PVRSRV_ERROR PVRSRVGetDCSystemBufferKM(void *hDeviceKM, void **phBuffer);
139 enum PVRSRV_ERROR PVRSRVGetDCInfoKM(void *hDeviceKM,
140 struct DISPLAY_INFO *psDisplayInfo);
142 enum PVRSRV_ERROR PVRSRVCreateDCSwapChainKM(
143 struct PVRSRV_PER_PROCESS_DATA *psPerProc, void *hDeviceKM,
144 u32 ui32Flags, struct DISPLAY_SURF_ATTRIBUTES *psDstSurfAttrib,
145 struct DISPLAY_SURF_ATTRIBUTES *psSrcSurfAttrib,
146 u32 ui32BufferCount, u32 ui32OEMFlags, void **phSwapChain,
147 u32 *pui32SwapChainID);
149 enum PVRSRV_ERROR PVRSRVDestroyDCSwapChainKM(void *hSwapChain);
150 enum PVRSRV_ERROR PVRSRVSetDCDstRectKM(void *hDeviceKM, void *hSwapChain,
151 struct IMG_RECT *psRect);
152 enum PVRSRV_ERROR PVRSRVSetDCSrcRectKM(void *hDeviceKM, void *hSwapChain,
153 struct IMG_RECT *psRect);
154 enum PVRSRV_ERROR PVRSRVSetDCDstColourKeyKM(void *hDeviceKM, void *hSwapChain,
156 enum PVRSRV_ERROR PVRSRVSetDCSrcColourKeyKM(void *hDeviceKM, void *hSwapChain,
158 enum PVRSRV_ERROR PVRSRVGetDCBuffersKM(void *hDeviceKM, void *hSwapChain,
159 u32 *pui32BufferCount, void **phBuffer);
160 enum PVRSRV_ERROR PVRSRVSwapToDCBufferKM(void *hDeviceKM, void *hBuffer,
161 u32 ui32SwapInterval, void *hPrivateTag,
162 u32 ui32ClipRectCount, struct IMG_RECT *psClipRect);
163 enum PVRSRV_ERROR PVRSRVSwapToDCSystemKM(void *hDeviceKM, void *hSwapChain);
165 enum PVRSRV_ERROR PVRSRVOpenBCDeviceKM(
166 struct PVRSRV_PER_PROCESS_DATA *psPerProc,
167 u32 ui32DeviceID, void *hDevCookie, void **phDeviceKM);
168 enum PVRSRV_ERROR PVRSRVCloseBCDeviceKM(void *hDeviceKM,
169 IMG_BOOL bResManCallback);
171 enum PVRSRV_ERROR PVRSRVGetBCInfoKM(void *hDeviceKM,
172 struct BUFFER_INFO *psBufferInfo);
173 enum PVRSRV_ERROR PVRSRVGetBCBufferKM(void *hDeviceKM,
174 u32 ui32BufferIndex, void **phBuffer);
176 enum PVRSRV_ERROR PVRSRVMapDeviceClassMemoryKM(
177 struct PVRSRV_PER_PROCESS_DATA *psPerProc, void *hDevMemContext,
178 void *hDeviceClassBuffer,
179 struct PVRSRV_KERNEL_MEM_INFO **ppsMemInfo, void **phOSMapInfo);
181 enum PVRSRV_ERROR PVRSRVUnmapDeviceClassMemoryKM(
182 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo);
184 enum PVRSRV_ERROR PVRSRVGetFreeDeviceMemKM(u32 ui32Flags, u32 *pui32Total,
185 u32 *pui32Free, u32 *pui32LargestBlock);
186 enum PVRSRV_ERROR PVRSRVAllocSyncInfoKM(void *hDevCookie, void *hDevMemContext,
187 struct PVRSRV_KERNEL_SYNC_INFO **ppsKernelSyncInfo);
188 enum PVRSRV_ERROR PVRSRVFreeSyncInfoKM(
189 struct PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo);
191 enum PVRSRV_ERROR PVRSRVGetMiscInfoKM(struct PVRSRV_MISC_INFO *psMiscInfo);
193 enum PVRSRV_ERROR PVRSRVGetFBStatsKM(u32 *pui32Total, u32 *pui32Available);
195 enum PVRSRV_ERROR PVRSRVAllocSharedSysMemoryKM(
196 struct PVRSRV_PER_PROCESS_DATA *psPerProc, u32 ui32Flags,
197 u32 ui32Size, struct PVRSRV_KERNEL_MEM_INFO **ppsKernelMemInfo);
199 enum PVRSRV_ERROR PVRSRVFreeSharedSysMemoryKM(
200 struct PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo);
202 enum PVRSRV_ERROR PVRSRVDissociateMemFromResmanKM(
203 struct PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo);
205 long PVRSRV_BridgeDispatchKM(struct file *, unsigned, unsigned long);