![]() |
|
|||
0001 /* 0002 * Copyright (c) 2016 Intel Corporation 0003 * 0004 * Permission to use, copy, modify, distribute, and sell this software and its 0005 * documentation for any purpose is hereby granted without fee, provided that 0006 * the above copyright notice appear in all copies and that both that copyright 0007 * notice and this permission notice appear in supporting documentation, and 0008 * that the name of the copyright holders not be used in advertising or 0009 * publicity pertaining to distribution of the software without specific, 0010 * written prior permission. The copyright holders make no representations 0011 * about the suitability of this software for any purpose. It is provided "as 0012 * is" without express or implied warranty. 0013 * 0014 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 0015 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 0016 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 0017 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 0018 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 0019 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 0020 * OF THIS SOFTWARE. 0021 */ 0022 0023 #ifndef __DRM_MODE_CONFIG_H__ 0024 #define __DRM_MODE_CONFIG_H__ 0025 0026 #include <linux/mutex.h> 0027 #include <linux/types.h> 0028 #include <linux/idr.h> 0029 #include <linux/workqueue.h> 0030 #include <linux/llist.h> 0031 0032 #include <drm/drm_modeset_lock.h> 0033 0034 struct drm_file; 0035 struct drm_device; 0036 struct drm_atomic_state; 0037 struct drm_mode_fb_cmd2; 0038 struct drm_format_info; 0039 struct drm_display_mode; 0040 0041 /** 0042 * struct drm_mode_config_funcs - basic driver provided mode setting functions 0043 * 0044 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that 0045 * involve drivers. 0046 */ 0047 struct drm_mode_config_funcs { 0048 /** 0049 * @fb_create: 0050 * 0051 * Create a new framebuffer object. The core does basic checks on the 0052 * requested metadata, but most of that is left to the driver. See 0053 * &struct drm_mode_fb_cmd2 for details. 0054 * 0055 * To validate the pixel format and modifier drivers can use 0056 * drm_any_plane_has_format() to make sure at least one plane supports 0057 * the requested values. Note that the driver must first determine the 0058 * actual modifier used if the request doesn't have it specified, 0059 * ie. when (@mode_cmd->flags & DRM_MODE_FB_MODIFIERS) == 0. 0060 * 0061 * IMPORTANT: These implied modifiers for legacy userspace must be 0062 * stored in struct &drm_framebuffer, including all relevant metadata 0063 * like &drm_framebuffer.pitches and &drm_framebuffer.offsets if the 0064 * modifier enables additional planes beyond the fourcc pixel format 0065 * code. This is required by the GETFB2 ioctl. 0066 * 0067 * If the parameters are deemed valid and the backing storage objects in 0068 * the underlying memory manager all exist, then the driver allocates 0069 * a new &drm_framebuffer structure, subclassed to contain 0070 * driver-specific information (like the internal native buffer object 0071 * references). It also needs to fill out all relevant metadata, which 0072 * should be done by calling drm_helper_mode_fill_fb_struct(). 0073 * 0074 * The initialization is finalized by calling drm_framebuffer_init(), 0075 * which registers the framebuffer and makes it accessible to other 0076 * threads. 0077 * 0078 * RETURNS: 0079 * 0080 * A new framebuffer with an initial reference count of 1 or a negative 0081 * error code encoded with ERR_PTR(). 0082 */ 0083 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, 0084 struct drm_file *file_priv, 0085 const struct drm_mode_fb_cmd2 *mode_cmd); 0086 0087 /** 0088 * @get_format_info: 0089 * 0090 * Allows a driver to return custom format information for special 0091 * fb layouts (eg. ones with auxiliary compression control planes). 0092 * 0093 * RETURNS: 0094 * 0095 * The format information specific to the given fb metadata, or 0096 * NULL if none is found. 0097 */ 0098 const struct drm_format_info *(*get_format_info)(const struct drm_mode_fb_cmd2 *mode_cmd); 0099 0100 /** 0101 * @output_poll_changed: 0102 * 0103 * Callback used by helpers to inform the driver of output configuration 0104 * changes. 0105 * 0106 * Drivers implementing fbdev emulation use drm_kms_helper_hotplug_event() 0107 * to call this hook to inform the fbdev helper of output changes. 0108 * 0109 * This hook is deprecated, drivers should instead use 0110 * drm_fbdev_generic_setup() which takes care of any necessary 0111 * hotplug event forwarding already without further involvement by 0112 * the driver. 0113 */ 0114 void (*output_poll_changed)(struct drm_device *dev); 0115 0116 /** 0117 * @mode_valid: 0118 * 0119 * Device specific validation of display modes. Can be used to reject 0120 * modes that can never be supported. Only device wide constraints can 0121 * be checked here. crtc/encoder/bridge/connector specific constraints 0122 * should be checked in the .mode_valid() hook for each specific object. 0123 */ 0124 enum drm_mode_status (*mode_valid)(struct drm_device *dev, 0125 const struct drm_display_mode *mode); 0126 0127 /** 0128 * @atomic_check: 0129 * 0130 * This is the only hook to validate an atomic modeset update. This 0131 * function must reject any modeset and state changes which the hardware 0132 * or driver doesn't support. This includes but is of course not limited 0133 * to: 0134 * 0135 * - Checking that the modes, framebuffers, scaling and placement 0136 * requirements and so on are within the limits of the hardware. 0137 * 0138 * - Checking that any hidden shared resources are not oversubscribed. 0139 * This can be shared PLLs, shared lanes, overall memory bandwidth, 0140 * display fifo space (where shared between planes or maybe even 0141 * CRTCs). 0142 * 0143 * - Checking that virtualized resources exported to userspace are not 0144 * oversubscribed. For various reasons it can make sense to expose 0145 * more planes, crtcs or encoders than which are physically there. One 0146 * example is dual-pipe operations (which generally should be hidden 0147 * from userspace if when lockstepped in hardware, exposed otherwise), 0148 * where a plane might need 1 hardware plane (if it's just on one 0149 * pipe), 2 hardware planes (when it spans both pipes) or maybe even 0150 * shared a hardware plane with a 2nd plane (if there's a compatible 0151 * plane requested on the area handled by the other pipe). 0152 * 0153 * - Check that any transitional state is possible and that if 0154 * requested, the update can indeed be done in the vblank period 0155 * without temporarily disabling some functions. 0156 * 0157 * - Check any other constraints the driver or hardware might have. 0158 * 0159 * - This callback also needs to correctly fill out the &drm_crtc_state 0160 * in this update to make sure that drm_atomic_crtc_needs_modeset() 0161 * reflects the nature of the possible update and returns true if and 0162 * only if the update cannot be applied without tearing within one 0163 * vblank on that CRTC. The core uses that information to reject 0164 * updates which require a full modeset (i.e. blanking the screen, or 0165 * at least pausing updates for a substantial amount of time) if 0166 * userspace has disallowed that in its request. 0167 * 0168 * - The driver also does not need to repeat basic input validation 0169 * like done for the corresponding legacy entry points. The core does 0170 * that before calling this hook. 0171 * 0172 * See the documentation of @atomic_commit for an exhaustive list of 0173 * error conditions which don't have to be checked at the in this 0174 * callback. 0175 * 0176 * See the documentation for &struct drm_atomic_state for how exactly 0177 * an atomic modeset update is described. 0178 * 0179 * Drivers using the atomic helpers can implement this hook using 0180 * drm_atomic_helper_check(), or one of the exported sub-functions of 0181 * it. 0182 * 0183 * RETURNS: 0184 * 0185 * 0 on success or one of the below negative error codes: 0186 * 0187 * - -EINVAL, if any of the above constraints are violated. 0188 * 0189 * - -EDEADLK, when returned from an attempt to acquire an additional 0190 * &drm_modeset_lock through drm_modeset_lock(). 0191 * 0192 * - -ENOMEM, if allocating additional state sub-structures failed due 0193 * to lack of memory. 0194 * 0195 * - -EINTR, -EAGAIN or -ERESTARTSYS, if the IOCTL should be restarted. 0196 * This can either be due to a pending signal, or because the driver 0197 * needs to completely bail out to recover from an exceptional 0198 * situation like a GPU hang. From a userspace point all errors are 0199 * treated equally. 0200 */ 0201 int (*atomic_check)(struct drm_device *dev, 0202 struct drm_atomic_state *state); 0203 0204 /** 0205 * @atomic_commit: 0206 * 0207 * This is the only hook to commit an atomic modeset update. The core 0208 * guarantees that @atomic_check has been called successfully before 0209 * calling this function, and that nothing has been changed in the 0210 * interim. 0211 * 0212 * See the documentation for &struct drm_atomic_state for how exactly 0213 * an atomic modeset update is described. 0214 * 0215 * Drivers using the atomic helpers can implement this hook using 0216 * drm_atomic_helper_commit(), or one of the exported sub-functions of 0217 * it. 0218 * 0219 * Nonblocking commits (as indicated with the nonblock parameter) must 0220 * do any preparatory work which might result in an unsuccessful commit 0221 * in the context of this callback. The only exceptions are hardware 0222 * errors resulting in -EIO. But even in that case the driver must 0223 * ensure that the display pipe is at least running, to avoid 0224 * compositors crashing when pageflips don't work. Anything else, 0225 * specifically committing the update to the hardware, should be done 0226 * without blocking the caller. For updates which do not require a 0227 * modeset this must be guaranteed. 0228 * 0229 * The driver must wait for any pending rendering to the new 0230 * framebuffers to complete before executing the flip. It should also 0231 * wait for any pending rendering from other drivers if the underlying 0232 * buffer is a shared dma-buf. Nonblocking commits must not wait for 0233 * rendering in the context of this callback. 0234 * 0235 * An application can request to be notified when the atomic commit has 0236 * completed. These events are per-CRTC and can be distinguished by the 0237 * CRTC index supplied in &drm_event to userspace. 0238 * 0239 * The drm core will supply a &struct drm_event in each CRTC's 0240 * &drm_crtc_state.event. See the documentation for 0241 * &drm_crtc_state.event for more details about the precise semantics of 0242 * this event. 0243 * 0244 * NOTE: 0245 * 0246 * Drivers are not allowed to shut down any display pipe successfully 0247 * enabled through an atomic commit on their own. Doing so can result in 0248 * compositors crashing if a page flip is suddenly rejected because the 0249 * pipe is off. 0250 * 0251 * RETURNS: 0252 * 0253 * 0 on success or one of the below negative error codes: 0254 * 0255 * - -EBUSY, if a nonblocking updated is requested and there is 0256 * an earlier updated pending. Drivers are allowed to support a queue 0257 * of outstanding updates, but currently no driver supports that. 0258 * Note that drivers must wait for preceding updates to complete if a 0259 * synchronous update is requested, they are not allowed to fail the 0260 * commit in that case. 0261 * 0262 * - -ENOMEM, if the driver failed to allocate memory. Specifically 0263 * this can happen when trying to pin framebuffers, which must only 0264 * be done when committing the state. 0265 * 0266 * - -ENOSPC, as a refinement of the more generic -ENOMEM to indicate 0267 * that the driver has run out of vram, iommu space or similar GPU 0268 * address space needed for framebuffer. 0269 * 0270 * - -EIO, if the hardware completely died. 0271 * 0272 * - -EINTR, -EAGAIN or -ERESTARTSYS, if the IOCTL should be restarted. 0273 * This can either be due to a pending signal, or because the driver 0274 * needs to completely bail out to recover from an exceptional 0275 * situation like a GPU hang. From a userspace point of view all errors are 0276 * treated equally. 0277 * 0278 * This list is exhaustive. Specifically this hook is not allowed to 0279 * return -EINVAL (any invalid requests should be caught in 0280 * @atomic_check) or -EDEADLK (this function must not acquire 0281 * additional modeset locks). 0282 */ 0283 int (*atomic_commit)(struct drm_device *dev, 0284 struct drm_atomic_state *state, 0285 bool nonblock); 0286 0287 /** 0288 * @atomic_state_alloc: 0289 * 0290 * This optional hook can be used by drivers that want to subclass struct 0291 * &drm_atomic_state to be able to track their own driver-private global 0292 * state easily. If this hook is implemented, drivers must also 0293 * implement @atomic_state_clear and @atomic_state_free. 0294 * 0295 * Subclassing of &drm_atomic_state is deprecated in favour of using 0296 * &drm_private_state and &drm_private_obj. 0297 * 0298 * RETURNS: 0299 * 0300 * A new &drm_atomic_state on success or NULL on failure. 0301 */ 0302 struct drm_atomic_state *(*atomic_state_alloc)(struct drm_device *dev); 0303 0304 /** 0305 * @atomic_state_clear: 0306 * 0307 * This hook must clear any driver private state duplicated into the 0308 * passed-in &drm_atomic_state. This hook is called when the caller 0309 * encountered a &drm_modeset_lock deadlock and needs to drop all 0310 * already acquired locks as part of the deadlock avoidance dance 0311 * implemented in drm_modeset_backoff(). 0312 * 0313 * Any duplicated state must be invalidated since a concurrent atomic 0314 * update might change it, and the drm atomic interfaces always apply 0315 * updates as relative changes to the current state. 0316 * 0317 * Drivers that implement this must call drm_atomic_state_default_clear() 0318 * to clear common state. 0319 * 0320 * Subclassing of &drm_atomic_state is deprecated in favour of using 0321 * &drm_private_state and &drm_private_obj. 0322 */ 0323 void (*atomic_state_clear)(struct drm_atomic_state *state); 0324 0325 /** 0326 * @atomic_state_free: 0327 * 0328 * This hook needs driver private resources and the &drm_atomic_state 0329 * itself. Note that the core first calls drm_atomic_state_clear() to 0330 * avoid code duplicate between the clear and free hooks. 0331 * 0332 * Drivers that implement this must call 0333 * drm_atomic_state_default_release() to release common resources. 0334 * 0335 * Subclassing of &drm_atomic_state is deprecated in favour of using 0336 * &drm_private_state and &drm_private_obj. 0337 */ 0338 void (*atomic_state_free)(struct drm_atomic_state *state); 0339 }; 0340 0341 /** 0342 * struct drm_mode_config - Mode configuration control structure 0343 * @min_width: minimum fb pixel width on this device 0344 * @min_height: minimum fb pixel height on this device 0345 * @max_width: maximum fb pixel width on this device 0346 * @max_height: maximum fb pixel height on this device 0347 * @funcs: core driver provided mode setting functions 0348 * @fb_base: base address of the framebuffer 0349 * @poll_enabled: track polling support for this device 0350 * @poll_running: track polling status for this device 0351 * @delayed_event: track delayed poll uevent deliver for this device 0352 * @output_poll_work: delayed work for polling in process context 0353 * @preferred_depth: preferred RBG pixel depth, used by fb helpers 0354 * @prefer_shadow: hint to userspace to prefer shadow-fb rendering 0355 * @cursor_width: hint to userspace for max cursor width 0356 * @cursor_height: hint to userspace for max cursor height 0357 * @helper_private: mid-layer private data 0358 * 0359 * Core mode resource tracking structure. All CRTC, encoders, and connectors 0360 * enumerated by the driver are added here, as are global properties. Some 0361 * global restrictions are also here, e.g. dimension restrictions. 0362 * 0363 * Framebuffer sizes refer to the virtual screen that can be displayed by 0364 * the CRTC. This can be different from the physical resolution programmed. 0365 * The minimum width and height, stored in @min_width and @min_height, 0366 * describe the smallest size of the framebuffer. It correlates to the 0367 * minimum programmable resolution. 0368 * The maximum width, stored in @max_width, is typically limited by the 0369 * maximum pitch between two adjacent scanlines. The maximum height, stored 0370 * in @max_height, is usually only limited by the amount of addressable video 0371 * memory. For hardware that has no real maximum, drivers should pick a 0372 * reasonable default. 0373 * 0374 * See also @DRM_SHADOW_PLANE_MAX_WIDTH and @DRM_SHADOW_PLANE_MAX_HEIGHT. 0375 */ 0376 struct drm_mode_config { 0377 /** 0378 * @mutex: 0379 * 0380 * This is the big scary modeset BKL which protects everything that 0381 * isn't protect otherwise. Scope is unclear and fuzzy, try to remove 0382 * anything from under its protection and move it into more well-scoped 0383 * locks. 0384 * 0385 * The one important thing this protects is the use of @acquire_ctx. 0386 */ 0387 struct mutex mutex; 0388 0389 /** 0390 * @connection_mutex: 0391 * 0392 * This protects connector state and the connector to encoder to CRTC 0393 * routing chain. 0394 * 0395 * For atomic drivers specifically this protects &drm_connector.state. 0396 */ 0397 struct drm_modeset_lock connection_mutex; 0398 0399 /** 0400 * @acquire_ctx: 0401 * 0402 * Global implicit acquire context used by atomic drivers for legacy 0403 * IOCTLs. Deprecated, since implicit locking contexts make it 0404 * impossible to use driver-private &struct drm_modeset_lock. Users of 0405 * this must hold @mutex. 0406 */ 0407 struct drm_modeset_acquire_ctx *acquire_ctx; 0408 0409 /** 0410 * @idr_mutex: 0411 * 0412 * Mutex for KMS ID allocation and management. Protects both @object_idr 0413 * and @tile_idr. 0414 */ 0415 struct mutex idr_mutex; 0416 0417 /** 0418 * @object_idr: 0419 * 0420 * Main KMS ID tracking object. Use this idr for all IDs, fb, crtc, 0421 * connector, modes - just makes life easier to have only one. 0422 */ 0423 struct idr object_idr; 0424 0425 /** 0426 * @tile_idr: 0427 * 0428 * Use this idr for allocating new IDs for tiled sinks like use in some 0429 * high-res DP MST screens. 0430 */ 0431 struct idr tile_idr; 0432 0433 /** @fb_lock: Mutex to protect fb the global @fb_list and @num_fb. */ 0434 struct mutex fb_lock; 0435 /** @num_fb: Number of entries on @fb_list. */ 0436 int num_fb; 0437 /** @fb_list: List of all &struct drm_framebuffer. */ 0438 struct list_head fb_list; 0439 0440 /** 0441 * @connector_list_lock: Protects @num_connector and 0442 * @connector_list and @connector_free_list. 0443 */ 0444 spinlock_t connector_list_lock; 0445 /** 0446 * @num_connector: Number of connectors on this device. Protected by 0447 * @connector_list_lock. 0448 */ 0449 int num_connector; 0450 /** 0451 * @connector_ida: ID allocator for connector indices. 0452 */ 0453 struct ida connector_ida; 0454 /** 0455 * @connector_list: 0456 * 0457 * List of connector objects linked with &drm_connector.head. Protected 0458 * by @connector_list_lock. Only use drm_for_each_connector_iter() and 0459 * &struct drm_connector_list_iter to walk this list. 0460 */ 0461 struct list_head connector_list; 0462 /** 0463 * @connector_free_list: 0464 * 0465 * List of connector objects linked with &drm_connector.free_head. 0466 * Protected by @connector_list_lock. Used by 0467 * drm_for_each_connector_iter() and 0468 * &struct drm_connector_list_iter to savely free connectors using 0469 * @connector_free_work. 0470 */ 0471 struct llist_head connector_free_list; 0472 /** 0473 * @connector_free_work: Work to clean up @connector_free_list. 0474 */ 0475 struct work_struct connector_free_work; 0476 0477 /** 0478 * @num_encoder: 0479 * 0480 * Number of encoders on this device. This is invariant over the 0481 * lifetime of a device and hence doesn't need any locks. 0482 */ 0483 int num_encoder; 0484 /** 0485 * @encoder_list: 0486 * 0487 * List of encoder objects linked with &drm_encoder.head. This is 0488 * invariant over the lifetime of a device and hence doesn't need any 0489 * locks. 0490 */ 0491 struct list_head encoder_list; 0492 0493 /** 0494 * @num_total_plane: 0495 * 0496 * Number of universal (i.e. with primary/curso) planes on this device. 0497 * This is invariant over the lifetime of a device and hence doesn't 0498 * need any locks. 0499 */ 0500 int num_total_plane; 0501 /** 0502 * @plane_list: 0503 * 0504 * List of plane objects linked with &drm_plane.head. This is invariant 0505 * over the lifetime of a device and hence doesn't need any locks. 0506 */ 0507 struct list_head plane_list; 0508 0509 /** 0510 * @num_crtc: 0511 * 0512 * Number of CRTCs on this device linked with &drm_crtc.head. This is invariant over the lifetime 0513 * of a device and hence doesn't need any locks. 0514 */ 0515 int num_crtc; 0516 /** 0517 * @crtc_list: 0518 * 0519 * List of CRTC objects linked with &drm_crtc.head. This is invariant 0520 * over the lifetime of a device and hence doesn't need any locks. 0521 */ 0522 struct list_head crtc_list; 0523 0524 /** 0525 * @property_list: 0526 * 0527 * List of property type objects linked with &drm_property.head. This is 0528 * invariant over the lifetime of a device and hence doesn't need any 0529 * locks. 0530 */ 0531 struct list_head property_list; 0532 0533 /** 0534 * @privobj_list: 0535 * 0536 * List of private objects linked with &drm_private_obj.head. This is 0537 * invariant over the lifetime of a device and hence doesn't need any 0538 * locks. 0539 */ 0540 struct list_head privobj_list; 0541 0542 int min_width, min_height; 0543 int max_width, max_height; 0544 const struct drm_mode_config_funcs *funcs; 0545 resource_size_t fb_base; 0546 0547 /* output poll support */ 0548 bool poll_enabled; 0549 bool poll_running; 0550 bool delayed_event; 0551 struct delayed_work output_poll_work; 0552 0553 /** 0554 * @blob_lock: 0555 * 0556 * Mutex for blob property allocation and management, protects 0557 * @property_blob_list and &drm_file.blobs. 0558 */ 0559 struct mutex blob_lock; 0560 0561 /** 0562 * @property_blob_list: 0563 * 0564 * List of all the blob property objects linked with 0565 * &drm_property_blob.head. Protected by @blob_lock. 0566 */ 0567 struct list_head property_blob_list; 0568 0569 /* pointers to standard properties */ 0570 0571 /** 0572 * @edid_property: Default connector property to hold the EDID of the 0573 * currently connected sink, if any. 0574 */ 0575 struct drm_property *edid_property; 0576 /** 0577 * @dpms_property: Default connector property to control the 0578 * connector's DPMS state. 0579 */ 0580 struct drm_property *dpms_property; 0581 /** 0582 * @path_property: Default connector property to hold the DP MST path 0583 * for the port. 0584 */ 0585 struct drm_property *path_property; 0586 /** 0587 * @tile_property: Default connector property to store the tile 0588 * position of a tiled screen, for sinks which need to be driven with 0589 * multiple CRTCs. 0590 */ 0591 struct drm_property *tile_property; 0592 /** 0593 * @link_status_property: Default connector property for link status 0594 * of a connector 0595 */ 0596 struct drm_property *link_status_property; 0597 /** 0598 * @plane_type_property: Default plane property to differentiate 0599 * CURSOR, PRIMARY and OVERLAY legacy uses of planes. 0600 */ 0601 struct drm_property *plane_type_property; 0602 /** 0603 * @prop_src_x: Default atomic plane property for the plane source 0604 * position in the connected &drm_framebuffer. 0605 */ 0606 struct drm_property *prop_src_x; 0607 /** 0608 * @prop_src_y: Default atomic plane property for the plane source 0609 * position in the connected &drm_framebuffer. 0610 */ 0611 struct drm_property *prop_src_y; 0612 /** 0613 * @prop_src_w: Default atomic plane property for the plane source 0614 * position in the connected &drm_framebuffer. 0615 */ 0616 struct drm_property *prop_src_w; 0617 /** 0618 * @prop_src_h: Default atomic plane property for the plane source 0619 * position in the connected &drm_framebuffer. 0620 */ 0621 struct drm_property *prop_src_h; 0622 /** 0623 * @prop_crtc_x: Default atomic plane property for the plane destination 0624 * position in the &drm_crtc is being shown on. 0625 */ 0626 struct drm_property *prop_crtc_x; 0627 /** 0628 * @prop_crtc_y: Default atomic plane property for the plane destination 0629 * position in the &drm_crtc is being shown on. 0630 */ 0631 struct drm_property *prop_crtc_y; 0632 /** 0633 * @prop_crtc_w: Default atomic plane property for the plane destination 0634 * position in the &drm_crtc is being shown on. 0635 */ 0636 struct drm_property *prop_crtc_w; 0637 /** 0638 * @prop_crtc_h: Default atomic plane property for the plane destination 0639 * position in the &drm_crtc is being shown on. 0640 */ 0641 struct drm_property *prop_crtc_h; 0642 /** 0643 * @prop_fb_id: Default atomic plane property to specify the 0644 * &drm_framebuffer. 0645 */ 0646 struct drm_property *prop_fb_id; 0647 /** 0648 * @prop_in_fence_fd: Sync File fd representing the incoming fences 0649 * for a Plane. 0650 */ 0651 struct drm_property *prop_in_fence_fd; 0652 /** 0653 * @prop_out_fence_ptr: Sync File fd pointer representing the 0654 * outgoing fences for a CRTC. Userspace should provide a pointer to a 0655 * value of type s32, and then cast that pointer to u64. 0656 */ 0657 struct drm_property *prop_out_fence_ptr; 0658 /** 0659 * @prop_crtc_id: Default atomic plane property to specify the 0660 * &drm_crtc. 0661 */ 0662 struct drm_property *prop_crtc_id; 0663 /** 0664 * @prop_fb_damage_clips: Optional plane property to mark damaged 0665 * regions on the plane in framebuffer coordinates of the framebuffer 0666 * attached to the plane. 0667 * 0668 * The layout of blob data is simply an array of &drm_mode_rect. Unlike 0669 * plane src coordinates, damage clips are not in 16.16 fixed point. 0670 */ 0671 struct drm_property *prop_fb_damage_clips; 0672 /** 0673 * @prop_active: Default atomic CRTC property to control the active 0674 * state, which is the simplified implementation for DPMS in atomic 0675 * drivers. 0676 */ 0677 struct drm_property *prop_active; 0678 /** 0679 * @prop_mode_id: Default atomic CRTC property to set the mode for a 0680 * CRTC. A 0 mode implies that the CRTC is entirely disabled - all 0681 * connectors must be of and active must be set to disabled, too. 0682 */ 0683 struct drm_property *prop_mode_id; 0684 /** 0685 * @prop_vrr_enabled: Default atomic CRTC property to indicate 0686 * whether variable refresh rate should be enabled on the CRTC. 0687 */ 0688 struct drm_property *prop_vrr_enabled; 0689 0690 /** 0691 * @dvi_i_subconnector_property: Optional DVI-I property to 0692 * differentiate between analog or digital mode. 0693 */ 0694 struct drm_property *dvi_i_subconnector_property; 0695 /** 0696 * @dvi_i_select_subconnector_property: Optional DVI-I property to 0697 * select between analog or digital mode. 0698 */ 0699 struct drm_property *dvi_i_select_subconnector_property; 0700 0701 /** 0702 * @dp_subconnector_property: Optional DP property to differentiate 0703 * between different DP downstream port types. 0704 */ 0705 struct drm_property *dp_subconnector_property; 0706 0707 /** 0708 * @tv_subconnector_property: Optional TV property to differentiate 0709 * between different TV connector types. 0710 */ 0711 struct drm_property *tv_subconnector_property; 0712 /** 0713 * @tv_select_subconnector_property: Optional TV property to select 0714 * between different TV connector types. 0715 */ 0716 struct drm_property *tv_select_subconnector_property; 0717 /** 0718 * @tv_mode_property: Optional TV property to select 0719 * the output TV mode. 0720 */ 0721 struct drm_property *tv_mode_property; 0722 /** 0723 * @tv_left_margin_property: Optional TV property to set the left 0724 * margin (expressed in pixels). 0725 */ 0726 struct drm_property *tv_left_margin_property; 0727 /** 0728 * @tv_right_margin_property: Optional TV property to set the right 0729 * margin (expressed in pixels). 0730 */ 0731 struct drm_property *tv_right_margin_property; 0732 /** 0733 * @tv_top_margin_property: Optional TV property to set the right 0734 * margin (expressed in pixels). 0735 */ 0736 struct drm_property *tv_top_margin_property; 0737 /** 0738 * @tv_bottom_margin_property: Optional TV property to set the right 0739 * margin (expressed in pixels). 0740 */ 0741 struct drm_property *tv_bottom_margin_property; 0742 /** 0743 * @tv_brightness_property: Optional TV property to set the 0744 * brightness. 0745 */ 0746 struct drm_property *tv_brightness_property; 0747 /** 0748 * @tv_contrast_property: Optional TV property to set the 0749 * contrast. 0750 */ 0751 struct drm_property *tv_contrast_property; 0752 /** 0753 * @tv_flicker_reduction_property: Optional TV property to control the 0754 * flicker reduction mode. 0755 */ 0756 struct drm_property *tv_flicker_reduction_property; 0757 /** 0758 * @tv_overscan_property: Optional TV property to control the overscan 0759 * setting. 0760 */ 0761 struct drm_property *tv_overscan_property; 0762 /** 0763 * @tv_saturation_property: Optional TV property to set the 0764 * saturation. 0765 */ 0766 struct drm_property *tv_saturation_property; 0767 /** 0768 * @tv_hue_property: Optional TV property to set the hue. 0769 */ 0770 struct drm_property *tv_hue_property; 0771 0772 /** 0773 * @scaling_mode_property: Optional connector property to control the 0774 * upscaling, mostly used for built-in panels. 0775 */ 0776 struct drm_property *scaling_mode_property; 0777 /** 0778 * @aspect_ratio_property: Optional connector property to control the 0779 * HDMI infoframe aspect ratio setting. 0780 */ 0781 struct drm_property *aspect_ratio_property; 0782 /** 0783 * @content_type_property: Optional connector property to control the 0784 * HDMI infoframe content type setting. 0785 */ 0786 struct drm_property *content_type_property; 0787 /** 0788 * @degamma_lut_property: Optional CRTC property to set the LUT used to 0789 * convert the framebuffer's colors to linear gamma. 0790 */ 0791 struct drm_property *degamma_lut_property; 0792 /** 0793 * @degamma_lut_size_property: Optional CRTC property for the size of 0794 * the degamma LUT as supported by the driver (read-only). 0795 */ 0796 struct drm_property *degamma_lut_size_property; 0797 /** 0798 * @ctm_property: Optional CRTC property to set the 0799 * matrix used to convert colors after the lookup in the 0800 * degamma LUT. 0801 */ 0802 struct drm_property *ctm_property; 0803 /** 0804 * @gamma_lut_property: Optional CRTC property to set the LUT used to 0805 * convert the colors, after the CTM matrix, to the gamma space of the 0806 * connected screen. 0807 */ 0808 struct drm_property *gamma_lut_property; 0809 /** 0810 * @gamma_lut_size_property: Optional CRTC property for the size of the 0811 * gamma LUT as supported by the driver (read-only). 0812 */ 0813 struct drm_property *gamma_lut_size_property; 0814 0815 /** 0816 * @suggested_x_property: Optional connector property with a hint for 0817 * the position of the output on the host's screen. 0818 */ 0819 struct drm_property *suggested_x_property; 0820 /** 0821 * @suggested_y_property: Optional connector property with a hint for 0822 * the position of the output on the host's screen. 0823 */ 0824 struct drm_property *suggested_y_property; 0825 0826 /** 0827 * @non_desktop_property: Optional connector property with a hint 0828 * that device isn't a standard display, and the console/desktop, 0829 * should not be displayed on it. 0830 */ 0831 struct drm_property *non_desktop_property; 0832 0833 /** 0834 * @panel_orientation_property: Optional connector property indicating 0835 * how the lcd-panel is mounted inside the casing (e.g. normal or 0836 * upside-down). 0837 */ 0838 struct drm_property *panel_orientation_property; 0839 0840 /** 0841 * @writeback_fb_id_property: Property for writeback connectors, storing 0842 * the ID of the output framebuffer. 0843 * See also: drm_writeback_connector_init() 0844 */ 0845 struct drm_property *writeback_fb_id_property; 0846 0847 /** 0848 * @writeback_pixel_formats_property: Property for writeback connectors, 0849 * storing an array of the supported pixel formats for the writeback 0850 * engine (read-only). 0851 * See also: drm_writeback_connector_init() 0852 */ 0853 struct drm_property *writeback_pixel_formats_property; 0854 /** 0855 * @writeback_out_fence_ptr_property: Property for writeback connectors, 0856 * fd pointer representing the outgoing fences for a writeback 0857 * connector. Userspace should provide a pointer to a value of type s32, 0858 * and then cast that pointer to u64. 0859 * See also: drm_writeback_connector_init() 0860 */ 0861 struct drm_property *writeback_out_fence_ptr_property; 0862 0863 /** 0864 * @hdr_output_metadata_property: Connector property containing hdr 0865 * metatada. This will be provided by userspace compositors based 0866 * on HDR content 0867 */ 0868 struct drm_property *hdr_output_metadata_property; 0869 0870 /** 0871 * @content_protection_property: DRM ENUM property for content 0872 * protection. See drm_connector_attach_content_protection_property(). 0873 */ 0874 struct drm_property *content_protection_property; 0875 0876 /** 0877 * @hdcp_content_type_property: DRM ENUM property for type of 0878 * Protected Content. 0879 */ 0880 struct drm_property *hdcp_content_type_property; 0881 0882 /* dumb ioctl parameters */ 0883 uint32_t preferred_depth, prefer_shadow; 0884 0885 /** 0886 * @prefer_shadow_fbdev: 0887 * 0888 * Hint to framebuffer emulation to prefer shadow-fb rendering. 0889 */ 0890 bool prefer_shadow_fbdev; 0891 0892 /** 0893 * @quirk_addfb_prefer_xbgr_30bpp: 0894 * 0895 * Special hack for legacy ADDFB to keep nouveau userspace happy. Should 0896 * only ever be set by the nouveau kernel driver. 0897 */ 0898 bool quirk_addfb_prefer_xbgr_30bpp; 0899 0900 /** 0901 * @quirk_addfb_prefer_host_byte_order: 0902 * 0903 * When set to true drm_mode_addfb() will pick host byte order 0904 * pixel_format when calling drm_mode_addfb2(). This is how 0905 * drm_mode_addfb() should have worked from day one. It 0906 * didn't though, so we ended up with quirks in both kernel 0907 * and userspace drivers to deal with the broken behavior. 0908 * Simply fixing drm_mode_addfb() unconditionally would break 0909 * these drivers, so add a quirk bit here to allow drivers 0910 * opt-in. 0911 */ 0912 bool quirk_addfb_prefer_host_byte_order; 0913 0914 /** 0915 * @async_page_flip: Does this device support async flips on the primary 0916 * plane? 0917 */ 0918 bool async_page_flip; 0919 0920 /** 0921 * @fb_modifiers_not_supported: 0922 * 0923 * When this flag is set, the DRM device will not expose modifier 0924 * support to userspace. This is only used by legacy drivers that infer 0925 * the buffer layout through heuristics without using modifiers. New 0926 * drivers shall not set fhis flag. 0927 */ 0928 bool fb_modifiers_not_supported; 0929 0930 /** 0931 * @normalize_zpos: 0932 * 0933 * If true the drm core will call drm_atomic_normalize_zpos() as part of 0934 * atomic mode checking from drm_atomic_helper_check() 0935 */ 0936 bool normalize_zpos; 0937 0938 /** 0939 * @modifiers_property: Plane property to list support modifier/format 0940 * combination. 0941 */ 0942 struct drm_property *modifiers_property; 0943 0944 /* cursor size */ 0945 uint32_t cursor_width, cursor_height; 0946 0947 /** 0948 * @suspend_state: 0949 * 0950 * Atomic state when suspended. 0951 * Set by drm_mode_config_helper_suspend() and cleared by 0952 * drm_mode_config_helper_resume(). 0953 */ 0954 struct drm_atomic_state *suspend_state; 0955 0956 const struct drm_mode_config_helper_funcs *helper_private; 0957 }; 0958 0959 int __must_check drmm_mode_config_init(struct drm_device *dev); 0960 0961 /** 0962 * drm_mode_config_init - DRM mode_configuration structure initialization 0963 * @dev: DRM device 0964 * 0965 * This is the unmanaged version of drmm_mode_config_init() for drivers which 0966 * still explicitly call drm_mode_config_cleanup(). 0967 * 0968 * FIXME: This function is deprecated and drivers should be converted over to 0969 * drmm_mode_config_init(). 0970 */ 0971 static inline int drm_mode_config_init(struct drm_device *dev) 0972 { 0973 return drmm_mode_config_init(dev); 0974 } 0975 0976 void drm_mode_config_reset(struct drm_device *dev); 0977 void drm_mode_config_cleanup(struct drm_device *dev); 0978 0979 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |