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