Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2006 Keith Packard |
| 3 | * Copyright © 2007-2008 Dave Airlie |
| 4 | * Copyright © 2007-2008 Intel Corporation |
| 5 | * Jesse Barnes <jesse.barnes@intel.com> |
| 6 | * Copyright © 2014 Intel Corporation |
| 7 | * Daniel Vetter <daniel.vetter@ffwll.ch> |
| 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 | |
| 30 | /* |
| 31 | * Note on terminology: here, for brevity and convenience, we refer to connector |
| 32 | * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS, |
| 33 | * DVI, etc. And 'screen' refers to the whole of the visible display, which |
| 34 | * may span multiple monitors (and therefore multiple CRTC and connector |
| 35 | * structures). |
| 36 | */ |
| 37 | |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 38 | /** |
| 39 | * enum drm_mode_status - hardware support status of a mode |
| 40 | * @MODE_OK: Mode OK |
| 41 | * @MODE_HSYNC: hsync out of range |
| 42 | * @MODE_VSYNC: vsync out of range |
| 43 | * @MODE_H_ILLEGAL: mode has illegal horizontal timings |
| 44 | * @MODE_V_ILLEGAL: mode has illegal horizontal timings |
| 45 | * @MODE_BAD_WIDTH: requires an unsupported linepitch |
| 46 | * @MODE_NOMODE: no mode with a matching name |
| 47 | * @MODE_NO_INTERLACE: interlaced mode not supported |
| 48 | * @MODE_NO_DBLESCAN: doublescan mode not supported |
| 49 | * @MODE_NO_VSCAN: multiscan mode not supported |
| 50 | * @MODE_MEM: insufficient video memory |
| 51 | * @MODE_VIRTUAL_X: mode width too large for specified virtual size |
| 52 | * @MODE_VIRTUAL_Y: mode height too large for specified virtual size |
| 53 | * @MODE_MEM_VIRT: insufficient video memory given virtual size |
| 54 | * @MODE_NOCLOCK: no fixed clock available |
| 55 | * @MODE_CLOCK_HIGH: clock required is too high |
| 56 | * @MODE_CLOCK_LOW: clock required is too low |
| 57 | * @MODE_CLOCK_RANGE: clock/mode isn't in a ClockRange |
| 58 | * @MODE_BAD_HVALUE: horizontal timing was out of range |
| 59 | * @MODE_BAD_VVALUE: vertical timing was out of range |
| 60 | * @MODE_BAD_VSCAN: VScan value out of range |
| 61 | * @MODE_HSYNC_NARROW: horizontal sync too narrow |
| 62 | * @MODE_HSYNC_WIDE: horizontal sync too wide |
| 63 | * @MODE_HBLANK_NARROW: horizontal blanking too narrow |
| 64 | * @MODE_HBLANK_WIDE: horizontal blanking too wide |
| 65 | * @MODE_VSYNC_NARROW: vertical sync too narrow |
| 66 | * @MODE_VSYNC_WIDE: vertical sync too wide |
| 67 | * @MODE_VBLANK_NARROW: vertical blanking too narrow |
| 68 | * @MODE_VBLANK_WIDE: vertical blanking too wide |
| 69 | * @MODE_PANEL: exceeds panel dimensions |
| 70 | * @MODE_INTERLACE_WIDTH: width too large for interlaced mode |
| 71 | * @MODE_ONE_WIDTH: only one width is supported |
| 72 | * @MODE_ONE_HEIGHT: only one height is supported |
| 73 | * @MODE_ONE_SIZE: only one resolution is supported |
| 74 | * @MODE_NO_REDUCED: monitor doesn't accept reduced blanking |
| 75 | * @MODE_NO_STEREO: stereo modes not supported |
Ville Syrjälä | 5ba8940 | 2015-12-10 22:39:08 +0200 | [diff] [blame] | 76 | * @MODE_STALE: mode has become stale |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 77 | * @MODE_BAD: unspecified reason |
| 78 | * @MODE_ERROR: error condition |
| 79 | * |
| 80 | * This enum is used to filter out modes not supported by the driver/hardware |
| 81 | * combination. |
| 82 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 83 | enum drm_mode_status { |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 84 | MODE_OK = 0, |
| 85 | MODE_HSYNC, |
| 86 | MODE_VSYNC, |
| 87 | MODE_H_ILLEGAL, |
| 88 | MODE_V_ILLEGAL, |
| 89 | MODE_BAD_WIDTH, |
| 90 | MODE_NOMODE, |
| 91 | MODE_NO_INTERLACE, |
| 92 | MODE_NO_DBLESCAN, |
| 93 | MODE_NO_VSCAN, |
| 94 | MODE_MEM, |
| 95 | MODE_VIRTUAL_X, |
| 96 | MODE_VIRTUAL_Y, |
| 97 | MODE_MEM_VIRT, |
| 98 | MODE_NOCLOCK, |
| 99 | MODE_CLOCK_HIGH, |
| 100 | MODE_CLOCK_LOW, |
| 101 | MODE_CLOCK_RANGE, |
| 102 | MODE_BAD_HVALUE, |
| 103 | MODE_BAD_VVALUE, |
| 104 | MODE_BAD_VSCAN, |
| 105 | MODE_HSYNC_NARROW, |
| 106 | MODE_HSYNC_WIDE, |
| 107 | MODE_HBLANK_NARROW, |
| 108 | MODE_HBLANK_WIDE, |
| 109 | MODE_VSYNC_NARROW, |
| 110 | MODE_VSYNC_WIDE, |
| 111 | MODE_VBLANK_NARROW, |
| 112 | MODE_VBLANK_WIDE, |
| 113 | MODE_PANEL, |
| 114 | MODE_INTERLACE_WIDTH, |
| 115 | MODE_ONE_WIDTH, |
| 116 | MODE_ONE_HEIGHT, |
| 117 | MODE_ONE_SIZE, |
| 118 | MODE_NO_REDUCED, |
| 119 | MODE_NO_STEREO, |
Ville Syrjälä | 5ba8940 | 2015-12-10 22:39:08 +0200 | [diff] [blame] | 120 | MODE_STALE = -3, |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 121 | MODE_BAD = -2, |
| 122 | MODE_ERROR = -1 |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 123 | }; |
| 124 | |
| 125 | #define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \ |
| 126 | DRM_MODE_TYPE_CRTC_C) |
| 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 | .base.type = DRM_MODE_OBJECT_MODE |
| 135 | |
| 136 | #define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */ |
| 137 | #define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */ |
Gustavo Padovan | ecb7e16 | 2014-12-01 15:40:09 -0800 | [diff] [blame] | 138 | #define CRTC_NO_DBLSCAN (1 << 2) /* don't adjust doublescan */ |
| 139 | #define CRTC_NO_VSCAN (1 << 3) /* don't adjust doublescan */ |
Damien Lespiau | 498b873 | 2015-02-16 15:12:31 +0000 | [diff] [blame] | 140 | #define CRTC_STEREO_DOUBLE_ONLY (CRTC_STEREO_DOUBLE | CRTC_NO_DBLSCAN | CRTC_NO_VSCAN) |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 141 | |
| 142 | #define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF |
| 143 | |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 144 | /** |
| 145 | * struct drm_display_mode - DRM kernel-internal display mode structure |
| 146 | * @hdisplay: horizontal display size |
| 147 | * @hsync_start: horizontal sync start |
| 148 | * @hsync_end: horizontal sync end |
| 149 | * @htotal: horizontal total size |
| 150 | * @hskew: horizontal skew?! |
| 151 | * @vdisplay: vertical display size |
| 152 | * @vsync_start: vertical sync start |
| 153 | * @vsync_end: vertical sync end |
| 154 | * @vtotal: vertical total size |
| 155 | * @vscan: vertical scan?! |
| 156 | * @crtc_hdisplay: hardware mode horizontal display size |
| 157 | * @crtc_hblank_start: hardware mode horizontal blank start |
| 158 | * @crtc_hblank_end: hardware mode horizontal blank end |
| 159 | * @crtc_hsync_start: hardware mode horizontal sync start |
| 160 | * @crtc_hsync_end: hardware mode horizontal sync end |
| 161 | * @crtc_htotal: hardware mode horizontal total size |
| 162 | * @crtc_hskew: hardware mode horizontal skew?! |
| 163 | * @crtc_vdisplay: hardware mode vertical display size |
| 164 | * @crtc_vblank_start: hardware mode vertical blank start |
| 165 | * @crtc_vblank_end: hardware mode vertical blank end |
| 166 | * @crtc_vsync_start: hardware mode vertical sync start |
| 167 | * @crtc_vsync_end: hardware mode vertical sync end |
| 168 | * @crtc_vtotal: hardware mode vertical total size |
| 169 | * |
| 170 | * The horizontal and vertical timings are defined per the following diagram. |
| 171 | * |
| 172 | * |
| 173 | * Active Front Sync Back |
| 174 | * Region Porch Porch |
| 175 | * <-----------------------><----------------><-------------><--------------> |
| 176 | * //////////////////////| |
| 177 | * ////////////////////// | |
| 178 | * ////////////////////// |.................. ................ |
| 179 | * _______________ |
| 180 | * <----- [hv]display -----> |
| 181 | * <------------- [hv]sync_start ------------> |
| 182 | * <--------------------- [hv]sync_end ---------------------> |
| 183 | * <-------------------------------- [hv]total ----------------------------->* |
| 184 | * |
| 185 | * This structure contains two copies of timings. First are the plain timings, |
| 186 | * which specify the logical mode, as it would be for a progressive 1:1 scanout |
| 187 | * at the refresh rate userspace can observe through vblank timestamps. Then |
| 188 | * there's the hardware timings, which are corrected for interlacing, |
| 189 | * double-clocking and similar things. They are provided as a convenience, and |
| 190 | * can be appropriately computed using drm_mode_set_crtcinfo(). |
| 191 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 192 | struct drm_display_mode { |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 193 | /** |
| 194 | * @head: |
| 195 | * |
| 196 | * struct list_head for mode lists. |
| 197 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 198 | struct list_head head; |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 199 | |
| 200 | /** |
| 201 | * @base: |
| 202 | * |
| 203 | * A display mode is a normal modeset object, possibly including public |
| 204 | * userspace id. |
| 205 | * |
| 206 | * FIXME: |
| 207 | * |
| 208 | * This can probably be removed since the entire concept of userspace |
| 209 | * managing modes explicitly has never landed in upstream kernel mode |
| 210 | * setting support. |
| 211 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 212 | struct drm_mode_object base; |
| 213 | |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 214 | /** |
| 215 | * @name: |
| 216 | * |
| 217 | * Human-readable name of the mode, filled out with drm_mode_set_name(). |
| 218 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 219 | char name[DRM_DISPLAY_MODE_LEN]; |
| 220 | |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 221 | /** |
| 222 | * @status: |
| 223 | * |
| 224 | * Status of the mode, used to filter out modes not supported by the |
| 225 | * hardware. See enum &drm_mode_status. |
| 226 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 227 | enum drm_mode_status status; |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 228 | |
| 229 | /** |
| 230 | * @type: |
| 231 | * |
| 232 | * A bitmask of flags, mostly about the source of a mode. Possible flags |
| 233 | * are: |
| 234 | * |
| 235 | * - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, effectively |
| 236 | * unused. |
| 237 | * - DRM_MODE_TYPE_PREFERRED: Preferred mode, usually the native |
| 238 | * resolution of an LCD panel. There should only be one preferred |
| 239 | * mode per connector at any given time. |
| 240 | * - DRM_MODE_TYPE_DRIVER: Mode created by the driver, which is all of |
| 241 | * them really. Drivers must set this bit for all modes they create |
| 242 | * and expose to userspace. |
| 243 | * |
| 244 | * Plus a big list of flags which shouldn't be used at all, but are |
| 245 | * still around since these flags are also used in the userspace ABI: |
| 246 | * |
| 247 | * - DRM_MODE_TYPE_DEFAULT: Again a leftover, use |
| 248 | * DRM_MODE_TYPE_PREFERRED instead. |
| 249 | * - DRM_MODE_TYPE_CLOCK_C and DRM_MODE_TYPE_CRTC_C: Define leftovers |
| 250 | * which are stuck around for hysterical raisins only. No one has an |
| 251 | * idea what they were meant for. Don't use. |
| 252 | * - DRM_MODE_TYPE_USERDEF: Mode defined by userspace, again a vestige |
| 253 | * from older kms designs where userspace had to first add a custom |
| 254 | * mode to the kernel's mode list before it could use it. Don't use. |
| 255 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 256 | unsigned int type; |
| 257 | |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 258 | /** |
| 259 | * @clock: |
| 260 | * |
| 261 | * Pixel clock in kHz. |
| 262 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 263 | int clock; /* in kHz */ |
| 264 | int hdisplay; |
| 265 | int hsync_start; |
| 266 | int hsync_end; |
| 267 | int htotal; |
| 268 | int hskew; |
| 269 | int vdisplay; |
| 270 | int vsync_start; |
| 271 | int vsync_end; |
| 272 | int vtotal; |
| 273 | int vscan; |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 274 | /** |
| 275 | * @flags: |
| 276 | * |
| 277 | * Sync and timing flags: |
| 278 | * |
| 279 | * - DRM_MODE_FLAG_PHSYNC: horizontal sync is active high. |
| 280 | * - DRM_MODE_FLAG_NHSYNC: horizontal sync is active low. |
| 281 | * - DRM_MODE_FLAG_PVSYNC: vertical sync is active high. |
| 282 | * - DRM_MODE_FLAG_NVSYNC: vertical sync is active low. |
| 283 | * - DRM_MODE_FLAG_INTERLACE: mode is interlaced. |
| 284 | * - DRM_MODE_FLAG_DBLSCAN: mode uses doublescan. |
| 285 | * - DRM_MODE_FLAG_CSYNC: mode uses composite sync. |
| 286 | * - DRM_MODE_FLAG_PCSYNC: composite sync is active high. |
| 287 | * - DRM_MODE_FLAG_NCSYNC: composite sync is active low. |
| 288 | * - DRM_MODE_FLAG_HSKEW: hskew provided (not used?). |
| 289 | * - DRM_MODE_FLAG_BCAST: not used? |
| 290 | * - DRM_MODE_FLAG_PIXMUX: not used? |
| 291 | * - DRM_MODE_FLAG_DBLCLK: double-clocked mode. |
| 292 | * - DRM_MODE_FLAG_CLKDIV2: half-clocked mode. |
| 293 | * |
| 294 | * Additionally there's flags to specify how 3D modes are packed: |
| 295 | * |
| 296 | * - DRM_MODE_FLAG_3D_NONE: normal, non-3D mode. |
| 297 | * - DRM_MODE_FLAG_3D_FRAME_PACKING: 2 full frames for left and right. |
| 298 | * - DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE: interleaved like fields. |
| 299 | * - DRM_MODE_FLAG_3D_LINE_ALTERNATIVE: interleaved lines. |
| 300 | * - DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL: side-by-side full frames. |
| 301 | * - DRM_MODE_FLAG_3D_L_DEPTH: ? |
| 302 | * - DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH: ? |
| 303 | * - DRM_MODE_FLAG_3D_TOP_AND_BOTTOM: frame split into top and bottom |
| 304 | * parts. |
| 305 | * - DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF: frame split into left and |
| 306 | * right parts. |
| 307 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 308 | unsigned int flags; |
| 309 | |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 310 | /** |
| 311 | * @width_mm: |
| 312 | * |
| 313 | * Addressable size of the output in mm, projectors should set this to |
| 314 | * 0. |
| 315 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 316 | int width_mm; |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 317 | |
| 318 | /** |
| 319 | * @height_mm: |
| 320 | * |
| 321 | * Addressable size of the output in mm, projectors should set this to |
| 322 | * 0. |
| 323 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 324 | int height_mm; |
| 325 | |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 326 | /** |
| 327 | * @crtc_clock: |
| 328 | * |
| 329 | * Actual pixel or dot clock in the hardware. This differs from the |
| 330 | * logical @clock when e.g. using interlacing, double-clocking, stereo |
| 331 | * modes or other fancy stuff that changes the timings and signals |
| 332 | * actually sent over the wire. |
| 333 | * |
| 334 | * This is again in kHz. |
| 335 | * |
| 336 | * Note that with digital outputs like HDMI or DP there's usually a |
| 337 | * massive confusion between the dot clock and the signal clock at the |
| 338 | * bit encoding level. Especially when a 8b/10b encoding is used and the |
| 339 | * difference is exactly a factor of 10. |
| 340 | */ |
| 341 | int crtc_clock; |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 342 | int crtc_hdisplay; |
| 343 | int crtc_hblank_start; |
| 344 | int crtc_hblank_end; |
| 345 | int crtc_hsync_start; |
| 346 | int crtc_hsync_end; |
| 347 | int crtc_htotal; |
| 348 | int crtc_hskew; |
| 349 | int crtc_vdisplay; |
| 350 | int crtc_vblank_start; |
| 351 | int crtc_vblank_end; |
| 352 | int crtc_vsync_start; |
| 353 | int crtc_vsync_end; |
| 354 | int crtc_vtotal; |
| 355 | |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 356 | /** |
| 357 | * @private: |
| 358 | * |
| 359 | * Pointer for driver private data. This can only be used for mode |
| 360 | * objects passed to drivers in modeset operations. It shouldn't be used |
| 361 | * by atomic drivers since they can store any additional data by |
| 362 | * subclassing state structures. |
| 363 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 364 | int *private; |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 365 | |
| 366 | /** |
| 367 | * @private_flags: |
| 368 | * |
| 369 | * Similar to @private, but just an integer. |
| 370 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 371 | int private_flags; |
| 372 | |
Daniel Vetter | 30ecad7 | 2015-12-09 09:29:36 +0100 | [diff] [blame] | 373 | /** |
| 374 | * @vrefresh: |
| 375 | * |
| 376 | * Vertical refresh rate, for debug output in human readable form. Not |
| 377 | * used in a functional way. |
| 378 | * |
| 379 | * This value is in Hz. |
| 380 | */ |
| 381 | int vrefresh; |
| 382 | |
| 383 | /** |
| 384 | * @hsync: |
| 385 | * |
| 386 | * Horizontal refresh rate, for debug output in human readable form. Not |
| 387 | * used in a functional way. |
| 388 | * |
| 389 | * This value is in kHz. |
| 390 | */ |
| 391 | int hsync; |
| 392 | |
| 393 | /** |
| 394 | * @picture_aspect_ratio: |
| 395 | * |
| 396 | * Field for setting the HDMI picture aspect ratio of a mode. |
| 397 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 398 | enum hdmi_picture_aspect picture_aspect_ratio; |
| 399 | }; |
| 400 | |
| 401 | /* mode specified on the command line */ |
| 402 | struct drm_cmdline_mode { |
| 403 | bool specified; |
| 404 | bool refresh_specified; |
| 405 | bool bpp_specified; |
| 406 | int xres, yres; |
| 407 | int bpp; |
| 408 | int refresh; |
| 409 | bool rb; |
| 410 | bool interlace; |
| 411 | bool cvt; |
| 412 | bool margins; |
| 413 | enum drm_connector_force force; |
| 414 | }; |
| 415 | |
Daniel Vetter | f5aabb9 | 2014-01-23 20:05:00 +0100 | [diff] [blame] | 416 | /** |
| 417 | * drm_mode_is_stereo - check for stereo mode flags |
| 418 | * @mode: drm_display_mode to check |
| 419 | * |
| 420 | * Returns: |
| 421 | * True if the mode is one of the stereo modes (like side-by-side), false if |
| 422 | * not. |
| 423 | */ |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 424 | static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode) |
| 425 | { |
| 426 | return mode->flags & DRM_MODE_FLAG_3D_MASK; |
| 427 | } |
| 428 | |
| 429 | struct drm_connector; |
| 430 | struct drm_cmdline_mode; |
| 431 | |
| 432 | struct drm_display_mode *drm_mode_create(struct drm_device *dev); |
| 433 | void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode); |
Daniel Stone | 934a8a8 | 2015-05-22 13:34:48 +0100 | [diff] [blame] | 434 | void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out, |
| 435 | const struct drm_display_mode *in); |
| 436 | int drm_mode_convert_umode(struct drm_display_mode *out, |
| 437 | const struct drm_mode_modeinfo *in); |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 438 | void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); |
| 439 | void drm_mode_debug_printmodeline(const struct drm_display_mode *mode); |
| 440 | |
| 441 | struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, |
| 442 | int hdisplay, int vdisplay, int vrefresh, |
| 443 | bool reduced, bool interlaced, |
| 444 | bool margins); |
| 445 | struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, |
| 446 | int hdisplay, int vdisplay, int vrefresh, |
| 447 | bool interlaced, int margins); |
| 448 | struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, |
| 449 | int hdisplay, int vdisplay, |
| 450 | int vrefresh, bool interlaced, |
| 451 | int margins, |
| 452 | int GTF_M, int GTF_2C, |
| 453 | int GTF_K, int GTF_2J); |
Daniel Vetter | ba0c242 | 2014-01-23 16:28:50 +0100 | [diff] [blame] | 454 | void drm_display_mode_from_videomode(const struct videomode *vm, |
| 455 | struct drm_display_mode *dmode); |
Steve Longerbeam | d490f45 | 2014-12-18 18:00:22 -0800 | [diff] [blame] | 456 | void drm_display_mode_to_videomode(const struct drm_display_mode *dmode, |
| 457 | struct videomode *vm); |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 458 | int of_get_drm_display_mode(struct device_node *np, |
| 459 | struct drm_display_mode *dmode, |
| 460 | int index); |
| 461 | |
| 462 | void drm_mode_set_name(struct drm_display_mode *mode); |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 463 | int drm_mode_hsync(const struct drm_display_mode *mode); |
| 464 | int drm_mode_vrefresh(const struct drm_display_mode *mode); |
| 465 | |
| 466 | void drm_mode_set_crtcinfo(struct drm_display_mode *p, |
| 467 | int adjust_flags); |
| 468 | void drm_mode_copy(struct drm_display_mode *dst, |
| 469 | const struct drm_display_mode *src); |
| 470 | struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, |
| 471 | const struct drm_display_mode *mode); |
| 472 | bool drm_mode_equal(const struct drm_display_mode *mode1, |
| 473 | const struct drm_display_mode *mode2); |
Ville Syrjälä | 4c6bcf4 | 2015-11-16 21:05:12 +0200 | [diff] [blame] | 474 | bool drm_mode_equal_no_clocks(const struct drm_display_mode *mode1, |
| 475 | const struct drm_display_mode *mode2); |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 476 | bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1, |
| 477 | const struct drm_display_mode *mode2); |
| 478 | |
| 479 | /* for use by the crtc helper probe functions */ |
Ville Syrjälä | abc0b14 | 2014-12-17 13:56:23 +0200 | [diff] [blame] | 480 | enum drm_mode_status drm_mode_validate_basic(const struct drm_display_mode *mode); |
Ville Syrjälä | 05acaec | 2014-12-17 13:56:22 +0200 | [diff] [blame] | 481 | enum drm_mode_status drm_mode_validate_size(const struct drm_display_mode *mode, |
| 482 | int maxX, int maxY); |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 483 | void drm_mode_prune_invalid(struct drm_device *dev, |
| 484 | struct list_head *mode_list, bool verbose); |
| 485 | void drm_mode_sort(struct list_head *mode_list); |
Ville Syrjälä | 6af3e65 | 2015-12-03 23:14:14 +0200 | [diff] [blame] | 486 | void drm_mode_connector_list_update(struct drm_connector *connector); |
Daniel Vetter | 5531000 | 2014-01-23 15:52:20 +0100 | [diff] [blame] | 487 | |
| 488 | /* parsing cmdline modes */ |
| 489 | bool |
| 490 | drm_mode_parse_command_line_for_connector(const char *mode_option, |
| 491 | struct drm_connector *connector, |
| 492 | struct drm_cmdline_mode *mode); |
| 493 | struct drm_display_mode * |
| 494 | drm_mode_create_from_cmdline_mode(struct drm_device *dev, |
| 495 | struct drm_cmdline_mode *cmd); |
| 496 | |
| 497 | #endif /* __DRM_MODES_H__ */ |