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