gpu: pvr: get rid of unnecessary hash lookups for the proc object
[sgx.git] / pvr / bufferclass_example.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 __BC_EXAMPLE_H__
28 #define __BC_EXAMPLE_H__
29
30 #include "img_defs.h"
31 #include "servicesext.h"
32 #include "kernelbuffer.h"
33
34 extern IMG_BOOL PVRGetBufferClassJTable(
35                                 struct PVRSRV_BC_BUFFER2SRV_KMJTABLE *psJTable);
36
37 #define BC_EXAMPLE_NUM_BUFFERS          3
38
39 #define YUV420                          1
40 #ifdef YUV420
41
42 #define BC_EXAMPLE_WIDTH                320
43 #define BC_EXAMPLE_HEIGHT               160
44 #define BC_EXAMPLE_STRIDE               320
45 #define BC_EXAMPLE_PIXELFORMAT          PVRSRV_PIXEL_FORMAT_NV12
46
47 #else
48
49 #define BC_EXAMPLE_WIDTH                320
50 #define BC_EXAMPLE_HEIGHT               160
51 #define BC_EXAMPLE_STRIDE               (320 * 2)
52 #define BC_EXAMPLE_PIXELFORMAT          PVRSRV_PIXEL_FORMAT_RGB565
53
54 #endif
55
56 #define BC_EXAMPLE_DEVICEID              0
57
58 struct BC_EXAMPLE_BUFFER {
59         u32 ui32Size;
60         void *hMemHandle;
61         struct IMG_SYS_PHYADDR sSysAddr;
62         struct IMG_SYS_PHYADDR sPageAlignSysAddr;
63         void __iomem *sCPUVAddr;
64         struct PVRSRV_SYNC_DATA *psSyncData;
65         struct BC_EXAMPLE_BUFFER *psNext;
66 };
67
68 struct BC_EXAMPLE_DEVINFO {
69         u32 ui32DeviceID;
70         struct BC_EXAMPLE_BUFFER *psSystemBuffer;
71         struct BUFFER_INFO sBufferInfo;
72         u32 ui32NumBuffers;
73         struct PVRSRV_BC_BUFFER2SRV_KMJTABLE sPVRJTable;
74         struct PVRSRV_BC_SRV2BUFFER_KMJTABLE sBCJTable;
75         void *hPVRServices;
76         u32 ui32RefCount;
77 };
78
79 enum PVRSRV_ERROR BC_Example_Init(void);
80 enum PVRSRV_ERROR BC_Example_Deinit(void);
81
82 enum PVRSRV_ERROR BCOpenPVRServices(void **phPVRServices);
83 enum PVRSRV_ERROR BCClosePVRServices(void *hPVRServices);
84
85 void *BCAllocKernelMem(u32 ui32Size);
86 void BCFreeKernelMem(void *pvMem);
87
88 enum PVRSRV_ERROR BCAllocContigMemory(u32 ui32Size, void **phMemHandle,
89                                  void __iomem **pLinAddr,
90                                  struct IMG_CPU_PHYADDR *pPhysAddr);
91 void BCFreeContigMemory(u32 ui32Size, void *hMemHandle, void __iomem *LinAddr,
92                         struct IMG_CPU_PHYADDR PhysAddr);
93
94 struct IMG_SYS_PHYADDR CpuPAddrToSysPAddrBC(struct IMG_CPU_PHYADDR cpu_paddr);
95 struct IMG_CPU_PHYADDR SysPAddrToCpuPAddrBC(struct IMG_SYS_PHYADDR sys_paddr);
96
97 void *MapPhysAddr(struct IMG_SYS_PHYADDR sSysAddr, u32 ui32Size);
98 void UnMapPhysAddr(void *pvAddr, u32 ui32Size);
99
100 enum PVRSRV_ERROR BCGetLibFuncAddr(void *hExtDrv, char *szFunctionName,
101          IMG_BOOL (**ppfnFuncTable)(struct PVRSRV_BC_BUFFER2SRV_KMJTABLE *));
102 struct BC_EXAMPLE_DEVINFO *GetAnchorPtr(void);
103
104 #endif