diff options
Diffstat (limited to 'drivers/gpu/pvr/services4/srvkm/env/linux/pvr_drm.h')
-rw-r--r-- | drivers/gpu/pvr/services4/srvkm/env/linux/pvr_drm.h | 185 |
1 files changed, 185 insertions, 0 deletions
diff --git a/drivers/gpu/pvr/services4/srvkm/env/linux/pvr_drm.h b/drivers/gpu/pvr/services4/srvkm/env/linux/pvr_drm.h new file mode 100644 index 000000000000..1d6e2749a579 --- /dev/null +++ b/drivers/gpu/pvr/services4/srvkm/env/linux/pvr_drm.h | |||
@@ -0,0 +1,185 @@ | |||
1 | /*************************************************************************/ /*! | ||
2 | @Title PowerVR drm driver | ||
3 | @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved | ||
4 | @Description drm module | ||
5 | @License Dual MIT/GPLv2 | ||
6 | |||
7 | The contents of this file are subject to the MIT license as set out below. | ||
8 | |||
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: | ||
15 | |||
16 | The above copyright notice and this permission notice shall be included in | ||
17 | all copies or substantial portions of the Software. | ||
18 | |||
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. | ||
22 | |||
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. | ||
30 | |||
31 | This License is also included in this distribution in the file called | ||
32 | "MIT-COPYING". | ||
33 | |||
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 | */ /**************************************************************************/ | ||
42 | #if !defined(__PVR_DRM_H__) | ||
43 | #define __PVR_DRM_H__ | ||
44 | |||
45 | #if defined (PDUMP) | ||
46 | #include "linuxsrv.h" | ||
47 | #endif | ||
48 | |||
49 | #include "pvr_drm_shared.h" | ||
50 | |||
51 | #if defined(SUPPORT_DRI_DRM) | ||
52 | |||
53 | #if defined(PVR_DISPLAY_CONTROLLER_DRM_IOCTL) | ||
54 | #include "3rdparty_dc_drm_shared.h" | ||
55 | #endif | ||
56 | |||
57 | #define PVR_DRM_MAKENAME_HELPER(x, y) x ## y | ||
58 | #define PVR_DRM_MAKENAME(x, y) PVR_DRM_MAKENAME_HELPER(x, y) | ||
59 | |||
60 | #if defined(PVR_DRI_DRM_PLATFORM_DEV) | ||
61 | #define LDM_DEV struct platform_device | ||
62 | #endif | ||
63 | |||
64 | int PVRCore_Init(void); | ||
65 | void PVRCore_Cleanup(void); | ||
66 | int PVRSRVOpen(struct drm_device *dev, struct drm_file *pFile); | ||
67 | void PVRSRVRelease(void *pvPrivData); | ||
68 | |||
69 | #if !defined(SUPPORT_DRI_DRM_PLUGIN) | ||
70 | #if defined(PVR_DRI_DRM_PLATFORM_DEV) | ||
71 | void PVRSRVDriverShutdown(LDM_DEV *pDevice); | ||
72 | int PVRSRVDriverSuspend(LDM_DEV *pDevice, pm_message_t state); | ||
73 | int PVRSRVDriverResume(LDM_DEV *pDevice); | ||
74 | #else | ||
75 | #if defined(SUPPORT_DRM_MODESET) | ||
76 | int PVRSRVDriverSuspend(struct pci_dev *pDevice, pm_message_t state); | ||
77 | int PVRSRVDriverResume(struct pci_dev *pDevice); | ||
78 | #else | ||
79 | int PVRSRVDriverSuspend(struct drm_device *pDevice, pm_message_t state); | ||
80 | int PVRSRVDriverResume(struct drm_device *pDevice); | ||
81 | #endif /* defined(SUPPORT_DRM_MODESET) */ | ||
82 | #endif /* defined(PVR_DRI_DRM_PLATFORM_DEV) */ | ||
83 | #endif /* !defined(SUPPORT_DRI_DRM_PLUGIN) */ | ||
84 | |||
85 | int PVRSRV_BridgeDispatchKM(struct drm_device *dev, void *arg, struct drm_file *pFile); | ||
86 | int PVRSRV_BridgeCompatDispatchKM(struct drm_device *dev, void *arg, struct drm_file *pFile); | ||
87 | |||
88 | #if defined(SUPPORT_DRI_DRM_EXT) | ||
89 | #define DRI_DRM_STATIC | ||
90 | /*Exported functions to common drm layer*/ | ||
91 | int PVRSRVDrmLoad(struct drm_device *dev, unsigned long flags); | ||
92 | int PVRSRVDrmUnload(struct drm_device *dev); | ||
93 | int PVRSRVDrmOpen(struct drm_device *dev, struct drm_file *file); | ||
94 | #if defined(PVR_LINUX_USING_WORKQUEUES) | ||
95 | DRI_DRM_STATIC int PVRSRVDrmRelease(struct inode *inode, struct file *filp); | ||
96 | #else | ||
97 | void PVRSRVDrmPostClose(struct drm_device *dev, struct drm_file *file); | ||
98 | #endif | ||
99 | int PVRDRMIsMaster(struct drm_device *dev, IMG_VOID *arg, struct drm_file *pFile); | ||
100 | int PVRDRMUnprivCmd(struct drm_device *dev, IMG_VOID *arg, struct drm_file *pFile); | ||
101 | int PVRDRM_Dummy_ioctl(struct drm_device *dev, IMG_VOID *arg, struct drm_file *pFile); | ||
102 | #else | ||
103 | #define DRI_DRM_STATIC static | ||
104 | #endif /* defined(SUPPORT_DRI_DRM_EXT) */ | ||
105 | |||
106 | #if defined(DISPLAY_CONTROLLER) | ||
107 | extern int PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Init)(struct drm_device *); | ||
108 | extern void PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Cleanup)(struct drm_device *); | ||
109 | extern int PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Suspend)(struct drm_device *); | ||
110 | extern int PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Resume)(struct drm_device *); | ||
111 | #if defined(PVR_DISPLAY_CONTROLLER_DRM_IOCTL) | ||
112 | extern int PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Ioctl)(struct drm_device *dev, void *arg, struct drm_file *pFile); | ||
113 | #endif | ||
114 | #endif | ||
115 | |||
116 | #if defined(PDUMP) | ||
117 | int dbgdrv_init(void); | ||
118 | void dbgdrv_cleanup(void); | ||
119 | IMG_INT dbgdrv_ioctl(struct drm_device *dev, IMG_VOID *arg, struct drm_file *pFile); | ||
120 | #endif | ||
121 | |||
122 | #if !defined(SUPPORT_DRI_DRM_EXT) | ||
123 | /* | ||
124 | * We need the command number names to begin with "DRM_" for newer versions | ||
125 | * of the macro used to fill out the DRM ioctl table. Similarly, the | ||
126 | * ioctl number names must begin with "DRM_IOCTL_". The suffixes for the | ||
127 | * two sets of strings must match (e.g. end with "PVR_SRVKM" in both | ||
128 | * cases). | ||
129 | */ | ||
130 | |||
131 | #define DRM_PVR_SRVKM PVR_DRM_SRVKM_CMD | ||
132 | #define DRM_PVR_IS_MASTER PVR_DRM_IS_MASTER_CMD | ||
133 | #define DRM_PVR_UNPRIV PVR_DRM_UNPRIV_CMD | ||
134 | #define DRM_PVR_DBGDRV PVR_DRM_DBGDRV_CMD | ||
135 | #define DRM_PVR_DISP PVR_DRM_DISP_CMD | ||
136 | |||
137 | /* | ||
138 | * Some versions of the kernel will dereference a NULL pointer if data is | ||
139 | * is passed to an ioctl that doesn't expect any, so avoid using the _IO | ||
140 | * macro, and use _IOW instead, specifying a dummy argument. | ||
141 | */ | ||
142 | typedef struct { | ||
143 | char dummy[4]; | ||
144 | } drm_pvr_dummy_arg; | ||
145 | |||
146 | /* IOCTL numbers */ | ||
147 | #define DRM_IOCTL_PVR_SRVKM DRM_IOWR(DRM_COMMAND_BASE + DRM_PVR_SRVKM, PVRSRV_BRIDGE_PACKAGE) | ||
148 | #define DRM_IOCTL_PVR_IS_MASTER DRM_IOW(DRM_COMMAND_BASE + DRM_PVR_IS_MASTER, drm_pvr_dummy_arg) | ||
149 | #define DRM_IOCTL_PVR_UNPRIV DRM_IOWR(DRM_COMMAND_BASE + DRM_PVR_UNPRIV, drm_pvr_unpriv_cmd) | ||
150 | |||
151 | #if defined(PDUMP) | ||
152 | #define DRM_IOCTL_PVR_DBGDRV DRM_IOWR(DRM_COMMAND_BASE + DRM_PVR_DBGDRV, IOCTL_PACKAGE) | ||
153 | #endif | ||
154 | |||
155 | #if defined(PVR_DISPLAY_CONTROLLER_DRM_IOCTL) | ||
156 | #define DRM_IOCTL_PVR_DISP DRM_IOWR(DRM_COMMAND_BASE + DRM_PVR_DISP, drm_pvr_display_cmd) | ||
157 | #endif | ||
158 | #endif /* !defined(SUPPORT_DRI_DRM_EXT) */ | ||
159 | |||
160 | #if defined(SUPPORT_DRI_DRM_PLUGIN) | ||
161 | typedef struct { | ||
162 | char *name; | ||
163 | |||
164 | int (*load)(struct drm_device *dev, unsigned long flags); | ||
165 | int (*unload)(struct drm_device *dev); | ||
166 | |||
167 | int (*open)(struct drm_device *dev, struct drm_file *file); | ||
168 | int (*release)(struct drm_device *dev, struct drm_file *file); | ||
169 | |||
170 | int (*mmap)(struct file* pFile, struct vm_area_struct* ps_vma); | ||
171 | |||
172 | struct drm_ioctl_desc *ioctls; | ||
173 | int num_ioctls; | ||
174 | int ioctl_start; | ||
175 | } PVRSRV_DRM_PLUGIN; | ||
176 | |||
177 | int SysDRMRegisterPlugin(PVRSRV_DRM_PLUGIN *psDRMPlugin); | ||
178 | void SysDRMUnregisterPlugin(PVRSRV_DRM_PLUGIN *psDRMPlugin); | ||
179 | #endif /* defined(SUPPORT_DRI_DRM_PLUGIN) */ | ||
180 | |||
181 | #endif /* defined(SUPPORT_DRI_DRM) */ | ||
182 | |||
183 | #endif /* defined(__PVR_DRM_H__) */ | ||
184 | |||
185 | |||