1 /*	$NetBSD: drm_modes.h,v 1.6 2021/12/19 01:55:52 riastradh Exp $	*/
2 
3 /*
4  * Copyright © 2006 Keith Packard
5  * Copyright © 2007-2008 Dave Airlie
6  * Copyright © 2007-2008 Intel Corporation
7  *   Jesse Barnes <jesse.barnes@intel.com>
8  * Copyright © 2014 Intel Corporation
9  *   Daniel Vetter <daniel.vetter@ffwll.ch>
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included in
19  * all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
24  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  */
29 #ifndef __DRM_MODES_H__
30 #define __DRM_MODES_H__
31 
32 #include <linux/hdmi.h>
33 
34 #include <drm/drm_mode_object.h>
35 #include <drm/drm_connector.h>
36 
37 struct videomode;
38 struct device_node;
39 
40 /*
41  * Note on terminology:  here, for brevity and convenience, we refer to connector
42  * control chips as 'CRTCs'.  They can control any type of connector, VGA, LVDS,
43  * DVI, etc.  And 'screen' refers to the whole of the visible display, which
44  * may span multiple monitors (and therefore multiple CRTC and connector
45  * structures).
46  */
47 
48 /**
49  * enum drm_mode_status - hardware support status of a mode
50  * @MODE_OK: Mode OK
51  * @MODE_HSYNC: hsync out of range
52  * @MODE_VSYNC: vsync out of range
53  * @MODE_H_ILLEGAL: mode has illegal horizontal timings
54  * @MODE_V_ILLEGAL: mode has illegal horizontal timings
55  * @MODE_BAD_WIDTH: requires an unsupported linepitch
56  * @MODE_NOMODE: no mode with a matching name
57  * @MODE_NO_INTERLACE: interlaced mode not supported
58  * @MODE_NO_DBLESCAN: doublescan mode not supported
59  * @MODE_NO_VSCAN: multiscan mode not supported
60  * @MODE_MEM: insufficient video memory
61  * @MODE_VIRTUAL_X: mode width too large for specified virtual size
62  * @MODE_VIRTUAL_Y: mode height too large for specified virtual size
63  * @MODE_MEM_VIRT: insufficient video memory given virtual size
64  * @MODE_NOCLOCK: no fixed clock available
65  * @MODE_CLOCK_HIGH: clock required is too high
66  * @MODE_CLOCK_LOW: clock required is too low
67  * @MODE_CLOCK_RANGE: clock/mode isn't in a ClockRange
68  * @MODE_BAD_HVALUE: horizontal timing was out of range
69  * @MODE_BAD_VVALUE: vertical timing was out of range
70  * @MODE_BAD_VSCAN: VScan value out of range
71  * @MODE_HSYNC_NARROW: horizontal sync too narrow
72  * @MODE_HSYNC_WIDE: horizontal sync too wide
73  * @MODE_HBLANK_NARROW: horizontal blanking too narrow
74  * @MODE_HBLANK_WIDE: horizontal blanking too wide
75  * @MODE_VSYNC_NARROW: vertical sync too narrow
76  * @MODE_VSYNC_WIDE: vertical sync too wide
77  * @MODE_VBLANK_NARROW: vertical blanking too narrow
78  * @MODE_VBLANK_WIDE: vertical blanking too wide
79  * @MODE_PANEL: exceeds panel dimensions
80  * @MODE_INTERLACE_WIDTH: width too large for interlaced mode
81  * @MODE_ONE_WIDTH: only one width is supported
82  * @MODE_ONE_HEIGHT: only one height is supported
83  * @MODE_ONE_SIZE: only one resolution is supported
84  * @MODE_NO_REDUCED: monitor doesn't accept reduced blanking
85  * @MODE_NO_STEREO: stereo modes not supported
86  * @MODE_NO_420: ycbcr 420 modes not supported
87  * @MODE_STALE: mode has become stale
88  * @MODE_BAD: unspecified reason
89  * @MODE_ERROR: error condition
90  *
91  * This enum is used to filter out modes not supported by the driver/hardware
92  * combination.
93  */
94 enum drm_mode_status {
95 	MODE_OK = 0,
96 	MODE_HSYNC,
97 	MODE_VSYNC,
98 	MODE_H_ILLEGAL,
99 	MODE_V_ILLEGAL,
100 	MODE_BAD_WIDTH,
101 	MODE_NOMODE,
102 	MODE_NO_INTERLACE,
103 	MODE_NO_DBLESCAN,
104 	MODE_NO_VSCAN,
105 	MODE_MEM,
106 	MODE_VIRTUAL_X,
107 	MODE_VIRTUAL_Y,
108 	MODE_MEM_VIRT,
109 	MODE_NOCLOCK,
110 	MODE_CLOCK_HIGH,
111 	MODE_CLOCK_LOW,
112 	MODE_CLOCK_RANGE,
113 	MODE_BAD_HVALUE,
114 	MODE_BAD_VVALUE,
115 	MODE_BAD_VSCAN,
116 	MODE_HSYNC_NARROW,
117 	MODE_HSYNC_WIDE,
118 	MODE_HBLANK_NARROW,
119 	MODE_HBLANK_WIDE,
120 	MODE_VSYNC_NARROW,
121 	MODE_VSYNC_WIDE,
122 	MODE_VBLANK_NARROW,
123 	MODE_VBLANK_WIDE,
124 	MODE_PANEL,
125 	MODE_INTERLACE_WIDTH,
126 	MODE_ONE_WIDTH,
127 	MODE_ONE_HEIGHT,
128 	MODE_ONE_SIZE,
129 	MODE_NO_REDUCED,
130 	MODE_NO_STEREO,
131 	MODE_NO_420,
132 	MODE_STALE = -3,
133 	MODE_BAD = -2,
134 	MODE_ERROR = -1
135 };
136 
137 #define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
138 	.name = nm, .status = 0, .type = (t), .clock = (c), \
139 	.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
140 	.htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
141 	.vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
142 	.vscan = (vs), .flags = (f)
143 
144 /**
145  * DRM_SIMPLE_MODE - Simple display mode
146  * @hd: Horizontal resolution, width
147  * @vd: Vertical resolution, height
148  * @hd_mm: Display width in millimeters
149  * @vd_mm: Display height in millimeters
150  *
151  * This macro initializes a &drm_display_mode that only contains info about
152  * resolution and physical size.
153  */
154 #define DRM_SIMPLE_MODE(hd, vd, hd_mm, vd_mm) \
155 	.type = DRM_MODE_TYPE_DRIVER, .clock = 1 /* pass validation */, \
156 	.hdisplay = (hd), .hsync_start = (hd), .hsync_end = (hd), \
157 	.htotal = (hd), .vdisplay = (vd), .vsync_start = (vd), \
158 	.vsync_end = (vd), .vtotal = (vd), .width_mm = (hd_mm), \
159 	.height_mm = (vd_mm)
160 
161 #define CRTC_INTERLACE_HALVE_V	(1 << 0) /* halve V values for interlacing */
162 #define CRTC_STEREO_DOUBLE	(1 << 1) /* adjust timings for stereo modes */
163 #define CRTC_NO_DBLSCAN		(1 << 2) /* don't adjust doublescan */
164 #define CRTC_NO_VSCAN		(1 << 3) /* don't adjust doublescan */
165 #define CRTC_STEREO_DOUBLE_ONLY	(CRTC_STEREO_DOUBLE | CRTC_NO_DBLSCAN | CRTC_NO_VSCAN)
166 
167 #define DRM_MODE_FLAG_3D_MAX	DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
168 
169 #define DRM_MODE_MATCH_TIMINGS (1 << 0)
170 #define DRM_MODE_MATCH_CLOCK (1 << 1)
171 #define DRM_MODE_MATCH_FLAGS (1 << 2)
172 #define DRM_MODE_MATCH_3D_FLAGS (1 << 3)
173 #define DRM_MODE_MATCH_ASPECT_RATIO (1 << 4)
174 
175 /**
176  * struct drm_display_mode - DRM kernel-internal display mode structure
177  * @hdisplay: horizontal display size
178  * @hsync_start: horizontal sync start
179  * @hsync_end: horizontal sync end
180  * @htotal: horizontal total size
181  * @hskew: horizontal skew?!
182  * @vdisplay: vertical display size
183  * @vsync_start: vertical sync start
184  * @vsync_end: vertical sync end
185  * @vtotal: vertical total size
186  * @vscan: vertical scan?!
187  * @crtc_hdisplay: hardware mode horizontal display size
188  * @crtc_hblank_start: hardware mode horizontal blank start
189  * @crtc_hblank_end: hardware mode horizontal blank end
190  * @crtc_hsync_start: hardware mode horizontal sync start
191  * @crtc_hsync_end: hardware mode horizontal sync end
192  * @crtc_htotal: hardware mode horizontal total size
193  * @crtc_hskew: hardware mode horizontal skew?!
194  * @crtc_vdisplay: hardware mode vertical display size
195  * @crtc_vblank_start: hardware mode vertical blank start
196  * @crtc_vblank_end: hardware mode vertical blank end
197  * @crtc_vsync_start: hardware mode vertical sync start
198  * @crtc_vsync_end: hardware mode vertical sync end
199  * @crtc_vtotal: hardware mode vertical total size
200  *
201  * The horizontal and vertical timings are defined per the following diagram.
202  *
203  * ::
204  *
205  *
206  *               Active                 Front           Sync           Back
207  *              Region                 Porch                          Porch
208  *     <-----------------------><----------------><-------------><-------------->
209  *       //////////////////////|
210  *      ////////////////////// |
211  *     //////////////////////  |..................               ................
212  *                                                _______________
213  *     <----- [hv]display ----->
214  *     <------------- [hv]sync_start ------------>
215  *     <--------------------- [hv]sync_end --------------------->
216  *     <-------------------------------- [hv]total ----------------------------->*
217  *
218  * This structure contains two copies of timings. First are the plain timings,
219  * which specify the logical mode, as it would be for a progressive 1:1 scanout
220  * at the refresh rate userspace can observe through vblank timestamps. Then
221  * there's the hardware timings, which are corrected for interlacing,
222  * double-clocking and similar things. They are provided as a convenience, and
223  * can be appropriately computed using drm_mode_set_crtcinfo().
224  *
225  * For printing you can use %DRM_MODE_FMT and DRM_MODE_ARG().
226  */
227 struct drm_display_mode {
228 	/**
229 	 * @head:
230 	 *
231 	 * struct list_head for mode lists.
232 	 */
233 	struct list_head head;
234 
235 	/**
236 	 * @name:
237 	 *
238 	 * Human-readable name of the mode, filled out with drm_mode_set_name().
239 	 */
240 	char name[DRM_DISPLAY_MODE_LEN];
241 
242 	/**
243 	 * @status:
244 	 *
245 	 * Status of the mode, used to filter out modes not supported by the
246 	 * hardware. See enum &drm_mode_status.
247 	 */
248 	enum drm_mode_status status;
249 
250 	/**
251 	 * @type:
252 	 *
253 	 * A bitmask of flags, mostly about the source of a mode. Possible flags
254 	 * are:
255 	 *
256 	 *  - DRM_MODE_TYPE_PREFERRED: Preferred mode, usually the native
257 	 *    resolution of an LCD panel. There should only be one preferred
258 	 *    mode per connector at any given time.
259 	 *  - DRM_MODE_TYPE_DRIVER: Mode created by the driver, which is all of
260 	 *    them really. Drivers must set this bit for all modes they create
261 	 *    and expose to userspace.
262 	 *  - DRM_MODE_TYPE_USERDEF: Mode defined via kernel command line
263 	 *
264 	 * Plus a big list of flags which shouldn't be used at all, but are
265 	 * still around since these flags are also used in the userspace ABI.
266 	 * We no longer accept modes with these types though:
267 	 *
268 	 *  - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, unused.
269 	 *    Use DRM_MODE_TYPE_DRIVER instead.
270 	 *  - DRM_MODE_TYPE_DEFAULT: Again a leftover, use
271 	 *    DRM_MODE_TYPE_PREFERRED instead.
272 	 *  - DRM_MODE_TYPE_CLOCK_C and DRM_MODE_TYPE_CRTC_C: Define leftovers
273 	 *    which are stuck around for hysterical raisins only. No one has an
274 	 *    idea what they were meant for. Don't use.
275 	 */
276 	unsigned int type;
277 
278 	/**
279 	 * @clock:
280 	 *
281 	 * Pixel clock in kHz.
282 	 */
283 	int clock;		/* in kHz */
284 	int hdisplay;
285 	int hsync_start;
286 	int hsync_end;
287 	int htotal;
288 	int hskew;
289 	int vdisplay;
290 	int vsync_start;
291 	int vsync_end;
292 	int vtotal;
293 	int vscan;
294 	/**
295 	 * @flags:
296 	 *
297 	 * Sync and timing flags:
298 	 *
299 	 *  - DRM_MODE_FLAG_PHSYNC: horizontal sync is active high.
300 	 *  - DRM_MODE_FLAG_NHSYNC: horizontal sync is active low.
301 	 *  - DRM_MODE_FLAG_PVSYNC: vertical sync is active high.
302 	 *  - DRM_MODE_FLAG_NVSYNC: vertical sync is active low.
303 	 *  - DRM_MODE_FLAG_INTERLACE: mode is interlaced.
304 	 *  - DRM_MODE_FLAG_DBLSCAN: mode uses doublescan.
305 	 *  - DRM_MODE_FLAG_CSYNC: mode uses composite sync.
306 	 *  - DRM_MODE_FLAG_PCSYNC: composite sync is active high.
307 	 *  - DRM_MODE_FLAG_NCSYNC: composite sync is active low.
308 	 *  - DRM_MODE_FLAG_HSKEW: hskew provided (not used?).
309 	 *  - DRM_MODE_FLAG_BCAST: <deprecated>
310 	 *  - DRM_MODE_FLAG_PIXMUX: <deprecated>
311 	 *  - DRM_MODE_FLAG_DBLCLK: double-clocked mode.
312 	 *  - DRM_MODE_FLAG_CLKDIV2: half-clocked mode.
313 	 *
314 	 * Additionally there's flags to specify how 3D modes are packed:
315 	 *
316 	 *  - DRM_MODE_FLAG_3D_NONE: normal, non-3D mode.
317 	 *  - DRM_MODE_FLAG_3D_FRAME_PACKING: 2 full frames for left and right.
318 	 *  - DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE: interleaved like fields.
319 	 *  - DRM_MODE_FLAG_3D_LINE_ALTERNATIVE: interleaved lines.
320 	 *  - DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL: side-by-side full frames.
321 	 *  - DRM_MODE_FLAG_3D_L_DEPTH: ?
322 	 *  - DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH: ?
323 	 *  - DRM_MODE_FLAG_3D_TOP_AND_BOTTOM: frame split into top and bottom
324 	 *    parts.
325 	 *  - DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF: frame split into left and
326 	 *    right parts.
327 	 */
328 	unsigned int flags;
329 
330 	/**
331 	 * @width_mm:
332 	 *
333 	 * Addressable size of the output in mm, projectors should set this to
334 	 * 0.
335 	 */
336 	int width_mm;
337 
338 	/**
339 	 * @height_mm:
340 	 *
341 	 * Addressable size of the output in mm, projectors should set this to
342 	 * 0.
343 	 */
344 	int height_mm;
345 
346 	/**
347 	 * @crtc_clock:
348 	 *
349 	 * Actual pixel or dot clock in the hardware. This differs from the
350 	 * logical @clock when e.g. using interlacing, double-clocking, stereo
351 	 * modes or other fancy stuff that changes the timings and signals
352 	 * actually sent over the wire.
353 	 *
354 	 * This is again in kHz.
355 	 *
356 	 * Note that with digital outputs like HDMI or DP there's usually a
357 	 * massive confusion between the dot clock and the signal clock at the
358 	 * bit encoding level. Especially when a 8b/10b encoding is used and the
359 	 * difference is exactly a factor of 10.
360 	 */
361 	int crtc_clock;
362 	int crtc_hdisplay;
363 	int crtc_hblank_start;
364 	int crtc_hblank_end;
365 	int crtc_hsync_start;
366 	int crtc_hsync_end;
367 	int crtc_htotal;
368 	int crtc_hskew;
369 	int crtc_vdisplay;
370 	int crtc_vblank_start;
371 	int crtc_vblank_end;
372 	int crtc_vsync_start;
373 	int crtc_vsync_end;
374 	int crtc_vtotal;
375 
376 	/**
377 	 * @private:
378 	 *
379 	 * Pointer for driver private data. This can only be used for mode
380 	 * objects passed to drivers in modeset operations. It shouldn't be used
381 	 * by atomic drivers since they can store any additional data by
382 	 * subclassing state structures.
383 	 */
384 	int *private;
385 
386 	/**
387 	 * @private_flags:
388 	 *
389 	 * Similar to @private, but just an integer.
390 	 */
391 	int private_flags;
392 
393 	/**
394 	 * @vrefresh:
395 	 *
396 	 * Vertical refresh rate, for debug output in human readable form. Not
397 	 * used in a functional way.
398 	 *
399 	 * This value is in Hz.
400 	 */
401 	int vrefresh;
402 
403 	/**
404 	 * @hsync:
405 	 *
406 	 * Horizontal refresh rate, for debug output in human readable form. Not
407 	 * used in a functional way.
408 	 *
409 	 * This value is in kHz.
410 	 */
411 	int hsync;
412 
413 	/**
414 	 * @picture_aspect_ratio:
415 	 *
416 	 * Field for setting the HDMI picture aspect ratio of a mode.
417 	 */
418 	enum hdmi_picture_aspect picture_aspect_ratio;
419 
420 	/**
421 	 * @export_head:
422 	 *
423 	 * struct list_head for modes to be exposed to the userspace.
424 	 * This is to maintain a list of exposed modes while preparing
425 	 * user-mode's list in drm_mode_getconnector ioctl. The purpose of this
426 	 * list_head only lies in the ioctl function, and is not expected to be
427 	 * used outside the function.
428 	 * Once used, the stale pointers are not reset, but left as it is, to
429 	 * avoid overhead of protecting it by mode_config.mutex.
430 	 */
431 	struct list_head export_head;
432 };
433 
434 /**
435  * DRM_MODE_FMT - printf string for &struct drm_display_mode
436  */
437 #define DRM_MODE_FMT    "\"%s\": %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x"
438 
439 /**
440  * DRM_MODE_ARG - printf arguments for &struct drm_display_mode
441  * @m: display mode
442  */
443 #define DRM_MODE_ARG(m) \
444 	(m)->name, (m)->vrefresh, (m)->clock, \
445 	(m)->hdisplay, (m)->hsync_start, (m)->hsync_end, (m)->htotal, \
446 	(m)->vdisplay, (m)->vsync_start, (m)->vsync_end, (m)->vtotal, \
447 	(m)->type, (m)->flags
448 
449 #define obj_to_mode(x) container_of(x, struct drm_display_mode, base)
450 
451 /**
452  * drm_mode_is_stereo - check for stereo mode flags
453  * @mode: drm_display_mode to check
454  *
455  * Returns:
456  * True if the mode is one of the stereo modes (like side-by-side), false if
457  * not.
458  */
drm_mode_is_stereo(const struct drm_display_mode * mode)459 static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode)
460 {
461 	return mode->flags & DRM_MODE_FLAG_3D_MASK;
462 }
463 
464 struct drm_connector;
465 struct drm_cmdline_mode;
466 
467 struct drm_display_mode *drm_mode_create(struct drm_device *dev);
468 void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
469 void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
470 			       const struct drm_display_mode *in);
471 int drm_mode_convert_umode(struct drm_device *dev,
472 			   struct drm_display_mode *out,
473 			   const struct drm_mode_modeinfo *in);
474 void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
475 void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
476 bool drm_mode_is_420_only(const struct drm_display_info *display,
477 			  const struct drm_display_mode *mode);
478 bool drm_mode_is_420_also(const struct drm_display_info *display,
479 			  const struct drm_display_mode *mode);
480 bool drm_mode_is_420(const struct drm_display_info *display,
481 		     const struct drm_display_mode *mode);
482 
483 struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
484 				      int hdisplay, int vdisplay, int vrefresh,
485 				      bool reduced, bool interlaced,
486 				      bool margins);
487 struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
488 				      int hdisplay, int vdisplay, int vrefresh,
489 				      bool interlaced, int margins);
490 struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
491 					      int hdisplay, int vdisplay,
492 					      int vrefresh, bool interlaced,
493 					      int margins,
494 					      int GTF_M, int GTF_2C,
495 					      int GTF_K, int GTF_2J);
496 void drm_display_mode_from_videomode(const struct videomode *vm,
497 				     struct drm_display_mode *dmode);
498 void drm_display_mode_to_videomode(const struct drm_display_mode *dmode,
499 				   struct videomode *vm);
500 void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags);
501 int of_get_drm_display_mode(struct device_node *np,
502 			    struct drm_display_mode *dmode, u32 *bus_flags,
503 			    int index);
504 
505 void drm_mode_set_name(struct drm_display_mode *mode);
506 int drm_mode_hsync(const struct drm_display_mode *mode);
507 int drm_mode_vrefresh(const struct drm_display_mode *mode);
508 void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
509 			    int *hdisplay, int *vdisplay);
510 
511 void drm_mode_set_crtcinfo(struct drm_display_mode *p,
512 			   int adjust_flags);
513 void drm_mode_copy(struct drm_display_mode *dst,
514 		   const struct drm_display_mode *src);
515 struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
516 					    const struct drm_display_mode *mode);
517 bool drm_mode_match(const struct drm_display_mode *mode1,
518 		    const struct drm_display_mode *mode2,
519 		    unsigned int match_flags);
520 bool drm_mode_equal(const struct drm_display_mode *mode1,
521 		    const struct drm_display_mode *mode2);
522 bool drm_mode_equal_no_clocks(const struct drm_display_mode *mode1,
523 			      const struct drm_display_mode *mode2);
524 bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
525 					const struct drm_display_mode *mode2);
526 
527 /* for use by the crtc helper probe functions */
528 enum drm_mode_status drm_mode_validate_driver(struct drm_device *dev,
529 					      const struct drm_display_mode *mode);
530 enum drm_mode_status drm_mode_validate_size(const struct drm_display_mode *mode,
531 					    int maxX, int maxY);
532 enum drm_mode_status
533 drm_mode_validate_ycbcr420(const struct drm_display_mode *mode,
534 			   struct drm_connector *connector);
535 void drm_mode_prune_invalid(struct drm_device *dev,
536 			    struct list_head *mode_list, bool verbose);
537 void drm_mode_sort(struct list_head *mode_list);
538 void drm_connector_list_update(struct drm_connector *connector);
539 
540 /* parsing cmdline modes */
541 bool
542 drm_mode_parse_command_line_for_connector(const char *mode_option,
543 					  const struct drm_connector *connector,
544 					  struct drm_cmdline_mode *mode);
545 struct drm_display_mode *
546 drm_mode_create_from_cmdline_mode(struct drm_device *dev,
547 				  struct drm_cmdline_mode *cmd);
548 
549 #endif /* __DRM_MODES_H__ */
550