drm_mode_config.h 33 KB

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