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