2 * Copyright © 2006 Keith Packard
3 * Copyright © 2007-2008 Dave Airlie
4 * Copyright © 2007-2008 Intel Corporation
5 * Jesse Barnes <jesse.barnes@intel.com>
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:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
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.
25 #ifndef __DRM_CRTC_H__
26 #define __DRM_CRTC_H__
28 #include <linux/i2c.h>
29 #include <linux/spinlock.h>
30 #include <linux/types.h>
31 #include <linux/idr.h>
37 struct drm_framebuffer
;
40 #define DRM_MODE_OBJECT_CRTC 0xcccccccc
41 #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
42 #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
43 #define DRM_MODE_OBJECT_MODE 0xdededede
44 #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
45 #define DRM_MODE_OBJECT_FB 0xfbfbfbfb
46 #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
48 struct drm_mode_object
{
54 * Note on terminology: here, for brevity and convenience, we refer to connector
55 * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS,
56 * DVI, etc. And 'screen' refers to the whole of the visible display, which
57 * may span multiple monitors (and therefore multiple CRTC and connector
61 enum drm_mode_status
{
62 MODE_OK
= 0, /* Mode OK */
63 MODE_HSYNC
, /* hsync out of range */
64 MODE_VSYNC
, /* vsync out of range */
65 MODE_H_ILLEGAL
, /* mode has illegal horizontal timings */
66 MODE_V_ILLEGAL
, /* mode has illegal horizontal timings */
67 MODE_BAD_WIDTH
, /* requires an unsupported linepitch */
68 MODE_NOMODE
, /* no mode with a maching name */
69 MODE_NO_INTERLACE
, /* interlaced mode not supported */
70 MODE_NO_DBLESCAN
, /* doublescan mode not supported */
71 MODE_NO_VSCAN
, /* multiscan mode not supported */
72 MODE_MEM
, /* insufficient video memory */
73 MODE_VIRTUAL_X
, /* mode width too large for specified virtual size */
74 MODE_VIRTUAL_Y
, /* mode height too large for specified virtual size */
75 MODE_MEM_VIRT
, /* insufficient video memory given virtual size */
76 MODE_NOCLOCK
, /* no fixed clock available */
77 MODE_CLOCK_HIGH
, /* clock required is too high */
78 MODE_CLOCK_LOW
, /* clock required is too low */
79 MODE_CLOCK_RANGE
, /* clock/mode isn't in a ClockRange */
80 MODE_BAD_HVALUE
, /* horizontal timing was out of range */
81 MODE_BAD_VVALUE
, /* vertical timing was out of range */
82 MODE_BAD_VSCAN
, /* VScan value out of range */
83 MODE_HSYNC_NARROW
, /* horizontal sync too narrow */
84 MODE_HSYNC_WIDE
, /* horizontal sync too wide */
85 MODE_HBLANK_NARROW
, /* horizontal blanking too narrow */
86 MODE_HBLANK_WIDE
, /* horizontal blanking too wide */
87 MODE_VSYNC_NARROW
, /* vertical sync too narrow */
88 MODE_VSYNC_WIDE
, /* vertical sync too wide */
89 MODE_VBLANK_NARROW
, /* vertical blanking too narrow */
90 MODE_VBLANK_WIDE
, /* vertical blanking too wide */
91 MODE_PANEL
, /* exceeds panel dimensions */
92 MODE_INTERLACE_WIDTH
, /* width too large for interlaced mode */
93 MODE_ONE_WIDTH
, /* only one width is supported */
94 MODE_ONE_HEIGHT
, /* only one height is supported */
95 MODE_ONE_SIZE
, /* only one resolution is supported */
96 MODE_NO_REDUCED
, /* monitor doesn't accept reduced blanking */
97 MODE_UNVERIFIED
= -3, /* mode needs to reverified */
98 MODE_BAD
= -2, /* unspecified reason */
99 MODE_ERROR
= -1 /* error condition */
102 #define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
103 DRM_MODE_TYPE_CRTC_C)
105 #define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
106 .name = nm, .status = 0, .type = (t), .clock = (c), \
107 .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
108 .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
109 .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
110 .vscan = (vs), .flags = (f), .vrefresh = 0
112 #define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */
114 struct drm_display_mode
{
116 struct list_head head
;
117 struct drm_mode_object base
;
119 char name
[DRM_DISPLAY_MODE_LEN
];
122 enum drm_mode_status status
;
125 /* Proposed mode values */
126 int clock
; /* in kHz */
139 /* Addressable image size (may be 0 for projectors, etc.) */
143 /* Actual mode we give to hw */
147 int crtc_hblank_start
;
149 int crtc_hsync_start
;
154 int crtc_vblank_start
;
156 int crtc_vsync_start
;
162 /* Driver private mode info */
167 int vrefresh
; /* in Hz */
168 int hsync
; /* in kHz */
171 enum drm_connector_status
{
172 connector_status_connected
= 1,
173 connector_status_disconnected
= 2,
174 connector_status_unknown
= 3,
177 enum subpixel_order
{
179 SubPixelHorizontalRGB
,
180 SubPixelHorizontalBGR
,
188 * Describes a given display (e.g. CRT or flat panel) and its limitations.
190 struct drm_display_info
{
191 char name
[DRM_DISPLAY_INFO_LEN
];
194 unsigned int width_mm
;
195 unsigned int height_mm
;
197 unsigned int min_vfreq
, max_vfreq
;
198 unsigned int min_hfreq
, max_hfreq
;
199 unsigned int pixel_clock
;
201 enum subpixel_order subpixel_order
;
203 char *raw_edid
; /* if any */
206 struct drm_framebuffer_funcs
{
207 void (*destroy
)(struct drm_framebuffer
*framebuffer
);
208 int (*create_handle
)(struct drm_framebuffer
*fb
,
209 struct drm_file
*file_priv
,
210 unsigned int *handle
);
212 * Optinal callback for the dirty fb ioctl.
214 * Userspace can notify the driver via this callback
215 * that a area of the framebuffer has changed and should
216 * be flushed to the display hardware.
218 * See documentation in drm_mode.h for the struct
219 * drm_mode_fb_dirty_cmd for more information as all
220 * the semantics and arguments have a one to one mapping
223 int (*dirty
)(struct drm_framebuffer
*framebuffer
, unsigned flags
,
224 unsigned color
, struct drm_clip_rect
*clips
,
228 struct drm_framebuffer
{
229 struct drm_device
*dev
;
230 struct list_head head
;
231 struct drm_mode_object base
;
232 const struct drm_framebuffer_funcs
*funcs
;
236 /* depth can be 15 or 16 */
240 struct list_head filp_head
;
241 /* if you are using the helper */
242 void *helper_private
;
245 struct drm_property_blob
{
246 struct drm_mode_object base
;
247 struct list_head head
;
252 struct drm_property_enum
{
254 struct list_head head
;
255 char name
[DRM_PROP_NAME_LEN
];
258 struct drm_property
{
259 struct list_head head
;
260 struct drm_mode_object base
;
262 char name
[DRM_PROP_NAME_LEN
];
266 struct list_head enum_blob_list
;
270 struct drm_connector
;
272 struct drm_pending_vblank_event
;
275 * drm_crtc_funcs - control CRTCs for a given device
276 * @dpms: control display power levels
277 * @save: save CRTC state
278 * @resore: restore CRTC state
279 * @lock: lock the CRTC
280 * @unlock: unlock the CRTC
281 * @shadow_allocate: allocate shadow pixmap
282 * @shadow_create: create shadow pixmap for rotation support
283 * @shadow_destroy: free shadow pixmap
284 * @mode_fixup: fixup proposed mode
285 * @mode_set: set the desired mode on the CRTC
286 * @gamma_set: specify color ramp for CRTC
287 * @destroy: deinit and free object.
289 * The drm_crtc_funcs structure is the central CRTC management structure
290 * in the DRM. Each CRTC controls one or more connectors (note that the name
291 * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc.
292 * connectors, not just CRTs).
294 * Each driver is responsible for filling out this structure at startup time,
295 * in addition to providing other modesetting features, like i2c and DDC
298 struct drm_crtc_funcs
{
299 /* Save CRTC state */
300 void (*save
)(struct drm_crtc
*crtc
); /* suspend? */
301 /* Restore CRTC state */
302 void (*restore
)(struct drm_crtc
*crtc
); /* resume? */
304 /* cursor controls */
305 int (*cursor_set
)(struct drm_crtc
*crtc
, struct drm_file
*file_priv
,
306 uint32_t handle
, uint32_t width
, uint32_t height
);
307 int (*cursor_move
)(struct drm_crtc
*crtc
, int x
, int y
);
309 /* Set gamma on the CRTC */
310 void (*gamma_set
)(struct drm_crtc
*crtc
, u16
*r
, u16
*g
, u16
*b
,
311 uint32_t start
, uint32_t size
);
312 /* Object destroy routine */
313 void (*destroy
)(struct drm_crtc
*crtc
);
315 int (*set_config
)(struct drm_mode_set
*set
);
318 * Flip to the given framebuffer. This implements the page
319 * flip ioctl descibed in drm_mode.h, specifically, the
320 * implementation must return immediately and block all
321 * rendering to the current fb until the flip has completed.
322 * If userspace set the event flag in the ioctl, the event
323 * argument will point to an event to send back when the flip
324 * completes, otherwise it will be NULL.
326 int (*page_flip
)(struct drm_crtc
*crtc
,
327 struct drm_framebuffer
*fb
,
328 struct drm_pending_vblank_event
*event
);
332 * drm_crtc - central CRTC control structure
333 * @enabled: is this CRTC enabled?
334 * @x: x position on screen
335 * @y: y position on screen
336 * @funcs: CRTC control functions
338 * Each CRTC may have one or more connectors associated with it. This structure
339 * allows the CRTC to be controlled.
342 struct drm_device
*dev
;
343 struct list_head head
;
345 struct drm_mode_object base
;
347 /* framebuffer the connector is currently bound to */
348 struct drm_framebuffer
*fb
;
352 struct drm_display_mode mode
;
355 const struct drm_crtc_funcs
*funcs
;
357 /* CRTC gamma size for reporting to userspace */
359 uint16_t *gamma_store
;
361 /* if you are using the helper */
362 void *helper_private
;
367 * drm_connector_funcs - control connectors on a given device
368 * @dpms: set power state (see drm_crtc_funcs above)
369 * @save: save connector state
370 * @restore: restore connector state
371 * @mode_valid: is this mode valid on the given connector?
372 * @mode_fixup: try to fixup proposed mode for this connector
373 * @mode_set: set this mode
374 * @detect: is this connector active?
375 * @get_modes: get mode list for this connector
376 * @set_property: property for this connector may need update
377 * @destroy: make object go away
378 * @force: notify the driver the connector is forced on
380 * Each CRTC may have one or more connectors attached to it. The functions
381 * below allow the core DRM code to control connectors, enumerate available modes,
384 struct drm_connector_funcs
{
385 void (*dpms
)(struct drm_connector
*connector
, int mode
);
386 void (*save
)(struct drm_connector
*connector
);
387 void (*restore
)(struct drm_connector
*connector
);
389 /* Check to see if anything is attached to the connector.
390 * @force is set to false whilst polling, true when checking the
391 * connector due to user request. @force can be used by the driver
392 * to avoid expensive, destructive operations during automated
395 enum drm_connector_status (*detect
)(struct drm_connector
*connector
,
397 int (*fill_modes
)(struct drm_connector
*connector
, uint32_t max_width
, uint32_t max_height
);
398 int (*set_property
)(struct drm_connector
*connector
, struct drm_property
*property
,
400 void (*destroy
)(struct drm_connector
*connector
);
401 void (*force
)(struct drm_connector
*connector
);
404 struct drm_encoder_funcs
{
405 void (*destroy
)(struct drm_encoder
*encoder
);
408 #define DRM_CONNECTOR_MAX_UMODES 16
409 #define DRM_CONNECTOR_MAX_PROPERTY 16
410 #define DRM_CONNECTOR_LEN 32
411 #define DRM_CONNECTOR_MAX_ENCODER 2
414 * drm_encoder - central DRM encoder structure
417 struct drm_device
*dev
;
418 struct list_head head
;
420 struct drm_mode_object base
;
422 uint32_t possible_crtcs
;
423 uint32_t possible_clones
;
425 struct drm_crtc
*crtc
;
426 const struct drm_encoder_funcs
*funcs
;
427 void *helper_private
;
430 enum drm_connector_force
{
431 DRM_FORCE_UNSPECIFIED
,
433 DRM_FORCE_ON
, /* force on analog part normally */
434 DRM_FORCE_ON_DIGITAL
, /* for DVI-I use digital connector */
437 /* should we poll this connector for connects and disconnects */
438 /* hot plug detectable */
439 #define DRM_CONNECTOR_POLL_HPD (1 << 0)
440 /* poll for connections */
441 #define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
442 /* can cleanly poll for disconnections without flickering the screen */
443 /* DACs should rarely do this without a lot of testing */
444 #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
447 * drm_connector - central DRM connector control structure
448 * @crtc: CRTC this connector is currently connected to, NULL if none
449 * @interlace_allowed: can this connector handle interlaced modes?
450 * @doublescan_allowed: can this connector handle doublescan?
451 * @available_modes: modes available on this connector (from get_modes() + user)
452 * @initial_x: initial x position for this connector
453 * @initial_y: initial y position for this connector
454 * @status: connector connected?
455 * @funcs: connector control functions
457 * Each connector may be connected to one or more CRTCs, or may be clonable by
458 * another connector if they can share a CRTC. Each connector also has a specific
459 * position in the broader display (referred to as a 'screen' though it could
460 * span multiple monitors).
462 struct drm_connector
{
463 struct drm_device
*dev
;
465 struct device_attribute
*attr
;
466 struct list_head head
;
468 struct drm_mode_object base
;
471 int connector_type_id
;
472 bool interlace_allowed
;
473 bool doublescan_allowed
;
474 struct list_head modes
; /* list of modes on this connector */
476 int initial_x
, initial_y
;
477 enum drm_connector_status status
;
479 /* these are modes added by probing with DDC or the BIOS */
480 struct list_head probed_modes
;
482 struct drm_display_info display_info
;
483 const struct drm_connector_funcs
*funcs
;
485 struct list_head user_modes
;
486 struct drm_property_blob
*edid_blob_ptr
;
487 u32 property_ids
[DRM_CONNECTOR_MAX_PROPERTY
];
488 uint64_t property_values
[DRM_CONNECTOR_MAX_PROPERTY
];
490 uint8_t polled
; /* DRM_CONNECTOR_POLL_* */
492 /* requested DPMS state */
495 void *helper_private
;
497 /* forced on connector */
498 enum drm_connector_force force
;
499 uint32_t encoder_ids
[DRM_CONNECTOR_MAX_ENCODER
];
500 uint32_t force_encoder_id
;
501 struct drm_encoder
*encoder
; /* currently active encoder */
505 * struct drm_mode_set
507 * Represents a single crtc the connectors that it drives with what mode
508 * and from which framebuffer it scans out from.
510 * This is used to set modes.
512 struct drm_mode_set
{
513 struct list_head head
;
515 struct drm_framebuffer
*fb
;
516 struct drm_crtc
*crtc
;
517 struct drm_display_mode
*mode
;
522 struct drm_connector
**connectors
;
523 size_t num_connectors
;
527 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout
529 struct drm_mode_config_funcs
{
530 struct drm_framebuffer
*(*fb_create
)(struct drm_device
*dev
, struct drm_file
*file_priv
, struct drm_mode_fb_cmd
*mode_cmd
);
531 void (*output_poll_changed
)(struct drm_device
*dev
);
534 struct drm_mode_group
{
536 uint32_t num_encoders
;
537 uint32_t num_connectors
;
539 /* list of object IDs for this group */
544 * drm_mode_config - Mode configuration control structure
547 struct drm_mode_config
{
548 struct mutex mutex
; /* protects configuration (mode lists etc.) */
549 struct mutex idr_mutex
; /* for IDR management */
550 struct idr crtc_idr
; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
551 /* this is limited to one for now */
553 struct list_head fb_list
;
555 struct list_head connector_list
;
557 struct list_head encoder_list
;
560 struct list_head crtc_list
;
562 struct list_head property_list
;
564 int min_width
, min_height
;
565 int max_width
, max_height
;
566 struct drm_mode_config_funcs
*funcs
;
567 resource_size_t fb_base
;
569 /* output poll support */
571 struct delayed_work output_poll_work
;
573 /* pointers to standard properties */
574 struct list_head property_blob_list
;
575 struct drm_property
*edid_property
;
576 struct drm_property
*dpms_property
;
578 /* DVI-I properties */
579 struct drm_property
*dvi_i_subconnector_property
;
580 struct drm_property
*dvi_i_select_subconnector_property
;
583 struct drm_property
*tv_subconnector_property
;
584 struct drm_property
*tv_select_subconnector_property
;
585 struct drm_property
*tv_mode_property
;
586 struct drm_property
*tv_left_margin_property
;
587 struct drm_property
*tv_right_margin_property
;
588 struct drm_property
*tv_top_margin_property
;
589 struct drm_property
*tv_bottom_margin_property
;
590 struct drm_property
*tv_brightness_property
;
591 struct drm_property
*tv_contrast_property
;
592 struct drm_property
*tv_flicker_reduction_property
;
593 struct drm_property
*tv_overscan_property
;
594 struct drm_property
*tv_saturation_property
;
595 struct drm_property
*tv_hue_property
;
597 /* Optional properties */
598 struct drm_property
*scaling_mode_property
;
599 struct drm_property
*dithering_mode_property
;
600 struct drm_property
*dirty_info_property
;
603 #define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
604 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
605 #define obj_to_encoder(x) container_of(x, struct drm_encoder, base)
606 #define obj_to_mode(x) container_of(x, struct drm_display_mode, base)
607 #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
608 #define obj_to_property(x) container_of(x, struct drm_property, base)
609 #define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
612 extern void drm_crtc_init(struct drm_device
*dev
,
613 struct drm_crtc
*crtc
,
614 const struct drm_crtc_funcs
*funcs
);
615 extern void drm_crtc_cleanup(struct drm_crtc
*crtc
);
617 extern void drm_connector_init(struct drm_device
*dev
,
618 struct drm_connector
*connector
,
619 const struct drm_connector_funcs
*funcs
,
622 extern void drm_connector_cleanup(struct drm_connector
*connector
);
624 extern void drm_encoder_init(struct drm_device
*dev
,
625 struct drm_encoder
*encoder
,
626 const struct drm_encoder_funcs
*funcs
,
629 extern void drm_encoder_cleanup(struct drm_encoder
*encoder
);
631 extern char *drm_get_connector_name(struct drm_connector
*connector
);
632 extern char *drm_get_dpms_name(int val
);
633 extern char *drm_get_dvi_i_subconnector_name(int val
);
634 extern char *drm_get_dvi_i_select_name(int val
);
635 extern char *drm_get_tv_subconnector_name(int val
);
636 extern char *drm_get_tv_select_name(int val
);
637 extern void drm_fb_release(struct drm_file
*file_priv
);
638 extern int drm_mode_group_init_legacy_group(struct drm_device
*dev
, struct drm_mode_group
*group
);
639 extern struct edid
*drm_get_edid(struct drm_connector
*connector
,
640 struct i2c_adapter
*adapter
);
641 extern int drm_add_edid_modes(struct drm_connector
*connector
, struct edid
*edid
);
642 extern void drm_mode_probed_add(struct drm_connector
*connector
, struct drm_display_mode
*mode
);
643 extern void drm_mode_remove(struct drm_connector
*connector
, struct drm_display_mode
*mode
);
644 extern struct drm_display_mode
*drm_mode_duplicate(struct drm_device
*dev
,
645 struct drm_display_mode
*mode
);
646 extern void drm_mode_debug_printmodeline(struct drm_display_mode
*mode
);
647 extern void drm_mode_config_init(struct drm_device
*dev
);
648 extern void drm_mode_config_cleanup(struct drm_device
*dev
);
649 extern void drm_mode_set_name(struct drm_display_mode
*mode
);
650 extern bool drm_mode_equal(struct drm_display_mode
*mode1
, struct drm_display_mode
*mode2
);
651 extern int drm_mode_width(struct drm_display_mode
*mode
);
652 extern int drm_mode_height(struct drm_display_mode
*mode
);
654 /* for us by fb module */
655 extern int drm_mode_attachmode_crtc(struct drm_device
*dev
,
656 struct drm_crtc
*crtc
,
657 struct drm_display_mode
*mode
);
658 extern int drm_mode_detachmode_crtc(struct drm_device
*dev
, struct drm_display_mode
*mode
);
660 extern struct drm_display_mode
*drm_mode_create(struct drm_device
*dev
);
661 extern void drm_mode_destroy(struct drm_device
*dev
, struct drm_display_mode
*mode
);
662 extern void drm_mode_list_concat(struct list_head
*head
,
663 struct list_head
*new);
664 extern void drm_mode_validate_size(struct drm_device
*dev
,
665 struct list_head
*mode_list
,
666 int maxX
, int maxY
, int maxPitch
);
667 extern void drm_mode_prune_invalid(struct drm_device
*dev
,
668 struct list_head
*mode_list
, bool verbose
);
669 extern void drm_mode_sort(struct list_head
*mode_list
);
670 extern int drm_mode_hsync(struct drm_display_mode
*mode
);
671 extern int drm_mode_vrefresh(struct drm_display_mode
*mode
);
672 extern void drm_mode_set_crtcinfo(struct drm_display_mode
*p
,
674 extern void drm_mode_connector_list_update(struct drm_connector
*connector
);
675 extern int drm_mode_connector_update_edid_property(struct drm_connector
*connector
,
677 extern int drm_connector_property_set_value(struct drm_connector
*connector
,
678 struct drm_property
*property
,
680 extern int drm_connector_property_get_value(struct drm_connector
*connector
,
681 struct drm_property
*property
,
683 extern struct drm_display_mode
*drm_crtc_mode_create(struct drm_device
*dev
);
684 extern void drm_framebuffer_set_object(struct drm_device
*dev
,
685 unsigned long handle
);
686 extern int drm_framebuffer_init(struct drm_device
*dev
,
687 struct drm_framebuffer
*fb
,
688 const struct drm_framebuffer_funcs
*funcs
);
689 extern void drm_framebuffer_cleanup(struct drm_framebuffer
*fb
);
690 extern int drmfb_probe(struct drm_device
*dev
, struct drm_crtc
*crtc
);
691 extern int drmfb_remove(struct drm_device
*dev
, struct drm_framebuffer
*fb
);
692 extern void drm_crtc_probe_connector_modes(struct drm_device
*dev
, int maxX
, int maxY
);
693 extern bool drm_crtc_in_use(struct drm_crtc
*crtc
);
695 extern int drm_connector_attach_property(struct drm_connector
*connector
,
696 struct drm_property
*property
, uint64_t init_val
);
697 extern struct drm_property
*drm_property_create(struct drm_device
*dev
, int flags
,
698 const char *name
, int num_values
);
699 extern void drm_property_destroy(struct drm_device
*dev
, struct drm_property
*property
);
700 extern int drm_property_add_enum(struct drm_property
*property
, int index
,
701 uint64_t value
, const char *name
);
702 extern int drm_mode_create_dvi_i_properties(struct drm_device
*dev
);
703 extern int drm_mode_create_tv_properties(struct drm_device
*dev
, int num_formats
,
705 extern int drm_mode_create_scaling_mode_property(struct drm_device
*dev
);
706 extern int drm_mode_create_dithering_property(struct drm_device
*dev
);
707 extern int drm_mode_create_dirty_info_property(struct drm_device
*dev
);
708 extern char *drm_get_encoder_name(struct drm_encoder
*encoder
);
710 extern int drm_mode_connector_attach_encoder(struct drm_connector
*connector
,
711 struct drm_encoder
*encoder
);
712 extern void drm_mode_connector_detach_encoder(struct drm_connector
*connector
,
713 struct drm_encoder
*encoder
);
714 extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc
*crtc
,
716 extern struct drm_mode_object
*drm_mode_object_find(struct drm_device
*dev
,
717 uint32_t id
, uint32_t type
);
719 extern int drm_mode_getresources(struct drm_device
*dev
,
720 void *data
, struct drm_file
*file_priv
);
722 extern int drm_mode_getcrtc(struct drm_device
*dev
,
723 void *data
, struct drm_file
*file_priv
);
724 extern int drm_mode_getconnector(struct drm_device
*dev
,
725 void *data
, struct drm_file
*file_priv
);
726 extern int drm_mode_setcrtc(struct drm_device
*dev
,
727 void *data
, struct drm_file
*file_priv
);
728 extern int drm_mode_cursor_ioctl(struct drm_device
*dev
,
729 void *data
, struct drm_file
*file_priv
);
730 extern int drm_mode_addfb(struct drm_device
*dev
,
731 void *data
, struct drm_file
*file_priv
);
732 extern int drm_mode_rmfb(struct drm_device
*dev
,
733 void *data
, struct drm_file
*file_priv
);
734 extern int drm_mode_getfb(struct drm_device
*dev
,
735 void *data
, struct drm_file
*file_priv
);
736 extern int drm_mode_dirtyfb_ioctl(struct drm_device
*dev
,
737 void *data
, struct drm_file
*file_priv
);
738 extern int drm_mode_addmode_ioctl(struct drm_device
*dev
,
739 void *data
, struct drm_file
*file_priv
);
740 extern int drm_mode_rmmode_ioctl(struct drm_device
*dev
,
741 void *data
, struct drm_file
*file_priv
);
742 extern int drm_mode_attachmode_ioctl(struct drm_device
*dev
,
743 void *data
, struct drm_file
*file_priv
);
744 extern int drm_mode_detachmode_ioctl(struct drm_device
*dev
,
745 void *data
, struct drm_file
*file_priv
);
747 extern int drm_mode_getproperty_ioctl(struct drm_device
*dev
,
748 void *data
, struct drm_file
*file_priv
);
749 extern int drm_mode_getblob_ioctl(struct drm_device
*dev
,
750 void *data
, struct drm_file
*file_priv
);
751 extern int drm_mode_connector_property_set_ioctl(struct drm_device
*dev
,
752 void *data
, struct drm_file
*file_priv
);
753 extern int drm_mode_hotplug_ioctl(struct drm_device
*dev
,
754 void *data
, struct drm_file
*file_priv
);
755 extern int drm_mode_replacefb(struct drm_device
*dev
,
756 void *data
, struct drm_file
*file_priv
);
757 extern int drm_mode_getencoder(struct drm_device
*dev
,
758 void *data
, struct drm_file
*file_priv
);
759 extern int drm_mode_gamma_get_ioctl(struct drm_device
*dev
,
760 void *data
, struct drm_file
*file_priv
);
761 extern int drm_mode_gamma_set_ioctl(struct drm_device
*dev
,
762 void *data
, struct drm_file
*file_priv
);
763 extern bool drm_detect_hdmi_monitor(struct edid
*edid
);
764 extern int drm_mode_page_flip_ioctl(struct drm_device
*dev
,
765 void *data
, struct drm_file
*file_priv
);
766 extern struct drm_display_mode
*drm_cvt_mode(struct drm_device
*dev
,
767 int hdisplay
, int vdisplay
, int vrefresh
,
768 bool reduced
, bool interlaced
, bool margins
);
769 extern struct drm_display_mode
*drm_gtf_mode(struct drm_device
*dev
,
770 int hdisplay
, int vdisplay
, int vrefresh
,
771 bool interlaced
, int margins
);
772 extern struct drm_display_mode
*drm_gtf_mode_complex(struct drm_device
*dev
,
773 int hdisplay
, int vdisplay
, int vrefresh
,
774 bool interlaced
, int margins
, int GTF_M
,
775 int GTF_2C
, int GTF_K
, int GTF_2J
);
776 extern int drm_add_modes_noedid(struct drm_connector
*connector
,
777 int hdisplay
, int vdisplay
);
779 extern bool drm_edid_is_valid(struct edid
*edid
);
780 struct drm_display_mode
*drm_mode_find_dmt(struct drm_device
*dev
,
781 int hsize
, int vsize
, int fresh
);
782 #endif /* __DRM_CRTC_H__ */