drm_modes.h 19 KB

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