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