Daniel Vetter | 28575f1 | 2016-11-14 12:58:23 +0100 | [diff] [blame] | 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 | |
| 31 | #include <drm/drm_modeset_lock.h> |
| 32 | |
| 33 | struct drm_file; |
| 34 | struct drm_device; |
| 35 | struct drm_atomic_state; |
| 36 | struct drm_mode_fb_cmd2; |
| 37 | |
| 38 | /** |
| 39 | * struct drm_mode_config_funcs - basic driver provided mode setting functions |
| 40 | * |
| 41 | * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that |
| 42 | * involve drivers. |
| 43 | */ |
| 44 | struct drm_mode_config_funcs { |
| 45 | /** |
| 46 | * @fb_create: |
| 47 | * |
| 48 | * Create a new framebuffer object. The core does basic checks on the |
| 49 | * requested metadata, but most of that is left to the driver. See |
| 50 | * struct &drm_mode_fb_cmd2 for details. |
| 51 | * |
| 52 | * If the parameters are deemed valid and the backing storage objects in |
| 53 | * the underlying memory manager all exist, then the driver allocates |
| 54 | * a new &drm_framebuffer structure, subclassed to contain |
| 55 | * driver-specific information (like the internal native buffer object |
| 56 | * references). It also needs to fill out all relevant metadata, which |
| 57 | * should be done by calling drm_helper_mode_fill_fb_struct(). |
| 58 | * |
| 59 | * The initialization is finalized by calling drm_framebuffer_init(), |
| 60 | * which registers the framebuffer and makes it accessible to other |
| 61 | * threads. |
| 62 | * |
| 63 | * RETURNS: |
| 64 | * |
| 65 | * A new framebuffer with an initial reference count of 1 or a negative |
| 66 | * error code encoded with ERR_PTR(). |
| 67 | */ |
| 68 | struct drm_framebuffer *(*fb_create)(struct drm_device *dev, |
| 69 | struct drm_file *file_priv, |
| 70 | const struct drm_mode_fb_cmd2 *mode_cmd); |
| 71 | |
| 72 | /** |
| 73 | * @output_poll_changed: |
| 74 | * |
| 75 | * Callback used by helpers to inform the driver of output configuration |
| 76 | * changes. |
| 77 | * |
| 78 | * Drivers implementing fbdev emulation with the helpers can call |
| 79 | * drm_fb_helper_hotplug_changed from this hook to inform the fbdev |
| 80 | * helper of output changes. |
| 81 | * |
| 82 | * FIXME: |
| 83 | * |
| 84 | * Except that there's no vtable for device-level helper callbacks |
| 85 | * there's no reason this is a core function. |
| 86 | */ |
| 87 | void (*output_poll_changed)(struct drm_device *dev); |
| 88 | |
| 89 | /** |
| 90 | * @atomic_check: |
| 91 | * |
| 92 | * This is the only hook to validate an atomic modeset update. This |
| 93 | * function must reject any modeset and state changes which the hardware |
| 94 | * or driver doesn't support. This includes but is of course not limited |
| 95 | * to: |
| 96 | * |
| 97 | * - Checking that the modes, framebuffers, scaling and placement |
| 98 | * requirements and so on are within the limits of the hardware. |
| 99 | * |
| 100 | * - Checking that any hidden shared resources are not oversubscribed. |
| 101 | * This can be shared PLLs, shared lanes, overall memory bandwidth, |
| 102 | * display fifo space (where shared between planes or maybe even |
| 103 | * CRTCs). |
| 104 | * |
| 105 | * - Checking that virtualized resources exported to userspace are not |
| 106 | * oversubscribed. For various reasons it can make sense to expose |
| 107 | * more planes, crtcs or encoders than which are physically there. One |
| 108 | * example is dual-pipe operations (which generally should be hidden |
| 109 | * from userspace if when lockstepped in hardware, exposed otherwise), |
| 110 | * where a plane might need 1 hardware plane (if it's just on one |
| 111 | * pipe), 2 hardware planes (when it spans both pipes) or maybe even |
| 112 | * shared a hardware plane with a 2nd plane (if there's a compatible |
| 113 | * plane requested on the area handled by the other pipe). |
| 114 | * |
| 115 | * - Check that any transitional state is possible and that if |
| 116 | * requested, the update can indeed be done in the vblank period |
| 117 | * without temporarily disabling some functions. |
| 118 | * |
| 119 | * - Check any other constraints the driver or hardware might have. |
| 120 | * |
| 121 | * - This callback also needs to correctly fill out the &drm_crtc_state |
| 122 | * in this update to make sure that drm_atomic_crtc_needs_modeset() |
| 123 | * reflects the nature of the possible update and returns true if and |
| 124 | * only if the update cannot be applied without tearing within one |
| 125 | * vblank on that CRTC. The core uses that information to reject |
| 126 | * updates which require a full modeset (i.e. blanking the screen, or |
| 127 | * at least pausing updates for a substantial amount of time) if |
| 128 | * userspace has disallowed that in its request. |
| 129 | * |
| 130 | * - The driver also does not need to repeat basic input validation |
| 131 | * like done for the corresponding legacy entry points. The core does |
| 132 | * that before calling this hook. |
| 133 | * |
| 134 | * See the documentation of @atomic_commit for an exhaustive list of |
| 135 | * error conditions which don't have to be checked at the |
| 136 | * ->atomic_check() stage? |
| 137 | * |
| 138 | * See the documentation for struct &drm_atomic_state for how exactly |
| 139 | * an atomic modeset update is described. |
| 140 | * |
| 141 | * Drivers using the atomic helpers can implement this hook using |
| 142 | * drm_atomic_helper_check(), or one of the exported sub-functions of |
| 143 | * it. |
| 144 | * |
| 145 | * RETURNS: |
| 146 | * |
| 147 | * 0 on success or one of the below negative error codes: |
| 148 | * |
| 149 | * - -EINVAL, if any of the above constraints are violated. |
| 150 | * |
| 151 | * - -EDEADLK, when returned from an attempt to acquire an additional |
| 152 | * &drm_modeset_lock through drm_modeset_lock(). |
| 153 | * |
| 154 | * - -ENOMEM, if allocating additional state sub-structures failed due |
| 155 | * to lack of memory. |
| 156 | * |
| 157 | * - -EINTR, -EAGAIN or -ERESTARTSYS, if the IOCTL should be restarted. |
| 158 | * This can either be due to a pending signal, or because the driver |
| 159 | * needs to completely bail out to recover from an exceptional |
| 160 | * situation like a GPU hang. From a userspace point all errors are |
| 161 | * treated equally. |
| 162 | */ |
| 163 | int (*atomic_check)(struct drm_device *dev, |
| 164 | struct drm_atomic_state *state); |
| 165 | |
| 166 | /** |
| 167 | * @atomic_commit: |
| 168 | * |
| 169 | * This is the only hook to commit an atomic modeset update. The core |
| 170 | * guarantees that @atomic_check has been called successfully before |
| 171 | * calling this function, and that nothing has been changed in the |
| 172 | * interim. |
| 173 | * |
| 174 | * See the documentation for struct &drm_atomic_state for how exactly |
| 175 | * an atomic modeset update is described. |
| 176 | * |
| 177 | * Drivers using the atomic helpers can implement this hook using |
| 178 | * drm_atomic_helper_commit(), or one of the exported sub-functions of |
| 179 | * it. |
| 180 | * |
| 181 | * Nonblocking commits (as indicated with the nonblock parameter) must |
| 182 | * do any preparatory work which might result in an unsuccessful commit |
| 183 | * in the context of this callback. The only exceptions are hardware |
| 184 | * errors resulting in -EIO. But even in that case the driver must |
| 185 | * ensure that the display pipe is at least running, to avoid |
| 186 | * compositors crashing when pageflips don't work. Anything else, |
| 187 | * specifically committing the update to the hardware, should be done |
| 188 | * without blocking the caller. For updates which do not require a |
| 189 | * modeset this must be guaranteed. |
| 190 | * |
| 191 | * The driver must wait for any pending rendering to the new |
| 192 | * framebuffers to complete before executing the flip. It should also |
| 193 | * wait for any pending rendering from other drivers if the underlying |
| 194 | * buffer is a shared dma-buf. Nonblocking commits must not wait for |
| 195 | * rendering in the context of this callback. |
| 196 | * |
| 197 | * An application can request to be notified when the atomic commit has |
| 198 | * completed. These events are per-CRTC and can be distinguished by the |
| 199 | * CRTC index supplied in &drm_event to userspace. |
| 200 | * |
| 201 | * The drm core will supply a struct &drm_event in the event |
| 202 | * member of each CRTC's &drm_crtc_state structure. See the |
| 203 | * documentation for &drm_crtc_state for more details about the precise |
| 204 | * semantics of this event. |
| 205 | * |
| 206 | * NOTE: |
| 207 | * |
| 208 | * Drivers are not allowed to shut down any display pipe successfully |
| 209 | * enabled through an atomic commit on their own. Doing so can result in |
| 210 | * compositors crashing if a page flip is suddenly rejected because the |
| 211 | * pipe is off. |
| 212 | * |
| 213 | * RETURNS: |
| 214 | * |
| 215 | * 0 on success or one of the below negative error codes: |
| 216 | * |
| 217 | * - -EBUSY, if a nonblocking updated is requested and there is |
| 218 | * an earlier updated pending. Drivers are allowed to support a queue |
| 219 | * of outstanding updates, but currently no driver supports that. |
| 220 | * Note that drivers must wait for preceding updates to complete if a |
| 221 | * synchronous update is requested, they are not allowed to fail the |
| 222 | * commit in that case. |
| 223 | * |
| 224 | * - -ENOMEM, if the driver failed to allocate memory. Specifically |
| 225 | * this can happen when trying to pin framebuffers, which must only |
| 226 | * be done when committing the state. |
| 227 | * |
| 228 | * - -ENOSPC, as a refinement of the more generic -ENOMEM to indicate |
| 229 | * that the driver has run out of vram, iommu space or similar GPU |
| 230 | * address space needed for framebuffer. |
| 231 | * |
| 232 | * - -EIO, if the hardware completely died. |
| 233 | * |
| 234 | * - -EINTR, -EAGAIN or -ERESTARTSYS, if the IOCTL should be restarted. |
| 235 | * This can either be due to a pending signal, or because the driver |
| 236 | * needs to completely bail out to recover from an exceptional |
| 237 | * situation like a GPU hang. From a userspace point of view all errors are |
| 238 | * treated equally. |
| 239 | * |
| 240 | * This list is exhaustive. Specifically this hook is not allowed to |
| 241 | * return -EINVAL (any invalid requests should be caught in |
| 242 | * @atomic_check) or -EDEADLK (this function must not acquire |
| 243 | * additional modeset locks). |
| 244 | */ |
| 245 | int (*atomic_commit)(struct drm_device *dev, |
| 246 | struct drm_atomic_state *state, |
| 247 | bool nonblock); |
| 248 | |
| 249 | /** |
| 250 | * @atomic_state_alloc: |
| 251 | * |
| 252 | * This optional hook can be used by drivers that want to subclass struct |
| 253 | * &drm_atomic_state to be able to track their own driver-private global |
| 254 | * state easily. If this hook is implemented, drivers must also |
| 255 | * implement @atomic_state_clear and @atomic_state_free. |
| 256 | * |
| 257 | * RETURNS: |
| 258 | * |
| 259 | * A new &drm_atomic_state on success or NULL on failure. |
| 260 | */ |
| 261 | struct drm_atomic_state *(*atomic_state_alloc)(struct drm_device *dev); |
| 262 | |
| 263 | /** |
| 264 | * @atomic_state_clear: |
| 265 | * |
| 266 | * This hook must clear any driver private state duplicated into the |
| 267 | * passed-in &drm_atomic_state. This hook is called when the caller |
| 268 | * encountered a &drm_modeset_lock deadlock and needs to drop all |
| 269 | * already acquired locks as part of the deadlock avoidance dance |
| 270 | * implemented in drm_modeset_lock_backoff(). |
| 271 | * |
| 272 | * Any duplicated state must be invalidated since a concurrent atomic |
| 273 | * update might change it, and the drm atomic interfaces always apply |
| 274 | * updates as relative changes to the current state. |
| 275 | * |
| 276 | * Drivers that implement this must call drm_atomic_state_default_clear() |
| 277 | * to clear common state. |
| 278 | */ |
| 279 | void (*atomic_state_clear)(struct drm_atomic_state *state); |
| 280 | |
| 281 | /** |
| 282 | * @atomic_state_free: |
| 283 | * |
| 284 | * This hook needs driver private resources and the &drm_atomic_state |
| 285 | * itself. Note that the core first calls drm_atomic_state_clear() to |
| 286 | * avoid code duplicate between the clear and free hooks. |
| 287 | * |
| 288 | * Drivers that implement this must call drm_atomic_state_default_free() |
| 289 | * to release common resources. |
| 290 | */ |
| 291 | void (*atomic_state_free)(struct drm_atomic_state *state); |
| 292 | }; |
| 293 | |
| 294 | /** |
| 295 | * struct drm_mode_config - Mode configuration control structure |
| 296 | * @mutex: mutex protecting KMS related lists and structures |
| 297 | * @connection_mutex: ww mutex protecting connector state and routing |
| 298 | * @acquire_ctx: global implicit acquire context used by atomic drivers for |
| 299 | * legacy IOCTLs |
| 300 | * @fb_lock: mutex to protect fb state and lists |
| 301 | * @num_fb: number of fbs available |
| 302 | * @fb_list: list of framebuffers available |
| 303 | * @num_encoder: number of encoders on this device |
| 304 | * @encoder_list: list of encoder objects |
| 305 | * @num_overlay_plane: number of overlay planes on this device |
| 306 | * @num_total_plane: number of universal (i.e. with primary/curso) planes on this device |
| 307 | * @plane_list: list of plane objects |
| 308 | * @num_crtc: number of CRTCs on this device |
| 309 | * @crtc_list: list of CRTC objects |
| 310 | * @property_list: list of property objects |
| 311 | * @min_width: minimum pixel width on this device |
| 312 | * @min_height: minimum pixel height on this device |
| 313 | * @max_width: maximum pixel width on this device |
| 314 | * @max_height: maximum pixel height on this device |
| 315 | * @funcs: core driver provided mode setting functions |
| 316 | * @fb_base: base address of the framebuffer |
| 317 | * @poll_enabled: track polling support for this device |
| 318 | * @poll_running: track polling status for this device |
| 319 | * @delayed_event: track delayed poll uevent deliver for this device |
| 320 | * @output_poll_work: delayed work for polling in process context |
| 321 | * @property_blob_list: list of all the blob property objects |
| 322 | * @blob_lock: mutex for blob property allocation and management |
| 323 | * @*_property: core property tracking |
| 324 | * @preferred_depth: preferred RBG pixel depth, used by fb helpers |
| 325 | * @prefer_shadow: hint to userspace to prefer shadow-fb rendering |
| 326 | * @cursor_width: hint to userspace for max cursor width |
| 327 | * @cursor_height: hint to userspace for max cursor height |
| 328 | * @helper_private: mid-layer private data |
| 329 | * |
| 330 | * Core mode resource tracking structure. All CRTC, encoders, and connectors |
| 331 | * enumerated by the driver are added here, as are global properties. Some |
| 332 | * global restrictions are also here, e.g. dimension restrictions. |
| 333 | */ |
| 334 | struct drm_mode_config { |
| 335 | struct mutex mutex; /* protects configuration (mode lists etc.) */ |
| 336 | struct drm_modeset_lock connection_mutex; /* protects connector->encoder and encoder->crtc links */ |
| 337 | struct drm_modeset_acquire_ctx *acquire_ctx; /* for legacy _lock_all() / _unlock_all() */ |
| 338 | |
| 339 | /** |
| 340 | * @idr_mutex: |
| 341 | * |
| 342 | * Mutex for KMS ID allocation and management. Protects both @crtc_idr |
| 343 | * and @tile_idr. |
| 344 | */ |
| 345 | struct mutex idr_mutex; |
| 346 | |
| 347 | /** |
| 348 | * @crtc_idr: |
| 349 | * |
| 350 | * Main KMS ID tracking object. Use this idr for all IDs, fb, crtc, |
| 351 | * connector, modes - just makes life easier to have only one. |
| 352 | */ |
| 353 | struct idr crtc_idr; |
| 354 | |
| 355 | /** |
| 356 | * @tile_idr: |
| 357 | * |
| 358 | * Use this idr for allocating new IDs for tiled sinks like use in some |
| 359 | * high-res DP MST screens. |
| 360 | */ |
| 361 | struct idr tile_idr; |
| 362 | |
| 363 | struct mutex fb_lock; /* proctects global and per-file fb lists */ |
| 364 | int num_fb; |
| 365 | struct list_head fb_list; |
| 366 | |
| 367 | /** |
Daniel Vetter | 613051d | 2016-12-14 00:08:06 +0100 | [diff] [blame^] | 368 | * @connector_list_lock: Protects @num_connector and |
| 369 | * @connector_list. |
| 370 | */ |
| 371 | spinlock_t connector_list_lock; |
| 372 | /** |
| 373 | * @num_connector: Number of connectors on this device. Protected by |
| 374 | * @connector_list_lock. |
Daniel Vetter | 28575f1 | 2016-11-14 12:58:23 +0100 | [diff] [blame] | 375 | */ |
| 376 | int num_connector; |
| 377 | /** |
| 378 | * @connector_ida: ID allocator for connector indices. |
| 379 | */ |
| 380 | struct ida connector_ida; |
| 381 | /** |
Daniel Vetter | 613051d | 2016-12-14 00:08:06 +0100 | [diff] [blame^] | 382 | * @connector_list: List of connector objects. Protected by |
| 383 | * @connector_list_lock. Only use drm_for_each_connector_iter() and |
| 384 | * struct &drm_connector_list_iter to walk this list. |
Daniel Vetter | 28575f1 | 2016-11-14 12:58:23 +0100 | [diff] [blame] | 385 | */ |
| 386 | struct list_head connector_list; |
| 387 | int num_encoder; |
| 388 | struct list_head encoder_list; |
| 389 | |
| 390 | /* |
| 391 | * Track # of overlay planes separately from # of total planes. By |
| 392 | * default we only advertise overlay planes to userspace; if userspace |
| 393 | * sets the "universal plane" capability bit, we'll go ahead and |
| 394 | * expose all planes. |
| 395 | */ |
| 396 | int num_overlay_plane; |
| 397 | int num_total_plane; |
| 398 | struct list_head plane_list; |
| 399 | |
| 400 | int num_crtc; |
| 401 | struct list_head crtc_list; |
| 402 | |
| 403 | struct list_head property_list; |
| 404 | |
| 405 | int min_width, min_height; |
| 406 | int max_width, max_height; |
| 407 | const struct drm_mode_config_funcs *funcs; |
| 408 | resource_size_t fb_base; |
| 409 | |
| 410 | /* output poll support */ |
| 411 | bool poll_enabled; |
| 412 | bool poll_running; |
| 413 | bool delayed_event; |
| 414 | struct delayed_work output_poll_work; |
| 415 | |
| 416 | struct mutex blob_lock; |
| 417 | |
| 418 | /* pointers to standard properties */ |
| 419 | struct list_head property_blob_list; |
| 420 | /** |
| 421 | * @edid_property: Default connector property to hold the EDID of the |
| 422 | * currently connected sink, if any. |
| 423 | */ |
| 424 | struct drm_property *edid_property; |
| 425 | /** |
| 426 | * @dpms_property: Default connector property to control the |
| 427 | * connector's DPMS state. |
| 428 | */ |
| 429 | struct drm_property *dpms_property; |
| 430 | /** |
| 431 | * @path_property: Default connector property to hold the DP MST path |
| 432 | * for the port. |
| 433 | */ |
| 434 | struct drm_property *path_property; |
| 435 | /** |
| 436 | * @tile_property: Default connector property to store the tile |
| 437 | * position of a tiled screen, for sinks which need to be driven with |
| 438 | * multiple CRTCs. |
| 439 | */ |
| 440 | struct drm_property *tile_property; |
| 441 | /** |
| 442 | * @plane_type_property: Default plane property to differentiate |
| 443 | * CURSOR, PRIMARY and OVERLAY legacy uses of planes. |
| 444 | */ |
| 445 | struct drm_property *plane_type_property; |
| 446 | /** |
| 447 | * @prop_src_x: Default atomic plane property for the plane source |
| 448 | * position in the connected &drm_framebuffer. |
| 449 | */ |
| 450 | struct drm_property *prop_src_x; |
| 451 | /** |
| 452 | * @prop_src_y: Default atomic plane property for the plane source |
| 453 | * position in the connected &drm_framebuffer. |
| 454 | */ |
| 455 | struct drm_property *prop_src_y; |
| 456 | /** |
| 457 | * @prop_src_w: Default atomic plane property for the plane source |
| 458 | * position in the connected &drm_framebuffer. |
| 459 | */ |
| 460 | struct drm_property *prop_src_w; |
| 461 | /** |
| 462 | * @prop_src_h: Default atomic plane property for the plane source |
| 463 | * position in the connected &drm_framebuffer. |
| 464 | */ |
| 465 | struct drm_property *prop_src_h; |
| 466 | /** |
| 467 | * @prop_crtc_x: Default atomic plane property for the plane destination |
| 468 | * position in the &drm_crtc is is being shown on. |
| 469 | */ |
| 470 | struct drm_property *prop_crtc_x; |
| 471 | /** |
| 472 | * @prop_crtc_y: Default atomic plane property for the plane destination |
| 473 | * position in the &drm_crtc is is being shown on. |
| 474 | */ |
| 475 | struct drm_property *prop_crtc_y; |
| 476 | /** |
| 477 | * @prop_crtc_w: Default atomic plane property for the plane destination |
| 478 | * position in the &drm_crtc is is being shown on. |
| 479 | */ |
| 480 | struct drm_property *prop_crtc_w; |
| 481 | /** |
| 482 | * @prop_crtc_h: Default atomic plane property for the plane destination |
| 483 | * position in the &drm_crtc is is being shown on. |
| 484 | */ |
| 485 | struct drm_property *prop_crtc_h; |
| 486 | /** |
| 487 | * @prop_fb_id: Default atomic plane property to specify the |
| 488 | * &drm_framebuffer. |
| 489 | */ |
| 490 | struct drm_property *prop_fb_id; |
| 491 | /** |
Gustavo Padovan | 9626014 | 2016-11-15 22:06:39 +0900 | [diff] [blame] | 492 | * @prop_in_fence_fd: Sync File fd representing the incoming fences |
| 493 | * for a Plane. |
| 494 | */ |
| 495 | struct drm_property *prop_in_fence_fd; |
| 496 | /** |
Gustavo Padovan | beaf5af | 2016-11-16 22:00:21 +0900 | [diff] [blame] | 497 | * @prop_out_fence_ptr: Sync File fd pointer representing the |
| 498 | * outgoing fences for a CRTC. Userspace should provide a pointer to a |
| 499 | * value of type s64, and then cast that pointer to u64. |
| 500 | */ |
| 501 | struct drm_property *prop_out_fence_ptr; |
| 502 | /** |
Daniel Vetter | 28575f1 | 2016-11-14 12:58:23 +0100 | [diff] [blame] | 503 | * @prop_crtc_id: Default atomic plane property to specify the |
| 504 | * &drm_crtc. |
| 505 | */ |
| 506 | struct drm_property *prop_crtc_id; |
| 507 | /** |
| 508 | * @prop_active: Default atomic CRTC property to control the active |
| 509 | * state, which is the simplified implementation for DPMS in atomic |
| 510 | * drivers. |
| 511 | */ |
| 512 | struct drm_property *prop_active; |
| 513 | /** |
| 514 | * @prop_mode_id: Default atomic CRTC property to set the mode for a |
| 515 | * CRTC. A 0 mode implies that the CRTC is entirely disabled - all |
| 516 | * connectors must be of and active must be set to disabled, too. |
| 517 | */ |
| 518 | struct drm_property *prop_mode_id; |
| 519 | |
| 520 | /** |
| 521 | * @dvi_i_subconnector_property: Optional DVI-I property to |
| 522 | * differentiate between analog or digital mode. |
| 523 | */ |
| 524 | struct drm_property *dvi_i_subconnector_property; |
| 525 | /** |
| 526 | * @dvi_i_select_subconnector_property: Optional DVI-I property to |
| 527 | * select between analog or digital mode. |
| 528 | */ |
| 529 | struct drm_property *dvi_i_select_subconnector_property; |
| 530 | |
| 531 | /** |
| 532 | * @tv_subconnector_property: Optional TV property to differentiate |
| 533 | * between different TV connector types. |
| 534 | */ |
| 535 | struct drm_property *tv_subconnector_property; |
| 536 | /** |
| 537 | * @tv_select_subconnector_property: Optional TV property to select |
| 538 | * between different TV connector types. |
| 539 | */ |
| 540 | struct drm_property *tv_select_subconnector_property; |
| 541 | /** |
| 542 | * @tv_mode_property: Optional TV property to select |
| 543 | * the output TV mode. |
| 544 | */ |
| 545 | struct drm_property *tv_mode_property; |
| 546 | /** |
| 547 | * @tv_left_margin_property: Optional TV property to set the left |
| 548 | * margin. |
| 549 | */ |
| 550 | struct drm_property *tv_left_margin_property; |
| 551 | /** |
| 552 | * @tv_right_margin_property: Optional TV property to set the right |
| 553 | * margin. |
| 554 | */ |
| 555 | struct drm_property *tv_right_margin_property; |
| 556 | /** |
| 557 | * @tv_top_margin_property: Optional TV property to set the right |
| 558 | * margin. |
| 559 | */ |
| 560 | struct drm_property *tv_top_margin_property; |
| 561 | /** |
| 562 | * @tv_bottom_margin_property: Optional TV property to set the right |
| 563 | * margin. |
| 564 | */ |
| 565 | struct drm_property *tv_bottom_margin_property; |
| 566 | /** |
| 567 | * @tv_brightness_property: Optional TV property to set the |
| 568 | * brightness. |
| 569 | */ |
| 570 | struct drm_property *tv_brightness_property; |
| 571 | /** |
| 572 | * @tv_contrast_property: Optional TV property to set the |
| 573 | * contrast. |
| 574 | */ |
| 575 | struct drm_property *tv_contrast_property; |
| 576 | /** |
| 577 | * @tv_flicker_reduction_property: Optional TV property to control the |
| 578 | * flicker reduction mode. |
| 579 | */ |
| 580 | struct drm_property *tv_flicker_reduction_property; |
| 581 | /** |
| 582 | * @tv_overscan_property: Optional TV property to control the overscan |
| 583 | * setting. |
| 584 | */ |
| 585 | struct drm_property *tv_overscan_property; |
| 586 | /** |
| 587 | * @tv_saturation_property: Optional TV property to set the |
| 588 | * saturation. |
| 589 | */ |
| 590 | struct drm_property *tv_saturation_property; |
| 591 | /** |
| 592 | * @tv_hue_property: Optional TV property to set the hue. |
| 593 | */ |
| 594 | struct drm_property *tv_hue_property; |
| 595 | |
| 596 | /** |
| 597 | * @scaling_mode_property: Optional connector property to control the |
| 598 | * upscaling, mostly used for built-in panels. |
| 599 | */ |
| 600 | struct drm_property *scaling_mode_property; |
| 601 | /** |
| 602 | * @aspect_ratio_property: Optional connector property to control the |
| 603 | * HDMI infoframe aspect ratio setting. |
| 604 | */ |
| 605 | struct drm_property *aspect_ratio_property; |
| 606 | /** |
| 607 | * @degamma_lut_property: Optional CRTC property to set the LUT used to |
| 608 | * convert the framebuffer's colors to linear gamma. |
| 609 | */ |
| 610 | struct drm_property *degamma_lut_property; |
| 611 | /** |
| 612 | * @degamma_lut_size_property: Optional CRTC property for the size of |
| 613 | * the degamma LUT as supported by the driver (read-only). |
| 614 | */ |
| 615 | struct drm_property *degamma_lut_size_property; |
| 616 | /** |
| 617 | * @ctm_property: Optional CRTC property to set the |
| 618 | * matrix used to convert colors after the lookup in the |
| 619 | * degamma LUT. |
| 620 | */ |
| 621 | struct drm_property *ctm_property; |
| 622 | /** |
| 623 | * @gamma_lut_property: Optional CRTC property to set the LUT used to |
| 624 | * convert the colors, after the CTM matrix, to the gamma space of the |
| 625 | * connected screen. |
| 626 | */ |
| 627 | struct drm_property *gamma_lut_property; |
| 628 | /** |
| 629 | * @gamma_lut_size_property: Optional CRTC property for the size of the |
| 630 | * gamma LUT as supported by the driver (read-only). |
| 631 | */ |
| 632 | struct drm_property *gamma_lut_size_property; |
| 633 | |
| 634 | /** |
| 635 | * @suggested_x_property: Optional connector property with a hint for |
| 636 | * the position of the output on the host's screen. |
| 637 | */ |
| 638 | struct drm_property *suggested_x_property; |
| 639 | /** |
| 640 | * @suggested_y_property: Optional connector property with a hint for |
| 641 | * the position of the output on the host's screen. |
| 642 | */ |
| 643 | struct drm_property *suggested_y_property; |
| 644 | |
| 645 | /* dumb ioctl parameters */ |
| 646 | uint32_t preferred_depth, prefer_shadow; |
| 647 | |
| 648 | /** |
| 649 | * @async_page_flip: Does this device support async flips on the primary |
| 650 | * plane? |
| 651 | */ |
| 652 | bool async_page_flip; |
| 653 | |
| 654 | /** |
| 655 | * @allow_fb_modifiers: |
| 656 | * |
| 657 | * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call. |
| 658 | */ |
| 659 | bool allow_fb_modifiers; |
| 660 | |
| 661 | /* cursor size */ |
| 662 | uint32_t cursor_width, cursor_height; |
| 663 | |
| 664 | struct drm_mode_config_helper_funcs *helper_private; |
| 665 | }; |
| 666 | |
| 667 | void drm_mode_config_init(struct drm_device *dev); |
| 668 | void drm_mode_config_reset(struct drm_device *dev); |
| 669 | void drm_mode_config_cleanup(struct drm_device *dev); |
| 670 | |
| 671 | #endif |