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 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the "Software"), 9 * to deal in the Software without restriction, including without limitation 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * and/or sell copies of the Software, and to permit persons to whom the 12 * Software is furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be included in 15 * all copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 * OTHER DEALINGS IN THE SOFTWARE. 24 */ 25 #ifndef __DRM_CRTC_H__ 26 #define __DRM_CRTC_H__ 27 28 #include <linux/i2c.h> 29 #include <linux/spinlock.h> 30 #include <linux/types.h> 31 #include <linux/fb.h> 32 #include <linux/hdmi.h> 33 #include <linux/media-bus-format.h> 34 #include <uapi/drm/drm_mode.h> 35 #include <uapi/drm/drm_fourcc.h> 36 #include <drm/drm_modeset_lock.h> 37 #include <drm/drm_rect.h> 38 #include <drm/drm_mode_object.h> 39 #include <drm/drm_modes.h> 40 #include <drm/drm_connector.h> 41 #include <drm/drm_device.h> 42 #include <drm/drm_property.h> 43 #include <drm/drm_plane.h> 44 #include <drm/drm_blend.h> 45 #include <drm/drm_color_mgmt.h> 46 #include <drm/drm_debugfs_crc.h> 47 #include <drm/drm_mode_config.h> 48 49 struct drm_device; 50 struct drm_framebuffer; 51 struct drm_mode_set; 52 struct drm_file; 53 struct drm_clip_rect; 54 struct drm_printer; 55 struct drm_self_refresh_data; 56 struct device_node; 57 struct dma_fence; 58 struct edid; 59 60 static inline int64_t U642I64(uint64_t val) 61 { 62 return (int64_t)*((int64_t *)&val); 63 } 64 static inline uint64_t I642U64(int64_t val) 65 { 66 return (uint64_t)*((uint64_t *)&val); 67 } 68 69 struct drm_crtc; 70 struct drm_pending_vblank_event; 71 struct drm_plane; 72 struct drm_bridge; 73 struct drm_atomic_state; 74 75 struct drm_crtc_helper_funcs; 76 struct drm_plane_helper_funcs; 77 78 /** 79 * struct drm_crtc_state - mutable CRTC state 80 * 81 * Note that the distinction between @enable and @active is rather subtle: 82 * Flipping @active while @enable is set without changing anything else may 83 * never return in a failure from the &drm_mode_config_funcs.atomic_check 84 * callback. Userspace assumes that a DPMS On will always succeed. In other 85 * words: @enable controls resource assignment, @active controls the actual 86 * hardware state. 87 * 88 * The three booleans active_changed, connectors_changed and mode_changed are 89 * intended to indicate whether a full modeset is needed, rather than strictly 90 * describing what has changed in a commit. See also: 91 * drm_atomic_crtc_needs_modeset() 92 * 93 * WARNING: Transitional helpers (like drm_helper_crtc_mode_set() or 94 * drm_helper_crtc_mode_set_base()) do not maintain many of the derived control 95 * state like @plane_mask so drivers not converted over to atomic helpers should 96 * not rely on these being accurate! 97 */ 98 struct drm_crtc_state { 99 /** @crtc: backpointer to the CRTC */ 100 struct drm_crtc *crtc; 101 102 /** 103 * @enable: Whether the CRTC should be enabled, gates all other state. 104 * This controls reservations of shared resources. Actual hardware state 105 * is controlled by @active. 106 */ 107 bool enable; 108 109 /** 110 * @active: Whether the CRTC is actively displaying (used for DPMS). 111 * Implies that @enable is set. The driver must not release any shared 112 * resources if @active is set to false but @enable still true, because 113 * userspace expects that a DPMS ON always succeeds. 114 * 115 * Hence drivers must not consult @active in their various 116 * &drm_mode_config_funcs.atomic_check callback to reject an atomic 117 * commit. They can consult it to aid in the computation of derived 118 * hardware state, since even in the DPMS OFF state the display hardware 119 * should be as much powered down as when the CRTC is completely 120 * disabled through setting @enable to false. 121 */ 122 bool active; 123 124 /** 125 * @planes_changed: Planes on this crtc are updated. Used by the atomic 126 * helpers and drivers to steer the atomic commit control flow. 127 */ 128 bool planes_changed : 1; 129 130 /** 131 * @mode_changed: @mode or @enable has been changed. Used by the atomic 132 * helpers and drivers to steer the atomic commit control flow. See also 133 * drm_atomic_crtc_needs_modeset(). 134 * 135 * Drivers are supposed to set this for any CRTC state changes that 136 * require a full modeset. They can also reset it to false if e.g. a 137 * @mode change can be done without a full modeset by only changing 138 * scaler settings. 139 */ 140 bool mode_changed : 1; 141 142 /** 143 * @active_changed: @active has been toggled. Used by the atomic 144 * helpers and drivers to steer the atomic commit control flow. See also 145 * drm_atomic_crtc_needs_modeset(). 146 */ 147 bool active_changed : 1; 148 149 /** 150 * @connectors_changed: Connectors to this crtc have been updated, 151 * either in their state or routing. Used by the atomic 152 * helpers and drivers to steer the atomic commit control flow. See also 153 * drm_atomic_crtc_needs_modeset(). 154 * 155 * Drivers are supposed to set this as-needed from their own atomic 156 * check code, e.g. from &drm_encoder_helper_funcs.atomic_check 157 */ 158 bool connectors_changed : 1; 159 /** 160 * @zpos_changed: zpos values of planes on this crtc have been updated. 161 * Used by the atomic helpers and drivers to steer the atomic commit 162 * control flow. 163 */ 164 bool zpos_changed : 1; 165 /** 166 * @color_mgmt_changed: Color management properties have changed 167 * (@gamma_lut, @degamma_lut or @ctm). Used by the atomic helpers and 168 * drivers to steer the atomic commit control flow. 169 */ 170 bool color_mgmt_changed : 1; 171 172 /** 173 * @no_vblank: 174 * 175 * Reflects the ability of a CRTC to send VBLANK events. This state 176 * usually depends on the pipeline configuration. If set to true, DRM 177 * atomic helpers will send out a fake VBLANK event during display 178 * updates after all hardware changes have been committed. This is 179 * implemented in drm_atomic_helper_fake_vblank(). 180 * 181 * One usage is for drivers and/or hardware without support for VBLANK 182 * interrupts. Such drivers typically do not initialize vblanking 183 * (i.e., call drm_vblank_init() with the number of CRTCs). For CRTCs 184 * without initialized vblanking, this field is set to true in 185 * drm_atomic_helper_check_modeset(), and a fake VBLANK event will be 186 * send out on each update of the display pipeline by 187 * drm_atomic_helper_fake_vblank(). 188 * 189 * Another usage is CRTCs feeding a writeback connector operating in 190 * oneshot mode. In this case the fake VBLANK event is only generated 191 * when a job is queued to the writeback connector, and we want the 192 * core to fake VBLANK events when this part of the pipeline hasn't 193 * changed but others had or when the CRTC and connectors are being 194 * disabled. 195 * 196 * __drm_atomic_helper_crtc_duplicate_state() will not reset the value 197 * from the current state, the CRTC driver is then responsible for 198 * updating this field when needed. 199 * 200 * Note that the combination of &drm_crtc_state.event == NULL and 201 * &drm_crtc_state.no_blank == true is valid and usually used when the 202 * writeback connector attached to the CRTC has a new job queued. In 203 * this case the driver will send the VBLANK event on its own when the 204 * writeback job is complete. 205 */ 206 bool no_vblank : 1; 207 208 /** 209 * @plane_mask: Bitmask of drm_plane_mask(plane) of planes attached to 210 * this CRTC. 211 */ 212 u32 plane_mask; 213 214 /** 215 * @connector_mask: Bitmask of drm_connector_mask(connector) of 216 * connectors attached to this CRTC. 217 */ 218 u32 connector_mask; 219 220 /** 221 * @encoder_mask: Bitmask of drm_encoder_mask(encoder) of encoders 222 * attached to this CRTC. 223 */ 224 u32 encoder_mask; 225 226 /** 227 * @adjusted_mode: 228 * 229 * Internal display timings which can be used by the driver to handle 230 * differences between the mode requested by userspace in @mode and what 231 * is actually programmed into the hardware. 232 * 233 * For drivers using &drm_bridge, this stores hardware display timings 234 * used between the CRTC and the first bridge. For other drivers, the 235 * meaning of the adjusted_mode field is purely driver implementation 236 * defined information, and will usually be used to store the hardware 237 * display timings used between the CRTC and encoder blocks. 238 */ 239 struct drm_display_mode adjusted_mode; 240 241 /** 242 * @mode: 243 * 244 * Display timings requested by userspace. The driver should try to 245 * match the refresh rate as close as possible (but note that it's 246 * undefined what exactly is close enough, e.g. some of the HDMI modes 247 * only differ in less than 1% of the refresh rate). The active width 248 * and height as observed by userspace for positioning planes must match 249 * exactly. 250 * 251 * For external connectors where the sink isn't fixed (like with a 252 * built-in panel), this mode here should match the physical mode on the 253 * wire to the last details (i.e. including sync polarities and 254 * everything). 255 */ 256 struct drm_display_mode mode; 257 258 /** 259 * @mode_blob: &drm_property_blob for @mode, for exposing the mode to 260 * atomic userspace. 261 */ 262 struct drm_property_blob *mode_blob; 263 264 /** 265 * @degamma_lut: 266 * 267 * Lookup table for converting framebuffer pixel data before apply the 268 * color conversion matrix @ctm. See drm_crtc_enable_color_mgmt(). The 269 * blob (if not NULL) is an array of &struct drm_color_lut. 270 */ 271 struct drm_property_blob *degamma_lut; 272 273 /** 274 * @ctm: 275 * 276 * Color transformation matrix. See drm_crtc_enable_color_mgmt(). The 277 * blob (if not NULL) is a &struct drm_color_ctm. 278 */ 279 struct drm_property_blob *ctm; 280 281 /** 282 * @gamma_lut: 283 * 284 * Lookup table for converting pixel data after the color conversion 285 * matrix @ctm. See drm_crtc_enable_color_mgmt(). The blob (if not 286 * NULL) is an array of &struct drm_color_lut. 287 * 288 * Note that for mostly historical reasons stemming from Xorg heritage, 289 * this is also used to store the color map (also sometimes color lut, 290 * CLUT or color palette) for indexed formats like DRM_FORMAT_C8. 291 */ 292 struct drm_property_blob *gamma_lut; 293 294 /** 295 * @target_vblank: 296 * 297 * Target vertical blank period when a page flip 298 * should take effect. 299 */ 300 u32 target_vblank; 301 302 /** 303 * @async_flip: 304 * 305 * This is set when DRM_MODE_PAGE_FLIP_ASYNC is set in the legacy 306 * PAGE_FLIP IOCTL. It's not wired up for the atomic IOCTL itself yet. 307 */ 308 bool async_flip; 309 310 /** 311 * @vrr_enabled: 312 * 313 * Indicates if variable refresh rate should be enabled for the CRTC. 314 * Support for the requested vrr state will depend on driver and 315 * hardware capabiltiy - lacking support is not treated as failure. 316 */ 317 bool vrr_enabled; 318 319 /** 320 * @self_refresh_active: 321 * 322 * Used by the self refresh helpers to denote when a self refresh 323 * transition is occurring. This will be set on enable/disable callbacks 324 * when self refresh is being enabled or disabled. In some cases, it may 325 * not be desirable to fully shut off the crtc during self refresh. 326 * CRTC's can inspect this flag and determine the best course of action. 327 */ 328 bool self_refresh_active; 329 330 /** 331 * @scaling_filter: 332 * 333 * Scaling filter to be applied 334 */ 335 enum drm_scaling_filter scaling_filter; 336 337 /** 338 * @event: 339 * 340 * Optional pointer to a DRM event to signal upon completion of the 341 * state update. The driver must send out the event when the atomic 342 * commit operation completes. There are two cases: 343 * 344 * - The event is for a CRTC which is being disabled through this 345 * atomic commit. In that case the event can be send out any time 346 * after the hardware has stopped scanning out the current 347 * framebuffers. It should contain the timestamp and counter for the 348 * last vblank before the display pipeline was shut off. The simplest 349 * way to achieve that is calling drm_crtc_send_vblank_event() 350 * somewhen after drm_crtc_vblank_off() has been called. 351 * 352 * - For a CRTC which is enabled at the end of the commit (even when it 353 * undergoes an full modeset) the vblank timestamp and counter must 354 * be for the vblank right before the first frame that scans out the 355 * new set of buffers. Again the event can only be sent out after the 356 * hardware has stopped scanning out the old buffers. 357 * 358 * - Events for disabled CRTCs are not allowed, and drivers can ignore 359 * that case. 360 * 361 * For very simple hardware without VBLANK interrupt, enabling 362 * &struct drm_crtc_state.no_vblank makes DRM's atomic commit helpers 363 * send a fake VBLANK event at the end of the display update after all 364 * hardware changes have been applied. See 365 * drm_atomic_helper_fake_vblank(). 366 * 367 * For more complex hardware this 368 * can be handled by the drm_crtc_send_vblank_event() function, 369 * which the driver should call on the provided event upon completion of 370 * the atomic commit. Note that if the driver supports vblank signalling 371 * and timestamping the vblank counters and timestamps must agree with 372 * the ones returned from page flip events. With the current vblank 373 * helper infrastructure this can be achieved by holding a vblank 374 * reference while the page flip is pending, acquired through 375 * drm_crtc_vblank_get() and released with drm_crtc_vblank_put(). 376 * Drivers are free to implement their own vblank counter and timestamp 377 * tracking though, e.g. if they have accurate timestamp registers in 378 * hardware. 379 * 380 * For hardware which supports some means to synchronize vblank 381 * interrupt delivery with committing display state there's also 382 * drm_crtc_arm_vblank_event(). See the documentation of that function 383 * for a detailed discussion of the constraints it needs to be used 384 * safely. 385 * 386 * If the device can't notify of flip completion in a race-free way 387 * at all, then the event should be armed just after the page flip is 388 * committed. In the worst case the driver will send the event to 389 * userspace one frame too late. This doesn't allow for a real atomic 390 * update, but it should avoid tearing. 391 */ 392 struct drm_pending_vblank_event *event; 393 394 /** 395 * @commit: 396 * 397 * This tracks how the commit for this update proceeds through the 398 * various phases. This is never cleared, except when we destroy the 399 * state, so that subsequent commits can synchronize with previous ones. 400 */ 401 struct drm_crtc_commit *commit; 402 403 /** @state: backpointer to global drm_atomic_state */ 404 struct drm_atomic_state *state; 405 }; 406 407 /** 408 * struct drm_crtc_funcs - control CRTCs for a given device 409 * 410 * The drm_crtc_funcs structure is the central CRTC management structure 411 * in the DRM. Each CRTC controls one or more connectors (note that the name 412 * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc. 413 * connectors, not just CRTs). 414 * 415 * Each driver is responsible for filling out this structure at startup time, 416 * in addition to providing other modesetting features, like i2c and DDC 417 * bus accessors. 418 */ 419 struct drm_crtc_funcs { 420 /** 421 * @reset: 422 * 423 * Reset CRTC hardware and software state to off. This function isn't 424 * called by the core directly, only through drm_mode_config_reset(). 425 * It's not a helper hook only for historical reasons. 426 * 427 * Atomic drivers can use drm_atomic_helper_crtc_reset() to reset 428 * atomic state using this hook. 429 */ 430 void (*reset)(struct drm_crtc *crtc); 431 432 /** 433 * @cursor_set: 434 * 435 * Update the cursor image. The cursor position is relative to the CRTC 436 * and can be partially or fully outside of the visible area. 437 * 438 * Note that contrary to all other KMS functions the legacy cursor entry 439 * points don't take a framebuffer object, but instead take directly a 440 * raw buffer object id from the driver's buffer manager (which is 441 * either GEM or TTM for current drivers). 442 * 443 * This entry point is deprecated, drivers should instead implement 444 * universal plane support and register a proper cursor plane using 445 * drm_crtc_init_with_planes(). 446 * 447 * This callback is optional 448 * 449 * RETURNS: 450 * 451 * 0 on success or a negative error code on failure. 452 */ 453 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, 454 uint32_t handle, uint32_t width, uint32_t height); 455 456 /** 457 * @cursor_set2: 458 * 459 * Update the cursor image, including hotspot information. The hotspot 460 * must not affect the cursor position in CRTC coordinates, but is only 461 * meant as a hint for virtualized display hardware to coordinate the 462 * guests and hosts cursor position. The cursor hotspot is relative to 463 * the cursor image. Otherwise this works exactly like @cursor_set. 464 * 465 * This entry point is deprecated, drivers should instead implement 466 * universal plane support and register a proper cursor plane using 467 * drm_crtc_init_with_planes(). 468 * 469 * This callback is optional. 470 * 471 * RETURNS: 472 * 473 * 0 on success or a negative error code on failure. 474 */ 475 int (*cursor_set2)(struct drm_crtc *crtc, struct drm_file *file_priv, 476 uint32_t handle, uint32_t width, uint32_t height, 477 int32_t hot_x, int32_t hot_y); 478 479 /** 480 * @cursor_move: 481 * 482 * Update the cursor position. The cursor does not need to be visible 483 * when this hook is called. 484 * 485 * This entry point is deprecated, drivers should instead implement 486 * universal plane support and register a proper cursor plane using 487 * drm_crtc_init_with_planes(). 488 * 489 * This callback is optional. 490 * 491 * RETURNS: 492 * 493 * 0 on success or a negative error code on failure. 494 */ 495 int (*cursor_move)(struct drm_crtc *crtc, int x, int y); 496 497 /** 498 * @gamma_set: 499 * 500 * Set gamma on the CRTC. 501 * 502 * This callback is optional. 503 * 504 * Atomic drivers who want to support gamma tables should implement the 505 * atomic color management support, enabled by calling 506 * drm_crtc_enable_color_mgmt(), which then supports the legacy gamma 507 * interface through the drm_atomic_helper_legacy_gamma_set() 508 * compatibility implementation. 509 */ 510 int (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 511 uint32_t size, 512 struct drm_modeset_acquire_ctx *ctx); 513 514 /** 515 * @destroy: 516 * 517 * Clean up CRTC resources. This is only called at driver unload time 518 * through drm_mode_config_cleanup() since a CRTC cannot be hotplugged 519 * in DRM. 520 */ 521 void (*destroy)(struct drm_crtc *crtc); 522 523 /** 524 * @set_config: 525 * 526 * This is the main legacy entry point to change the modeset state on a 527 * CRTC. All the details of the desired configuration are passed in a 528 * &struct drm_mode_set - see there for details. 529 * 530 * Drivers implementing atomic modeset should use 531 * drm_atomic_helper_set_config() to implement this hook. 532 * 533 * RETURNS: 534 * 535 * 0 on success or a negative error code on failure. 536 */ 537 int (*set_config)(struct drm_mode_set *set, 538 struct drm_modeset_acquire_ctx *ctx); 539 540 /** 541 * @page_flip: 542 * 543 * Legacy entry point to schedule a flip to the given framebuffer. 544 * 545 * Page flipping is a synchronization mechanism that replaces the frame 546 * buffer being scanned out by the CRTC with a new frame buffer during 547 * vertical blanking, avoiding tearing (except when requested otherwise 548 * through the DRM_MODE_PAGE_FLIP_ASYNC flag). When an application 549 * requests a page flip the DRM core verifies that the new frame buffer 550 * is large enough to be scanned out by the CRTC in the currently 551 * configured mode and then calls this hook with a pointer to the new 552 * frame buffer. 553 * 554 * The driver must wait for any pending rendering to the new framebuffer 555 * to complete before executing the flip. It should also wait for any 556 * pending rendering from other drivers if the underlying buffer is a 557 * shared dma-buf. 558 * 559 * An application can request to be notified when the page flip has 560 * completed. The drm core will supply a &struct drm_event in the event 561 * parameter in this case. This can be handled by the 562 * drm_crtc_send_vblank_event() function, which the driver should call on 563 * the provided event upon completion of the flip. Note that if 564 * the driver supports vblank signalling and timestamping the vblank 565 * counters and timestamps must agree with the ones returned from page 566 * flip events. With the current vblank helper infrastructure this can 567 * be achieved by holding a vblank reference while the page flip is 568 * pending, acquired through drm_crtc_vblank_get() and released with 569 * drm_crtc_vblank_put(). Drivers are free to implement their own vblank 570 * counter and timestamp tracking though, e.g. if they have accurate 571 * timestamp registers in hardware. 572 * 573 * This callback is optional. 574 * 575 * NOTE: 576 * 577 * Very early versions of the KMS ABI mandated that the driver must 578 * block (but not reject) any rendering to the old framebuffer until the 579 * flip operation has completed and the old framebuffer is no longer 580 * visible. This requirement has been lifted, and userspace is instead 581 * expected to request delivery of an event and wait with recycling old 582 * buffers until such has been received. 583 * 584 * RETURNS: 585 * 586 * 0 on success or a negative error code on failure. Note that if a 587 * page flip operation is already pending the callback should return 588 * -EBUSY. Pageflips on a disabled CRTC (either by setting a NULL mode 589 * or just runtime disabled through DPMS respectively the new atomic 590 * "ACTIVE" state) should result in an -EINVAL error code. Note that 591 * drm_atomic_helper_page_flip() checks this already for atomic drivers. 592 */ 593 int (*page_flip)(struct drm_crtc *crtc, 594 struct drm_framebuffer *fb, 595 struct drm_pending_vblank_event *event, 596 uint32_t flags, 597 struct drm_modeset_acquire_ctx *ctx); 598 599 /** 600 * @page_flip_target: 601 * 602 * Same as @page_flip but with an additional parameter specifying the 603 * absolute target vertical blank period (as reported by 604 * drm_crtc_vblank_count()) when the flip should take effect. 605 * 606 * Note that the core code calls drm_crtc_vblank_get before this entry 607 * point, and will call drm_crtc_vblank_put if this entry point returns 608 * any non-0 error code. It's the driver's responsibility to call 609 * drm_crtc_vblank_put after this entry point returns 0, typically when 610 * the flip completes. 611 */ 612 int (*page_flip_target)(struct drm_crtc *crtc, 613 struct drm_framebuffer *fb, 614 struct drm_pending_vblank_event *event, 615 uint32_t flags, uint32_t target, 616 struct drm_modeset_acquire_ctx *ctx); 617 618 /** 619 * @set_property: 620 * 621 * This is the legacy entry point to update a property attached to the 622 * CRTC. 623 * 624 * This callback is optional if the driver does not support any legacy 625 * driver-private properties. For atomic drivers it is not used because 626 * property handling is done entirely in the DRM core. 627 * 628 * RETURNS: 629 * 630 * 0 on success or a negative error code on failure. 631 */ 632 int (*set_property)(struct drm_crtc *crtc, 633 struct drm_property *property, uint64_t val); 634 635 /** 636 * @atomic_duplicate_state: 637 * 638 * Duplicate the current atomic state for this CRTC and return it. 639 * The core and helpers guarantee that any atomic state duplicated with 640 * this hook and still owned by the caller (i.e. not transferred to the 641 * driver by calling &drm_mode_config_funcs.atomic_commit) will be 642 * cleaned up by calling the @atomic_destroy_state hook in this 643 * structure. 644 * 645 * This callback is mandatory for atomic drivers. 646 * 647 * Atomic drivers which don't subclass &struct drm_crtc_state should use 648 * drm_atomic_helper_crtc_duplicate_state(). Drivers that subclass the 649 * state structure to extend it with driver-private state should use 650 * __drm_atomic_helper_crtc_duplicate_state() to make sure shared state is 651 * duplicated in a consistent fashion across drivers. 652 * 653 * It is an error to call this hook before &drm_crtc.state has been 654 * initialized correctly. 655 * 656 * NOTE: 657 * 658 * If the duplicate state references refcounted resources this hook must 659 * acquire a reference for each of them. The driver must release these 660 * references again in @atomic_destroy_state. 661 * 662 * RETURNS: 663 * 664 * Duplicated atomic state or NULL when the allocation failed. 665 */ 666 struct drm_crtc_state *(*atomic_duplicate_state)(struct drm_crtc *crtc); 667 668 /** 669 * @atomic_destroy_state: 670 * 671 * Destroy a state duplicated with @atomic_duplicate_state and release 672 * or unreference all resources it references 673 * 674 * This callback is mandatory for atomic drivers. 675 */ 676 void (*atomic_destroy_state)(struct drm_crtc *crtc, 677 struct drm_crtc_state *state); 678 679 /** 680 * @atomic_set_property: 681 * 682 * Decode a driver-private property value and store the decoded value 683 * into the passed-in state structure. Since the atomic core decodes all 684 * standardized properties (even for extensions beyond the core set of 685 * properties which might not be implemented by all drivers) this 686 * requires drivers to subclass the state structure. 687 * 688 * Such driver-private properties should really only be implemented for 689 * truly hardware/vendor specific state. Instead it is preferred to 690 * standardize atomic extension and decode the properties used to expose 691 * such an extension in the core. 692 * 693 * Do not call this function directly, use 694 * drm_atomic_crtc_set_property() instead. 695 * 696 * This callback is optional if the driver does not support any 697 * driver-private atomic properties. 698 * 699 * NOTE: 700 * 701 * This function is called in the state assembly phase of atomic 702 * modesets, which can be aborted for any reason (including on 703 * userspace's request to just check whether a configuration would be 704 * possible). Drivers MUST NOT touch any persistent state (hardware or 705 * software) or data structures except the passed in @state parameter. 706 * 707 * Also since userspace controls in which order properties are set this 708 * function must not do any input validation (since the state update is 709 * incomplete and hence likely inconsistent). Instead any such input 710 * validation must be done in the various atomic_check callbacks. 711 * 712 * RETURNS: 713 * 714 * 0 if the property has been found, -EINVAL if the property isn't 715 * implemented by the driver (which should never happen, the core only 716 * asks for properties attached to this CRTC). No other validation is 717 * allowed by the driver. The core already checks that the property 718 * value is within the range (integer, valid enum value, ...) the driver 719 * set when registering the property. 720 */ 721 int (*atomic_set_property)(struct drm_crtc *crtc, 722 struct drm_crtc_state *state, 723 struct drm_property *property, 724 uint64_t val); 725 /** 726 * @atomic_get_property: 727 * 728 * Reads out the decoded driver-private property. This is used to 729 * implement the GETCRTC IOCTL. 730 * 731 * Do not call this function directly, use 732 * drm_atomic_crtc_get_property() instead. 733 * 734 * This callback is optional if the driver does not support any 735 * driver-private atomic properties. 736 * 737 * RETURNS: 738 * 739 * 0 on success, -EINVAL if the property isn't implemented by the 740 * driver (which should never happen, the core only asks for 741 * properties attached to this CRTC). 742 */ 743 int (*atomic_get_property)(struct drm_crtc *crtc, 744 const struct drm_crtc_state *state, 745 struct drm_property *property, 746 uint64_t *val); 747 748 /** 749 * @late_register: 750 * 751 * This optional hook can be used to register additional userspace 752 * interfaces attached to the crtc like debugfs interfaces. 753 * It is called late in the driver load sequence from drm_dev_register(). 754 * Everything added from this callback should be unregistered in 755 * the early_unregister callback. 756 * 757 * Returns: 758 * 759 * 0 on success, or a negative error code on failure. 760 */ 761 int (*late_register)(struct drm_crtc *crtc); 762 763 /** 764 * @early_unregister: 765 * 766 * This optional hook should be used to unregister the additional 767 * userspace interfaces attached to the crtc from 768 * @late_register. It is called from drm_dev_unregister(), 769 * early in the driver unload sequence to disable userspace access 770 * before data structures are torndown. 771 */ 772 void (*early_unregister)(struct drm_crtc *crtc); 773 774 /** 775 * @set_crc_source: 776 * 777 * Changes the source of CRC checksums of frames at the request of 778 * userspace, typically for testing purposes. The sources available are 779 * specific of each driver and a %NULL value indicates that CRC 780 * generation is to be switched off. 781 * 782 * When CRC generation is enabled, the driver should call 783 * drm_crtc_add_crc_entry() at each frame, providing any information 784 * that characterizes the frame contents in the crcN arguments, as 785 * provided from the configured source. Drivers must accept an "auto" 786 * source name that will select a default source for this CRTC. 787 * 788 * This may trigger an atomic modeset commit if necessary, to enable CRC 789 * generation. 790 * 791 * Note that "auto" can depend upon the current modeset configuration, 792 * e.g. it could pick an encoder or output specific CRC sampling point. 793 * 794 * This callback is optional if the driver does not support any CRC 795 * generation functionality. 796 * 797 * RETURNS: 798 * 799 * 0 on success or a negative error code on failure. 800 */ 801 int (*set_crc_source)(struct drm_crtc *crtc, const char *source); 802 803 /** 804 * @verify_crc_source: 805 * 806 * verifies the source of CRC checksums of frames before setting the 807 * source for CRC and during crc open. Source parameter can be NULL 808 * while disabling crc source. 809 * 810 * This callback is optional if the driver does not support any CRC 811 * generation functionality. 812 * 813 * RETURNS: 814 * 815 * 0 on success or a negative error code on failure. 816 */ 817 int (*verify_crc_source)(struct drm_crtc *crtc, const char *source, 818 size_t *values_cnt); 819 /** 820 * @get_crc_sources: 821 * 822 * Driver callback for getting a list of all the available sources for 823 * CRC generation. This callback depends upon verify_crc_source, So 824 * verify_crc_source callback should be implemented before implementing 825 * this. Driver can pass full list of available crc sources, this 826 * callback does the verification on each crc-source before passing it 827 * to userspace. 828 * 829 * This callback is optional if the driver does not support exporting of 830 * possible CRC sources list. 831 * 832 * RETURNS: 833 * 834 * a constant character pointer to the list of all the available CRC 835 * sources. On failure driver should return NULL. count should be 836 * updated with number of sources in list. if zero we don't process any 837 * source from the list. 838 */ 839 const char *const *(*get_crc_sources)(struct drm_crtc *crtc, 840 size_t *count); 841 842 /** 843 * @atomic_print_state: 844 * 845 * If driver subclasses &struct drm_crtc_state, it should implement 846 * this optional hook for printing additional driver specific state. 847 * 848 * Do not call this directly, use drm_atomic_crtc_print_state() 849 * instead. 850 */ 851 void (*atomic_print_state)(struct drm_printer *p, 852 const struct drm_crtc_state *state); 853 854 /** 855 * @get_vblank_counter: 856 * 857 * Driver callback for fetching a raw hardware vblank counter for the 858 * CRTC. It's meant to be used by new drivers as the replacement of 859 * &drm_driver.get_vblank_counter hook. 860 * 861 * This callback is optional. If a device doesn't have a hardware 862 * counter, the driver can simply leave the hook as NULL. The DRM core 863 * will account for missed vblank events while interrupts where disabled 864 * based on system timestamps. 865 * 866 * Wraparound handling and loss of events due to modesetting is dealt 867 * with in the DRM core code, as long as drivers call 868 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or 869 * enabling a CRTC. 870 * 871 * See also &drm_device.vblank_disable_immediate and 872 * &drm_device.max_vblank_count. 873 * 874 * Returns: 875 * 876 * Raw vblank counter value. 877 */ 878 u32 (*get_vblank_counter)(struct drm_crtc *crtc); 879 880 /** 881 * @enable_vblank: 882 * 883 * Enable vblank interrupts for the CRTC. It's meant to be used by 884 * new drivers as the replacement of &drm_driver.enable_vblank hook. 885 * 886 * Returns: 887 * 888 * Zero on success, appropriate errno if the vblank interrupt cannot 889 * be enabled. 890 */ 891 int (*enable_vblank)(struct drm_crtc *crtc); 892 893 /** 894 * @disable_vblank: 895 * 896 * Disable vblank interrupts for the CRTC. It's meant to be used by 897 * new drivers as the replacement of &drm_driver.disable_vblank hook. 898 */ 899 void (*disable_vblank)(struct drm_crtc *crtc); 900 901 /** 902 * @get_vblank_timestamp: 903 * 904 * Called by drm_get_last_vbltimestamp(). Should return a precise 905 * timestamp when the most recent vblank interval ended or will end. 906 * 907 * Specifically, the timestamp in @vblank_time should correspond as 908 * closely as possible to the time when the first video scanline of 909 * the video frame after the end of vblank will start scanning out, 910 * the time immediately after end of the vblank interval. If the 911 * @crtc is currently inside vblank, this will be a time in the future. 912 * If the @crtc is currently scanning out a frame, this will be the 913 * past start time of the current scanout. This is meant to adhere 914 * to the OpenML OML_sync_control extension specification. 915 * 916 * Parameters: 917 * 918 * crtc: 919 * CRTC for which timestamp should be returned. 920 * max_error: 921 * Maximum allowable timestamp error in nanoseconds. 922 * Implementation should strive to provide timestamp 923 * with an error of at most max_error nanoseconds. 924 * Returns true upper bound on error for timestamp. 925 * vblank_time: 926 * Target location for returned vblank timestamp. 927 * in_vblank_irq: 928 * True when called from drm_crtc_handle_vblank(). Some drivers 929 * need to apply some workarounds for gpu-specific vblank irq quirks 930 * if flag is set. 931 * 932 * Returns: 933 * 934 * True on success, false on failure, which means the core should 935 * fallback to a simple timestamp taken in drm_crtc_handle_vblank(). 936 */ 937 bool (*get_vblank_timestamp)(struct drm_crtc *crtc, 938 int *max_error, 939 ktime_t *vblank_time, 940 bool in_vblank_irq); 941 }; 942 943 /** 944 * struct drm_crtc - central CRTC control structure 945 * 946 * Each CRTC may have one or more connectors associated with it. This structure 947 * allows the CRTC to be controlled. 948 */ 949 struct drm_crtc { 950 /** @dev: parent DRM device */ 951 struct drm_device *dev; 952 /** @port: OF node used by drm_of_find_possible_crtcs(). */ 953 struct device_node *port; 954 /** 955 * @head: 956 * 957 * List of all CRTCs on @dev, linked from &drm_mode_config.crtc_list. 958 * Invariant over the lifetime of @dev and therefore does not need 959 * locking. 960 */ 961 struct list_head head; 962 963 /** @name: human readable name, can be overwritten by the driver */ 964 char *name; 965 966 /** 967 * @mutex: 968 * 969 * This provides a read lock for the overall CRTC state (mode, dpms 970 * state, ...) and a write lock for everything which can be update 971 * without a full modeset (fb, cursor data, CRTC properties ...). A full 972 * modeset also need to grab &drm_mode_config.connection_mutex. 973 * 974 * For atomic drivers specifically this protects @state. 975 */ 976 struct drm_modeset_lock mutex; 977 978 /** @base: base KMS object for ID tracking etc. */ 979 struct drm_mode_object base; 980 981 /** 982 * @primary: 983 * Primary plane for this CRTC. Note that this is only 984 * relevant for legacy IOCTL, it specifies the plane implicitly used by 985 * the SETCRTC and PAGE_FLIP IOCTLs. It does not have any significance 986 * beyond that. 987 */ 988 struct drm_plane *primary; 989 990 /** 991 * @cursor: 992 * Cursor plane for this CRTC. Note that this is only relevant for 993 * legacy IOCTL, it specifies the plane implicitly used by the SETCURSOR 994 * and SETCURSOR2 IOCTLs. It does not have any significance 995 * beyond that. 996 */ 997 struct drm_plane *cursor; 998 999 /** 1000 * @index: Position inside the mode_config.list, can be used as an array 1001 * index. It is invariant over the lifetime of the CRTC. 1002 */ 1003 unsigned index; 1004 1005 /** 1006 * @cursor_x: Current x position of the cursor, used for universal 1007 * cursor planes because the SETCURSOR IOCTL only can update the 1008 * framebuffer without supplying the coordinates. Drivers should not use 1009 * this directly, atomic drivers should look at &drm_plane_state.crtc_x 1010 * of the cursor plane instead. 1011 */ 1012 int cursor_x; 1013 /** 1014 * @cursor_y: Current y position of the cursor, used for universal 1015 * cursor planes because the SETCURSOR IOCTL only can update the 1016 * framebuffer without supplying the coordinates. Drivers should not use 1017 * this directly, atomic drivers should look at &drm_plane_state.crtc_y 1018 * of the cursor plane instead. 1019 */ 1020 int cursor_y; 1021 1022 /** 1023 * @enabled: 1024 * 1025 * Is this CRTC enabled? Should only be used by legacy drivers, atomic 1026 * drivers should instead consult &drm_crtc_state.enable and 1027 * &drm_crtc_state.active. Atomic drivers can update this by calling 1028 * drm_atomic_helper_update_legacy_modeset_state(). 1029 */ 1030 bool enabled; 1031 1032 /** 1033 * @mode: 1034 * 1035 * Current mode timings. Should only be used by legacy drivers, atomic 1036 * drivers should instead consult &drm_crtc_state.mode. Atomic drivers 1037 * can update this by calling 1038 * drm_atomic_helper_update_legacy_modeset_state(). 1039 */ 1040 struct drm_display_mode mode; 1041 1042 /** 1043 * @hwmode: 1044 * 1045 * Programmed mode in hw, after adjustments for encoders, crtc, panel 1046 * scaling etc. Should only be used by legacy drivers, for high 1047 * precision vblank timestamps in 1048 * drm_crtc_vblank_helper_get_vblank_timestamp(). 1049 * 1050 * Note that atomic drivers should not use this, but instead use 1051 * &drm_crtc_state.adjusted_mode. And for high-precision timestamps 1052 * drm_crtc_vblank_helper_get_vblank_timestamp() used 1053 * &drm_vblank_crtc.hwmode, 1054 * which is filled out by calling drm_calc_timestamping_constants(). 1055 */ 1056 struct drm_display_mode hwmode; 1057 1058 /** 1059 * @x: 1060 * x position on screen. Should only be used by legacy drivers, atomic 1061 * drivers should look at &drm_plane_state.crtc_x of the primary plane 1062 * instead. Updated by calling 1063 * drm_atomic_helper_update_legacy_modeset_state(). 1064 */ 1065 int x; 1066 /** 1067 * @y: 1068 * y position on screen. Should only be used by legacy drivers, atomic 1069 * drivers should look at &drm_plane_state.crtc_y of the primary plane 1070 * instead. Updated by calling 1071 * drm_atomic_helper_update_legacy_modeset_state(). 1072 */ 1073 int y; 1074 1075 /** @funcs: CRTC control functions */ 1076 const struct drm_crtc_funcs *funcs; 1077 1078 /** 1079 * @gamma_size: Size of legacy gamma ramp reported to userspace. Set up 1080 * by calling drm_mode_crtc_set_gamma_size(). 1081 * 1082 * Note that atomic drivers need to instead use 1083 * &drm_crtc_state.gamma_lut. See drm_crtc_enable_color_mgmt(). 1084 */ 1085 uint32_t gamma_size; 1086 1087 /** 1088 * @gamma_store: Gamma ramp values used by the legacy SETGAMMA and 1089 * GETGAMMA IOCTls. Set up by calling drm_mode_crtc_set_gamma_size(). 1090 * 1091 * Note that atomic drivers need to instead use 1092 * &drm_crtc_state.gamma_lut. See drm_crtc_enable_color_mgmt(). 1093 */ 1094 uint16_t *gamma_store; 1095 1096 /** @helper_private: mid-layer private data */ 1097 const struct drm_crtc_helper_funcs *helper_private; 1098 1099 /** @properties: property tracking for this CRTC */ 1100 struct drm_object_properties properties; 1101 1102 /** 1103 * @scaling_filter_property: property to apply a particular filter while 1104 * scaling. 1105 */ 1106 struct drm_property *scaling_filter_property; 1107 1108 /** 1109 * @state: 1110 * 1111 * Current atomic state for this CRTC. 1112 * 1113 * This is protected by @mutex. Note that nonblocking atomic commits 1114 * access the current CRTC state without taking locks. Either by going 1115 * through the &struct drm_atomic_state pointers, see 1116 * for_each_oldnew_crtc_in_state(), for_each_old_crtc_in_state() and 1117 * for_each_new_crtc_in_state(). Or through careful ordering of atomic 1118 * commit operations as implemented in the atomic helpers, see 1119 * &struct drm_crtc_commit. 1120 */ 1121 struct drm_crtc_state *state; 1122 1123 /** 1124 * @commit_list: 1125 * 1126 * List of &drm_crtc_commit structures tracking pending commits. 1127 * Protected by @commit_lock. This list holds its own full reference, 1128 * as does the ongoing commit. 1129 * 1130 * "Note that the commit for a state change is also tracked in 1131 * &drm_crtc_state.commit. For accessing the immediately preceding 1132 * commit in an atomic update it is recommended to just use that 1133 * pointer in the old CRTC state, since accessing that doesn't need 1134 * any locking or list-walking. @commit_list should only be used to 1135 * stall for framebuffer cleanup that's signalled through 1136 * &drm_crtc_commit.cleanup_done." 1137 */ 1138 struct list_head commit_list; 1139 1140 /** 1141 * @commit_lock: 1142 * 1143 * Spinlock to protect @commit_list. 1144 */ 1145 spinlock_t commit_lock; 1146 1147 /** 1148 * @debugfs_entry: 1149 * 1150 * Debugfs directory for this CRTC. 1151 */ 1152 struct dentry *debugfs_entry; 1153 1154 /** 1155 * @crc: 1156 * 1157 * Configuration settings of CRC capture. 1158 */ 1159 struct drm_crtc_crc crc; 1160 1161 /** 1162 * @fence_context: 1163 * 1164 * timeline context used for fence operations. 1165 */ 1166 unsigned int fence_context; 1167 1168 /** 1169 * @fence_lock: 1170 * 1171 * spinlock to protect the fences in the fence_context. 1172 */ 1173 spinlock_t fence_lock; 1174 /** 1175 * @fence_seqno: 1176 * 1177 * Seqno variable used as monotonic counter for the fences 1178 * created on the CRTC's timeline. 1179 */ 1180 unsigned long fence_seqno; 1181 1182 /** 1183 * @timeline_name: 1184 * 1185 * The name of the CRTC's fence timeline. 1186 */ 1187 char timeline_name[32]; 1188 1189 /** 1190 * @self_refresh_data: Holds the state for the self refresh helpers 1191 * 1192 * Initialized via drm_self_refresh_helper_init(). 1193 */ 1194 struct drm_self_refresh_data *self_refresh_data; 1195 }; 1196 1197 /** 1198 * struct drm_mode_set - new values for a CRTC config change 1199 * @fb: framebuffer to use for new config 1200 * @crtc: CRTC whose configuration we're about to change 1201 * @mode: mode timings to use 1202 * @x: position of this CRTC relative to @fb 1203 * @y: position of this CRTC relative to @fb 1204 * @connectors: array of connectors to drive with this CRTC if possible 1205 * @num_connectors: size of @connectors array 1206 * 1207 * This represents a modeset configuration for the legacy SETCRTC ioctl and is 1208 * also used internally. Atomic drivers instead use &drm_atomic_state. 1209 */ 1210 struct drm_mode_set { 1211 struct drm_framebuffer *fb; 1212 struct drm_crtc *crtc; 1213 struct drm_display_mode *mode; 1214 1215 uint32_t x; 1216 uint32_t y; 1217 1218 struct drm_connector **connectors; 1219 size_t num_connectors; 1220 }; 1221 1222 #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) 1223 1224 __printf(6, 7) 1225 int drm_crtc_init_with_planes(struct drm_device *dev, 1226 struct drm_crtc *crtc, 1227 struct drm_plane *primary, 1228 struct drm_plane *cursor, 1229 const struct drm_crtc_funcs *funcs, 1230 const char *name, ...); 1231 void drm_crtc_cleanup(struct drm_crtc *crtc); 1232 1233 __printf(7, 8) 1234 void *__drmm_crtc_alloc_with_planes(struct drm_device *dev, 1235 size_t size, size_t offset, 1236 struct drm_plane *primary, 1237 struct drm_plane *cursor, 1238 const struct drm_crtc_funcs *funcs, 1239 const char *name, ...); 1240 1241 /** 1242 * drmm_crtc_alloc_with_planes - Allocate and initialize a new CRTC object with 1243 * specified primary and cursor planes. 1244 * @dev: DRM device 1245 * @type: the type of the struct which contains struct &drm_crtc 1246 * @member: the name of the &drm_crtc within @type. 1247 * @primary: Primary plane for CRTC 1248 * @cursor: Cursor plane for CRTC 1249 * @funcs: callbacks for the new CRTC 1250 * @name: printf style format string for the CRTC name, or NULL for default name 1251 * 1252 * Allocates and initializes a new crtc object. Cleanup is automatically 1253 * handled through registering drmm_crtc_cleanup() with drmm_add_action(). 1254 * 1255 * The @drm_crtc_funcs.destroy hook must be NULL. 1256 * 1257 * Returns: 1258 * Pointer to new crtc, or ERR_PTR on failure. 1259 */ 1260 #define drmm_crtc_alloc_with_planes(dev, type, member, primary, cursor, funcs, name, ...) \ 1261 ((type *)__drmm_crtc_alloc_with_planes(dev, sizeof(type), \ 1262 offsetof(type, member), \ 1263 primary, cursor, funcs, \ 1264 name, ##__VA_ARGS__)) 1265 1266 /** 1267 * drm_crtc_index - find the index of a registered CRTC 1268 * @crtc: CRTC to find index for 1269 * 1270 * Given a registered CRTC, return the index of that CRTC within a DRM 1271 * device's list of CRTCs. 1272 */ 1273 static inline unsigned int drm_crtc_index(const struct drm_crtc *crtc) 1274 { 1275 return crtc->index; 1276 } 1277 1278 /** 1279 * drm_crtc_mask - find the mask of a registered CRTC 1280 * @crtc: CRTC to find mask for 1281 * 1282 * Given a registered CRTC, return the mask bit of that CRTC for the 1283 * &drm_encoder.possible_crtcs and &drm_plane.possible_crtcs fields. 1284 */ 1285 static inline uint32_t drm_crtc_mask(const struct drm_crtc *crtc) 1286 { 1287 return 1 << drm_crtc_index(crtc); 1288 } 1289 1290 int drm_mode_set_config_internal(struct drm_mode_set *set); 1291 struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx); 1292 1293 /** 1294 * drm_crtc_find - look up a CRTC object from its ID 1295 * @dev: DRM device 1296 * @file_priv: drm file to check for lease against. 1297 * @id: &drm_mode_object ID 1298 * 1299 * This can be used to look up a CRTC from its userspace ID. Only used by 1300 * drivers for legacy IOCTLs and interface, nowadays extensions to the KMS 1301 * userspace interface should be done using &drm_property. 1302 */ 1303 static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, 1304 struct drm_file *file_priv, 1305 uint32_t id) 1306 { 1307 struct drm_mode_object *mo; 1308 mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CRTC); 1309 return mo ? obj_to_crtc(mo) : NULL; 1310 } 1311 1312 /** 1313 * drm_for_each_crtc - iterate over all CRTCs 1314 * @crtc: a &struct drm_crtc as the loop cursor 1315 * @dev: the &struct drm_device 1316 * 1317 * Iterate over all CRTCs of @dev. 1318 */ 1319 #define drm_for_each_crtc(crtc, dev) \ 1320 list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head) 1321 1322 /** 1323 * drm_for_each_crtc_reverse - iterate over all CRTCs in reverse order 1324 * @crtc: a &struct drm_crtc as the loop cursor 1325 * @dev: the &struct drm_device 1326 * 1327 * Iterate over all CRTCs of @dev. 1328 */ 1329 #define drm_for_each_crtc_reverse(crtc, dev) \ 1330 list_for_each_entry_reverse(crtc, &(dev)->mode_config.crtc_list, head) 1331 1332 int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc, 1333 unsigned int supported_filters); 1334 1335 #endif /* __DRM_CRTC_H__ */ 1336