1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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>
32#include <linux/fb.h>
33
34#include <drm/drm_fourcc.h>
35
36struct drm_device;
37struct drm_mode_set;
38struct drm_framebuffer;
39struct drm_object_properties;
40
41
42#define DRM_MODE_OBJECT_CRTC 0xcccccccc
43#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
44#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
45#define DRM_MODE_OBJECT_MODE 0xdededede
46#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
47#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
48#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
49#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
50
51struct drm_mode_object {
52 uint32_t id;
53 uint32_t type;
54 struct drm_object_properties *properties;
55};
56
57#define DRM_OBJECT_MAX_PROPERTY 24
58struct drm_object_properties {
59 int count;
60 uint32_t ids[DRM_OBJECT_MAX_PROPERTY];
61 uint64_t values[DRM_OBJECT_MAX_PROPERTY];
62};
63
64
65
66
67
68
69
70
71
72enum drm_mode_status {
73 MODE_OK = 0,
74 MODE_HSYNC,
75 MODE_VSYNC,
76 MODE_H_ILLEGAL,
77 MODE_V_ILLEGAL,
78 MODE_BAD_WIDTH,
79 MODE_NOMODE,
80 MODE_NO_INTERLACE,
81 MODE_NO_DBLESCAN,
82 MODE_NO_VSCAN,
83 MODE_MEM,
84 MODE_VIRTUAL_X,
85 MODE_VIRTUAL_Y,
86 MODE_MEM_VIRT,
87 MODE_NOCLOCK,
88 MODE_CLOCK_HIGH,
89 MODE_CLOCK_LOW,
90 MODE_CLOCK_RANGE,
91 MODE_BAD_HVALUE,
92 MODE_BAD_VVALUE,
93 MODE_BAD_VSCAN,
94 MODE_HSYNC_NARROW,
95 MODE_HSYNC_WIDE,
96 MODE_HBLANK_NARROW,
97 MODE_HBLANK_WIDE,
98 MODE_VSYNC_NARROW,
99 MODE_VSYNC_WIDE,
100 MODE_VBLANK_NARROW,
101 MODE_VBLANK_WIDE,
102 MODE_PANEL,
103 MODE_INTERLACE_WIDTH,
104 MODE_ONE_WIDTH,
105 MODE_ONE_HEIGHT,
106 MODE_ONE_SIZE,
107 MODE_NO_REDUCED,
108 MODE_UNVERIFIED = -3,
109 MODE_BAD = -2,
110 MODE_ERROR = -1
111};
112
113#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
114 DRM_MODE_TYPE_CRTC_C)
115
116#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
117 .name = nm, .status = 0, .type = (t), .clock = (c), \
118 .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
119 .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
120 .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
121 .vscan = (vs), .flags = (f), .vrefresh = 0, \
122 .base.type = DRM_MODE_OBJECT_MODE
123
124#define CRTC_INTERLACE_HALVE_V 0x1
125
126struct drm_display_mode {
127
128 struct list_head head;
129 struct drm_mode_object base;
130
131 char name[DRM_DISPLAY_MODE_LEN];
132
133 enum drm_mode_status status;
134 unsigned int type;
135
136
137 int clock;
138 int hdisplay;
139 int hsync_start;
140 int hsync_end;
141 int htotal;
142 int hskew;
143 int vdisplay;
144 int vsync_start;
145 int vsync_end;
146 int vtotal;
147 int vscan;
148 unsigned int flags;
149
150
151 int width_mm;
152 int height_mm;
153
154
155 int clock_index;
156 int synth_clock;
157 int crtc_hdisplay;
158 int crtc_hblank_start;
159 int crtc_hblank_end;
160 int crtc_hsync_start;
161 int crtc_hsync_end;
162 int crtc_htotal;
163 int crtc_hskew;
164 int crtc_vdisplay;
165 int crtc_vblank_start;
166 int crtc_vblank_end;
167 int crtc_vsync_start;
168 int crtc_vsync_end;
169 int crtc_vtotal;
170
171
172 int private_size;
173 int *private;
174 int private_flags;
175
176 int vrefresh;
177 int hsync;
178};
179
180enum drm_connector_status {
181 connector_status_connected = 1,
182 connector_status_disconnected = 2,
183 connector_status_unknown = 3,
184};
185
186enum subpixel_order {
187 SubPixelUnknown = 0,
188 SubPixelHorizontalRGB,
189 SubPixelHorizontalBGR,
190 SubPixelVerticalRGB,
191 SubPixelVerticalBGR,
192 SubPixelNone,
193};
194
195#define DRM_COLOR_FORMAT_RGB444 (1<<0)
196#define DRM_COLOR_FORMAT_YCRCB444 (1<<1)
197#define DRM_COLOR_FORMAT_YCRCB422 (1<<2)
198
199
200
201struct drm_display_info {
202 char name[DRM_DISPLAY_INFO_LEN];
203
204
205 unsigned int width_mm;
206 unsigned int height_mm;
207
208
209 unsigned int min_vfreq, max_vfreq;
210 unsigned int min_hfreq, max_hfreq;
211 unsigned int pixel_clock;
212 unsigned int bpc;
213
214 enum subpixel_order subpixel_order;
215 u32 color_formats;
216
217 u8 cea_rev;
218
219 char *raw_edid;
220};
221
222struct drm_framebuffer_funcs {
223 void (*destroy)(struct drm_framebuffer *framebuffer);
224 int (*create_handle)(struct drm_framebuffer *fb,
225 struct drm_file *file_priv,
226 unsigned int *handle);
227
228
229
230
231
232
233
234
235
236
237
238
239 int (*dirty)(struct drm_framebuffer *framebuffer,
240 struct drm_file *file_priv, unsigned flags,
241 unsigned color, struct drm_clip_rect *clips,
242 unsigned num_clips);
243};
244
245struct drm_framebuffer {
246 struct drm_device *dev;
247 struct list_head head;
248 struct drm_mode_object base;
249 const struct drm_framebuffer_funcs *funcs;
250 unsigned int pitches[4];
251 unsigned int offsets[4];
252 unsigned int width;
253 unsigned int height;
254
255 unsigned int depth;
256 int bits_per_pixel;
257 int flags;
258 uint32_t pixel_format;
259 struct list_head filp_head;
260
261 void *helper_private;
262};
263
264struct drm_property_blob {
265 struct drm_mode_object base;
266 struct list_head head;
267 unsigned int length;
268 unsigned char data[];
269};
270
271struct drm_property_enum {
272 uint64_t value;
273 struct list_head head;
274 char name[DRM_PROP_NAME_LEN];
275};
276
277struct drm_property {
278 struct list_head head;
279 struct drm_mode_object base;
280 uint32_t flags;
281 char name[DRM_PROP_NAME_LEN];
282 uint32_t num_values;
283 uint64_t *values;
284
285 struct list_head enum_blob_list;
286};
287
288struct drm_crtc;
289struct drm_connector;
290struct drm_encoder;
291struct drm_pending_vblank_event;
292struct drm_plane;
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316struct drm_crtc_funcs {
317
318 void (*save)(struct drm_crtc *crtc);
319
320 void (*restore)(struct drm_crtc *crtc);
321
322 void (*reset)(struct drm_crtc *crtc);
323
324
325 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
326 uint32_t handle, uint32_t width, uint32_t height);
327 int (*cursor_move)(struct drm_crtc *crtc, int x, int y);
328
329
330 void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
331 uint32_t start, uint32_t size);
332
333 void (*destroy)(struct drm_crtc *crtc);
334
335 int (*set_config)(struct drm_mode_set *set);
336
337
338
339
340
341
342
343
344
345
346 int (*page_flip)(struct drm_crtc *crtc,
347 struct drm_framebuffer *fb,
348 struct drm_pending_vblank_event *event);
349
350 int (*set_property)(struct drm_crtc *crtc,
351 struct drm_property *property, uint64_t val);
352};
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376struct drm_crtc {
377 struct drm_device *dev;
378 struct list_head head;
379
380 struct drm_mode_object base;
381
382
383 struct drm_framebuffer *fb;
384
385 bool enabled;
386
387
388 struct drm_display_mode mode;
389
390
391
392
393 struct drm_display_mode hwmode;
394
395 int x, y;
396 const struct drm_crtc_funcs *funcs;
397
398
399 uint32_t gamma_size;
400 uint16_t *gamma_store;
401
402
403 s64 framedur_ns, linedur_ns, pixeldur_ns;
404
405
406 void *helper_private;
407
408 struct drm_object_properties properties;
409};
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428struct drm_connector_funcs {
429 void (*dpms)(struct drm_connector *connector, int mode);
430 void (*save)(struct drm_connector *connector);
431 void (*restore)(struct drm_connector *connector);
432 void (*reset)(struct drm_connector *connector);
433
434
435
436
437
438
439
440 enum drm_connector_status (*detect)(struct drm_connector *connector,
441 bool force);
442 int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
443 int (*set_property)(struct drm_connector *connector, struct drm_property *property,
444 uint64_t val);
445 void (*destroy)(struct drm_connector *connector);
446 void (*force)(struct drm_connector *connector);
447};
448
449
450
451
452
453
454
455
456struct drm_encoder_funcs {
457 void (*reset)(struct drm_encoder *encoder);
458 void (*destroy)(struct drm_encoder *encoder);
459};
460
461#define DRM_CONNECTOR_MAX_UMODES 16
462#define DRM_CONNECTOR_LEN 32
463#define DRM_CONNECTOR_MAX_ENCODER 3
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480struct drm_encoder {
481 struct drm_device *dev;
482 struct list_head head;
483
484 struct drm_mode_object base;
485 int encoder_type;
486 uint32_t possible_crtcs;
487 uint32_t possible_clones;
488
489 struct drm_crtc *crtc;
490 const struct drm_encoder_funcs *funcs;
491 void *helper_private;
492};
493
494enum drm_connector_force {
495 DRM_FORCE_UNSPECIFIED,
496 DRM_FORCE_OFF,
497 DRM_FORCE_ON,
498 DRM_FORCE_ON_DIGITAL,
499};
500
501
502
503#define DRM_CONNECTOR_POLL_HPD (1 << 0)
504
505#define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
506
507
508#define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
509
510#define MAX_ELD_BYTES 128
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550struct drm_connector {
551 struct drm_device *dev;
552 struct device kdev;
553 struct device_attribute *attr;
554 struct list_head head;
555
556 struct drm_mode_object base;
557
558 int connector_type;
559 int connector_type_id;
560 bool interlace_allowed;
561 bool doublescan_allowed;
562 struct list_head modes;
563
564 enum drm_connector_status status;
565
566
567 struct list_head probed_modes;
568
569 struct drm_display_info display_info;
570 const struct drm_connector_funcs *funcs;
571
572 struct list_head user_modes;
573 struct drm_property_blob *edid_blob_ptr;
574 struct drm_object_properties properties;
575
576 uint8_t polled;
577
578
579 int dpms;
580
581 void *helper_private;
582
583
584 enum drm_connector_force force;
585 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
586 struct drm_encoder *encoder;
587
588
589 uint8_t eld[MAX_ELD_BYTES];
590 bool dvi_dual;
591 int max_tmds_clock;
592 bool latency_present[2];
593 int video_latency[2];
594 int audio_latency[2];
595 int null_edid_counter;
596};
597
598
599
600
601
602
603
604
605struct drm_plane_funcs {
606 int (*update_plane)(struct drm_plane *plane,
607 struct drm_crtc *crtc, struct drm_framebuffer *fb,
608 int crtc_x, int crtc_y,
609 unsigned int crtc_w, unsigned int crtc_h,
610 uint32_t src_x, uint32_t src_y,
611 uint32_t src_w, uint32_t src_h);
612 int (*disable_plane)(struct drm_plane *plane);
613 void (*destroy)(struct drm_plane *plane);
614
615 int (*set_property)(struct drm_plane *plane,
616 struct drm_property *property, uint64_t val);
617};
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636struct drm_plane {
637 struct drm_device *dev;
638 struct list_head head;
639
640 struct drm_mode_object base;
641
642 uint32_t possible_crtcs;
643 uint32_t *format_types;
644 uint32_t format_count;
645
646 struct drm_crtc *crtc;
647 struct drm_framebuffer *fb;
648
649
650 uint32_t gamma_size;
651 uint16_t *gamma_store;
652
653 bool enabled;
654
655 const struct drm_plane_funcs *funcs;
656 void *helper_private;
657
658 struct drm_object_properties properties;
659};
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677struct drm_mode_set {
678 struct drm_framebuffer *fb;
679 struct drm_crtc *crtc;
680 struct drm_display_mode *mode;
681
682 uint32_t x;
683 uint32_t y;
684
685 struct drm_connector **connectors;
686 size_t num_connectors;
687};
688
689
690
691
692
693
694
695
696
697struct drm_mode_config_funcs {
698 struct drm_framebuffer *(*fb_create)(struct drm_device *dev,
699 struct drm_file *file_priv,
700 struct drm_mode_fb_cmd2 *mode_cmd);
701 void (*output_poll_changed)(struct drm_device *dev);
702};
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717struct drm_mode_group {
718 uint32_t num_crtcs;
719 uint32_t num_encoders;
720 uint32_t num_connectors;
721
722
723 uint32_t *id_list;
724};
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753struct drm_mode_config {
754 struct mutex mutex;
755 struct mutex idr_mutex;
756 struct idr crtc_idr;
757
758 int num_fb;
759 struct list_head fb_list;
760 int num_connector;
761 struct list_head connector_list;
762 int num_encoder;
763 struct list_head encoder_list;
764 int num_plane;
765 struct list_head plane_list;
766
767 int num_crtc;
768 struct list_head crtc_list;
769
770 struct list_head property_list;
771
772 int min_width, min_height;
773 int max_width, max_height;
774 const struct drm_mode_config_funcs *funcs;
775 resource_size_t fb_base;
776
777
778 bool poll_enabled;
779 struct delayed_work output_poll_work;
780
781
782 struct list_head property_blob_list;
783 struct drm_property *edid_property;
784 struct drm_property *dpms_property;
785
786
787 struct drm_property *dvi_i_subconnector_property;
788 struct drm_property *dvi_i_select_subconnector_property;
789
790
791 struct drm_property *tv_subconnector_property;
792 struct drm_property *tv_select_subconnector_property;
793 struct drm_property *tv_mode_property;
794 struct drm_property *tv_left_margin_property;
795 struct drm_property *tv_right_margin_property;
796 struct drm_property *tv_top_margin_property;
797 struct drm_property *tv_bottom_margin_property;
798 struct drm_property *tv_brightness_property;
799 struct drm_property *tv_contrast_property;
800 struct drm_property *tv_flicker_reduction_property;
801 struct drm_property *tv_overscan_property;
802 struct drm_property *tv_saturation_property;
803 struct drm_property *tv_hue_property;
804
805
806 struct drm_property *scaling_mode_property;
807 struct drm_property *dithering_mode_property;
808 struct drm_property *dirty_info_property;
809
810
811 uint32_t preferred_depth, prefer_shadow;
812};
813
814#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
815#define obj_to_connector(x) container_of(x, struct drm_connector, base)
816#define obj_to_encoder(x) container_of(x, struct drm_encoder, base)
817#define obj_to_mode(x) container_of(x, struct drm_display_mode, base)
818#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
819#define obj_to_property(x) container_of(x, struct drm_property, base)
820#define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
821#define obj_to_plane(x) container_of(x, struct drm_plane, base)
822
823struct drm_prop_enum_list {
824 int type;
825 char *name;
826};
827
828extern int drm_crtc_init(struct drm_device *dev,
829 struct drm_crtc *crtc,
830 const struct drm_crtc_funcs *funcs);
831extern void drm_crtc_cleanup(struct drm_crtc *crtc);
832
833extern int drm_connector_init(struct drm_device *dev,
834 struct drm_connector *connector,
835 const struct drm_connector_funcs *funcs,
836 int connector_type);
837
838extern void drm_connector_cleanup(struct drm_connector *connector);
839
840extern void drm_connector_unplug_all(struct drm_device *dev);
841
842extern int drm_encoder_init(struct drm_device *dev,
843 struct drm_encoder *encoder,
844 const struct drm_encoder_funcs *funcs,
845 int encoder_type);
846
847extern int drm_plane_init(struct drm_device *dev,
848 struct drm_plane *plane,
849 unsigned long possible_crtcs,
850 const struct drm_plane_funcs *funcs,
851 const uint32_t *formats, uint32_t format_count,
852 bool priv);
853extern void drm_plane_cleanup(struct drm_plane *plane);
854
855extern void drm_encoder_cleanup(struct drm_encoder *encoder);
856
857extern char *drm_get_connector_name(struct drm_connector *connector);
858extern char *drm_get_dpms_name(int val);
859extern char *drm_get_dvi_i_subconnector_name(int val);
860extern char *drm_get_dvi_i_select_name(int val);
861extern char *drm_get_tv_subconnector_name(int val);
862extern char *drm_get_tv_select_name(int val);
863extern void drm_fb_release(struct drm_file *file_priv);
864extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
865extern struct edid *drm_get_edid(struct drm_connector *connector,
866 struct i2c_adapter *adapter);
867extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
868extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
869extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
870extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src);
871extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
872 const struct drm_display_mode *mode);
873extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
874extern void drm_mode_config_init(struct drm_device *dev);
875extern void drm_mode_config_reset(struct drm_device *dev);
876extern void drm_mode_config_cleanup(struct drm_device *dev);
877extern void drm_mode_set_name(struct drm_display_mode *mode);
878extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2);
879extern int drm_mode_width(struct drm_display_mode *mode);
880extern int drm_mode_height(struct drm_display_mode *mode);
881
882
883extern int drm_mode_attachmode_crtc(struct drm_device *dev,
884 struct drm_crtc *crtc,
885 const struct drm_display_mode *mode);
886extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode);
887
888extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
889extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
890extern void drm_mode_list_concat(struct list_head *head,
891 struct list_head *new);
892extern void drm_mode_validate_size(struct drm_device *dev,
893 struct list_head *mode_list,
894 int maxX, int maxY, int maxPitch);
895extern void drm_mode_prune_invalid(struct drm_device *dev,
896 struct list_head *mode_list, bool verbose);
897extern void drm_mode_sort(struct list_head *mode_list);
898extern int drm_mode_hsync(const struct drm_display_mode *mode);
899extern int drm_mode_vrefresh(const struct drm_display_mode *mode);
900extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
901 int adjust_flags);
902extern void drm_mode_connector_list_update(struct drm_connector *connector);
903extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
904 struct edid *edid);
905extern int drm_connector_property_set_value(struct drm_connector *connector,
906 struct drm_property *property,
907 uint64_t value);
908extern int drm_connector_property_get_value(struct drm_connector *connector,
909 struct drm_property *property,
910 uint64_t *value);
911extern int drm_object_property_set_value(struct drm_mode_object *obj,
912 struct drm_property *property,
913 uint64_t val);
914extern int drm_object_property_get_value(struct drm_mode_object *obj,
915 struct drm_property *property,
916 uint64_t *value);
917extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev);
918extern void drm_framebuffer_set_object(struct drm_device *dev,
919 unsigned long handle);
920extern int drm_framebuffer_init(struct drm_device *dev,
921 struct drm_framebuffer *fb,
922 const struct drm_framebuffer_funcs *funcs);
923extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
924extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc);
925extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
926extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
927extern bool drm_crtc_in_use(struct drm_crtc *crtc);
928
929extern void drm_connector_attach_property(struct drm_connector *connector,
930 struct drm_property *property, uint64_t init_val);
931extern void drm_object_attach_property(struct drm_mode_object *obj,
932 struct drm_property *property,
933 uint64_t init_val);
934extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
935 const char *name, int num_values);
936extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
937 const char *name,
938 const struct drm_prop_enum_list *props,
939 int num_values);
940struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
941 int flags, const char *name,
942 const struct drm_prop_enum_list *props,
943 int num_values);
944struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
945 const char *name,
946 uint64_t min, uint64_t max);
947extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
948extern int drm_property_add_enum(struct drm_property *property, int index,
949 uint64_t value, const char *name);
950extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
951extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
952 char *formats[]);
953extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
954extern int drm_mode_create_dithering_property(struct drm_device *dev);
955extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
956extern char *drm_get_encoder_name(struct drm_encoder *encoder);
957
958extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
959 struct drm_encoder *encoder);
960extern void drm_mode_connector_detach_encoder(struct drm_connector *connector,
961 struct drm_encoder *encoder);
962extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
963 int gamma_size);
964extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
965 uint32_t id, uint32_t type);
966
967extern int drm_mode_getresources(struct drm_device *dev,
968 void *data, struct drm_file *file_priv);
969extern int drm_mode_getplane_res(struct drm_device *dev, void *data,
970 struct drm_file *file_priv);
971extern int drm_mode_getcrtc(struct drm_device *dev,
972 void *data, struct drm_file *file_priv);
973extern int drm_mode_getconnector(struct drm_device *dev,
974 void *data, struct drm_file *file_priv);
975extern int drm_mode_setcrtc(struct drm_device *dev,
976 void *data, struct drm_file *file_priv);
977extern int drm_mode_getplane(struct drm_device *dev,
978 void *data, struct drm_file *file_priv);
979extern int drm_mode_setplane(struct drm_device *dev,
980 void *data, struct drm_file *file_priv);
981extern int drm_mode_cursor_ioctl(struct drm_device *dev,
982 void *data, struct drm_file *file_priv);
983extern int drm_mode_addfb(struct drm_device *dev,
984 void *data, struct drm_file *file_priv);
985extern int drm_mode_addfb2(struct drm_device *dev,
986 void *data, struct drm_file *file_priv);
987extern uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
988extern int drm_mode_rmfb(struct drm_device *dev,
989 void *data, struct drm_file *file_priv);
990extern int drm_mode_getfb(struct drm_device *dev,
991 void *data, struct drm_file *file_priv);
992extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
993 void *data, struct drm_file *file_priv);
994extern int drm_mode_addmode_ioctl(struct drm_device *dev,
995 void *data, struct drm_file *file_priv);
996extern int drm_mode_rmmode_ioctl(struct drm_device *dev,
997 void *data, struct drm_file *file_priv);
998extern int drm_mode_attachmode_ioctl(struct drm_device *dev,
999 void *data, struct drm_file *file_priv);
1000extern int drm_mode_detachmode_ioctl(struct drm_device *dev,
1001 void *data, struct drm_file *file_priv);
1002
1003extern int drm_mode_getproperty_ioctl(struct drm_device *dev,
1004 void *data, struct drm_file *file_priv);
1005extern int drm_mode_getblob_ioctl(struct drm_device *dev,
1006 void *data, struct drm_file *file_priv);
1007extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
1008 void *data, struct drm_file *file_priv);
1009extern int drm_mode_hotplug_ioctl(struct drm_device *dev,
1010 void *data, struct drm_file *file_priv);
1011extern int drm_mode_replacefb(struct drm_device *dev,
1012 void *data, struct drm_file *file_priv);
1013extern int drm_mode_getencoder(struct drm_device *dev,
1014 void *data, struct drm_file *file_priv);
1015extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
1016 void *data, struct drm_file *file_priv);
1017extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
1018 void *data, struct drm_file *file_priv);
1019extern u8 *drm_find_cea_extension(struct edid *edid);
1020extern bool drm_detect_hdmi_monitor(struct edid *edid);
1021extern bool drm_detect_monitor_audio(struct edid *edid);
1022extern int drm_mode_page_flip_ioctl(struct drm_device *dev,
1023 void *data, struct drm_file *file_priv);
1024extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
1025 int hdisplay, int vdisplay, int vrefresh,
1026 bool reduced, bool interlaced, bool margins);
1027extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
1028 int hdisplay, int vdisplay, int vrefresh,
1029 bool interlaced, int margins);
1030extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
1031 int hdisplay, int vdisplay, int vrefresh,
1032 bool interlaced, int margins, int GTF_M,
1033 int GTF_2C, int GTF_K, int GTF_2J);
1034extern int drm_add_modes_noedid(struct drm_connector *connector,
1035 int hdisplay, int vdisplay);
1036
1037extern int drm_edid_header_is_valid(const u8 *raw_edid);
1038extern bool drm_edid_block_valid(u8 *raw_edid, int block);
1039extern bool drm_edid_is_valid(struct edid *edid);
1040struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
1041 int hsize, int vsize, int fresh,
1042 bool rb);
1043
1044extern int drm_mode_create_dumb_ioctl(struct drm_device *dev,
1045 void *data, struct drm_file *file_priv);
1046extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
1047 void *data, struct drm_file *file_priv);
1048extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
1049 void *data, struct drm_file *file_priv);
1050extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
1051 struct drm_file *file_priv);
1052extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
1053 struct drm_file *file_priv);
1054
1055extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1056 int *bpp);
1057extern int drm_format_num_planes(uint32_t format);
1058extern int drm_format_plane_cpp(uint32_t format, int plane);
1059extern int drm_format_horz_chroma_subsampling(uint32_t format);
1060extern int drm_format_vert_chroma_subsampling(uint32_t format);
1061
1062#endif
1063