1 /* 2 * Copyright (c) 2016 Intel Corporation 3 * 4 * Permission to use, copy, modify, distribute, and sell this software and its 5 * documentation for any purpose is hereby granted without fee, provided that 6 * the above copyright notice appear in all copies and that both that copyright 7 * notice and this permission notice appear in supporting documentation, and 8 * that the name of the copyright holders not be used in advertising or 9 * publicity pertaining to distribution of the software without specific, 10 * written prior permission. The copyright holders make no representations 11 * about the suitability of this software for any purpose. It is provided "as 12 * is" without express or implied warranty. 13 * 14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 20 * OF THIS SOFTWARE. 21 */ 22 23 #ifndef __DRM_MODE_CONFIG_H__ 24 #define __DRM_MODE_CONFIG_H__ 25 26 #include <linux/mutex.h> 27 #include <linux/types.h> 28 #include <linux/idr.h> 29 #include <linux/workqueue.h> 30 #include <linux/llist.h> 31 32 #include <drm/drm_modeset_lock.h> 33 34 struct drm_file; 35 struct drm_device; 36 struct drm_atomic_state; 37 struct drm_mode_fb_cmd2; 38 struct drm_format_info; 39 struct drm_display_mode; 40 41 /** 42 * struct drm_mode_config_funcs - basic driver provided mode setting functions 43 * 44 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that 45 * involve drivers. 46 */ 47 struct drm_mode_config_funcs { 48 /** 49 * @fb_create: 50 * 51 * Create a new framebuffer object. The core does basic checks on the 52 * requested metadata, but most of that is left to the driver. See 53 * &struct drm_mode_fb_cmd2 for details. 54 * 55 * To validate the pixel format and modifier drivers can use 56 * drm_any_plane_has_format() to make sure at least one plane supports 57 * the requested values. Note that the driver must first determine the 58 * actual modifier used if the request doesn't have it specified, 59 * ie. when (@mode_cmd->flags & DRM_MODE_FB_MODIFIERS) == 0. 60 * 61 * If the parameters are deemed valid and the backing storage objects in 62 * the underlying memory manager all exist, then the driver allocates 63 * a new &drm_framebuffer structure, subclassed to contain 64 * driver-specific information (like the internal native buffer object 65 * references). It also needs to fill out all relevant metadata, which 66 * should be done by calling drm_helper_mode_fill_fb_struct(). 67 * 68 * The initialization is finalized by calling drm_framebuffer_init(), 69 * which registers the framebuffer and makes it accessible to other 70 * threads. 71 * 72 * RETURNS: 73 * 74 * A new framebuffer with an initial reference count of 1 or a negative 75 * error code encoded with ERR_PTR(). 76 */ 77 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, 78 struct drm_file *file_priv, 79 const struct drm_mode_fb_cmd2 *mode_cmd); 80 81 /** 82 * @get_format_info: 83 * 84 * Allows a driver to return custom format information for special 85 * fb layouts (eg. ones with auxiliary compression control planes). 86 * 87 * RETURNS: 88 * 89 * The format information specific to the given fb metadata, or 90 * NULL if none is found. 91 */ 92 const struct drm_format_info *(*get_format_info)(const struct drm_mode_fb_cmd2 *mode_cmd); 93 94 /** 95 * @output_poll_changed: 96 * 97 * Callback used by helpers to inform the driver of output configuration 98 * changes. 99 * 100 * Drivers implementing fbdev emulation with the helpers can call 101 * drm_fb_helper_hotplug_changed from this hook to inform the fbdev 102 * helper of output changes. 103 * 104 * FIXME: 105 * 106 * Except that there's no vtable for device-level helper callbacks 107 * there's no reason this is a core function. 108 */ 109 void (*output_poll_changed)(struct drm_device *dev); 110 111 /** 112 * @mode_valid: 113 * 114 * Device specific validation of display modes. Can be used to reject 115 * modes that can never be supported. Only device wide constraints can 116 * be checked here. crtc/encoder/bridge/connector specific constraints 117 * should be checked in the .mode_valid() hook for each specific object. 118 */ 119 enum drm_mode_status (*mode_valid)(struct drm_device *dev, 120 const struct drm_display_mode *mode); 121 122 /** 123 * @atomic_check: 124 * 125 * This is the only hook to validate an atomic modeset update. This 126 * function must reject any modeset and state changes which the hardware 127 * or driver doesn't support. This includes but is of course not limited 128 * to: 129 * 130 * - Checking that the modes, framebuffers, scaling and placement 131 * requirements and so on are within the limits of the hardware. 132 * 133 * - Checking that any hidden shared resources are not oversubscribed. 134 * This can be shared PLLs, shared lanes, overall memory bandwidth, 135 * display fifo space (where shared between planes or maybe even 136 * CRTCs). 137 * 138 * - Checking that virtualized resources exported to userspace are not 139 * oversubscribed. For various reasons it can make sense to expose 140 * more planes, crtcs or encoders than which are physically there. One 141 * example is dual-pipe operations (which generally should be hidden 142 * from userspace if when lockstepped in hardware, exposed otherwise), 143 * where a plane might need 1 hardware plane (if it's just on one 144 * pipe), 2 hardware planes (when it spans both pipes) or maybe even 145 * shared a hardware plane with a 2nd plane (if there's a compatible 146 * plane requested on the area handled by the other pipe). 147 * 148 * - Check that any transitional state is possible and that if 149 * requested, the update can indeed be done in the vblank period 150 * without temporarily disabling some functions. 151 * 152 * - Check any other constraints the driver or hardware might have. 153 * 154 * - This callback also needs to correctly fill out the &drm_crtc_state 155 * in this update to make sure that drm_atomic_crtc_needs_modeset() 156 * reflects the nature of the possible update and returns true if and 157 * only if the update cannot be applied without tearing within one 158 * vblank on that CRTC. The core uses that information to reject 159 * updates which require a full modeset (i.e. blanking the screen, or 160 * at least pausing updates for a substantial amount of time) if 161 * userspace has disallowed that in its request. 162 * 163 * - The driver also does not need to repeat basic input validation 164 * like done for the corresponding legacy entry points. The core does 165 * that before calling this hook. 166 * 167 * See the documentation of @atomic_commit for an exhaustive list of 168 * error conditions which don't have to be checked at the in this 169 * callback. 170 * 171 * See the documentation for &struct drm_atomic_state for how exactly 172 * an atomic modeset update is described. 173 * 174 * Drivers using the atomic helpers can implement this hook using 175 * drm_atomic_helper_check(), or one of the exported sub-functions of 176 * it. 177 * 178 * RETURNS: 179 * 180 * 0 on success or one of the below negative error codes: 181 * 182 * - -EINVAL, if any of the above constraints are violated. 183 * 184 * - -EDEADLK, when returned from an attempt to acquire an additional 185 * &drm_modeset_lock through drm_modeset_lock(). 186 * 187 * - -ENOMEM, if allocating additional state sub-structures failed due 188 * to lack of memory. 189 * 190 * - -EINTR, -EAGAIN or -ERESTARTSYS, if the IOCTL should be restarted. 191 * This can either be due to a pending signal, or because the driver 192 * needs to completely bail out to recover from an exceptional 193 * situation like a GPU hang. From a userspace point all errors are 194 * treated equally. 195 */ 196 int (*atomic_check)(struct drm_device *dev, 197 struct drm_atomic_state *state); 198 199 /** 200 * @atomic_commit: 201 * 202 * This is the only hook to commit an atomic modeset update. The core 203 * guarantees that @atomic_check has been called successfully before 204 * calling this function, and that nothing has been changed in the 205 * interim. 206 * 207 * See the documentation for &struct drm_atomic_state for how exactly 208 * an atomic modeset update is described. 209 * 210 * Drivers using the atomic helpers can implement this hook using 211 * drm_atomic_helper_commit(), or one of the exported sub-functions of 212 * it. 213 * 214 * Nonblocking commits (as indicated with the nonblock parameter) must 215 * do any preparatory work which might result in an unsuccessful commit 216 * in the context of this callback. The only exceptions are hardware 217 * errors resulting in -EIO. But even in that case the driver must 218 * ensure that the display pipe is at least running, to avoid 219 * compositors crashing when pageflips don't work. Anything else, 220 * specifically committing the update to the hardware, should be done 221 * without blocking the caller. For updates which do not require a 222 * modeset this must be guaranteed. 223 * 224 * The driver must wait for any pending rendering to the new 225 * framebuffers to complete before executing the flip. It should also 226 * wait for any pending rendering from other drivers if the underlying 227 * buffer is a shared dma-buf. Nonblocking commits must not wait for 228 * rendering in the context of this callback. 229 * 230 * An application can request to be notified when the atomic commit has 231 * completed. These events are per-CRTC and can be distinguished by the 232 * CRTC index supplied in &drm_event to userspace. 233 * 234 * The drm core will supply a &struct drm_event in each CRTC's 235 * &drm_crtc_state.event. See the documentation for 236 * &drm_crtc_state.event for more details about the precise semantics of 237 * this event. 238 * 239 * NOTE: 240 * 241 * Drivers are not allowed to shut down any display pipe successfully 242 * enabled through an atomic commit on their own. Doing so can result in 243 * compositors crashing if a page flip is suddenly rejected because the 244 * pipe is off. 245 * 246 * RETURNS: 247 * 248 * 0 on success or one of the below negative error codes: 249 * 250 * - -EBUSY, if a nonblocking updated is requested and there is 251 * an earlier updated pending. Drivers are allowed to support a queue 252 * of outstanding updates, but currently no driver supports that. 253 * Note that drivers must wait for preceding updates to complete if a 254 * synchronous update is requested, they are not allowed to fail the 255 * commit in that case. 256 * 257 * - -ENOMEM, if the driver failed to allocate memory. Specifically 258 * this can happen when trying to pin framebuffers, which must only 259 * be done when committing the state. 260 * 261 * - -ENOSPC, as a refinement of the more generic -ENOMEM to indicate 262 * that the driver has run out of vram, iommu space or similar GPU 263 * address space needed for framebuffer. 264 * 265 * - -EIO, if the hardware completely died. 266 * 267 * - -EINTR, -EAGAIN or -ERESTARTSYS, if the IOCTL should be restarted. 268 * This can either be due to a pending signal, or because the driver 269 * needs to completely bail out to recover from an exceptional 270 * situation like a GPU hang. From a userspace point of view all errors are 271 * treated equally. 272 * 273 * This list is exhaustive. Specifically this hook is not allowed to 274 * return -EINVAL (any invalid requests should be caught in 275 * @atomic_check) or -EDEADLK (this function must not acquire 276 * additional modeset locks). 277 */ 278 int (*atomic_commit)(struct drm_device *dev, 279 struct drm_atomic_state *state, 280 bool nonblock); 281 282 /** 283 * @atomic_state_alloc: 284 * 285 * This optional hook can be used by drivers that want to subclass struct 286 * &drm_atomic_state to be able to track their own driver-private global 287 * state easily. If this hook is implemented, drivers must also 288 * implement @atomic_state_clear and @atomic_state_free. 289 * 290 * Subclassing of &drm_atomic_state is deprecated in favour of using 291 * &drm_private_state and &drm_private_obj. 292 * 293 * RETURNS: 294 * 295 * A new &drm_atomic_state on success or NULL on failure. 296 */ 297 struct drm_atomic_state *(*atomic_state_alloc)(struct drm_device *dev); 298 299 /** 300 * @atomic_state_clear: 301 * 302 * This hook must clear any driver private state duplicated into the 303 * passed-in &drm_atomic_state. This hook is called when the caller 304 * encountered a &drm_modeset_lock deadlock and needs to drop all 305 * already acquired locks as part of the deadlock avoidance dance 306 * implemented in drm_modeset_backoff(). 307 * 308 * Any duplicated state must be invalidated since a concurrent atomic 309 * update might change it, and the drm atomic interfaces always apply 310 * updates as relative changes to the current state. 311 * 312 * Drivers that implement this must call drm_atomic_state_default_clear() 313 * to clear common state. 314 * 315 * Subclassing of &drm_atomic_state is deprecated in favour of using 316 * &drm_private_state and &drm_private_obj. 317 */ 318 void (*atomic_state_clear)(struct drm_atomic_state *state); 319 320 /** 321 * @atomic_state_free: 322 * 323 * This hook needs driver private resources and the &drm_atomic_state 324 * itself. Note that the core first calls drm_atomic_state_clear() to 325 * avoid code duplicate between the clear and free hooks. 326 * 327 * Drivers that implement this must call 328 * drm_atomic_state_default_release() to release common resources. 329 * 330 * Subclassing of &drm_atomic_state is deprecated in favour of using 331 * &drm_private_state and &drm_private_obj. 332 */ 333 void (*atomic_state_free)(struct drm_atomic_state *state); 334 }; 335 336 /** 337 * struct drm_mode_config - Mode configuration control structure 338 * @min_width: minimum fb pixel width on this device 339 * @min_height: minimum fb pixel height on this device 340 * @max_width: maximum fb pixel width on this device 341 * @max_height: maximum fb pixel height on this device 342 * @funcs: core driver provided mode setting functions 343 * @fb_base: base address of the framebuffer 344 * @poll_enabled: track polling support for this device 345 * @poll_running: track polling status for this device 346 * @delayed_event: track delayed poll uevent deliver for this device 347 * @output_poll_work: delayed work for polling in process context 348 * @preferred_depth: preferred RBG pixel depth, used by fb helpers 349 * @prefer_shadow: hint to userspace to prefer shadow-fb rendering 350 * @cursor_width: hint to userspace for max cursor width 351 * @cursor_height: hint to userspace for max cursor height 352 * @helper_private: mid-layer private data 353 * 354 * Core mode resource tracking structure. All CRTC, encoders, and connectors 355 * enumerated by the driver are added here, as are global properties. Some 356 * global restrictions are also here, e.g. dimension restrictions. 357 */ 358 struct drm_mode_config { 359 /** 360 * @mutex: 361 * 362 * This is the big scary modeset BKL which protects everything that 363 * isn't protect otherwise. Scope is unclear and fuzzy, try to remove 364 * anything from under its protection and move it into more well-scoped 365 * locks. 366 * 367 * The one important thing this protects is the use of @acquire_ctx. 368 */ 369 struct mutex mutex; 370 371 /** 372 * @connection_mutex: 373 * 374 * This protects connector state and the connector to encoder to CRTC 375 * routing chain. 376 * 377 * For atomic drivers specifically this protects &drm_connector.state. 378 */ 379 struct drm_modeset_lock connection_mutex; 380 381 /** 382 * @acquire_ctx: 383 * 384 * Global implicit acquire context used by atomic drivers for legacy 385 * IOCTLs. Deprecated, since implicit locking contexts make it 386 * impossible to use driver-private &struct drm_modeset_lock. Users of 387 * this must hold @mutex. 388 */ 389 struct drm_modeset_acquire_ctx *acquire_ctx; 390 391 /** 392 * @idr_mutex: 393 * 394 * Mutex for KMS ID allocation and management. Protects both @object_idr 395 * and @tile_idr. 396 */ 397 struct mutex idr_mutex; 398 399 /** 400 * @object_idr: 401 * 402 * Main KMS ID tracking object. Use this idr for all IDs, fb, crtc, 403 * connector, modes - just makes life easier to have only one. 404 */ 405 struct idr object_idr; 406 407 /** 408 * @tile_idr: 409 * 410 * Use this idr for allocating new IDs for tiled sinks like use in some 411 * high-res DP MST screens. 412 */ 413 struct idr tile_idr; 414 415 /** @fb_lock: Mutex to protect fb the global @fb_list and @num_fb. */ 416 struct mutex fb_lock; 417 /** @num_fb: Number of entries on @fb_list. */ 418 int num_fb; 419 /** @fb_list: List of all &struct drm_framebuffer. */ 420 struct list_head fb_list; 421 422 /** 423 * @connector_list_lock: Protects @num_connector and 424 * @connector_list and @connector_free_list. 425 */ 426 spinlock_t connector_list_lock; 427 /** 428 * @num_connector: Number of connectors on this device. Protected by 429 * @connector_list_lock. 430 */ 431 int num_connector; 432 /** 433 * @connector_ida: ID allocator for connector indices. 434 */ 435 struct ida connector_ida; 436 /** 437 * @connector_list: 438 * 439 * List of connector objects linked with &drm_connector.head. Protected 440 * by @connector_list_lock. Only use drm_for_each_connector_iter() and 441 * &struct drm_connector_list_iter to walk this list. 442 */ 443 struct list_head connector_list; 444 /** 445 * @connector_free_list: 446 * 447 * List of connector objects linked with &drm_connector.free_head. 448 * Protected by @connector_list_lock. Used by 449 * drm_for_each_connector_iter() and 450 * &struct drm_connector_list_iter to savely free connectors using 451 * @connector_free_work. 452 */ 453 struct llist_head connector_free_list; 454 /** 455 * @connector_free_work: Work to clean up @connector_free_list. 456 */ 457 struct work_struct connector_free_work; 458 459 /** 460 * @num_encoder: 461 * 462 * Number of encoders on this device. This is invariant over the 463 * lifetime of a device and hence doesn't need any locks. 464 */ 465 int num_encoder; 466 /** 467 * @encoder_list: 468 * 469 * List of encoder objects linked with &drm_encoder.head. This is 470 * invariant over the lifetime of a device and hence doesn't need any 471 * locks. 472 */ 473 struct list_head encoder_list; 474 475 /** 476 * @num_total_plane: 477 * 478 * Number of universal (i.e. with primary/curso) planes on this device. 479 * This is invariant over the lifetime of a device and hence doesn't 480 * need any locks. 481 */ 482 int num_total_plane; 483 /** 484 * @plane_list: 485 * 486 * List of plane objects linked with &drm_plane.head. This is invariant 487 * over the lifetime of a device and hence doesn't need any locks. 488 */ 489 struct list_head plane_list; 490 491 /** 492 * @num_crtc: 493 * 494 * Number of CRTCs on this device linked with &drm_crtc.head. This is invariant over the lifetime 495 * of a device and hence doesn't need any locks. 496 */ 497 int num_crtc; 498 /** 499 * @crtc_list: 500 * 501 * List of CRTC objects linked with &drm_crtc.head. This is invariant 502 * over the lifetime of a device and hence doesn't need any locks. 503 */ 504 struct list_head crtc_list; 505 506 /** 507 * @property_list: 508 * 509 * List of property type objects linked with &drm_property.head. This is 510 * invariant over the lifetime of a device and hence doesn't need any 511 * locks. 512 */ 513 struct list_head property_list; 514 515 /** 516 * @privobj_list: 517 * 518 * List of private objects linked with &drm_private_obj.head. This is 519 * invariant over the lifetime of a device and hence doesn't need any 520 * locks. 521 */ 522 struct list_head privobj_list; 523 524 int min_width, min_height; 525 int max_width, max_height; 526 const struct drm_mode_config_funcs *funcs; 527 resource_size_t fb_base; 528 529 /* output poll support */ 530 bool poll_enabled; 531 bool poll_running; 532 bool delayed_event; 533 struct delayed_work output_poll_work; 534 535 /** 536 * @blob_lock: 537 * 538 * Mutex for blob property allocation and management, protects 539 * @property_blob_list and &drm_file.blobs. 540 */ 541 struct mutex blob_lock; 542 543 /** 544 * @property_blob_list: 545 * 546 * List of all the blob property objects linked with 547 * &drm_property_blob.head. Protected by @blob_lock. 548 */ 549 struct list_head property_blob_list; 550 551 /* pointers to standard properties */ 552 553 /** 554 * @edid_property: Default connector property to hold the EDID of the 555 * currently connected sink, if any. 556 */ 557 struct drm_property *edid_property; 558 /** 559 * @dpms_property: Default connector property to control the 560 * connector's DPMS state. 561 */ 562 struct drm_property *dpms_property; 563 /** 564 * @path_property: Default connector property to hold the DP MST path 565 * for the port. 566 */ 567 struct drm_property *path_property; 568 /** 569 * @tile_property: Default connector property to store the tile 570 * position of a tiled screen, for sinks which need to be driven with 571 * multiple CRTCs. 572 */ 573 struct drm_property *tile_property; 574 /** 575 * @link_status_property: Default connector property for link status 576 * of a connector 577 */ 578 struct drm_property *link_status_property; 579 /** 580 * @plane_type_property: Default plane property to differentiate 581 * CURSOR, PRIMARY and OVERLAY legacy uses of planes. 582 */ 583 struct drm_property *plane_type_property; 584 /** 585 * @prop_src_x: Default atomic plane property for the plane source 586 * position in the connected &drm_framebuffer. 587 */ 588 struct drm_property *prop_src_x; 589 /** 590 * @prop_src_y: Default atomic plane property for the plane source 591 * position in the connected &drm_framebuffer. 592 */ 593 struct drm_property *prop_src_y; 594 /** 595 * @prop_src_w: Default atomic plane property for the plane source 596 * position in the connected &drm_framebuffer. 597 */ 598 struct drm_property *prop_src_w; 599 /** 600 * @prop_src_h: Default atomic plane property for the plane source 601 * position in the connected &drm_framebuffer. 602 */ 603 struct drm_property *prop_src_h; 604 /** 605 * @prop_crtc_x: Default atomic plane property for the plane destination 606 * position in the &drm_crtc is being shown on. 607 */ 608 struct drm_property *prop_crtc_x; 609 /** 610 * @prop_crtc_y: Default atomic plane property for the plane destination 611 * position in the &drm_crtc is being shown on. 612 */ 613 struct drm_property *prop_crtc_y; 614 /** 615 * @prop_crtc_w: Default atomic plane property for the plane destination 616 * position in the &drm_crtc is being shown on. 617 */ 618 struct drm_property *prop_crtc_w; 619 /** 620 * @prop_crtc_h: Default atomic plane property for the plane destination 621 * position in the &drm_crtc is being shown on. 622 */ 623 struct drm_property *prop_crtc_h; 624 /** 625 * @prop_fb_id: Default atomic plane property to specify the 626 * &drm_framebuffer. 627 */ 628 struct drm_property *prop_fb_id; 629 /** 630 * @prop_in_fence_fd: Sync File fd representing the incoming fences 631 * for a Plane. 632 */ 633 struct drm_property *prop_in_fence_fd; 634 /** 635 * @prop_out_fence_ptr: Sync File fd pointer representing the 636 * outgoing fences for a CRTC. Userspace should provide a pointer to a 637 * value of type s32, and then cast that pointer to u64. 638 */ 639 struct drm_property *prop_out_fence_ptr; 640 /** 641 * @prop_crtc_id: Default atomic plane property to specify the 642 * &drm_crtc. 643 */ 644 struct drm_property *prop_crtc_id; 645 /** 646 * @prop_fb_damage_clips: Optional plane property to mark damaged 647 * regions on the plane in framebuffer coordinates of the framebuffer 648 * attached to the plane. 649 * 650 * The layout of blob data is simply an array of &drm_mode_rect. Unlike 651 * plane src coordinates, damage clips are not in 16.16 fixed point. 652 */ 653 struct drm_property *prop_fb_damage_clips; 654 /** 655 * @prop_active: Default atomic CRTC property to control the active 656 * state, which is the simplified implementation for DPMS in atomic 657 * drivers. 658 */ 659 struct drm_property *prop_active; 660 /** 661 * @prop_mode_id: Default atomic CRTC property to set the mode for a 662 * CRTC. A 0 mode implies that the CRTC is entirely disabled - all 663 * connectors must be of and active must be set to disabled, too. 664 */ 665 struct drm_property *prop_mode_id; 666 /** 667 * @prop_vrr_enabled: Default atomic CRTC property to indicate 668 * whether variable refresh rate should be enabled on the CRTC. 669 */ 670 struct drm_property *prop_vrr_enabled; 671 672 /** 673 * @dvi_i_subconnector_property: Optional DVI-I property to 674 * differentiate between analog or digital mode. 675 */ 676 struct drm_property *dvi_i_subconnector_property; 677 /** 678 * @dvi_i_select_subconnector_property: Optional DVI-I property to 679 * select between analog or digital mode. 680 */ 681 struct drm_property *dvi_i_select_subconnector_property; 682 683 /** 684 * @dp_subconnector_property: Optional DP property to differentiate 685 * between different DP downstream port types. 686 */ 687 struct drm_property *dp_subconnector_property; 688 689 /** 690 * @tv_subconnector_property: Optional TV property to differentiate 691 * between different TV connector types. 692 */ 693 struct drm_property *tv_subconnector_property; 694 /** 695 * @tv_select_subconnector_property: Optional TV property to select 696 * between different TV connector types. 697 */ 698 struct drm_property *tv_select_subconnector_property; 699 /** 700 * @tv_mode_property: Optional TV property to select 701 * the output TV mode. 702 */ 703 struct drm_property *tv_mode_property; 704 /** 705 * @tv_left_margin_property: Optional TV property to set the left 706 * margin (expressed in pixels). 707 */ 708 struct drm_property *tv_left_margin_property; 709 /** 710 * @tv_right_margin_property: Optional TV property to set the right 711 * margin (expressed in pixels). 712 */ 713 struct drm_property *tv_right_margin_property; 714 /** 715 * @tv_top_margin_property: Optional TV property to set the right 716 * margin (expressed in pixels). 717 */ 718 struct drm_property *tv_top_margin_property; 719 /** 720 * @tv_bottom_margin_property: Optional TV property to set the right 721 * margin (expressed in pixels). 722 */ 723 struct drm_property *tv_bottom_margin_property; 724 /** 725 * @tv_brightness_property: Optional TV property to set the 726 * brightness. 727 */ 728 struct drm_property *tv_brightness_property; 729 /** 730 * @tv_contrast_property: Optional TV property to set the 731 * contrast. 732 */ 733 struct drm_property *tv_contrast_property; 734 /** 735 * @tv_flicker_reduction_property: Optional TV property to control the 736 * flicker reduction mode. 737 */ 738 struct drm_property *tv_flicker_reduction_property; 739 /** 740 * @tv_overscan_property: Optional TV property to control the overscan 741 * setting. 742 */ 743 struct drm_property *tv_overscan_property; 744 /** 745 * @tv_saturation_property: Optional TV property to set the 746 * saturation. 747 */ 748 struct drm_property *tv_saturation_property; 749 /** 750 * @tv_hue_property: Optional TV property to set the hue. 751 */ 752 struct drm_property *tv_hue_property; 753 754 /** 755 * @scaling_mode_property: Optional connector property to control the 756 * upscaling, mostly used for built-in panels. 757 */ 758 struct drm_property *scaling_mode_property; 759 /** 760 * @aspect_ratio_property: Optional connector property to control the 761 * HDMI infoframe aspect ratio setting. 762 */ 763 struct drm_property *aspect_ratio_property; 764 /** 765 * @content_type_property: Optional connector property to control the 766 * HDMI infoframe content type setting. 767 */ 768 struct drm_property *content_type_property; 769 /** 770 * @degamma_lut_property: Optional CRTC property to set the LUT used to 771 * convert the framebuffer's colors to linear gamma. 772 */ 773 struct drm_property *degamma_lut_property; 774 /** 775 * @degamma_lut_size_property: Optional CRTC property for the size of 776 * the degamma LUT as supported by the driver (read-only). 777 */ 778 struct drm_property *degamma_lut_size_property; 779 /** 780 * @ctm_property: Optional CRTC property to set the 781 * matrix used to convert colors after the lookup in the 782 * degamma LUT. 783 */ 784 struct drm_property *ctm_property; 785 /** 786 * @gamma_lut_property: Optional CRTC property to set the LUT used to 787 * convert the colors, after the CTM matrix, to the gamma space of the 788 * connected screen. 789 */ 790 struct drm_property *gamma_lut_property; 791 /** 792 * @gamma_lut_size_property: Optional CRTC property for the size of the 793 * gamma LUT as supported by the driver (read-only). 794 */ 795 struct drm_property *gamma_lut_size_property; 796 797 /** 798 * @suggested_x_property: Optional connector property with a hint for 799 * the position of the output on the host's screen. 800 */ 801 struct drm_property *suggested_x_property; 802 /** 803 * @suggested_y_property: Optional connector property with a hint for 804 * the position of the output on the host's screen. 805 */ 806 struct drm_property *suggested_y_property; 807 808 /** 809 * @non_desktop_property: Optional connector property with a hint 810 * that device isn't a standard display, and the console/desktop, 811 * should not be displayed on it. 812 */ 813 struct drm_property *non_desktop_property; 814 815 /** 816 * @panel_orientation_property: Optional connector property indicating 817 * how the lcd-panel is mounted inside the casing (e.g. normal or 818 * upside-down). 819 */ 820 struct drm_property *panel_orientation_property; 821 822 /** 823 * @writeback_fb_id_property: Property for writeback connectors, storing 824 * the ID of the output framebuffer. 825 * See also: drm_writeback_connector_init() 826 */ 827 struct drm_property *writeback_fb_id_property; 828 829 /** 830 * @writeback_pixel_formats_property: Property for writeback connectors, 831 * storing an array of the supported pixel formats for the writeback 832 * engine (read-only). 833 * See also: drm_writeback_connector_init() 834 */ 835 struct drm_property *writeback_pixel_formats_property; 836 /** 837 * @writeback_out_fence_ptr_property: Property for writeback connectors, 838 * fd pointer representing the outgoing fences for a writeback 839 * connector. Userspace should provide a pointer to a value of type s32, 840 * and then cast that pointer to u64. 841 * See also: drm_writeback_connector_init() 842 */ 843 struct drm_property *writeback_out_fence_ptr_property; 844 845 /** 846 * @hdr_output_metadata_property: Connector property containing hdr 847 * metatada. This will be provided by userspace compositors based 848 * on HDR content 849 */ 850 struct drm_property *hdr_output_metadata_property; 851 852 /** 853 * @content_protection_property: DRM ENUM property for content 854 * protection. See drm_connector_attach_content_protection_property(). 855 */ 856 struct drm_property *content_protection_property; 857 858 /** 859 * @hdcp_content_type_property: DRM ENUM property for type of 860 * Protected Content. 861 */ 862 struct drm_property *hdcp_content_type_property; 863 864 /* dumb ioctl parameters */ 865 uint32_t preferred_depth, prefer_shadow; 866 867 /** 868 * @prefer_shadow_fbdev: 869 * 870 * Hint to framebuffer emulation to prefer shadow-fb rendering. 871 */ 872 bool prefer_shadow_fbdev; 873 874 /** 875 * @fbdev_use_iomem: 876 * 877 * Set to true if framebuffer reside in iomem. 878 * When set to true memcpy_toio() is used when copying the framebuffer in 879 * drm_fb_helper.drm_fb_helper_dirty_blit_real(). 880 * 881 * FIXME: This should be replaced with a per-mapping is_iomem 882 * flag (like ttm does), and then used everywhere in fbdev code. 883 */ 884 bool fbdev_use_iomem; 885 886 /** 887 * @quirk_addfb_prefer_xbgr_30bpp: 888 * 889 * Special hack for legacy ADDFB to keep nouveau userspace happy. Should 890 * only ever be set by the nouveau kernel driver. 891 */ 892 bool quirk_addfb_prefer_xbgr_30bpp; 893 894 /** 895 * @quirk_addfb_prefer_host_byte_order: 896 * 897 * When set to true drm_mode_addfb() will pick host byte order 898 * pixel_format when calling drm_mode_addfb2(). This is how 899 * drm_mode_addfb() should have worked from day one. It 900 * didn't though, so we ended up with quirks in both kernel 901 * and userspace drivers to deal with the broken behavior. 902 * Simply fixing drm_mode_addfb() unconditionally would break 903 * these drivers, so add a quirk bit here to allow drivers 904 * opt-in. 905 */ 906 bool quirk_addfb_prefer_host_byte_order; 907 908 /** 909 * @async_page_flip: Does this device support async flips on the primary 910 * plane? 911 */ 912 bool async_page_flip; 913 914 /** 915 * @allow_fb_modifiers: 916 * 917 * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call. 918 */ 919 bool allow_fb_modifiers; 920 921 /** 922 * @normalize_zpos: 923 * 924 * If true the drm core will call drm_atomic_normalize_zpos() as part of 925 * atomic mode checking from drm_atomic_helper_check() 926 */ 927 bool normalize_zpos; 928 929 /** 930 * @modifiers_property: Plane property to list support modifier/format 931 * combination. 932 */ 933 struct drm_property *modifiers_property; 934 935 /* cursor size */ 936 uint32_t cursor_width, cursor_height; 937 938 /** 939 * @suspend_state: 940 * 941 * Atomic state when suspended. 942 * Set by drm_mode_config_helper_suspend() and cleared by 943 * drm_mode_config_helper_resume(). 944 */ 945 struct drm_atomic_state *suspend_state; 946 947 const struct drm_mode_config_helper_funcs *helper_private; 948 }; 949 950 int __must_check drmm_mode_config_init(struct drm_device *dev); 951 952 /** 953 * drm_mode_config_init - DRM mode_configuration structure initialization 954 * @dev: DRM device 955 * 956 * This is the unmanaged version of drmm_mode_config_init() for drivers which 957 * still explicitly call drm_mode_config_cleanup(). 958 * 959 * FIXME: This function is deprecated and drivers should be converted over to 960 * drmm_mode_config_init(). 961 */ 962 static inline int drm_mode_config_init(struct drm_device *dev) 963 { 964 return drmm_mode_config_init(dev); 965 } 966 967 void drm_mode_config_reset(struct drm_device *dev); 968 void drm_mode_config_cleanup(struct drm_device *dev); 969 970 #endif 971