]>
Commit | Line | Data |
---|---|---|
f453ba04 DA |
1 | /* |
2 | * Copyright © 2006 Keith Packard | |
3 | * Copyright © 2007-2008 Dave Airlie | |
4 | * Copyright © 2007-2008 Intel Corporation | |
5 | * Jesse Barnes <jesse.barnes@intel.com> | |
6 | * | |
7 | * Permission is hereby granted, free of charge, to any person obtaining a | |
8 | * copy of this software and associated documentation files (the "Software"), | |
9 | * to deal in the Software without restriction, including without limitation | |
10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
11 | * and/or sell copies of the Software, and to permit persons to whom the | |
12 | * Software is furnished to do so, subject to the following conditions: | |
13 | * | |
14 | * The above copyright notice and this permission notice shall be included in | |
15 | * all copies or substantial portions of the Software. | |
16 | * | |
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
20 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
23 | * OTHER DEALINGS IN THE SOFTWARE. | |
24 | */ | |
25 | #ifndef __DRM_CRTC_H__ | |
26 | #define __DRM_CRTC_H__ | |
27 | ||
28 | #include <linux/i2c.h> | |
29 | #include <linux/spinlock.h> | |
30 | #include <linux/types.h> | |
31 | #include <linux/idr.h> | |
f453ba04 DA |
32 | #include <linux/fb.h> |
33 | ||
308e5bcb JB |
34 | #include <drm/drm_fourcc.h> |
35 | ||
f453ba04 DA |
36 | struct drm_device; |
37 | struct drm_mode_set; | |
38 | struct drm_framebuffer; | |
39 | ||
40 | ||
41 | #define DRM_MODE_OBJECT_CRTC 0xcccccccc | |
42 | #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 | |
43 | #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0 | |
44 | #define DRM_MODE_OBJECT_MODE 0xdededede | |
45 | #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 | |
46 | #define DRM_MODE_OBJECT_FB 0xfbfbfbfb | |
47 | #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb | |
8cf5c917 | 48 | #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee |
f453ba04 DA |
49 | |
50 | struct drm_mode_object { | |
51 | uint32_t id; | |
52 | uint32_t type; | |
53 | }; | |
54 | ||
55 | /* | |
56 | * Note on terminology: here, for brevity and convenience, we refer to connector | |
57 | * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS, | |
58 | * DVI, etc. And 'screen' refers to the whole of the visible display, which | |
59 | * may span multiple monitors (and therefore multiple CRTC and connector | |
60 | * structures). | |
61 | */ | |
62 | ||
63 | enum drm_mode_status { | |
64 | MODE_OK = 0, /* Mode OK */ | |
65 | MODE_HSYNC, /* hsync out of range */ | |
66 | MODE_VSYNC, /* vsync out of range */ | |
67 | MODE_H_ILLEGAL, /* mode has illegal horizontal timings */ | |
68 | MODE_V_ILLEGAL, /* mode has illegal horizontal timings */ | |
69 | MODE_BAD_WIDTH, /* requires an unsupported linepitch */ | |
25985edc | 70 | MODE_NOMODE, /* no mode with a matching name */ |
f453ba04 DA |
71 | MODE_NO_INTERLACE, /* interlaced mode not supported */ |
72 | MODE_NO_DBLESCAN, /* doublescan mode not supported */ | |
73 | MODE_NO_VSCAN, /* multiscan mode not supported */ | |
74 | MODE_MEM, /* insufficient video memory */ | |
75 | MODE_VIRTUAL_X, /* mode width too large for specified virtual size */ | |
76 | MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */ | |
77 | MODE_MEM_VIRT, /* insufficient video memory given virtual size */ | |
78 | MODE_NOCLOCK, /* no fixed clock available */ | |
79 | MODE_CLOCK_HIGH, /* clock required is too high */ | |
80 | MODE_CLOCK_LOW, /* clock required is too low */ | |
81 | MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */ | |
82 | MODE_BAD_HVALUE, /* horizontal timing was out of range */ | |
83 | MODE_BAD_VVALUE, /* vertical timing was out of range */ | |
84 | MODE_BAD_VSCAN, /* VScan value out of range */ | |
85 | MODE_HSYNC_NARROW, /* horizontal sync too narrow */ | |
86 | MODE_HSYNC_WIDE, /* horizontal sync too wide */ | |
87 | MODE_HBLANK_NARROW, /* horizontal blanking too narrow */ | |
88 | MODE_HBLANK_WIDE, /* horizontal blanking too wide */ | |
89 | MODE_VSYNC_NARROW, /* vertical sync too narrow */ | |
90 | MODE_VSYNC_WIDE, /* vertical sync too wide */ | |
91 | MODE_VBLANK_NARROW, /* vertical blanking too narrow */ | |
92 | MODE_VBLANK_WIDE, /* vertical blanking too wide */ | |
93 | MODE_PANEL, /* exceeds panel dimensions */ | |
94 | MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ | |
95 | MODE_ONE_WIDTH, /* only one width is supported */ | |
96 | MODE_ONE_HEIGHT, /* only one height is supported */ | |
97 | MODE_ONE_SIZE, /* only one resolution is supported */ | |
98 | MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ | |
99 | MODE_UNVERIFIED = -3, /* mode needs to reverified */ | |
100 | MODE_BAD = -2, /* unspecified reason */ | |
101 | MODE_ERROR = -1 /* error condition */ | |
102 | }; | |
103 | ||
104 | #define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \ | |
105 | DRM_MODE_TYPE_CRTC_C) | |
106 | ||
107 | #define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \ | |
108 | .name = nm, .status = 0, .type = (t), .clock = (c), \ | |
109 | .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \ | |
110 | .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \ | |
111 | .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \ | |
112 | .vscan = (vs), .flags = (f), .vrefresh = 0 | |
113 | ||
114 | #define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */ | |
115 | ||
116 | struct drm_display_mode { | |
117 | /* Header */ | |
118 | struct list_head head; | |
119 | struct drm_mode_object base; | |
120 | ||
121 | char name[DRM_DISPLAY_MODE_LEN]; | |
122 | ||
f453ba04 DA |
123 | enum drm_mode_status status; |
124 | int type; | |
125 | ||
126 | /* Proposed mode values */ | |
7ac96a9c | 127 | int clock; /* in kHz */ |
f453ba04 DA |
128 | int hdisplay; |
129 | int hsync_start; | |
130 | int hsync_end; | |
131 | int htotal; | |
132 | int hskew; | |
133 | int vdisplay; | |
134 | int vsync_start; | |
135 | int vsync_end; | |
136 | int vtotal; | |
137 | int vscan; | |
138 | unsigned int flags; | |
139 | ||
140 | /* Addressable image size (may be 0 for projectors, etc.) */ | |
141 | int width_mm; | |
142 | int height_mm; | |
143 | ||
144 | /* Actual mode we give to hw */ | |
145 | int clock_index; | |
146 | int synth_clock; | |
147 | int crtc_hdisplay; | |
148 | int crtc_hblank_start; | |
149 | int crtc_hblank_end; | |
150 | int crtc_hsync_start; | |
151 | int crtc_hsync_end; | |
152 | int crtc_htotal; | |
153 | int crtc_hskew; | |
154 | int crtc_vdisplay; | |
155 | int crtc_vblank_start; | |
156 | int crtc_vblank_end; | |
157 | int crtc_vsync_start; | |
158 | int crtc_vsync_end; | |
159 | int crtc_vtotal; | |
160 | int crtc_hadjusted; | |
161 | int crtc_vadjusted; | |
162 | ||
163 | /* Driver private mode info */ | |
164 | int private_size; | |
165 | int *private; | |
166 | int private_flags; | |
167 | ||
7ac96a9c AJ |
168 | int vrefresh; /* in Hz */ |
169 | int hsync; /* in kHz */ | |
f453ba04 DA |
170 | }; |
171 | ||
172 | enum drm_connector_status { | |
173 | connector_status_connected = 1, | |
174 | connector_status_disconnected = 2, | |
175 | connector_status_unknown = 3, | |
176 | }; | |
177 | ||
178 | enum subpixel_order { | |
179 | SubPixelUnknown = 0, | |
180 | SubPixelHorizontalRGB, | |
181 | SubPixelHorizontalBGR, | |
182 | SubPixelVerticalRGB, | |
183 | SubPixelVerticalBGR, | |
184 | SubPixelNone, | |
185 | }; | |
186 | ||
da05a5a7 JB |
187 | #define DRM_COLOR_FORMAT_RGB444 (1<<0) |
188 | #define DRM_COLOR_FORMAT_YCRCB444 (1<<1) | |
189 | #define DRM_COLOR_FORMAT_YCRCB422 (1<<2) | |
f453ba04 DA |
190 | /* |
191 | * Describes a given display (e.g. CRT or flat panel) and its limitations. | |
192 | */ | |
193 | struct drm_display_info { | |
194 | char name[DRM_DISPLAY_INFO_LEN]; | |
fb439640 | 195 | |
f453ba04 DA |
196 | /* Physical size */ |
197 | unsigned int width_mm; | |
198 | unsigned int height_mm; | |
199 | ||
f453ba04 DA |
200 | /* Clock limits FIXME: storage format */ |
201 | unsigned int min_vfreq, max_vfreq; | |
202 | unsigned int min_hfreq, max_hfreq; | |
203 | unsigned int pixel_clock; | |
3b11228b | 204 | unsigned int bpc; |
f453ba04 | 205 | |
f453ba04 | 206 | enum subpixel_order subpixel_order; |
da05a5a7 | 207 | u32 color_formats; |
f453ba04 | 208 | |
ebec9a7b JB |
209 | u8 cea_rev; |
210 | ||
f453ba04 DA |
211 | char *raw_edid; /* if any */ |
212 | }; | |
213 | ||
214 | struct drm_framebuffer_funcs { | |
215 | void (*destroy)(struct drm_framebuffer *framebuffer); | |
216 | int (*create_handle)(struct drm_framebuffer *fb, | |
217 | struct drm_file *file_priv, | |
218 | unsigned int *handle); | |
884840aa JB |
219 | /** |
220 | * Optinal callback for the dirty fb ioctl. | |
221 | * | |
222 | * Userspace can notify the driver via this callback | |
223 | * that a area of the framebuffer has changed and should | |
224 | * be flushed to the display hardware. | |
225 | * | |
226 | * See documentation in drm_mode.h for the struct | |
227 | * drm_mode_fb_dirty_cmd for more information as all | |
228 | * the semantics and arguments have a one to one mapping | |
229 | * on this function. | |
230 | */ | |
02b00162 TH |
231 | int (*dirty)(struct drm_framebuffer *framebuffer, |
232 | struct drm_file *file_priv, unsigned flags, | |
884840aa JB |
233 | unsigned color, struct drm_clip_rect *clips, |
234 | unsigned num_clips); | |
f453ba04 DA |
235 | }; |
236 | ||
237 | struct drm_framebuffer { | |
238 | struct drm_device *dev; | |
239 | struct list_head head; | |
240 | struct drm_mode_object base; | |
241 | const struct drm_framebuffer_funcs *funcs; | |
242 | unsigned int pitch; | |
243 | unsigned int width; | |
244 | unsigned int height; | |
245 | /* depth can be 15 or 16 */ | |
246 | unsigned int depth; | |
247 | int bits_per_pixel; | |
248 | int flags; | |
308e5bcb | 249 | uint32_t pixel_format; /* fourcc format */ |
f453ba04 | 250 | struct list_head filp_head; |
785b93ef DA |
251 | /* if you are using the helper */ |
252 | void *helper_private; | |
f453ba04 DA |
253 | }; |
254 | ||
255 | struct drm_property_blob { | |
256 | struct drm_mode_object base; | |
257 | struct list_head head; | |
258 | unsigned int length; | |
259 | void *data; | |
260 | }; | |
261 | ||
262 | struct drm_property_enum { | |
263 | uint64_t value; | |
264 | struct list_head head; | |
265 | char name[DRM_PROP_NAME_LEN]; | |
266 | }; | |
267 | ||
268 | struct drm_property { | |
269 | struct list_head head; | |
270 | struct drm_mode_object base; | |
271 | uint32_t flags; | |
272 | char name[DRM_PROP_NAME_LEN]; | |
273 | uint32_t num_values; | |
274 | uint64_t *values; | |
275 | ||
276 | struct list_head enum_blob_list; | |
277 | }; | |
278 | ||
279 | struct drm_crtc; | |
280 | struct drm_connector; | |
281 | struct drm_encoder; | |
d91d8a3f | 282 | struct drm_pending_vblank_event; |
8cf5c917 | 283 | struct drm_plane; |
f453ba04 DA |
284 | |
285 | /** | |
286 | * drm_crtc_funcs - control CRTCs for a given device | |
eb033556 | 287 | * @reset: reset CRTC after state has been invalidate (e.g. resume) |
f453ba04 DA |
288 | * @dpms: control display power levels |
289 | * @save: save CRTC state | |
290 | * @resore: restore CRTC state | |
291 | * @lock: lock the CRTC | |
292 | * @unlock: unlock the CRTC | |
293 | * @shadow_allocate: allocate shadow pixmap | |
294 | * @shadow_create: create shadow pixmap for rotation support | |
295 | * @shadow_destroy: free shadow pixmap | |
296 | * @mode_fixup: fixup proposed mode | |
297 | * @mode_set: set the desired mode on the CRTC | |
298 | * @gamma_set: specify color ramp for CRTC | |
299 | * @destroy: deinit and free object. | |
300 | * | |
301 | * The drm_crtc_funcs structure is the central CRTC management structure | |
302 | * in the DRM. Each CRTC controls one or more connectors (note that the name | |
303 | * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc. | |
304 | * connectors, not just CRTs). | |
305 | * | |
306 | * Each driver is responsible for filling out this structure at startup time, | |
307 | * in addition to providing other modesetting features, like i2c and DDC | |
308 | * bus accessors. | |
309 | */ | |
310 | struct drm_crtc_funcs { | |
311 | /* Save CRTC state */ | |
312 | void (*save)(struct drm_crtc *crtc); /* suspend? */ | |
313 | /* Restore CRTC state */ | |
314 | void (*restore)(struct drm_crtc *crtc); /* resume? */ | |
eb033556 CW |
315 | /* Reset CRTC state */ |
316 | void (*reset)(struct drm_crtc *crtc); | |
f453ba04 DA |
317 | |
318 | /* cursor controls */ | |
319 | int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, | |
320 | uint32_t handle, uint32_t width, uint32_t height); | |
321 | int (*cursor_move)(struct drm_crtc *crtc, int x, int y); | |
322 | ||
323 | /* Set gamma on the CRTC */ | |
324 | void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, | |
7203425a | 325 | uint32_t start, uint32_t size); |
f453ba04 DA |
326 | /* Object destroy routine */ |
327 | void (*destroy)(struct drm_crtc *crtc); | |
328 | ||
329 | int (*set_config)(struct drm_mode_set *set); | |
d91d8a3f KH |
330 | |
331 | /* | |
332 | * Flip to the given framebuffer. This implements the page | |
25985edc | 333 | * flip ioctl described in drm_mode.h, specifically, the |
d91d8a3f KH |
334 | * implementation must return immediately and block all |
335 | * rendering to the current fb until the flip has completed. | |
336 | * If userspace set the event flag in the ioctl, the event | |
337 | * argument will point to an event to send back when the flip | |
338 | * completes, otherwise it will be NULL. | |
339 | */ | |
340 | int (*page_flip)(struct drm_crtc *crtc, | |
341 | struct drm_framebuffer *fb, | |
342 | struct drm_pending_vblank_event *event); | |
f453ba04 DA |
343 | }; |
344 | ||
345 | /** | |
346 | * drm_crtc - central CRTC control structure | |
7749163e JB |
347 | * @dev: parent DRM device |
348 | * @head: list management | |
349 | * @base: base KMS object for ID tracking etc. | |
f453ba04 | 350 | * @enabled: is this CRTC enabled? |
7749163e JB |
351 | * @mode: current mode timings |
352 | * @hwmode: mode timings as programmed to hw regs | |
f453ba04 DA |
353 | * @x: x position on screen |
354 | * @y: y position on screen | |
f453ba04 | 355 | * @funcs: CRTC control functions |
7749163e JB |
356 | * @gamma_size: size of gamma ramp |
357 | * @gamma_store: gamma ramp values | |
358 | * @framedur_ns: precise frame timing | |
359 | * @framedur_ns: precise line timing | |
360 | * @pixeldur_ns: precise pixel timing | |
361 | * @helper_private: mid-layer private data | |
f453ba04 DA |
362 | * |
363 | * Each CRTC may have one or more connectors associated with it. This structure | |
364 | * allows the CRTC to be controlled. | |
365 | */ | |
366 | struct drm_crtc { | |
367 | struct drm_device *dev; | |
368 | struct list_head head; | |
369 | ||
370 | struct drm_mode_object base; | |
371 | ||
372 | /* framebuffer the connector is currently bound to */ | |
373 | struct drm_framebuffer *fb; | |
374 | ||
375 | bool enabled; | |
376 | ||
27641c3f | 377 | /* Requested mode from modesetting. */ |
f453ba04 DA |
378 | struct drm_display_mode mode; |
379 | ||
27641c3f MK |
380 | /* Programmed mode in hw, after adjustments for encoders, |
381 | * crtc, panel scaling etc. Needed for timestamping etc. | |
382 | */ | |
383 | struct drm_display_mode hwmode; | |
384 | ||
f453ba04 | 385 | int x, y; |
f453ba04 DA |
386 | const struct drm_crtc_funcs *funcs; |
387 | ||
388 | /* CRTC gamma size for reporting to userspace */ | |
389 | uint32_t gamma_size; | |
390 | uint16_t *gamma_store; | |
391 | ||
27641c3f MK |
392 | /* Constants needed for precise vblank and swap timestamping. */ |
393 | s64 framedur_ns, linedur_ns, pixeldur_ns; | |
394 | ||
f453ba04 DA |
395 | /* if you are using the helper */ |
396 | void *helper_private; | |
397 | }; | |
398 | ||
399 | ||
400 | /** | |
401 | * drm_connector_funcs - control connectors on a given device | |
402 | * @dpms: set power state (see drm_crtc_funcs above) | |
403 | * @save: save connector state | |
404 | * @restore: restore connector state | |
eb033556 | 405 | * @reset: reset connector after state has been invalidate (e.g. resume) |
f453ba04 DA |
406 | * @mode_valid: is this mode valid on the given connector? |
407 | * @mode_fixup: try to fixup proposed mode for this connector | |
408 | * @mode_set: set this mode | |
409 | * @detect: is this connector active? | |
410 | * @get_modes: get mode list for this connector | |
411 | * @set_property: property for this connector may need update | |
412 | * @destroy: make object go away | |
d50ba256 | 413 | * @force: notify the driver the connector is forced on |
f453ba04 DA |
414 | * |
415 | * Each CRTC may have one or more connectors attached to it. The functions | |
416 | * below allow the core DRM code to control connectors, enumerate available modes, | |
417 | * etc. | |
418 | */ | |
419 | struct drm_connector_funcs { | |
420 | void (*dpms)(struct drm_connector *connector, int mode); | |
421 | void (*save)(struct drm_connector *connector); | |
422 | void (*restore)(struct drm_connector *connector); | |
eb033556 | 423 | void (*reset)(struct drm_connector *connector); |
930a9e28 CW |
424 | |
425 | /* Check to see if anything is attached to the connector. | |
426 | * @force is set to false whilst polling, true when checking the | |
427 | * connector due to user request. @force can be used by the driver | |
428 | * to avoid expensive, destructive operations during automated | |
429 | * probing. | |
430 | */ | |
7b334fcb | 431 | enum drm_connector_status (*detect)(struct drm_connector *connector, |
930a9e28 | 432 | bool force); |
40a518d9 | 433 | int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); |
f453ba04 DA |
434 | int (*set_property)(struct drm_connector *connector, struct drm_property *property, |
435 | uint64_t val); | |
436 | void (*destroy)(struct drm_connector *connector); | |
d50ba256 | 437 | void (*force)(struct drm_connector *connector); |
f453ba04 DA |
438 | }; |
439 | ||
6c3db920 JB |
440 | /** |
441 | * drm_encoder_funcs - encoder controls | |
442 | * @reset: reset state (e.g. at init or resume time) | |
443 | * @destroy: cleanup and free associated data | |
444 | * | |
445 | * Encoders sit between CRTCs and connectors. | |
446 | */ | |
f453ba04 | 447 | struct drm_encoder_funcs { |
eb033556 | 448 | void (*reset)(struct drm_encoder *encoder); |
f453ba04 DA |
449 | void (*destroy)(struct drm_encoder *encoder); |
450 | }; | |
451 | ||
452 | #define DRM_CONNECTOR_MAX_UMODES 16 | |
453 | #define DRM_CONNECTOR_MAX_PROPERTY 16 | |
454 | #define DRM_CONNECTOR_LEN 32 | |
455 | #define DRM_CONNECTOR_MAX_ENCODER 2 | |
456 | ||
457 | /** | |
458 | * drm_encoder - central DRM encoder structure | |
db3e4499 JB |
459 | * @dev: parent DRM device |
460 | * @head: list management | |
461 | * @base: base KMS object | |
462 | * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h | |
463 | * @possible_crtcs: bitmask of potential CRTC bindings | |
464 | * @possible_clones: bitmask of potential sibling encoders for cloning | |
465 | * @crtc: currently bound CRTC | |
466 | * @funcs: control functions | |
467 | * @helper_private: mid-layer private data | |
468 | * | |
469 | * CRTCs drive pixels to encoders, which convert them into signals | |
470 | * appropriate for a given connector or set of connectors. | |
f453ba04 DA |
471 | */ |
472 | struct drm_encoder { | |
473 | struct drm_device *dev; | |
474 | struct list_head head; | |
475 | ||
476 | struct drm_mode_object base; | |
477 | int encoder_type; | |
478 | uint32_t possible_crtcs; | |
479 | uint32_t possible_clones; | |
480 | ||
481 | struct drm_crtc *crtc; | |
482 | const struct drm_encoder_funcs *funcs; | |
483 | void *helper_private; | |
484 | }; | |
485 | ||
d50ba256 DA |
486 | enum drm_connector_force { |
487 | DRM_FORCE_UNSPECIFIED, | |
488 | DRM_FORCE_OFF, | |
489 | DRM_FORCE_ON, /* force on analog part normally */ | |
490 | DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ | |
491 | }; | |
492 | ||
eb1f8e4f DA |
493 | /* should we poll this connector for connects and disconnects */ |
494 | /* hot plug detectable */ | |
495 | #define DRM_CONNECTOR_POLL_HPD (1 << 0) | |
496 | /* poll for connections */ | |
497 | #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) | |
498 | /* can cleanly poll for disconnections without flickering the screen */ | |
499 | /* DACs should rarely do this without a lot of testing */ | |
500 | #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) | |
501 | ||
76adaa34 WF |
502 | #define MAX_ELD_BYTES 128 |
503 | ||
f453ba04 DA |
504 | /** |
505 | * drm_connector - central DRM connector control structure | |
72252548 JB |
506 | * @dev: parent DRM device |
507 | * @kdev: kernel device for sysfs attributes | |
508 | * @attr: sysfs attributes | |
509 | * @head: list management | |
510 | * @base: base KMS object | |
511 | * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h | |
512 | * @connector_type_id: index into connector type enum | |
f453ba04 DA |
513 | * @interlace_allowed: can this connector handle interlaced modes? |
514 | * @doublescan_allowed: can this connector handle doublescan? | |
72252548 JB |
515 | * @modes: modes available on this connector (from fill_modes() + user) |
516 | * @status: one of the drm_connector_status enums (connected, not, or unknown) | |
517 | * @probed_modes: list of modes derived directly from the display | |
518 | * @display_info: information about attached display (e.g. from EDID) | |
f453ba04 | 519 | * @funcs: connector control functions |
72252548 JB |
520 | * @user_modes: user added mode list |
521 | * @edid_blob_ptr: DRM property containing EDID if present | |
522 | * @property_ids: property tracking for this connector | |
523 | * @property_values: value pointers or data for properties | |
524 | * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling | |
525 | * @dpms: current dpms state | |
526 | * @helper_private: mid-layer private data | |
527 | * @force: a %DRM_FORCE_<foo> state for forced mode sets | |
528 | * @encoder_ids: valid encoders for this connector | |
529 | * @encoder: encoder driving this connector, if any | |
530 | * @eld: EDID-like data, if present | |
531 | * @dvi_dual: dual link DVI, if found | |
532 | * @max_tmds_clock: max clock rate, if found | |
533 | * @latency_present: AV delay info from ELD, if found | |
534 | * @video_latency: video latency info from ELD, if found | |
535 | * @audio_latency: audio latency info from ELD, if found | |
536 | * @null_edid_counter: track sinks that give us all zeros for the EDID | |
f453ba04 DA |
537 | * |
538 | * Each connector may be connected to one or more CRTCs, or may be clonable by | |
539 | * another connector if they can share a CRTC. Each connector also has a specific | |
540 | * position in the broader display (referred to as a 'screen' though it could | |
541 | * span multiple monitors). | |
542 | */ | |
543 | struct drm_connector { | |
544 | struct drm_device *dev; | |
545 | struct device kdev; | |
546 | struct device_attribute *attr; | |
547 | struct list_head head; | |
548 | ||
549 | struct drm_mode_object base; | |
550 | ||
551 | int connector_type; | |
552 | int connector_type_id; | |
553 | bool interlace_allowed; | |
554 | bool doublescan_allowed; | |
555 | struct list_head modes; /* list of modes on this connector */ | |
556 | ||
f453ba04 DA |
557 | enum drm_connector_status status; |
558 | ||
559 | /* these are modes added by probing with DDC or the BIOS */ | |
560 | struct list_head probed_modes; | |
561 | ||
562 | struct drm_display_info display_info; | |
563 | const struct drm_connector_funcs *funcs; | |
564 | ||
565 | struct list_head user_modes; | |
566 | struct drm_property_blob *edid_blob_ptr; | |
567 | u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY]; | |
568 | uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY]; | |
569 | ||
eb1f8e4f DA |
570 | uint8_t polled; /* DRM_CONNECTOR_POLL_* */ |
571 | ||
c9fb15f6 KP |
572 | /* requested DPMS state */ |
573 | int dpms; | |
574 | ||
f453ba04 DA |
575 | void *helper_private; |
576 | ||
d50ba256 DA |
577 | /* forced on connector */ |
578 | enum drm_connector_force force; | |
f453ba04 | 579 | uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; |
f453ba04 | 580 | struct drm_encoder *encoder; /* currently active encoder */ |
4a9a8b71 | 581 | |
76adaa34 WF |
582 | /* EDID bits */ |
583 | uint8_t eld[MAX_ELD_BYTES]; | |
584 | bool dvi_dual; | |
585 | int max_tmds_clock; /* in MHz */ | |
586 | bool latency_present[2]; | |
587 | int video_latency[2]; /* [0]: progressive, [1]: interlaced */ | |
588 | int audio_latency[2]; | |
4a9a8b71 | 589 | int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */ |
f453ba04 DA |
590 | }; |
591 | ||
8cf5c917 JB |
592 | /** |
593 | * drm_plane_funcs - driver plane control functions | |
594 | * @update_plane: update the plane configuration | |
595 | * @disable_plane: shut down the plane | |
596 | * @destroy: clean up plane resources | |
597 | */ | |
598 | struct drm_plane_funcs { | |
599 | int (*update_plane)(struct drm_plane *plane, | |
600 | struct drm_crtc *crtc, struct drm_framebuffer *fb, | |
601 | int crtc_x, int crtc_y, | |
602 | unsigned int crtc_w, unsigned int crtc_h, | |
603 | uint32_t src_x, uint32_t src_y, | |
604 | uint32_t src_w, uint32_t src_h); | |
605 | int (*disable_plane)(struct drm_plane *plane); | |
606 | void (*destroy)(struct drm_plane *plane); | |
607 | }; | |
608 | ||
609 | /** | |
610 | * drm_plane - central DRM plane control structure | |
611 | * @dev: DRM device this plane belongs to | |
612 | * @head: for list management | |
613 | * @base: base mode object | |
614 | * @possible_crtcs: pipes this plane can be bound to | |
615 | * @format_types: array of formats supported by this plane | |
616 | * @format_count: number of formats supported | |
617 | * @crtc: currently bound CRTC | |
618 | * @fb: currently bound fb | |
619 | * @gamma_size: size of gamma table | |
620 | * @gamma_store: gamma correction table | |
621 | * @enabled: enabled flag | |
622 | * @funcs: helper functions | |
623 | * @helper_private: storage for drver layer | |
624 | */ | |
625 | struct drm_plane { | |
626 | struct drm_device *dev; | |
627 | struct list_head head; | |
628 | ||
629 | struct drm_mode_object base; | |
630 | ||
631 | uint32_t possible_crtcs; | |
632 | uint32_t *format_types; | |
633 | uint32_t format_count; | |
634 | ||
635 | struct drm_crtc *crtc; | |
636 | struct drm_framebuffer *fb; | |
637 | ||
638 | /* CRTC gamma size for reporting to userspace */ | |
639 | uint32_t gamma_size; | |
640 | uint16_t *gamma_store; | |
641 | ||
642 | bool enabled; | |
643 | ||
644 | const struct drm_plane_funcs *funcs; | |
645 | void *helper_private; | |
646 | }; | |
647 | ||
f453ba04 | 648 | /** |
ef27351a JB |
649 | * drm_mode_set - new values for a CRTC config change |
650 | * @head: list management | |
651 | * @fb: framebuffer to use for new config | |
652 | * @crtc: CRTC whose configuration we're about to change | |
653 | * @mode: mode timings to use | |
654 | * @x: position of this CRTC relative to @fb | |
655 | * @y: position of this CRTC relative to @fb | |
656 | * @connectors: array of connectors to drive with this CRTC if possible | |
657 | * @num_connectors: size of @connectors array | |
f453ba04 DA |
658 | * |
659 | * Represents a single crtc the connectors that it drives with what mode | |
660 | * and from which framebuffer it scans out from. | |
661 | * | |
662 | * This is used to set modes. | |
663 | */ | |
664 | struct drm_mode_set { | |
665 | struct list_head head; | |
666 | ||
667 | struct drm_framebuffer *fb; | |
668 | struct drm_crtc *crtc; | |
669 | struct drm_display_mode *mode; | |
670 | ||
671 | uint32_t x; | |
672 | uint32_t y; | |
673 | ||
674 | struct drm_connector **connectors; | |
675 | size_t num_connectors; | |
676 | }; | |
677 | ||
678 | /** | |
550cebcd JB |
679 | * struct drm_mode_config_funcs - basic driver provided mode setting functions |
680 | * @fb_create: create a new framebuffer object | |
681 | * @output_poll_changed: function to handle output configuration changes | |
682 | * | |
683 | * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that | |
684 | * involve drivers. | |
f453ba04 DA |
685 | */ |
686 | struct drm_mode_config_funcs { | |
550cebcd JB |
687 | struct drm_framebuffer *(*fb_create)(struct drm_device *dev, |
688 | struct drm_file *file_priv, | |
689 | struct drm_mode_fb_cmd2 *mode_cmd); | |
eb1f8e4f | 690 | void (*output_poll_changed)(struct drm_device *dev); |
f453ba04 DA |
691 | }; |
692 | ||
c1aaca23 JB |
693 | /** |
694 | * drm_mode_group - group of mode setting resources for potential sub-grouping | |
695 | * @num_crtcs: CRTC count | |
696 | * @num_encoders: encoder count | |
697 | * @num_connectors: connector count | |
698 | * @id_list: list of KMS object IDs in this group | |
699 | * | |
700 | * Currently this simply tracks the global mode setting state. But in the | |
701 | * future it could allow groups of objects to be set aside into independent | |
702 | * control groups for use by different user level processes (e.g. two X servers | |
703 | * running simultaneously on different heads, each with their own mode | |
704 | * configuration and freedom of mode setting). | |
705 | */ | |
f453ba04 DA |
706 | struct drm_mode_group { |
707 | uint32_t num_crtcs; | |
708 | uint32_t num_encoders; | |
709 | uint32_t num_connectors; | |
710 | ||
711 | /* list of object IDs for this group */ | |
712 | uint32_t *id_list; | |
713 | }; | |
714 | ||
715 | /** | |
716 | * drm_mode_config - Mode configuration control structure | |
a62c93d5 JB |
717 | * @mutex: mutex protecting KMS related lists and structures |
718 | * @idr_mutex: mutex for KMS ID allocation and management | |
719 | * @crtc_idr: main KMS ID tracking object | |
720 | * @num_fb: number of fbs available | |
721 | * @fb_list: list of framebuffers available | |
722 | * @num_connector: number of connectors on this device | |
723 | * @connector_list: list of connector objects | |
724 | * @num_encoder: number of encoders on this device | |
725 | * @encoder_list: list of encoder objects | |
726 | * @num_crtc: number of CRTCs on this device | |
727 | * @crtc_list: list of CRTC objects | |
728 | * @min_width: minimum pixel width on this device | |
729 | * @min_height: minimum pixel height on this device | |
730 | * @max_width: maximum pixel width on this device | |
731 | * @max_height: maximum pixel height on this device | |
732 | * @funcs: core driver provided mode setting functions | |
733 | * @fb_base: base address of the framebuffer | |
734 | * @poll_enabled: track polling status for this device | |
735 | * @output_poll_work: delayed work for polling in process context | |
736 | * @*_property: core property tracking | |
f453ba04 | 737 | * |
a62c93d5 JB |
738 | * Core mode resource tracking structure. All CRTC, encoders, and connectors |
739 | * enumerated by the driver are added here, as are global properties. Some | |
740 | * global restrictions are also here, e.g. dimension restrictions. | |
f453ba04 DA |
741 | */ |
742 | struct drm_mode_config { | |
ad2563c2 JB |
743 | struct mutex mutex; /* protects configuration (mode lists etc.) */ |
744 | struct mutex idr_mutex; /* for IDR management */ | |
f453ba04 DA |
745 | struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ |
746 | /* this is limited to one for now */ | |
747 | int num_fb; | |
748 | struct list_head fb_list; | |
749 | int num_connector; | |
750 | struct list_head connector_list; | |
751 | int num_encoder; | |
752 | struct list_head encoder_list; | |
8cf5c917 JB |
753 | int num_plane; |
754 | struct list_head plane_list; | |
f453ba04 DA |
755 | |
756 | int num_crtc; | |
757 | struct list_head crtc_list; | |
758 | ||
759 | struct list_head property_list; | |
760 | ||
f453ba04 DA |
761 | int min_width, min_height; |
762 | int max_width, max_height; | |
763 | struct drm_mode_config_funcs *funcs; | |
d883f7f1 | 764 | resource_size_t fb_base; |
f453ba04 | 765 | |
eb1f8e4f DA |
766 | /* output poll support */ |
767 | bool poll_enabled; | |
991ea75c | 768 | struct delayed_work output_poll_work; |
eb1f8e4f | 769 | |
f453ba04 DA |
770 | /* pointers to standard properties */ |
771 | struct list_head property_blob_list; | |
772 | struct drm_property *edid_property; | |
773 | struct drm_property *dpms_property; | |
774 | ||
775 | /* DVI-I properties */ | |
776 | struct drm_property *dvi_i_subconnector_property; | |
777 | struct drm_property *dvi_i_select_subconnector_property; | |
778 | ||
779 | /* TV properties */ | |
780 | struct drm_property *tv_subconnector_property; | |
781 | struct drm_property *tv_select_subconnector_property; | |
782 | struct drm_property *tv_mode_property; | |
783 | struct drm_property *tv_left_margin_property; | |
784 | struct drm_property *tv_right_margin_property; | |
785 | struct drm_property *tv_top_margin_property; | |
786 | struct drm_property *tv_bottom_margin_property; | |
b6b7902e FJ |
787 | struct drm_property *tv_brightness_property; |
788 | struct drm_property *tv_contrast_property; | |
789 | struct drm_property *tv_flicker_reduction_property; | |
a75f0236 FJ |
790 | struct drm_property *tv_overscan_property; |
791 | struct drm_property *tv_saturation_property; | |
792 | struct drm_property *tv_hue_property; | |
f453ba04 DA |
793 | |
794 | /* Optional properties */ | |
795 | struct drm_property *scaling_mode_property; | |
796 | struct drm_property *dithering_mode_property; | |
884840aa | 797 | struct drm_property *dirty_info_property; |
f453ba04 DA |
798 | }; |
799 | ||
800 | #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) | |
801 | #define obj_to_connector(x) container_of(x, struct drm_connector, base) | |
802 | #define obj_to_encoder(x) container_of(x, struct drm_encoder, base) | |
803 | #define obj_to_mode(x) container_of(x, struct drm_display_mode, base) | |
804 | #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) | |
805 | #define obj_to_property(x) container_of(x, struct drm_property, base) | |
806 | #define obj_to_blob(x) container_of(x, struct drm_property_blob, base) | |
8cf5c917 | 807 | #define obj_to_plane(x) container_of(x, struct drm_plane, base) |
f453ba04 DA |
808 | |
809 | ||
810 | extern void drm_crtc_init(struct drm_device *dev, | |
811 | struct drm_crtc *crtc, | |
812 | const struct drm_crtc_funcs *funcs); | |
813 | extern void drm_crtc_cleanup(struct drm_crtc *crtc); | |
814 | ||
815 | extern void drm_connector_init(struct drm_device *dev, | |
816 | struct drm_connector *connector, | |
817 | const struct drm_connector_funcs *funcs, | |
818 | int connector_type); | |
819 | ||
820 | extern void drm_connector_cleanup(struct drm_connector *connector); | |
821 | ||
822 | extern void drm_encoder_init(struct drm_device *dev, | |
823 | struct drm_encoder *encoder, | |
824 | const struct drm_encoder_funcs *funcs, | |
825 | int encoder_type); | |
826 | ||
8cf5c917 JB |
827 | extern int drm_plane_init(struct drm_device *dev, |
828 | struct drm_plane *plane, | |
829 | unsigned long possible_crtcs, | |
830 | const struct drm_plane_funcs *funcs, | |
22cd7c62 | 831 | const uint32_t *formats, uint32_t format_count); |
8cf5c917 JB |
832 | extern void drm_plane_cleanup(struct drm_plane *plane); |
833 | ||
f453ba04 DA |
834 | extern void drm_encoder_cleanup(struct drm_encoder *encoder); |
835 | ||
836 | extern char *drm_get_connector_name(struct drm_connector *connector); | |
837 | extern char *drm_get_dpms_name(int val); | |
838 | extern char *drm_get_dvi_i_subconnector_name(int val); | |
839 | extern char *drm_get_dvi_i_select_name(int val); | |
840 | extern char *drm_get_tv_subconnector_name(int val); | |
841 | extern char *drm_get_tv_select_name(int val); | |
ea39f835 | 842 | extern void drm_fb_release(struct drm_file *file_priv); |
f453ba04 DA |
843 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); |
844 | extern struct edid *drm_get_edid(struct drm_connector *connector, | |
845 | struct i2c_adapter *adapter); | |
f453ba04 DA |
846 | extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); |
847 | extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); | |
848 | extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); | |
849 | extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, | |
b1f559ec | 850 | const struct drm_display_mode *mode); |
f453ba04 DA |
851 | extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); |
852 | extern void drm_mode_config_init(struct drm_device *dev); | |
eb033556 | 853 | extern void drm_mode_config_reset(struct drm_device *dev); |
f453ba04 DA |
854 | extern void drm_mode_config_cleanup(struct drm_device *dev); |
855 | extern void drm_mode_set_name(struct drm_display_mode *mode); | |
856 | extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2); | |
857 | extern int drm_mode_width(struct drm_display_mode *mode); | |
858 | extern int drm_mode_height(struct drm_display_mode *mode); | |
859 | ||
860 | /* for us by fb module */ | |
861 | extern int drm_mode_attachmode_crtc(struct drm_device *dev, | |
862 | struct drm_crtc *crtc, | |
863 | struct drm_display_mode *mode); | |
864 | extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode); | |
865 | ||
866 | extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); | |
867 | extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode); | |
868 | extern void drm_mode_list_concat(struct list_head *head, | |
869 | struct list_head *new); | |
870 | extern void drm_mode_validate_size(struct drm_device *dev, | |
871 | struct list_head *mode_list, | |
872 | int maxX, int maxY, int maxPitch); | |
873 | extern void drm_mode_prune_invalid(struct drm_device *dev, | |
874 | struct list_head *mode_list, bool verbose); | |
875 | extern void drm_mode_sort(struct list_head *mode_list); | |
b1f559ec CW |
876 | extern int drm_mode_hsync(const struct drm_display_mode *mode); |
877 | extern int drm_mode_vrefresh(const struct drm_display_mode *mode); | |
f453ba04 DA |
878 | extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, |
879 | int adjust_flags); | |
880 | extern void drm_mode_connector_list_update(struct drm_connector *connector); | |
881 | extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, | |
882 | struct edid *edid); | |
883 | extern int drm_connector_property_set_value(struct drm_connector *connector, | |
884 | struct drm_property *property, | |
885 | uint64_t value); | |
886 | extern int drm_connector_property_get_value(struct drm_connector *connector, | |
887 | struct drm_property *property, | |
888 | uint64_t *value); | |
889 | extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev); | |
890 | extern void drm_framebuffer_set_object(struct drm_device *dev, | |
891 | unsigned long handle); | |
892 | extern int drm_framebuffer_init(struct drm_device *dev, | |
893 | struct drm_framebuffer *fb, | |
894 | const struct drm_framebuffer_funcs *funcs); | |
895 | extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb); | |
896 | extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc); | |
897 | extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb); | |
898 | extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY); | |
899 | extern bool drm_crtc_in_use(struct drm_crtc *crtc); | |
900 | ||
901 | extern int drm_connector_attach_property(struct drm_connector *connector, | |
902 | struct drm_property *property, uint64_t init_val); | |
903 | extern struct drm_property *drm_property_create(struct drm_device *dev, int flags, | |
904 | const char *name, int num_values); | |
905 | extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); | |
906 | extern int drm_property_add_enum(struct drm_property *property, int index, | |
907 | uint64_t value, const char *name); | |
908 | extern int drm_mode_create_dvi_i_properties(struct drm_device *dev); | |
909 | extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, | |
910 | char *formats[]); | |
911 | extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); | |
912 | extern int drm_mode_create_dithering_property(struct drm_device *dev); | |
884840aa | 913 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); |
f453ba04 DA |
914 | extern char *drm_get_encoder_name(struct drm_encoder *encoder); |
915 | ||
916 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, | |
917 | struct drm_encoder *encoder); | |
918 | extern void drm_mode_connector_detach_encoder(struct drm_connector *connector, | |
919 | struct drm_encoder *encoder); | |
920 | extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, | |
921 | int gamma_size); | |
7a9c9060 DV |
922 | extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, |
923 | uint32_t id, uint32_t type); | |
f453ba04 DA |
924 | /* IOCTLs */ |
925 | extern int drm_mode_getresources(struct drm_device *dev, | |
926 | void *data, struct drm_file *file_priv); | |
8cf5c917 JB |
927 | extern int drm_mode_getplane_res(struct drm_device *dev, void *data, |
928 | struct drm_file *file_priv); | |
f453ba04 DA |
929 | extern int drm_mode_getcrtc(struct drm_device *dev, |
930 | void *data, struct drm_file *file_priv); | |
931 | extern int drm_mode_getconnector(struct drm_device *dev, | |
932 | void *data, struct drm_file *file_priv); | |
933 | extern int drm_mode_setcrtc(struct drm_device *dev, | |
934 | void *data, struct drm_file *file_priv); | |
8cf5c917 JB |
935 | extern int drm_mode_getplane(struct drm_device *dev, |
936 | void *data, struct drm_file *file_priv); | |
937 | extern int drm_mode_setplane(struct drm_device *dev, | |
938 | void *data, struct drm_file *file_priv); | |
f453ba04 DA |
939 | extern int drm_mode_cursor_ioctl(struct drm_device *dev, |
940 | void *data, struct drm_file *file_priv); | |
941 | extern int drm_mode_addfb(struct drm_device *dev, | |
942 | void *data, struct drm_file *file_priv); | |
308e5bcb JB |
943 | extern int drm_mode_addfb2(struct drm_device *dev, |
944 | void *data, struct drm_file *file_priv); | |
945 | extern uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); | |
f453ba04 DA |
946 | extern int drm_mode_rmfb(struct drm_device *dev, |
947 | void *data, struct drm_file *file_priv); | |
948 | extern int drm_mode_getfb(struct drm_device *dev, | |
949 | void *data, struct drm_file *file_priv); | |
884840aa JB |
950 | extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev, |
951 | void *data, struct drm_file *file_priv); | |
f453ba04 DA |
952 | extern int drm_mode_addmode_ioctl(struct drm_device *dev, |
953 | void *data, struct drm_file *file_priv); | |
954 | extern int drm_mode_rmmode_ioctl(struct drm_device *dev, | |
955 | void *data, struct drm_file *file_priv); | |
956 | extern int drm_mode_attachmode_ioctl(struct drm_device *dev, | |
957 | void *data, struct drm_file *file_priv); | |
958 | extern int drm_mode_detachmode_ioctl(struct drm_device *dev, | |
959 | void *data, struct drm_file *file_priv); | |
960 | ||
961 | extern int drm_mode_getproperty_ioctl(struct drm_device *dev, | |
962 | void *data, struct drm_file *file_priv); | |
963 | extern int drm_mode_getblob_ioctl(struct drm_device *dev, | |
964 | void *data, struct drm_file *file_priv); | |
965 | extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev, | |
966 | void *data, struct drm_file *file_priv); | |
967 | extern int drm_mode_hotplug_ioctl(struct drm_device *dev, | |
968 | void *data, struct drm_file *file_priv); | |
969 | extern int drm_mode_replacefb(struct drm_device *dev, | |
970 | void *data, struct drm_file *file_priv); | |
971 | extern int drm_mode_getencoder(struct drm_device *dev, | |
972 | void *data, struct drm_file *file_priv); | |
973 | extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, | |
974 | void *data, struct drm_file *file_priv); | |
975 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, | |
976 | void *data, struct drm_file *file_priv); | |
eccaca28 | 977 | extern u8 *drm_find_cea_extension(struct edid *edid); |
f23c20c8 | 978 | extern bool drm_detect_hdmi_monitor(struct edid *edid); |
8fe9790d | 979 | extern bool drm_detect_monitor_audio(struct edid *edid); |
d91d8a3f KH |
980 | extern int drm_mode_page_flip_ioctl(struct drm_device *dev, |
981 | void *data, struct drm_file *file_priv); | |
d782c3f9 ZY |
982 | extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, |
983 | int hdisplay, int vdisplay, int vrefresh, | |
d50ba256 | 984 | bool reduced, bool interlaced, bool margins); |
26bbdada ZY |
985 | extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, |
986 | int hdisplay, int vdisplay, int vrefresh, | |
987 | bool interlaced, int margins); | |
7a374350 AJ |
988 | extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, |
989 | int hdisplay, int vdisplay, int vrefresh, | |
990 | bool interlaced, int margins, int GTF_M, | |
991 | int GTF_2C, int GTF_K, int GTF_2J); | |
f0fda0a4 ZY |
992 | extern int drm_add_modes_noedid(struct drm_connector *connector, |
993 | int hdisplay, int vdisplay); | |
3c537889 | 994 | |
051963d4 | 995 | extern int drm_edid_header_is_valid(const u8 *raw_edid); |
3c537889 | 996 | extern bool drm_edid_is_valid(struct edid *edid); |
1d42bbc8 DA |
997 | struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, |
998 | int hsize, int vsize, int fresh); | |
ff72145b DA |
999 | |
1000 | extern int drm_mode_create_dumb_ioctl(struct drm_device *dev, | |
1001 | void *data, struct drm_file *file_priv); | |
1002 | extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev, | |
1003 | void *data, struct drm_file *file_priv); | |
1004 | extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, | |
1005 | void *data, struct drm_file *file_priv); | |
248dbc23 DA |
1006 | |
1007 | extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, | |
1008 | int *bpp); | |
f453ba04 | 1009 | #endif /* __DRM_CRTC_H__ */ |