Rev 4103 | Rev 5056 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4103 | Rev 4559 | ||
---|---|---|---|
Line 28... | Line 28... | ||
28 | #include |
28 | #include |
29 | #include |
29 | #include |
30 | #include |
30 | #include |
31 | #include |
31 | #include |
32 | #include |
32 | #include |
- | 33 | #include |
|
33 | #include |
34 | #include |
Line 34... | Line 35... | ||
34 | 35 | ||
Line 35... | Line 36... | ||
35 | #include |
36 | #include |
Line 106... | Line 107... | ||
106 | MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ |
107 | MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ |
107 | MODE_ONE_WIDTH, /* only one width is supported */ |
108 | MODE_ONE_WIDTH, /* only one width is supported */ |
108 | MODE_ONE_HEIGHT, /* only one height is supported */ |
109 | MODE_ONE_HEIGHT, /* only one height is supported */ |
109 | MODE_ONE_SIZE, /* only one resolution is supported */ |
110 | MODE_ONE_SIZE, /* only one resolution is supported */ |
110 | MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ |
111 | MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ |
- | 112 | MODE_NO_STEREO, /* stereo modes not supported */ |
|
111 | MODE_UNVERIFIED = -3, /* mode needs to reverified */ |
113 | MODE_UNVERIFIED = -3, /* mode needs to reverified */ |
112 | MODE_BAD = -2, /* unspecified reason */ |
114 | MODE_BAD = -2, /* unspecified reason */ |
113 | MODE_ERROR = -1 /* error condition */ |
115 | MODE_ERROR = -1 /* error condition */ |
114 | }; |
116 | }; |
Line 122... | Line 124... | ||
122 | .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \ |
124 | .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \ |
123 | .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \ |
125 | .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \ |
124 | .vscan = (vs), .flags = (f), \ |
126 | .vscan = (vs), .flags = (f), \ |
125 | .base.type = DRM_MODE_OBJECT_MODE |
127 | .base.type = DRM_MODE_OBJECT_MODE |
Line 126... | Line 128... | ||
126 | 128 | ||
- | 129 | #define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */ |
|
- | 130 | #define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */ |
|
- | 131 | ||
Line 127... | Line 132... | ||
127 | #define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */ |
132 | #define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF |
128 | 133 | ||
129 | struct drm_display_mode { |
134 | struct drm_display_mode { |
130 | /* Header */ |
135 | /* Header */ |
Line 153... | Line 158... | ||
153 | /* Addressable image size (may be 0 for projectors, etc.) */ |
158 | /* Addressable image size (may be 0 for projectors, etc.) */ |
154 | int width_mm; |
159 | int width_mm; |
155 | int height_mm; |
160 | int height_mm; |
Line 156... | Line 161... | ||
156 | 161 | ||
157 | /* Actual mode we give to hw */ |
- | |
158 | int clock_index; |
162 | /* Actual mode we give to hw */ |
159 | int synth_clock; |
163 | int crtc_clock; /* in KHz */ |
160 | int crtc_hdisplay; |
164 | int crtc_hdisplay; |
161 | int crtc_hblank_start; |
165 | int crtc_hblank_start; |
162 | int crtc_hblank_end; |
166 | int crtc_hblank_end; |
163 | int crtc_hsync_start; |
167 | int crtc_hsync_start; |
Line 176... | Line 180... | ||
176 | int *private; |
180 | int *private; |
177 | int private_flags; |
181 | int private_flags; |
Line 178... | Line 182... | ||
178 | 182 | ||
179 | int vrefresh; /* in Hz */ |
183 | int vrefresh; /* in Hz */ |
- | 184 | int hsync; /* in kHz */ |
|
180 | int hsync; /* in kHz */ |
185 | enum hdmi_picture_aspect picture_aspect_ratio; |
Line -... | Line 186... | ||
- | 186 | }; |
|
- | 187 | ||
- | 188 | static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode) |
|
- | 189 | { |
|
- | 190 | return mode->flags & DRM_MODE_FLAG_3D_MASK; |
|
181 | }; |
191 | } |
182 | 192 | ||
183 | enum drm_connector_status { |
193 | enum drm_connector_status { |
184 | connector_status_connected = 1, |
194 | connector_status_connected = 1, |
185 | connector_status_disconnected = 2, |
195 | connector_status_disconnected = 2, |
Line 437... | Line 447... | ||
437 | /* CRTC gamma size for reporting to userspace */ |
447 | /* CRTC gamma size for reporting to userspace */ |
438 | uint32_t gamma_size; |
448 | uint32_t gamma_size; |
439 | uint16_t *gamma_store; |
449 | uint16_t *gamma_store; |
Line 440... | Line 450... | ||
440 | 450 | ||
441 | /* Constants needed for precise vblank and swap timestamping. */ |
451 | /* Constants needed for precise vblank and swap timestamping. */ |
Line 442... | Line 452... | ||
442 | s64 framedur_ns, linedur_ns, pixeldur_ns; |
452 | int framedur_ns, linedur_ns, pixeldur_ns; |
443 | 453 | ||
Line 444... | Line 454... | ||
444 | /* if you are using the helper */ |
454 | /* if you are using the helper */ |
Line 585... | Line 595... | ||
585 | * position in the broader display (referred to as a 'screen' though it could |
595 | * position in the broader display (referred to as a 'screen' though it could |
586 | * span multiple monitors). |
596 | * span multiple monitors). |
587 | */ |
597 | */ |
588 | struct drm_connector { |
598 | struct drm_connector { |
589 | struct drm_device *dev; |
599 | struct drm_device *dev; |
590 | struct device kdev; |
600 | struct device *kdev; |
591 | struct device_attribute *attr; |
601 | struct device_attribute *attr; |
592 | struct list_head head; |
602 | struct list_head head; |
Line 593... | Line 603... | ||
593 | 603 | ||
Line 594... | Line 604... | ||
594 | struct drm_mode_object base; |
604 | struct drm_mode_object base; |
595 | 605 | ||
596 | int connector_type; |
606 | int connector_type; |
597 | int connector_type_id; |
607 | int connector_type_id; |
- | 608 | bool interlace_allowed; |
|
598 | bool interlace_allowed; |
609 | bool doublescan_allowed; |
Line 599... | Line 610... | ||
599 | bool doublescan_allowed; |
610 | bool stereo_allowed; |
Line 600... | Line 611... | ||
600 | struct list_head modes; /* list of modes on this connector */ |
611 | struct list_head modes; /* list of modes on this connector */ |
Line 918... | Line 929... | ||
918 | 929 | ||
919 | extern int drm_crtc_init(struct drm_device *dev, |
930 | extern int drm_crtc_init(struct drm_device *dev, |
920 | struct drm_crtc *crtc, |
931 | struct drm_crtc *crtc, |
921 | const struct drm_crtc_funcs *funcs); |
932 | const struct drm_crtc_funcs *funcs); |
- | 933 | extern void drm_crtc_cleanup(struct drm_crtc *crtc); |
|
- | 934 | extern unsigned int drm_crtc_index(struct drm_crtc *crtc); |
|
- | 935 | ||
- | 936 | /** |
|
- | 937 | * drm_crtc_mask - find the mask of a registered CRTC |
|
- | 938 | * @crtc: CRTC to find mask for |
|
- | 939 | * |
|
- | 940 | * Given a registered CRTC, return the mask bit of that CRTC for an |
|
- | 941 | * encoder's possible_crtcs field. |
|
- | 942 | */ |
|
- | 943 | static inline uint32_t drm_crtc_mask(struct drm_crtc *crtc) |
|
- | 944 | { |
|
- | 945 | return 1 << drm_crtc_index(crtc); |
|
Line 922... | Line 946... | ||
922 | extern void drm_crtc_cleanup(struct drm_crtc *crtc); |
946 | } |
923 | 947 | ||
924 | extern void drm_connector_ida_init(void); |
948 | extern void drm_connector_ida_init(void); |
925 | extern void drm_connector_ida_destroy(void); |
949 | extern void drm_connector_ida_destroy(void); |
Line 939... | Line 963... | ||
939 | extern int drm_encoder_init(struct drm_device *dev, |
963 | extern int drm_encoder_init(struct drm_device *dev, |
940 | struct drm_encoder *encoder, |
964 | struct drm_encoder *encoder, |
941 | const struct drm_encoder_funcs *funcs, |
965 | const struct drm_encoder_funcs *funcs, |
942 | int encoder_type); |
966 | int encoder_type); |
Line -... | Line 967... | ||
- | 967 | ||
- | 968 | /** |
|
- | 969 | * drm_encoder_crtc_ok - can a given crtc drive a given encoder? |
|
- | 970 | * @encoder: encoder to test |
|
- | 971 | * @crtc: crtc to test |
|
- | 972 | * |
|
- | 973 | * Return false if @encoder can't be driven by @crtc, true otherwise. |
|
- | 974 | */ |
|
- | 975 | static inline bool drm_encoder_crtc_ok(struct drm_encoder *encoder, |
|
- | 976 | struct drm_crtc *crtc) |
|
- | 977 | { |
|
- | 978 | return !!(encoder->possible_crtcs & drm_crtc_mask(crtc)); |
|
- | 979 | } |
|
943 | 980 | ||
944 | extern int drm_plane_init(struct drm_device *dev, |
981 | extern int drm_plane_init(struct drm_device *dev, |
945 | struct drm_plane *plane, |
982 | struct drm_plane *plane, |
946 | unsigned long possible_crtcs, |
983 | unsigned long possible_crtcs, |
947 | const struct drm_plane_funcs *funcs, |
984 | const struct drm_plane_funcs *funcs, |
Line 962... | Line 999... | ||
962 | extern void drm_fb_release(struct drm_file *file_priv); |
999 | extern void drm_fb_release(struct drm_file *file_priv); |
963 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); |
1000 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); |
964 | extern bool drm_probe_ddc(struct i2c_adapter *adapter); |
1001 | extern bool drm_probe_ddc(struct i2c_adapter *adapter); |
965 | extern struct edid *drm_get_edid(struct drm_connector *connector, |
1002 | extern struct edid *drm_get_edid(struct drm_connector *connector, |
966 | struct i2c_adapter *adapter); |
1003 | struct i2c_adapter *adapter); |
- | 1004 | extern struct edid *drm_edid_duplicate(const struct edid *edid); |
|
967 | extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); |
1005 | extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); |
968 | extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); |
1006 | extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); |
969 | extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src); |
1007 | extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src); |
970 | extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, |
1008 | extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, |
971 | const struct drm_display_mode *mode); |
1009 | const struct drm_display_mode *mode); |
Line 973... | Line 1011... | ||
973 | extern void drm_mode_config_init(struct drm_device *dev); |
1011 | extern void drm_mode_config_init(struct drm_device *dev); |
974 | extern void drm_mode_config_reset(struct drm_device *dev); |
1012 | extern void drm_mode_config_reset(struct drm_device *dev); |
975 | extern void drm_mode_config_cleanup(struct drm_device *dev); |
1013 | extern void drm_mode_config_cleanup(struct drm_device *dev); |
976 | extern void drm_mode_set_name(struct drm_display_mode *mode); |
1014 | extern void drm_mode_set_name(struct drm_display_mode *mode); |
977 | extern bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); |
1015 | extern bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); |
978 | extern bool drm_mode_equal_no_clocks(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); |
1016 | extern bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2); |
979 | extern int drm_mode_width(const struct drm_display_mode *mode); |
1017 | extern int drm_mode_width(const struct drm_display_mode *mode); |
980 | extern int drm_mode_height(const struct drm_display_mode *mode); |
1018 | extern int drm_mode_height(const struct drm_display_mode *mode); |
Line 981... | Line 1019... | ||
981 | 1019 | ||
982 | /* for us by fb module */ |
1020 | /* for us by fb module */ |
Line 1106... | Line 1144... | ||
1106 | int hdisplay, int vdisplay, int vrefresh, |
1144 | int hdisplay, int vdisplay, int vrefresh, |
1107 | bool interlaced, int margins, int GTF_M, |
1145 | bool interlaced, int margins, int GTF_M, |
1108 | int GTF_2C, int GTF_K, int GTF_2J); |
1146 | int GTF_2C, int GTF_K, int GTF_2J); |
1109 | extern int drm_add_modes_noedid(struct drm_connector *connector, |
1147 | extern int drm_add_modes_noedid(struct drm_connector *connector, |
1110 | int hdisplay, int vdisplay); |
1148 | int hdisplay, int vdisplay); |
- | 1149 | extern void drm_set_preferred_mode(struct drm_connector *connector, |
|
- | 1150 | int hpref, int vpref); |
|
Line 1111... | Line 1151... | ||
1111 | 1151 | ||
1112 | extern int drm_edid_header_is_valid(const u8 *raw_edid); |
1152 | extern int drm_edid_header_is_valid(const u8 *raw_edid); |
1113 | extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid); |
1153 | extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid); |
1114 | extern bool drm_edid_is_valid(struct edid *edid); |
1154 | extern bool drm_edid_is_valid(struct edid *edid); |
Line 1133... | Line 1173... | ||
1133 | extern int drm_format_plane_cpp(uint32_t format, int plane); |
1173 | extern int drm_format_plane_cpp(uint32_t format, int plane); |
1134 | extern int drm_format_horz_chroma_subsampling(uint32_t format); |
1174 | extern int drm_format_horz_chroma_subsampling(uint32_t format); |
1135 | extern int drm_format_vert_chroma_subsampling(uint32_t format); |
1175 | extern int drm_format_vert_chroma_subsampling(uint32_t format); |
1136 | extern const char *drm_get_format_name(uint32_t format); |
1176 | extern const char *drm_get_format_name(uint32_t format); |
Line -... | Line 1177... | ||
- | 1177 | ||
- | 1178 | /* Helpers */ |
|
- | 1179 | static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, |
|
- | 1180 | uint32_t id) |
|
- | 1181 | { |
|
- | 1182 | struct drm_mode_object *mo; |
|
- | 1183 | mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CRTC); |
|
- | 1184 | return mo ? obj_to_crtc(mo) : NULL; |
|
- | 1185 | } |
|
- | 1186 | ||
- | 1187 | static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev, |
|
- | 1188 | uint32_t id) |
|
- | 1189 | { |
|
- | 1190 | struct drm_mode_object *mo; |
|
- | 1191 | mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER); |
|
- | 1192 | return mo ? obj_to_encoder(mo) : NULL; |
|
- | 1193 | } |
|
1137 | 1194 |