LUT updates
[platform/upstream/libdrm.git] / linux-core / drm_crtc.h
1 /*
2  * Copyright © 2006 Keith Packard
3  * Copyright © 2007 Intel Corporation
4  *   Jesse Barnes <jesse.barnes@intel.com>
5  */
6 #ifndef __DRM_CRTC_H__
7 #define __DRM_CRTC_H__
8
9 #include <linux/i2c.h>
10 #include <linux/spinlock.h>
11 #include <linux/types.h>
12 #include <linux/idr.h>
13
14 #include <linux/fb.h>
15
16 struct drm_device;
17 struct drm_mode_set;
18 struct drm_framebuffer;
19
20
21 #define DRM_MODE_OBJECT_CRTC 0xcccccccc
22 #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
23 #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
24 #define DRM_MODE_OBJECT_MODE 0xdededede
25 #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
26 #define DRM_MODE_OBJECT_FB 0xfbfbfbfb
27 #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
28
29 struct drm_mode_object {
30         uint32_t id;
31         uint32_t type;
32 };
33
34 /*
35  * Note on terminology:  here, for brevity and convenience, we refer to connector
36  * control chips as 'CRTCs'.  They can control any type of connector, VGA, LVDS,
37  * DVI, etc.  And 'screen' refers to the whole of the visible display, which
38  * may span multiple monitors (and therefore multiple CRTC and connector
39  * structures).
40  */
41
42 enum drm_mode_status {
43     MODE_OK     = 0,    /* Mode OK */
44     MODE_HSYNC,         /* hsync out of range */
45     MODE_VSYNC,         /* vsync out of range */
46     MODE_H_ILLEGAL,     /* mode has illegal horizontal timings */
47     MODE_V_ILLEGAL,     /* mode has illegal horizontal timings */
48     MODE_BAD_WIDTH,     /* requires an unsupported linepitch */
49     MODE_NOMODE,        /* no mode with a maching name */
50     MODE_NO_INTERLACE,  /* interlaced mode not supported */
51     MODE_NO_DBLESCAN,   /* doublescan mode not supported */
52     MODE_NO_VSCAN,      /* multiscan mode not supported */
53     MODE_MEM,           /* insufficient video memory */
54     MODE_VIRTUAL_X,     /* mode width too large for specified virtual size */
55     MODE_VIRTUAL_Y,     /* mode height too large for specified virtual size */
56     MODE_MEM_VIRT,      /* insufficient video memory given virtual size */
57     MODE_NOCLOCK,       /* no fixed clock available */
58     MODE_CLOCK_HIGH,    /* clock required is too high */
59     MODE_CLOCK_LOW,     /* clock required is too low */
60     MODE_CLOCK_RANGE,   /* clock/mode isn't in a ClockRange */
61     MODE_BAD_HVALUE,    /* horizontal timing was out of range */
62     MODE_BAD_VVALUE,    /* vertical timing was out of range */
63     MODE_BAD_VSCAN,     /* VScan value out of range */
64     MODE_HSYNC_NARROW,  /* horizontal sync too narrow */
65     MODE_HSYNC_WIDE,    /* horizontal sync too wide */
66     MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
67     MODE_HBLANK_WIDE,   /* horizontal blanking too wide */
68     MODE_VSYNC_NARROW,  /* vertical sync too narrow */
69     MODE_VSYNC_WIDE,    /* vertical sync too wide */
70     MODE_VBLANK_NARROW, /* vertical blanking too narrow */
71     MODE_VBLANK_WIDE,   /* vertical blanking too wide */
72     MODE_PANEL,         /* exceeds panel dimensions */
73     MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
74     MODE_ONE_WIDTH,     /* only one width is supported */
75     MODE_ONE_HEIGHT,    /* only one height is supported */
76     MODE_ONE_SIZE,      /* only one resolution is supported */
77     MODE_NO_REDUCED,    /* monitor doesn't accept reduced blanking */
78     MODE_UNVERIFIED = -3, /* mode needs to reverified */
79     MODE_BAD = -2,      /* unspecified reason */
80     MODE_ERROR  = -1    /* error condition */
81 };
82
83 #define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
84                                     DRM_MODE_TYPE_CRTC_C)
85
86 #define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
87         .name = nm, .status = 0, .type = (t), .clock = (c), \
88         .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
89         .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
90         .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
91         .vscan = (vs), .flags = (f), .vrefresh = 0
92
93 #define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */
94
95 struct drm_display_mode {
96         /* Header */
97         struct list_head head;
98         struct drm_mode_object base;
99
100         char name[DRM_DISPLAY_MODE_LEN];
101
102         int connector_count;
103         enum drm_mode_status status;
104         int type;
105
106         /* Proposed mode values */
107         int clock;
108         int hdisplay;
109         int hsync_start;
110         int hsync_end;
111         int htotal;
112         int hskew;
113         int vdisplay;
114         int vsync_start;
115         int vsync_end;
116         int vtotal;
117         int vscan;
118         unsigned int flags;
119
120         /* Addressable image size (may be 0 for projectors, etc.) */
121         int width_mm;
122         int height_mm;
123
124         /* Actual mode we give to hw */
125         int clock_index;
126         int synth_clock;
127         int crtc_hdisplay;
128         int crtc_hblank_start;
129         int crtc_hblank_end;
130         int crtc_hsync_start;
131         int crtc_hsync_end;
132         int crtc_htotal;
133         int crtc_hskew;
134         int crtc_vdisplay;
135         int crtc_vblank_start;
136         int crtc_vblank_end;
137         int crtc_vsync_start;
138         int crtc_vsync_end;
139         int crtc_vtotal;
140         int crtc_hadjusted;
141         int crtc_vadjusted;
142
143         /* Driver private mode info */
144         int private_size;
145         int *private;
146         int private_flags;
147
148         int vrefresh;
149         float hsync;
150 };
151
152 enum drm_connector_status {
153         connector_status_connected = 1,
154         connector_status_disconnected = 2,
155         connector_status_unknown = 3,
156 };
157
158 enum subpixel_order {
159         SubPixelUnknown = 0,
160         SubPixelHorizontalRGB,
161         SubPixelHorizontalBGR,
162         SubPixelVerticalRGB,
163         SubPixelVerticalBGR,
164         SubPixelNone,
165 };
166
167
168 /*
169  * Describes a given display (e.g. CRT or flat panel) and its limitations.
170  */
171 struct drm_display_info {
172         char name[DRM_DISPLAY_INFO_LEN];
173         /* Input info */
174         bool serration_vsync;
175         bool sync_on_green;
176         bool composite_sync;
177         bool separate_syncs;
178         bool blank_to_black;
179         unsigned char video_level;
180         bool digital;
181         /* Physical size */
182         unsigned int width_mm;
183         unsigned int height_mm;
184
185         /* Display parameters */
186         unsigned char gamma; /* FIXME: storage format */
187         bool gtf_supported;
188         bool standard_color;
189         enum {
190                 monochrome = 0,
191                 rgb,
192                 other,
193                 unknown,
194         } display_type;
195         bool active_off_supported;
196         bool suspend_supported;
197         bool standby_supported;
198
199         /* Color info FIXME: storage format */
200         unsigned short redx, redy;
201         unsigned short greenx, greeny;
202         unsigned short bluex, bluey;
203         unsigned short whitex, whitey;
204
205         /* Clock limits FIXME: storage format */
206         unsigned int min_vfreq, max_vfreq;
207         unsigned int min_hfreq, max_hfreq;
208         unsigned int pixel_clock;
209
210         /* White point indices FIXME: storage format */
211         unsigned int wpx1, wpy1;
212         unsigned int wpgamma1;
213         unsigned int wpx2, wpy2;
214         unsigned int wpgamma2;
215
216         enum subpixel_order subpixel_order;
217
218         char *raw_edid; /* if any */
219 };
220
221 struct drm_framebuffer_funcs {
222         void (*destroy)(struct drm_framebuffer *framebuffer);
223 };
224
225 struct drm_framebuffer {
226         struct drm_device *dev;
227         struct list_head head;
228         struct drm_mode_object base;
229         const struct drm_framebuffer_funcs *funcs;
230         unsigned int pitch;
231         unsigned int width;
232         unsigned int height;
233         /* depth can be 15 or 16 */
234         unsigned int depth;
235         int bits_per_pixel;
236         int flags;
237         void *fbdev;
238         u32 pseudo_palette[17];
239         struct list_head filp_head;
240         uint32_t mm_handle;
241 };
242
243 struct drm_property_blob {
244         struct drm_mode_object base;
245         struct list_head head;
246         unsigned int length;
247         void *data;
248 };
249
250 struct drm_property_enum {
251         uint64_t value;
252         struct list_head head;
253         char name[DRM_PROP_NAME_LEN];
254 };
255
256 struct drm_property {
257         struct list_head head;
258         struct drm_mode_object base;
259         uint32_t flags;
260         char name[DRM_PROP_NAME_LEN];
261         uint32_t num_values;
262         uint64_t *values;
263
264         struct list_head enum_blob_list;
265 };
266
267 struct drm_crtc;
268 struct drm_connector;
269 struct drm_encoder;
270
271 /**
272  * drm_crtc_funcs - control CRTCs for a given device
273  * @dpms: control display power levels
274  * @save: save CRTC state
275  * @resore: restore CRTC state
276  * @lock: lock the CRTC
277  * @unlock: unlock the CRTC
278  * @shadow_allocate: allocate shadow pixmap
279  * @shadow_create: create shadow pixmap for rotation support
280  * @shadow_destroy: free shadow pixmap
281  * @mode_fixup: fixup proposed mode
282  * @mode_set: set the desired mode on the CRTC
283  * @gamma_set: specify color ramp for CRTC
284  * @destroy: deinit and free object.
285  *
286  * The drm_crtc_funcs structure is the central CRTC management structure
287  * in the DRM.  Each CRTC controls one or more connectors (note that the name
288  * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc.
289  * connectors, not just CRTs).
290  *
291  * Each driver is responsible for filling out this structure at startup time,
292  * in addition to providing other modesetting features, like i2c and DDC
293  * bus accessors.
294  */
295 struct drm_crtc_funcs {
296         /* Save CRTC state */
297         void (*save)(struct drm_crtc *crtc); /* suspend? */
298         /* Restore CRTC state */
299         void (*restore)(struct drm_crtc *crtc); /* resume? */
300
301         /* cursor controls */
302         int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
303                           uint32_t handle, uint32_t width, uint32_t height);
304         int (*cursor_move)(struct drm_crtc *crtc, int x, int y);
305
306         /* Set gamma on the CRTC */
307         void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
308                           uint32_t size);
309         /* Object destroy routine */
310         void (*destroy)(struct drm_crtc *crtc);
311
312         int (*set_config)(struct drm_mode_set *set);
313 };
314
315 /**
316  * drm_crtc - central CRTC control structure
317  * @enabled: is this CRTC enabled?
318  * @x: x position on screen
319  * @y: y position on screen
320  * @desired_mode: new desired mode
321  * @desired_x: desired x for desired_mode
322  * @desired_y: desired y for desired_mode
323  * @funcs: CRTC control functions
324  *
325  * Each CRTC may have one or more connectors associated with it.  This structure
326  * allows the CRTC to be controlled.
327  */
328 struct drm_crtc {
329         struct drm_device *dev;
330         struct list_head head;
331
332         struct drm_mode_object base;
333
334         /* framebuffer the connector is currently bound to */
335         struct drm_framebuffer *fb;
336
337         bool enabled;
338
339         struct drm_display_mode mode;
340
341         int x, y;
342         struct drm_display_mode *desired_mode;
343         int desired_x, desired_y;
344         const struct drm_crtc_funcs *funcs;
345
346         /* CRTC gamma size for reporting to userspace */
347         uint32_t gamma_size;
348         uint16_t *gamma_store;
349
350         /* if you are using the helper */
351         void *helper_private;
352 };
353
354
355 /**
356  * drm_connector_funcs - control connectors on a given device
357  * @dpms: set power state (see drm_crtc_funcs above)
358  * @save: save connector state
359  * @restore: restore connector state
360  * @mode_valid: is this mode valid on the given connector?
361  * @mode_fixup: try to fixup proposed mode for this connector
362  * @mode_set: set this mode
363  * @detect: is this connector active?
364  * @get_modes: get mode list for this connector
365  * @set_property: property for this connector may need update
366  * @destroy: make object go away
367  *
368  * Each CRTC may have one or more connectors attached to it.  The functions
369  * below allow the core DRM code to control connectors, enumerate available modes,
370  * etc.
371  */
372 struct drm_connector_funcs {
373         void (*dpms)(struct drm_connector *connector, int mode);
374         void (*save)(struct drm_connector *connector);
375         void (*restore)(struct drm_connector *connector);
376         enum drm_connector_status (*detect)(struct drm_connector *connector);
377         void (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
378         int (*set_property)(struct drm_connector *connector, struct drm_property *property,
379                              uint64_t val);
380         void (*destroy)(struct drm_connector *connector);
381 };
382
383 struct drm_encoder_funcs {
384         void (*destroy)(struct drm_encoder *encoder);
385 };
386
387 #define DRM_CONNECTOR_MAX_UMODES 16
388 #define DRM_CONNECTOR_MAX_PROPERTY 16
389 #define DRM_CONNECTOR_LEN 32
390 #define DRM_CONNECTOR_MAX_ENCODER 2
391
392 /**
393  * drm_encoder - central DRM encoder structure 
394  */
395 struct drm_encoder {
396         struct drm_device *dev;
397         struct list_head head;
398
399         struct drm_mode_object base;
400         int encoder_type;
401         uint32_t possible_crtcs;
402         uint32_t possible_clones;
403
404         struct drm_crtc *crtc;
405         const struct drm_encoder_funcs *funcs;
406         void *helper_private;
407 };
408
409 /**
410  * drm_connector - central DRM connector control structure
411  * @crtc: CRTC this connector is currently connected to, NULL if none
412  * @interlace_allowed: can this connector handle interlaced modes?
413  * @doublescan_allowed: can this connector handle doublescan?
414  * @available_modes: modes available on this connector (from get_modes() + user)
415  * @initial_x: initial x position for this connector
416  * @initial_y: initial y position for this connector
417  * @status: connector connected?
418  * @funcs: connector control functions
419  *
420  * Each connector may be connected to one or more CRTCs, or may be clonable by
421  * another connector if they can share a CRTC.  Each connector also has a specific
422  * position in the broader display (referred to as a 'screen' though it could
423  * span multiple monitors).
424  */
425 struct drm_connector {
426         struct drm_device *dev;
427         struct device kdev;
428         struct device_attribute *attr;
429         struct list_head head;
430
431         struct drm_mode_object base;
432
433         int connector_type;
434         int connector_type_id;
435         bool interlace_allowed;
436         bool doublescan_allowed;
437         struct list_head modes; /* list of modes on this connector */
438
439         int initial_x, initial_y;
440         enum drm_connector_status status;
441
442         /* these are modes added by probing with DDC or the BIOS */
443         struct list_head probed_modes;
444         
445         struct drm_display_info display_info;
446         const struct drm_connector_funcs *funcs;
447
448         struct list_head user_modes;
449         struct drm_property_blob *edid_blob_ptr;
450         u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY];
451         uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY];
452
453         void *helper_private;
454
455         uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
456         uint32_t force_encoder_id;
457         struct drm_encoder *encoder; /* currently active encoder */
458 };
459
460 /**
461  * struct drm_mode_set
462  *
463  * Represents a single crtc the connectors that it drives with what mode
464  * and from which framebuffer it scans out from.
465  *
466  * This is used to set modes.
467  */
468 struct drm_mode_set {
469         struct list_head head;
470
471         struct drm_framebuffer *fb;
472         struct drm_crtc *crtc;
473         struct drm_display_mode *mode;
474
475         uint32_t x;
476         uint32_t y;
477
478         struct drm_connector **connectors;
479         size_t num_connectors;
480 };
481
482 /**
483  * struct drm_mode_config_funcs - configure CRTCs for a given screen layout
484  * @resize: adjust CRTCs as necessary for the proposed layout
485  *
486  * Currently only a resize hook is available.  DRM will call back into the
487  * driver with a new screen width and height.  If the driver can't support
488  * the proposed size, it can return false.  Otherwise it should adjust
489  * the CRTC<->connector mappings as needed and update its view of the screen.
490  */
491 struct drm_mode_config_funcs {
492         int (*resize_fb)(struct drm_device *dev, struct drm_file *file_priv, struct drm_framebuffer *fb, struct drm_mode_fb_cmd *mode_cmd);
493         struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd);
494         int (*fb_changed)(struct drm_device *dev);
495 };
496
497 struct drm_mode_group {
498         uint32_t num_crtcs;
499         uint32_t num_encoders;
500         uint32_t num_connectors;
501
502         /* list of object IDs for this group */
503         uint32_t *id_list;
504 };
505
506 /**
507  * drm_mode_config - Mode configuration control structure
508  *
509  */
510 struct drm_mode_config {
511         struct mutex mutex; /* protects configuration and IDR */
512         struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
513         /* this is limited to one for now */
514         int num_fb;
515         struct list_head fb_list;
516         int num_connector;
517         struct list_head connector_list;
518         int num_encoder;
519         struct list_head encoder_list;
520
521         int num_crtc;
522         struct list_head crtc_list;
523
524         struct list_head property_list;
525
526         /* in-kernel framebuffers - hung of filp_head in drm_framebuffer */
527         struct list_head fb_kernel_list;
528
529         int min_width, min_height;
530         int max_width, max_height;
531         struct drm_mode_config_funcs *funcs;
532         unsigned long fb_base;
533
534         /* pointers to standard properties */
535         struct list_head property_blob_list;
536         struct drm_property *edid_property;
537         struct drm_property *dpms_property;
538
539         /* DVI-I properties */
540         struct drm_property *dvi_i_subconnector_property;
541         struct drm_property *dvi_i_select_subconnector_property;
542
543         /* TV properties */
544         struct drm_property *tv_subconnector_property;
545         struct drm_property *tv_select_subconnector_property;
546         struct drm_property *tv_mode_property;
547         struct drm_property *tv_left_margin_property;
548         struct drm_property *tv_right_margin_property;
549         struct drm_property *tv_top_margin_property;
550         struct drm_property *tv_bottom_margin_property;
551
552         /* Optional properties */
553         struct drm_property *scaling_mode_property;
554         struct drm_property *dithering_mode_property;
555
556         /* hotplug */
557         uint32_t hotplug_counter;
558 };
559
560 #define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
561 #define obj_to_connector(x) container_of(x, struct drm_connector, base)
562 #define obj_to_encoder(x) container_of(x, struct drm_encoder, base)
563 #define obj_to_mode(x) container_of(x, struct drm_display_mode, base)
564 #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
565 #define obj_to_property(x) container_of(x, struct drm_property, base)
566 #define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
567
568
569 extern void drm_crtc_init(struct drm_device *dev,
570                           struct drm_crtc *crtc,
571                           const struct drm_crtc_funcs *funcs);
572 extern void drm_crtc_cleanup(struct drm_crtc *crtc);
573
574 extern void drm_connector_init(struct drm_device *dev,
575                             struct drm_connector *connector,
576                             const struct drm_connector_funcs *funcs,
577                             int connector_type);
578
579 extern void drm_connector_cleanup(struct drm_connector *connector);
580
581 extern void drm_encoder_init(struct drm_device *dev,
582                              struct drm_encoder *encoder,
583                              const struct drm_encoder_funcs *funcs,
584                              int encoder_type);
585
586 extern void drm_encoder_cleanup(struct drm_encoder *encoder);
587
588 extern char *drm_get_connector_name(struct drm_connector *connector);
589 extern char *drm_get_dpms_name(int val);
590 extern char *drm_get_select_subconnector_name(int val);
591 extern char *drm_get_subconnector_name(int val);
592 extern void drm_fb_release(struct file *filp);
593 extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
594 extern struct edid *drm_get_edid(struct drm_connector *connector,
595                                  struct i2c_adapter *adapter);
596 extern unsigned char *drm_do_probe_ddc_edid(struct i2c_adapter *adapter);
597 extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
598 extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
599 extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
600 extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
601                                                    struct drm_display_mode *mode);
602 extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
603 extern void drm_mode_config_init(struct drm_device *dev);
604 extern void drm_mode_config_cleanup(struct drm_device *dev);
605 extern void drm_mode_set_name(struct drm_display_mode *mode);
606 extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2);
607
608 /* for us by fb module */
609 extern int drm_mode_attachmode_crtc(struct drm_device *dev,
610                                     struct drm_crtc *crtc,
611                                     struct drm_display_mode *mode);
612 extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode);
613
614 extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
615 extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
616 extern void drm_mode_list_concat(struct list_head *head,
617                                  struct list_head *new);
618 extern void drm_mode_validate_size(struct drm_device *dev,
619                                    struct list_head *mode_list,
620                                    int maxX, int maxY, int maxPitch);
621 extern void drm_mode_prune_invalid(struct drm_device *dev,
622                                    struct list_head *mode_list, bool verbose);
623 extern void drm_mode_sort(struct list_head *mode_list);
624 extern int drm_mode_vrefresh(struct drm_display_mode *mode);
625 extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
626                                   int adjust_flags);
627 extern void drm_mode_connector_list_update(struct drm_connector *connector);
628 extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
629                                                 struct edid *edid);
630 extern int drm_connector_property_set_value(struct drm_connector *connector,
631                                          struct drm_property *property,
632                                          uint64_t value);
633 extern int drm_connector_property_get_value(struct drm_connector *connector,
634                                          struct drm_property *property,
635                                          uint64_t *value);
636 extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev);
637 extern void drm_framebuffer_set_object(struct drm_device *dev,
638                                        unsigned long handle);
639 extern struct drm_framebuffer *drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
640                                                     const struct drm_framebuffer_funcs *funcs);
641 extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
642 extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc);
643 extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
644 extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
645 extern bool drm_crtc_in_use(struct drm_crtc *crtc);
646
647 extern int drm_connector_attach_property(struct drm_connector *connector,
648                                       struct drm_property *property, uint64_t init_val);
649 extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
650                                                 const char *name, int num_values);
651 extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
652 extern int drm_property_add_enum(struct drm_property *property, int index, 
653                                  uint64_t value, const char *name);
654 extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
655 extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
656                                      char *formats[]);
657 extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
658 extern int drm_mode_create_dithering_property(struct drm_device *dev);
659 extern char *drm_get_encoder_name(struct drm_encoder *encoder);
660
661 extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
662                                              struct drm_encoder *encoder);
663 extern void drm_mode_connector_detach_encoder(struct drm_connector *connector,
664                                            struct drm_encoder *encoder);
665 extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
666                                          int gamma_size);
667 extern void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type);
668 /* IOCTLs */
669 extern int drm_mode_getresources(struct drm_device *dev,
670                                  void *data, struct drm_file *file_priv);
671
672 extern int drm_mode_getcrtc(struct drm_device *dev,
673                             void *data, struct drm_file *file_priv);
674 extern int drm_mode_getconnector(struct drm_device *dev,
675                               void *data, struct drm_file *file_priv);
676 extern int drm_mode_setcrtc(struct drm_device *dev,
677                             void *data, struct drm_file *file_priv);
678 extern int drm_mode_cursor_ioctl(struct drm_device *dev,
679                                 void *data, struct drm_file *file_priv);
680 extern int drm_mode_addfb(struct drm_device *dev,
681                           void *data, struct drm_file *file_priv);
682 extern int drm_mode_rmfb(struct drm_device *dev,
683                          void *data, struct drm_file *file_priv);
684 extern int drm_mode_getfb(struct drm_device *dev,
685                           void *data, struct drm_file *file_priv);
686 extern int drm_mode_addmode_ioctl(struct drm_device *dev,
687                                   void *data, struct drm_file *file_priv);
688 extern int drm_mode_rmmode_ioctl(struct drm_device *dev,
689                                  void *data, struct drm_file *file_priv);
690 extern int drm_mode_attachmode_ioctl(struct drm_device *dev,
691                                      void *data, struct drm_file *file_priv);
692 extern int drm_mode_detachmode_ioctl(struct drm_device *dev,
693                                      void *data, struct drm_file *file_priv);
694
695 extern int drm_mode_getproperty_ioctl(struct drm_device *dev,
696                                       void *data, struct drm_file *file_priv);
697 extern int drm_mode_getblob_ioctl(struct drm_device *dev,
698                                   void *data, struct drm_file *file_priv);
699 extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
700                                               void *data, struct drm_file *file_priv);
701 extern int drm_mode_hotplug_ioctl(struct drm_device *dev,
702                                   void *data, struct drm_file *file_priv);
703 extern int drm_mode_replacefb(struct drm_device *dev,
704                               void *data, struct drm_file *file_priv);
705 extern int drm_mode_getencoder(struct drm_device *dev,
706                                void *data, struct drm_file *file_priv);
707 extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
708                                     void *data, struct drm_file *file_priv);
709 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
710                                     void *data, struct drm_file *file_priv);
711 #endif /* __DRM_CRTC_H__ */
712