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