diff options
Diffstat (limited to 'libdrm/xf86drmMode.h')
-rw-r--r-- | libdrm/xf86drmMode.h | 256 |
1 files changed, 0 insertions, 256 deletions
diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h deleted file mode 100644 index b68d1469..00000000 --- a/libdrm/xf86drmMode.h +++ /dev/null | |||
@@ -1,256 +0,0 @@ | |||
1 | /* | ||
2 | * \file xf86drmMode.h | ||
3 | * Header for DRM modesetting interface. | ||
4 | * | ||
5 | * \author Jakob Bornecrantz <wallbraker@gmail.com> | ||
6 | * | ||
7 | * \par Acknowledgements: | ||
8 | * Feb 2007, Dave Airlie <airlied@linux.ie> | ||
9 | */ | ||
10 | |||
11 | /* | ||
12 | * Copyright (c) <year> <copyright holders> | ||
13 | * | ||
14 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
15 | * copy of this software and associated documentation files (the "Software"), | ||
16 | * to deal in the Software without restriction, including without limitation | ||
17 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
18 | * and/or sell copies of the Software, and to permit persons to whom the | ||
19 | * Software is furnished to do so, subject to the following conditions: | ||
20 | * | ||
21 | * The above copyright notice and this permission notice shall be included in | ||
22 | * all copies or substantial portions of the Software. | ||
23 | * | ||
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
29 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
30 | * IN THE SOFTWARE. | ||
31 | * | ||
32 | */ | ||
33 | |||
34 | #include <drm.h> | ||
35 | |||
36 | /* | ||
37 | * This is the interface for modesetting for drm. | ||
38 | * | ||
39 | * In order to use this interface you must include either <stdint.h> or another | ||
40 | * header defining uint32_t, int32_t and uint16_t. | ||
41 | * | ||
42 | * It aims to provide a randr1.2 compatible interface for modesettings in the | ||
43 | * kernel, the interface is also ment to be used by libraries like EGL. | ||
44 | * | ||
45 | * More information can be found in randrproto.txt which can be found here: | ||
46 | * http://gitweb.freedesktop.org/?p=xorg/proto/randrproto.git | ||
47 | * | ||
48 | * There are some major diffrences to be noted. Unlike the randr1.2 proto you | ||
49 | * need to create the memory object of the framebuffer yourself with the ttm | ||
50 | * buffer object interface. This object needs to be pinned. | ||
51 | */ | ||
52 | |||
53 | typedef struct _drmModeRes { | ||
54 | |||
55 | int count_fbs; | ||
56 | uint32_t *fbs; | ||
57 | |||
58 | int count_crtcs; | ||
59 | uint32_t *crtcs; | ||
60 | |||
61 | int count_connectors; | ||
62 | uint32_t *connectors; | ||
63 | |||
64 | int count_encoders; | ||
65 | uint32_t *encoders; | ||
66 | |||
67 | uint32_t min_width, max_width; | ||
68 | uint32_t min_height, max_height; | ||
69 | } drmModeRes, *drmModeResPtr; | ||
70 | |||
71 | typedef struct drm_mode_fb_cmd drmModeFB, *drmModeFBPtr; | ||
72 | |||
73 | typedef struct _drmModePropertyBlob { | ||
74 | uint32_t id; | ||
75 | uint32_t length; | ||
76 | void *data; | ||
77 | } drmModePropertyBlobRes, *drmModePropertyBlobPtr; | ||
78 | |||
79 | typedef struct _drmModeProperty { | ||
80 | uint32_t prop_id; | ||
81 | uint32_t flags; | ||
82 | char name[DRM_PROP_NAME_LEN]; | ||
83 | int count_values; | ||
84 | uint64_t *values; // store the blob lengths | ||
85 | int count_enums; | ||
86 | struct drm_mode_property_enum *enums; | ||
87 | int count_blobs; | ||
88 | uint32_t *blob_ids; // store the blob IDs | ||
89 | } drmModePropertyRes, *drmModePropertyPtr; | ||
90 | |||
91 | typedef struct _drmModeCrtc { | ||
92 | uint32_t crtc_id; | ||
93 | uint32_t buffer_id; /**< FB id to connect to 0 = disconnect */ | ||
94 | |||
95 | uint32_t x, y; /**< Position on the framebuffer */ | ||
96 | uint32_t width, height; | ||
97 | int mode_valid; | ||
98 | struct drm_mode_modeinfo mode; | ||
99 | |||
100 | int gamma_size; /**< Number of gamma stops */ | ||
101 | |||
102 | } drmModeCrtc, *drmModeCrtcPtr; | ||
103 | |||
104 | typedef struct _drmModeEncoder { | ||
105 | uint32_t encoder_id; | ||
106 | uint32_t encoder_type; | ||
107 | uint32_t crtc_id; | ||
108 | uint32_t possible_crtcs; | ||
109 | uint32_t possible_clones; | ||
110 | } drmModeEncoder, *drmModeEncoderPtr; | ||
111 | |||
112 | typedef enum { | ||
113 | DRM_MODE_CONNECTED = 1, | ||
114 | DRM_MODE_DISCONNECTED = 2, | ||
115 | DRM_MODE_UNKNOWNCONNECTION = 3 | ||
116 | } drmModeConnection; | ||
117 | |||
118 | typedef enum { | ||
119 | DRM_MODE_SUBPIXEL_UNKNOWN = 1, | ||
120 | DRM_MODE_SUBPIXEL_HORIZONTAL_RGB = 2, | ||
121 | DRM_MODE_SUBPIXEL_HORIZONTAL_BGR = 3, | ||
122 | DRM_MODE_SUBPIXEL_VERTICAL_RGB = 4, | ||
123 | DRM_MODE_SUBPIXEL_VERTICAL_BGR = 5, | ||
124 | DRM_MODE_SUBPIXEL_NONE = 6 | ||
125 | } drmModeSubPixel; | ||
126 | |||
127 | typedef struct _drmModeConnector { | ||
128 | uint32_t connector_id; | ||
129 | uint32_t encoder_id; /**< Encoder currently connected to */ | ||
130 | uint32_t connector_type; | ||
131 | uint32_t connector_type_id; | ||
132 | drmModeConnection connection; | ||
133 | uint32_t mmWidth, mmHeight; /**< HxW in millimeters */ | ||
134 | drmModeSubPixel subpixel; | ||
135 | |||
136 | int count_modes; | ||
137 | struct drm_mode_modeinfo *modes; | ||
138 | |||
139 | int count_props; | ||
140 | uint32_t *props; /**< List of property ids */ | ||
141 | uint64_t *prop_values; /**< List of property values */ | ||
142 | |||
143 | int count_encoders; | ||
144 | uint32_t *encoders; /**< List of encoder ids */ | ||
145 | } drmModeConnector, *drmModeConnectorPtr; | ||
146 | |||
147 | |||
148 | |||
149 | extern void drmModeFreeModeInfo( struct drm_mode_modeinfo *ptr ); | ||
150 | extern void drmModeFreeResources( drmModeResPtr ptr ); | ||
151 | extern void drmModeFreeFB( drmModeFBPtr ptr ); | ||
152 | extern void drmModeFreeCrtc( drmModeCrtcPtr ptr ); | ||
153 | extern void drmModeFreeConnector( drmModeConnectorPtr ptr ); | ||
154 | extern void drmModeFreeEncoder( drmModeEncoderPtr ptr ); | ||
155 | |||
156 | /** | ||
157 | * Retrives all of the resources associated with a card. | ||
158 | */ | ||
159 | extern drmModeResPtr drmModeGetResources(int fd); | ||
160 | |||
161 | /* | ||
162 | * FrameBuffer manipulation. | ||
163 | */ | ||
164 | |||
165 | /** | ||
166 | * Retrive information about framebuffer bufferId | ||
167 | */ | ||
168 | extern drmModeFBPtr drmModeGetFB(int fd, uint32_t bufferId); | ||
169 | |||
170 | /** | ||
171 | * Creates a new framebuffer with an buffer object as its scanout buffer. | ||
172 | */ | ||
173 | extern int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth, | ||
174 | uint8_t bpp, uint32_t pitch, uint32_t bo_handle, | ||
175 | uint32_t *buf_id); | ||
176 | /** | ||
177 | * Destroies the given framebuffer. | ||
178 | */ | ||
179 | extern int drmModeRmFB(int fd, uint32_t bufferId); | ||
180 | |||
181 | /** | ||
182 | * Replace a framebuffer object with a new one - for resizing the screen. | ||
183 | */ | ||
184 | extern int drmModeReplaceFB(int fd, uint32_t buffer_id, | ||
185 | uint32_t width, uint32_t height, uint8_t depth, | ||
186 | uint8_t bpp, uint32_t pitch, uint32_t bo_handle); | ||
187 | |||
188 | /* | ||
189 | * Crtc functions | ||
190 | */ | ||
191 | |||
192 | /** | ||
193 | * Retrive information about the ctrt crtcId | ||
194 | */ | ||
195 | extern drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId); | ||
196 | |||
197 | /** | ||
198 | * Set the mode on a crtc crtcId with the given mode modeId. | ||
199 | */ | ||
200 | int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId, | ||
201 | uint32_t x, uint32_t y, uint32_t *connectors, int count, | ||
202 | struct drm_mode_modeinfo *mode); | ||
203 | |||
204 | /* | ||
205 | * Cursor functions | ||
206 | */ | ||
207 | |||
208 | /** | ||
209 | * Set the cursor on crtc | ||
210 | */ | ||
211 | int drmModeSetCursor(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width, uint32_t height); | ||
212 | |||
213 | /** | ||
214 | * Move the cursor on crtc | ||
215 | */ | ||
216 | int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y); | ||
217 | |||
218 | /** | ||
219 | * Encoder functions | ||
220 | */ | ||
221 | drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id); | ||
222 | |||
223 | /* | ||
224 | * Connector manipulation | ||
225 | */ | ||
226 | |||
227 | /** | ||
228 | * Retrive information about the connector connectorId. | ||
229 | */ | ||
230 | extern drmModeConnectorPtr drmModeGetConnector(int fd, | ||
231 | uint32_t connectorId); | ||
232 | |||
233 | /** | ||
234 | * Attaches the given mode to an connector. | ||
235 | */ | ||
236 | extern int drmModeAttachMode(int fd, uint32_t connectorId, struct drm_mode_modeinfo *mode_info); | ||
237 | |||
238 | /** | ||
239 | * Detaches a mode from the connector | ||
240 | * must be unused, by the given mode. | ||
241 | */ | ||
242 | extern int drmModeDetachMode(int fd, uint32_t connectorId, struct drm_mode_modeinfo *mode_info); | ||
243 | |||
244 | extern drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId); | ||
245 | extern void drmModeFreeProperty(drmModePropertyPtr ptr); | ||
246 | |||
247 | extern drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id); | ||
248 | extern void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr); | ||
249 | extern int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property_id, | ||
250 | uint64_t value); | ||
251 | extern int drmCheckModesettingSupported(const char *busid); | ||
252 | |||
253 | extern int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size, | ||
254 | uint16_t *red, uint16_t *green, uint16_t *blue); | ||
255 | extern int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size, | ||
256 | uint16_t *red, uint16_t *green, uint16_t *blue); | ||