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"
36 void pvr_unlock(void);
37 int pvr_is_locked(void);
38 void pvr_init_lock(void);
39 void pvr_dvfs_lock(void);
40 void pvr_dvfs_unlock(void);
42 enum PVRSRV_ERROR LinuxBridgeInit(void);
43 void LinuxBridgeDeInit(void);
45 enum PVRSRV_ERROR PVRSRVEnumerateDevicesKM(u32 *pui32NumDevices,
46 struct PVRSRV_DEVICE_IDENTIFIER *psDevIdList);
48 enum PVRSRV_ERROR PVRSRVAcquireDeviceDataKM(u32 uiDevIndex,
49 enum PVRSRV_DEVICE_TYPE eDeviceType,
52 enum PVRSRV_ERROR PVRSRVCreateCommandQueueKM(u32 ui32QueueSize,
53 struct PVRSRV_QUEUE_INFO **ppsQueueInfo);
55 enum PVRSRV_ERROR PVRSRVDestroyCommandQueueKM(
56 struct PVRSRV_QUEUE_INFO *psQueueInfo);
58 enum PVRSRV_ERROR PVRSRVGetDeviceMemHeapsKM(void *hDevCookie,
59 struct PVRSRV_HEAP_INFO *psHeapInfo);
61 enum PVRSRV_ERROR PVRSRVCreateDeviceMemContextKM(void *hDevCookie,
62 struct PVRSRV_PER_PROCESS_DATA *psPerProc,
63 void **phDevMemContext, u32 *pui32ClientHeapCount,
64 struct PVRSRV_HEAP_INFO *psHeapInfo, IMG_BOOL *pbCreated,
67 enum PVRSRV_ERROR PVRSRVDestroyDeviceMemContextKM(void *hDevCookie,
68 void *hDevMemContext, IMG_BOOL *pbCreated);
70 enum PVRSRV_ERROR PVRSRVGetDeviceMemHeapInfoKM(void *hDevCookie,
71 void *hDevMemContext, u32 *pui32ClientHeapCount,
72 struct PVRSRV_HEAP_INFO *psHeapInfo, IMG_BOOL *pbShared);
74 enum PVRSRV_ERROR PVRSRVAllocDeviceMemKM(void *hDevCookie,
75 struct PVRSRV_PER_PROCESS_DATA *psPerProc, void *hDevMemHeap,
76 u32 ui32Flags, u32 ui32Size, u32 ui32Alignment,
77 struct PVRSRV_KERNEL_MEM_INFO **ppsMemInfo);
79 enum PVRSRV_ERROR PVRSRVFreeDeviceMemKM(void *hDevCookie,
80 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo);
82 enum PVRSRV_ERROR PVRSRVDissociateDeviceMemKM(void *hDevCookie,
83 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo);
85 enum PVRSRV_ERROR PVRSRVReserveDeviceVirtualMemKM(void *hDevMemHeap,
86 struct IMG_DEV_VIRTADDR *psDevVAddr, u32 ui32Size,
87 u32 ui32Alignment, struct PVRSRV_KERNEL_MEM_INFO **ppsMemInfo);
89 enum PVRSRV_ERROR PVRSRVFreeDeviceVirtualMemKM(
90 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo);
92 enum PVRSRV_ERROR PVRSRVMapDeviceMemoryKM(
93 struct PVRSRV_PER_PROCESS_DATA *psPerProc,
94 struct PVRSRV_KERNEL_MEM_INFO *psSrcMemInfo,
96 struct PVRSRV_KERNEL_MEM_INFO **ppsDstMemInfo);
98 enum PVRSRV_ERROR PVRSRVUnmapDeviceMemoryKM(
99 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo);
101 enum PVRSRV_ERROR PVRSRVWrapExtMemoryKM(void *hDevCookie,
102 struct PVRSRV_PER_PROCESS_DATA *psPerProc, void *hDevMemContext,
103 u32 ui32ByteSize, u32 ui32PageOffset, IMG_BOOL bPhysContig,
104 struct IMG_SYS_PHYADDR *psSysAddr, void *pvLinAddr,
105 struct PVRSRV_KERNEL_MEM_INFO **ppsMemInfo);
107 enum PVRSRV_ERROR PVRSRVUnwrapExtMemoryKM(struct PVRSRV_KERNEL_MEM_INFO
110 enum PVRSRV_ERROR PVRSRVEnumerateDCKM(enum PVRSRV_DEVICE_CLASS DeviceClass,
111 u32 *pui32DevCount, u32 *pui32DevID);
113 enum PVRSRV_ERROR PVRSRVOpenDCDeviceKM(
114 struct PVRSRV_PER_PROCESS_DATA *psPerProc,
115 u32 ui32DeviceID, void *hDevCookie, void **phDeviceKM);
117 enum PVRSRV_ERROR PVRSRVCloseDCDeviceKM(void *hDeviceKM,
118 IMG_BOOL bResManCallback);
120 enum PVRSRV_ERROR PVRSRVEnumDCFormatsKM(void *hDeviceKM, u32 *pui32Count,
121 struct DISPLAY_FORMAT *psFormat);
123 enum PVRSRV_ERROR PVRSRVEnumDCDimsKM(void *hDeviceKM,
124 struct DISPLAY_FORMAT *psFormat, u32 *pui32Count,
125 struct DISPLAY_DIMS *psDim);
127 enum PVRSRV_ERROR PVRSRVGetDCSystemBufferKM(void *hDeviceKM, void **phBuffer);
129 enum PVRSRV_ERROR PVRSRVGetDCInfoKM(void *hDeviceKM,
130 struct DISPLAY_INFO *psDisplayInfo);
132 enum PVRSRV_ERROR PVRSRVCreateDCSwapChainKM(
133 struct PVRSRV_PER_PROCESS_DATA *psPerProc, void *hDeviceKM,
134 u32 ui32Flags, struct DISPLAY_SURF_ATTRIBUTES *psDstSurfAttrib,
135 struct DISPLAY_SURF_ATTRIBUTES *psSrcSurfAttrib,
136 u32 ui32BufferCount, u32 ui32OEMFlags, void **phSwapChain,
137 u32 *pui32SwapChainID);
139 enum PVRSRV_ERROR PVRSRVDestroyDCSwapChainKM(void *hSwapChain);
140 enum PVRSRV_ERROR PVRSRVSetDCDstRectKM(void *hDeviceKM, void *hSwapChain,
141 struct IMG_RECT *psRect);
142 enum PVRSRV_ERROR PVRSRVSetDCSrcRectKM(void *hDeviceKM, void *hSwapChain,
143 struct IMG_RECT *psRect);
144 enum PVRSRV_ERROR PVRSRVSetDCDstColourKeyKM(void *hDeviceKM, void *hSwapChain,
146 enum PVRSRV_ERROR PVRSRVSetDCSrcColourKeyKM(void *hDeviceKM, void *hSwapChain,
148 enum PVRSRV_ERROR PVRSRVGetDCBuffersKM(void *hDeviceKM, void *hSwapChain,
149 u32 *pui32BufferCount, void **phBuffer);
150 enum PVRSRV_ERROR PVRSRVSwapToDCBufferKM(void *hDeviceKM, void *hBuffer,
151 u32 ui32SwapInterval, void *hPrivateTag,
152 u32 ui32ClipRectCount, struct IMG_RECT *psClipRect);
153 enum PVRSRV_ERROR PVRSRVSwapToDCSystemKM(void *hDeviceKM, void *hSwapChain);
155 enum PVRSRV_ERROR PVRSRVOpenBCDeviceKM(
156 struct PVRSRV_PER_PROCESS_DATA *psPerProc,
157 u32 ui32DeviceID, void *hDevCookie, void **phDeviceKM);
158 enum PVRSRV_ERROR PVRSRVCloseBCDeviceKM(void *hDeviceKM,
159 IMG_BOOL bResManCallback);
161 enum PVRSRV_ERROR PVRSRVGetBCInfoKM(void *hDeviceKM,
162 struct BUFFER_INFO *psBufferInfo);
163 enum PVRSRV_ERROR PVRSRVGetBCBufferKM(void *hDeviceKM,
164 u32 ui32BufferIndex, void **phBuffer);
166 enum PVRSRV_ERROR PVRSRVMapDeviceClassMemoryKM(
167 struct PVRSRV_PER_PROCESS_DATA *psPerProc, void *hDevMemContext,
168 void *hDeviceClassBuffer,
169 struct PVRSRV_KERNEL_MEM_INFO **ppsMemInfo, void **phOSMapInfo);
171 enum PVRSRV_ERROR PVRSRVUnmapDeviceClassMemoryKM(
172 struct PVRSRV_KERNEL_MEM_INFO *psMemInfo);
174 enum PVRSRV_ERROR PVRSRVGetFreeDeviceMemKM(u32 ui32Flags, u32 *pui32Total,
175 u32 *pui32Free, u32 *pui32LargestBlock);
176 enum PVRSRV_ERROR PVRSRVAllocSyncInfoKM(void *hDevCookie, void *hDevMemContext,
177 struct PVRSRV_KERNEL_SYNC_INFO **ppsKernelSyncInfo);
178 enum PVRSRV_ERROR PVRSRVFreeSyncInfoKM(
179 struct PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo);
181 enum PVRSRV_ERROR PVRSRVGetMiscInfoKM(struct PVRSRV_MISC_INFO *psMiscInfo);
183 enum PVRSRV_ERROR PVRSRVGetFBStatsKM(u32 *pui32Total, u32 *pui32Available);
185 enum PVRSRV_ERROR PVRSRVAllocSharedSysMemoryKM(
186 struct PVRSRV_PER_PROCESS_DATA *psPerProc, u32 ui32Flags,
187 u32 ui32Size, struct PVRSRV_KERNEL_MEM_INFO **ppsKernelMemInfo);
189 enum PVRSRV_ERROR PVRSRVFreeSharedSysMemoryKM(
190 struct PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo);
192 enum PVRSRV_ERROR PVRSRVDissociateMemFromResmanKM(
193 struct PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo);
195 long PVRSRV_BridgeDispatchKM(struct file *, unsigned, unsigned long);