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