| 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 |
|
| 30 | #include <linux/hdmi.h>
|
| 31 |
|
| 32 | #include <drm/drm_mode_object.h>
|
| 33 | #include <drm/drm_connector.h>
|
| 34 |
|
| 35 | struct videomode;
|
| 36 |
|
| 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 |
|
| 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 vertical 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
|
| 83 | * @MODE_NO_420: ycbcr 420 modes not supported
|
| 84 | * @MODE_STALE: mode has become stale
|
| 85 | * @MODE_BAD: unspecified reason
|
| 86 | * @MODE_ERROR: error condition
|
| 87 | *
|
| 88 | * This enum is used to filter out modes not supported by the driver/hardware
|
| 89 | * combination.
|
| 90 |
|
| 91 | enum drm_mode_status {
|
| 92 | MODE_OK = 0,
|
| 93 | MODE_HSYNC,
|
| 94 | MODE_VSYNC,
|
| 95 | MODE_H_ILLEGAL,
|
| 96 | MODE_V_ILLEGAL,
|
| 97 | MODE_BAD_WIDTH,
|
| 98 | MODE_NOMODE,
|
| 99 | MODE_NO_INTERLACE,
|
| 100 | MODE_NO_DBLESCAN,
|
| 101 | MODE_NO_VSCAN,
|
| 102 | MODE_MEM,
|
| 103 | MODE_VIRTUAL_X,
|
| 104 | MODE_VIRTUAL_Y,
|
| 105 | MODE_MEM_VIRT,
|
| 106 | MODE_NOCLOCK,
|
| 107 | MODE_CLOCK_HIGH,
|
| 108 | MODE_CLOCK_LOW,
|
| 109 | MODE_CLOCK_RANGE,
|
| 110 | MODE_BAD_HVALUE,
|
| 111 | MODE_BAD_VVALUE,
|
| 112 | MODE_BAD_VSCAN,
|
| 113 | MODE_HSYNC_NARROW,
|
| 114 | MODE_HSYNC_WIDE,
|
| 115 | MODE_HBLANK_NARROW,
|
| 116 | MODE_HBLANK_WIDE,
|
| 117 | MODE_VSYNC_NARROW,
|
| 118 | MODE_VSYNC_WIDE,
|
| 119 | MODE_VBLANK_NARROW,
|
| 120 | MODE_VBLANK_WIDE,
|
| 121 | MODE_PANEL,
|
| 122 | MODE_INTERLACE_WIDTH,
|
| 123 | MODE_ONE_WIDTH,
|
| 124 | MODE_ONE_HEIGHT,
|
| 125 | MODE_ONE_SIZE,
|
| 126 | MODE_NO_REDUCED,
|
| 127 | MODE_NO_STEREO,
|
| 128 | MODE_NO_420,
|
| 129 | MODE_STALE = -3,
|
| 130 | MODE_BAD = -2,
|
| 131 | MODE_ERROR = -1
|
| 132 | };
|
| 133 |
|
| 134 | #define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
|
| 135 | .name = nm, .status = 0, .type = (t), .clock = (c), \
|
| 136 | .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
|
| 137 | .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
|
| 138 | .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
|
| 139 | .vscan = (vs), .flags = (f)
|
| 140 |
|
| 141 | |
| 142 | * DRM_MODE_RES_MM - Calculates the display size from resolution and DPI
|
| 143 | * @res: The resolution in pixel
|
| 144 | * @dpi: The number of dots per inch
|
| 145 |
|
| 146 | #define DRM_MODE_RES_MM(res, dpi) \
|
| 147 | (((res) * 254ul) / ((dpi) * 10ul))
|
| 148 |
|
| 149 | #define __DRM_MODE_INIT(pix, hd, vd, hd_mm, vd_mm) \
|
| 150 | .type = DRM_MODE_TYPE_DRIVER, .clock = (pix), \
|
| 151 | .hdisplay = (hd), .hsync_start = (hd), .hsync_end = (hd), \
|
| 152 | .htotal = (hd), .vdisplay = (vd), .vsync_start = (vd), \
|
| 153 | .vsync_end = (vd), .vtotal = (vd), .width_mm = (hd_mm), \
|
| 154 | .height_mm = (vd_mm)
|
| 155 |
|
| 156 | |
| 157 | * DRM_MODE_INIT - Initialize display mode
|
| 158 | * @hz: Vertical refresh rate in Hertz
|
| 159 | * @hd: Horizontal resolution, width
|
| 160 | * @vd: Vertical resolution, height
|
| 161 | * @hd_mm: Display width in millimeters
|
| 162 | * @vd_mm: Display height in millimeters
|
| 163 | *
|
| 164 | * This macro initializes a &drm_display_mode that contains information about
|
| 165 | * refresh rate, resolution and physical size.
|
| 166 |
|
| 167 | #define DRM_MODE_INIT(hz, hd, vd, hd_mm, vd_mm) \
|
| 168 | __DRM_MODE_INIT((hd) * (vd) * (hz) / 1000 , hd, vd, hd_mm, vd_mm)
|
| 169 |
|
| 170 | |
| 171 | * DRM_SIMPLE_MODE - Simple display mode
|
| 172 | * @hd: Horizontal resolution, width
|
| 173 | * @vd: Vertical resolution, height
|
| 174 | * @hd_mm: Display width in millimeters
|
| 175 | * @vd_mm: Display height in millimeters
|
| 176 | *
|
| 177 | * This macro initializes a &drm_display_mode that only contains info about
|
| 178 | * resolution and physical size.
|
| 179 |
|
| 180 | #define DRM_SIMPLE_MODE(hd, vd, hd_mm, vd_mm) \
|
| 181 | __DRM_MODE_INIT(1 , hd, vd, hd_mm, vd_mm)
|
| 182 |
|
| 183 | #define CRTC_INTERLACE_HALVE_V (1 << 0)
|
| 184 | #define CRTC_STEREO_DOUBLE (1 << 1)
|
| 185 | #define CRTC_NO_DBLSCAN (1 << 2)
|
| 186 | #define CRTC_NO_VSCAN (1 << 3)
|
| 187 | #define CRTC_STEREO_DOUBLE_ONLY (CRTC_STEREO_DOUBLE | CRTC_NO_DBLSCAN | CRTC_NO_VSCAN)
|
| 188 |
|
| 189 | #define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
|
| 190 |
|
| 191 | #define DRM_MODE_MATCH_TIMINGS (1 << 0)
|
| 192 | #define DRM_MODE_MATCH_CLOCK (1 << 1)
|
| 193 | #define DRM_MODE_MATCH_FLAGS (1 << 2)
|
| 194 | #define DRM_MODE_MATCH_3D_FLAGS (1 << 3)
|
| 195 | #define DRM_MODE_MATCH_ASPECT_RATIO (1 << 4)
|
| 196 | #define DRM_MODE_MATCH_TIMINGS_VRR (1 << 5)
|
| 197 |
|
| 198 | |
| 199 | * struct drm_display_mode - DRM kernel-internal display mode structure
|
| 200 | * @hdisplay: horizontal display size
|
| 201 | * @hsync_start: horizontal sync start
|
| 202 | * @hsync_end: horizontal sync end
|
| 203 | * @htotal: horizontal total size
|
| 204 | * @hskew: horizontal skew?!
|
| 205 | * @vdisplay: vertical display size
|
| 206 | * @vsync_start: vertical sync start
|
| 207 | * @vsync_end: vertical sync end
|
| 208 | * @vtotal: vertical total size
|
| 209 | * @vscan: vertical scan?!
|
| 210 | * @crtc_hdisplay: hardware mode horizontal display size
|
| 211 | * @crtc_hblank_start: hardware mode horizontal blank start
|
| 212 | * @crtc_hblank_end: hardware mode horizontal blank end
|
| 213 | * @crtc_hsync_start: hardware mode horizontal sync start
|
| 214 | * @crtc_hsync_end: hardware mode horizontal sync end
|
| 215 | * @crtc_htotal: hardware mode horizontal total size
|
| 216 | * @crtc_hskew: hardware mode horizontal skew?!
|
| 217 | * @crtc_vdisplay: hardware mode vertical display size
|
| 218 | * @crtc_vblank_start: hardware mode vertical blank start
|
| 219 | * @crtc_vblank_end: hardware mode vertical blank end
|
| 220 | * @crtc_vsync_start: hardware mode vertical sync start
|
| 221 | * @crtc_vsync_end: hardware mode vertical sync end
|
| 222 | * @crtc_vtotal: hardware mode vertical total size
|
| 223 | *
|
| 224 | * This is the kernel API display mode information structure. For the
|
| 225 | * user-space version see struct drm_mode_modeinfo.
|
| 226 | *
|
| 227 | * The horizontal and vertical timings are defined per the following diagram.
|
| 228 | *
|
| 229 | * ::
|
| 230 | *
|
| 231 | *
|
| 232 | * Active Front Sync Back
|
| 233 | * Region Porch Porch
|
| 234 | * <-----------------------><----------------><-------------><-------------->
|
| 235 | * //////////////////////|
|
| 236 | * ////////////////////// |
|
| 237 | * ////////////////////// |.................. ................
|
| 238 | * _______________
|
| 239 | * <----- [hv]display ----->
|
| 240 | * <------------- [hv]sync_start ------------>
|
| 241 | * <--------------------- [hv]sync_end --------------------->
|
| 242 | * <-------------------------------- [hv]total ----------------------------->*
|
| 243 | *
|
| 244 | * This structure contains two copies of timings. First are the plain timings,
|
| 245 | * which specify the logical mode, as it would be for a progressive 1:1 scanout
|
| 246 | * at the refresh rate userspace can observe through vblank timestamps. Then
|
| 247 | * there's the hardware timings, which are corrected for interlacing,
|
| 248 | * double-clocking and similar things. They are provided as a convenience, and
|
| 249 | * can be appropriately computed using drm_mode_set_crtcinfo().
|
| 250 | *
|
| 251 | * For printing you can use %DRM_MODE_FMT and DRM_MODE_ARG().
|
| 252 |
|
| 253 | struct drm_display_mode {
|
| 254 | |
| 255 | * @clock:
|
| 256 | *
|
| 257 | * Pixel clock in kHz.
|
| 258 |
|
| 259 | int clock;
|
| 260 | u16 hdisplay;
|
| 261 | u16 hsync_start;
|
| 262 | u16 hsync_end;
|
| 263 | u16 htotal;
|
| 264 | u16 hskew;
|
| 265 | u16 vdisplay;
|
| 266 | u16 vsync_start;
|
| 267 | u16 vsync_end;
|
| 268 | u16 vtotal;
|
| 269 | u16 vscan;
|
| 270 | |
| 271 | * @flags:
|
| 272 | *
|
| 273 | * Sync and timing flags:
|
| 274 | *
|
| 275 | * - DRM_MODE_FLAG_PHSYNC: horizontal sync is active high.
|
| 276 | * - DRM_MODE_FLAG_NHSYNC: horizontal sync is active low.
|
| 277 | * - DRM_MODE_FLAG_PVSYNC: vertical sync is active high.
|
| 278 | * - DRM_MODE_FLAG_NVSYNC: vertical sync is active low.
|
| 279 | * - DRM_MODE_FLAG_INTERLACE: mode is interlaced.
|
| 280 | * - DRM_MODE_FLAG_DBLSCAN: mode uses doublescan.
|
| 281 | * - DRM_MODE_FLAG_CSYNC: mode uses composite sync.
|
| 282 | * - DRM_MODE_FLAG_PCSYNC: composite sync is active high.
|
| 283 | * - DRM_MODE_FLAG_NCSYNC: composite sync is active low.
|
| 284 | * - DRM_MODE_FLAG_HSKEW: hskew provided (not used?).
|
| 285 | * - DRM_MODE_FLAG_BCAST: <deprecated>
|
| 286 | * - DRM_MODE_FLAG_PIXMUX: <deprecated>
|
| 287 | * - DRM_MODE_FLAG_DBLCLK: double-clocked mode.
|
| 288 | * - DRM_MODE_FLAG_CLKDIV2: half-clocked mode.
|
| 289 | *
|
| 290 | * Additionally there's flags to specify how 3D modes are packed:
|
| 291 | *
|
| 292 | * - DRM_MODE_FLAG_3D_NONE: normal, non-3D mode.
|
| 293 | * - DRM_MODE_FLAG_3D_FRAME_PACKING: 2 full frames for left and right.
|
| 294 | * - DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE: interleaved like fields.
|
| 295 | * - DRM_MODE_FLAG_3D_LINE_ALTERNATIVE: interleaved lines.
|
| 296 | * - DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL: side-by-side full frames.
|
| 297 | * - DRM_MODE_FLAG_3D_L_DEPTH: ?
|
| 298 | * - DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH: ?
|
| 299 | * - DRM_MODE_FLAG_3D_TOP_AND_BOTTOM: frame split into top and bottom
|
| 300 | * parts.
|
| 301 | * - DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF: frame split into left and
|
| 302 | * right parts.
|
| 303 |
|
| 304 | u32 flags;
|
| 305 |
|
| 306 | |
| 307 | * @crtc_clock:
|
| 308 | *
|
| 309 | * Actual pixel or dot clock in the hardware. This differs from the
|
| 310 | * logical @clock when e.g. using interlacing, double-clocking, stereo
|
| 311 | * modes or other fancy stuff that changes the timings and signals
|
| 312 | * actually sent over the wire.
|
| 313 | *
|
| 314 | * This is again in kHz.
|
| 315 | *
|
| 316 | * Note that with digital outputs like HDMI or DP there's usually a
|
| 317 | * massive confusion between the dot clock and the signal clock at the
|
| 318 | * bit encoding level. Especially when a 8b/10b encoding is used and the
|
| 319 | * difference is exactly a factor of 10.
|
| 320 |
|
| 321 | int crtc_clock;
|
| 322 | u16 crtc_hdisplay;
|
| 323 | u16 crtc_hblank_start;
|
| 324 | u16 crtc_hblank_end;
|
| 325 | u16 crtc_hsync_start;
|
| 326 | u16 crtc_hsync_end;
|
| 327 | u16 crtc_htotal;
|
| 328 | u16 crtc_hskew;
|
| 329 | u16 crtc_vdisplay;
|
| 330 | u16 crtc_vblank_start;
|
| 331 | u16 crtc_vblank_end;
|
| 332 | u16 crtc_vsync_start;
|
| 333 | u16 crtc_vsync_end;
|
| 334 | u16 crtc_vtotal;
|
| 335 |
|
| 336 | |
| 337 | * @width_mm:
|
| 338 | *
|
| 339 | * Addressable size of the output in mm, projectors should set this to
|
| 340 | * 0.
|
| 341 |
|
| 342 | u16 width_mm;
|
| 343 |
|
| 344 | |
| 345 | * @height_mm:
|
| 346 | *
|
| 347 | * Addressable size of the output in mm, projectors should set this to
|
| 348 | * 0.
|
| 349 |
|
| 350 | u16 height_mm;
|
| 351 |
|
| 352 | |
| 353 | * @type:
|
| 354 | *
|
| 355 | * A bitmask of flags, mostly about the source of a mode. Possible flags
|
| 356 | * are:
|
| 357 | *
|
| 358 | * - DRM_MODE_TYPE_PREFERRED: Preferred mode, usually the native
|
| 359 | * resolution of an LCD panel. There should only be one preferred
|
| 360 | * mode per connector at any given time.
|
| 361 | * - DRM_MODE_TYPE_DRIVER: Mode created by the driver, which is all of
|
| 362 | * them really. Drivers must set this bit for all modes they create
|
| 363 | * and expose to userspace.
|
| 364 | * - DRM_MODE_TYPE_USERDEF: Mode defined or selected via the kernel
|
| 365 | * command line.
|
| 366 | *
|
| 367 | * Plus a big list of flags which shouldn't be used at all, but are
|
| 368 | * still around since these flags are also used in the userspace ABI.
|
| 369 | * We no longer accept modes with these types though:
|
| 370 | *
|
| 371 | * - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, unused.
|
| 372 | * Use DRM_MODE_TYPE_DRIVER instead.
|
| 373 | * - DRM_MODE_TYPE_DEFAULT: Again a leftover, use
|
| 374 | * DRM_MODE_TYPE_PREFERRED instead.
|
| 375 | * - DRM_MODE_TYPE_CLOCK_C and DRM_MODE_TYPE_CRTC_C: Define leftovers
|
| 376 | * which are stuck around for hysterical raisins only. No one has an
|
| 377 | * idea what they were meant for. Don't use.
|
| 378 |
|
| 379 | u8 type;
|
| 380 |
|
| 381 | |
| 382 | * @expose_to_userspace:
|
| 383 | *
|
| 384 | * Indicates whether the mode is to be exposed to the userspace.
|
| 385 | * This is to maintain a set of exposed modes while preparing
|
| 386 | * user-mode's list in drm_mode_getconnector ioctl. The purpose of
|
| 387 | * this only lies in the ioctl function, and is not to be used
|
| 388 | * outside the function.
|
| 389 |
|
| 390 | bool expose_to_userspace;
|
| 391 |
|
| 392 | |
| 393 | * @head:
|
| 394 | *
|
| 395 | * struct list_head for mode lists.
|
| 396 |
|
| 397 | struct list_head head;
|
| 398 |
|
| 399 | |
| 400 | * @name:
|
| 401 | *
|
| 402 | * Human-readable name of the mode, filled out with drm_mode_set_name().
|
| 403 |
|
| 404 | char name[DRM_DISPLAY_MODE_LEN];
|
| 405 |
|
| 406 | |
| 407 | * @status:
|
| 408 | *
|
| 409 | * Status of the mode, used to filter out modes not supported by the
|
| 410 | * hardware. See enum &drm_mode_status.
|
| 411 |
|
| 412 | enum drm_mode_status status;
|
| 413 |
|
| 414 | |
| 415 | * @picture_aspect_ratio:
|
| 416 | *
|
| 417 | * Field for setting the HDMI picture aspect ratio of a mode.
|
| 418 |
|
| 419 | enum hdmi_picture_aspect picture_aspect_ratio;
|
| 420 |
|
| 421 | };
|
| 422 |
|
| 423 | |
| 424 | * DRM_MODE_FMT - printf string for &struct drm_display_mode
|
| 425 |
|
| 426 | #define DRM_MODE_FMT "\"%s\": %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x"
|
| 427 |
|
| 428 | |
| 429 | * DRM_MODE_ARG - printf arguments for &struct drm_display_mode
|
| 430 | * @m: display mode
|
| 431 |
|
| 432 | #define DRM_MODE_ARG(m) \
|
| 433 | (m)->name, drm_mode_vrefresh(m), (m)->clock, \
|
| 434 | (m)->hdisplay, (m)->hsync_start, (m)->hsync_end, (m)->htotal, \
|
| 435 | (m)->vdisplay, (m)->vsync_start, (m)->vsync_end, (m)->vtotal, \
|
| 436 | (m)->type, (m)->flags
|
| 437 |
|
| 438 | #define obj_to_mode(x) container_of(x, struct drm_display_mode, base)
|
| 439 |
|
| 440 | |
| 441 | * drm_mode_is_stereo - check for stereo mode flags
|
| 442 | * @mode: drm_display_mode to check
|
| 443 | *
|
| 444 | * Returns:
|
| 445 | * True if the mode is one of the stereo modes (like side-by-side), false if
|
| 446 | * not.
|
| 447 |
|
| 448 | static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode)
|
| 449 | {
|
| 450 | return mode->flags & DRM_MODE_FLAG_3D_MASK;
|
| 451 | }
|
| 452 |
|
| 453 | struct drm_connector;
|
| 454 | struct drm_cmdline_mode;
|
| 455 |
|
| 456 | struct drm_display_mode *drm_mode_create(struct drm_device *dev);
|
| 457 | void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
|
| 458 | void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
|
| 459 | const struct drm_display_mode *in);
|
| 460 | int drm_mode_convert_umode(struct drm_device *dev,
|
| 461 | struct drm_display_mode *out,
|
| 462 | const struct drm_mode_modeinfo *in);
|
| 463 | void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
|
| 464 | void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
|
| 465 | bool drm_mode_is_420_only(const struct drm_display_info *display,
|
| 466 | const struct drm_display_mode *mode);
|
| 467 | bool drm_mode_is_420_also(const struct drm_display_info *display,
|
| 468 | const struct drm_display_mode *mode);
|
| 469 | bool drm_mode_is_420(const struct drm_display_info *display,
|
| 470 | const struct drm_display_mode *mode);
|
| 471 | void drm_set_preferred_mode(struct drm_connector *connector,
|
| 472 | int hpref, int vpref);
|
| 473 |
|
| 474 | struct drm_display_mode *drm_analog_tv_mode(struct drm_device *dev,
|
| 475 | enum drm_connector_tv_mode mode,
|
| 476 | unsigned long pixel_clock_hz,
|
| 477 | unsigned int hdisplay,
|
| 478 | unsigned int vdisplay,
|
| 479 | bool interlace);
|
| 480 |
|
| 481 | static inline struct drm_display_mode *drm_mode_analog_ntsc_480i(struct drm_device *dev)
|
| 482 | {
|
| 483 | return drm_analog_tv_mode(dev, DRM_MODE_TV_MODE_NTSC, 13500000, 720, 480, true);
|
| 484 | }
|
| 485 |
|
| 486 | static inline struct drm_display_mode *drm_mode_analog_pal_576i(struct drm_device *dev)
|
| 487 | {
|
| 488 | return drm_analog_tv_mode(dev, DRM_MODE_TV_MODE_PAL, 13500000, 720, 576, true);
|
| 489 | }
|
| 490 |
|
| 491 | struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
|
| 492 | int hdisplay, int vdisplay, int vrefresh,
|
| 493 | bool reduced, bool interlaced,
|
| 494 | bool margins);
|
| 495 | struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
|
| 496 | int hdisplay, int vdisplay, int vrefresh,
|
| 497 | bool interlaced, int margins);
|
| 498 | struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
|
| 499 | int hdisplay, int vdisplay,
|
| 500 | int vrefresh, bool interlaced,
|
| 501 | int margins,
|
| 502 | int GTF_M, int GTF_2C,
|
| 503 | int GTF_K, int GTF_2J);
|
| 504 | void drm_display_mode_from_videomode(const struct videomode *vm,
|
| 505 | struct drm_display_mode *dmode);
|
| 506 | void drm_display_mode_to_videomode(const struct drm_display_mode *dmode,
|
| 507 | struct videomode *vm);
|
| 508 | void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags);
|
| 509 |
|
| 510 | #if defined(CONFIG_OF)
|
| 511 | int of_get_drm_display_mode(struct device_node *np,
|
| 512 | struct drm_display_mode *dmode, u32 *bus_flags,
|
| 513 | int index);
|
| 514 | int of_get_drm_panel_display_mode(struct device_node *np,
|
| 515 | struct drm_display_mode *dmode, u32 *bus_flags);
|
| 516 | #else
|
| 517 | static inline int of_get_drm_display_mode(struct device_node *np,
|
| 518 | struct drm_display_mode *dmode,
|
| 519 | u32 *bus_flags, int index)
|
| 520 | {
|
| 521 | return -EINVAL;
|
| 522 | }
|
| 523 |
|
| 524 | static inline int of_get_drm_panel_display_mode(struct device_node *np,
|
| 525 | struct drm_display_mode *dmode, u32 *bus_flags)
|
| 526 | {
|
| 527 | return -EINVAL;
|
| 528 | }
|
| 529 | #endif
|
| 530 |
|
| 531 | void drm_mode_set_name(struct drm_display_mode *mode);
|
| 532 | int drm_mode_vrefresh(const struct drm_display_mode *mode);
|
| 533 | void drm_mode_get_hv_timing(const struct drm_display_mode *mode,
|
| 534 | int *hdisplay, int *vdisplay);
|
| 535 |
|
| 536 | void drm_mode_set_crtcinfo(struct drm_display_mode *p,
|
| 537 | int adjust_flags);
|
| 538 | void drm_mode_copy(struct drm_display_mode *dst,
|
| 539 | const struct drm_display_mode *src);
|
| 540 | void drm_mode_init(struct drm_display_mode *dst,
|
| 541 | const struct drm_display_mode *src);
|
| 542 | struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
|
| 543 | const struct drm_display_mode *mode);
|
| 544 | bool drm_mode_match(const struct drm_display_mode *mode1,
|
| 545 | const struct drm_display_mode *mode2,
|
| 546 | unsigned int match_flags);
|
| 547 | bool drm_mode_equal(const struct drm_display_mode *mode1,
|
| 548 | const struct drm_display_mode *mode2);
|
| 549 | bool drm_mode_equal_no_clocks(const struct drm_display_mode *mode1,
|
| 550 | const struct drm_display_mode *mode2);
|
| 551 | bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
|
| 552 | const struct drm_display_mode *mode2);
|
| 553 |
|
| 554 |
|
| 555 | enum drm_mode_status drm_mode_validate_driver(struct drm_device *dev,
|
| 556 | const struct drm_display_mode *mode);
|
| 557 | enum drm_mode_status drm_mode_validate_size(const struct drm_display_mode *mode,
|
| 558 | int maxX, int maxY);
|
| 559 | enum drm_mode_status
|
| 560 | drm_mode_validate_ycbcr420(const struct drm_display_mode *mode,
|
| 561 | struct drm_connector *connector);
|
| 562 | void drm_mode_prune_invalid(struct drm_device *dev,
|
| 563 | struct list_head *mode_list, bool verbose);
|
| 564 | void drm_mode_sort(struct list_head *mode_list);
|
| 565 | void drm_connector_list_update(struct drm_connector *connector);
|
| 566 |
|
| 567 |
|
| 568 | bool
|
| 569 | drm_mode_parse_command_line_for_connector(const char *mode_option,
|
| 570 | const struct drm_connector *connector,
|
| 571 | struct drm_cmdline_mode *mode);
|
| 572 | struct drm_display_mode *
|
| 573 | drm_mode_create_from_cmdline_mode(struct drm_device *dev,
|
| 574 | struct drm_cmdline_mode *cmd);
|
| 575 |
|
| 576 | #endif
|