drm_plane.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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_PLANE_H__
  23. #define __DRM_PLANE_H__
  24. #include <linux/list.h>
  25. #include <linux/ctype.h>
  26. #include <drm/drm_mode_object.h>
  27. struct drm_crtc;
  28. struct drm_printer;
  29. struct drm_modeset_acquire_ctx;
  30. /**
  31. * struct drm_plane_state - mutable plane state
  32. * @plane: backpointer to the plane
  33. * @crtc_w: width of visible portion of plane on crtc
  34. * @crtc_h: height of visible portion of plane on crtc
  35. * @src_x: left position of visible portion of plane within
  36. * plane (in 16.16)
  37. * @src_y: upper position of visible portion of plane within
  38. * plane (in 16.16)
  39. * @src_w: width of visible portion of plane (in 16.16)
  40. * @src_h: height of visible portion of plane (in 16.16)
  41. * @rotation: rotation of the plane
  42. * @zpos: priority of the given plane on crtc (optional)
  43. * Note that multiple active planes on the same crtc can have an identical
  44. * zpos value. The rule to solving the conflict is to compare the plane
  45. * object IDs; the plane with a higher ID must be stacked on top of a
  46. * plane with a lower ID.
  47. * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
  48. * where N is the number of active planes for given crtc. Note that
  49. * the driver must call drm_atomic_normalize_zpos() to update this before
  50. * it can be trusted.
  51. * @src: clipped source coordinates of the plane (in 16.16)
  52. * @dst: clipped destination coordinates of the plane
  53. * @state: backpointer to global drm_atomic_state
  54. */
  55. struct drm_plane_state {
  56. struct drm_plane *plane;
  57. /**
  58. * @crtc:
  59. *
  60. * Currently bound CRTC, NULL if disabled. Do not this write directly,
  61. * use drm_atomic_set_crtc_for_plane()
  62. */
  63. struct drm_crtc *crtc;
  64. /**
  65. * @fb:
  66. *
  67. * Currently bound framebuffer. Do not write this directly, use
  68. * drm_atomic_set_fb_for_plane()
  69. */
  70. struct drm_framebuffer *fb;
  71. /**
  72. * @fence:
  73. *
  74. * Optional fence to wait for before scanning out @fb. Do not write this
  75. * directly, use drm_atomic_set_fence_for_plane()
  76. */
  77. struct dma_fence *fence;
  78. /**
  79. * @crtc_x:
  80. *
  81. * Left position of visible portion of plane on crtc, signed dest
  82. * location allows it to be partially off screen.
  83. */
  84. int32_t crtc_x;
  85. /**
  86. * @crtc_y:
  87. *
  88. * Upper position of visible portion of plane on crtc, signed dest
  89. * location allows it to be partially off screen.
  90. */
  91. int32_t crtc_y;
  92. uint32_t crtc_w, crtc_h;
  93. /* Source values are 16.16 fixed point */
  94. uint32_t src_x, src_y;
  95. uint32_t src_h, src_w;
  96. /* Plane rotation */
  97. unsigned int rotation;
  98. /* Plane zpos */
  99. unsigned int zpos;
  100. unsigned int normalized_zpos;
  101. /* Clipped coordinates */
  102. struct drm_rect src, dst;
  103. /**
  104. * @visible:
  105. *
  106. * Visibility of the plane. This can be false even if fb!=NULL and
  107. * crtc!=NULL, due to clipping.
  108. */
  109. bool visible;
  110. /**
  111. * @commit: Tracks the pending commit to prevent use-after-free conditions,
  112. * and for async plane updates.
  113. *
  114. * May be NULL.
  115. */
  116. struct drm_crtc_commit *commit;
  117. struct drm_atomic_state *state;
  118. };
  119. static inline struct drm_rect
  120. drm_plane_state_src(const struct drm_plane_state *state)
  121. {
  122. struct drm_rect src = {
  123. .x1 = state->src_x,
  124. .y1 = state->src_y,
  125. .x2 = state->src_x + state->src_w,
  126. .y2 = state->src_y + state->src_h,
  127. };
  128. return src;
  129. }
  130. static inline struct drm_rect
  131. drm_plane_state_dest(const struct drm_plane_state *state)
  132. {
  133. struct drm_rect dest = {
  134. .x1 = state->crtc_x,
  135. .y1 = state->crtc_y,
  136. .x2 = state->crtc_x + state->crtc_w,
  137. .y2 = state->crtc_y + state->crtc_h,
  138. };
  139. return dest;
  140. }
  141. /**
  142. * struct drm_plane_funcs - driver plane control functions
  143. */
  144. struct drm_plane_funcs {
  145. /**
  146. * @update_plane:
  147. *
  148. * This is the legacy entry point to enable and configure the plane for
  149. * the given CRTC and framebuffer. It is never called to disable the
  150. * plane, i.e. the passed-in crtc and fb paramters are never NULL.
  151. *
  152. * The source rectangle in frame buffer memory coordinates is given by
  153. * the src_x, src_y, src_w and src_h parameters (as 16.16 fixed point
  154. * values). Devices that don't support subpixel plane coordinates can
  155. * ignore the fractional part.
  156. *
  157. * The destination rectangle in CRTC coordinates is given by the
  158. * crtc_x, crtc_y, crtc_w and crtc_h parameters (as integer values).
  159. * Devices scale the source rectangle to the destination rectangle. If
  160. * scaling is not supported, and the source rectangle size doesn't match
  161. * the destination rectangle size, the driver must return a
  162. * -<errorname>EINVAL</errorname> error.
  163. *
  164. * Drivers implementing atomic modeset should use
  165. * drm_atomic_helper_update_plane() to implement this hook.
  166. *
  167. * RETURNS:
  168. *
  169. * 0 on success or a negative error code on failure.
  170. */
  171. int (*update_plane)(struct drm_plane *plane,
  172. struct drm_crtc *crtc, struct drm_framebuffer *fb,
  173. int crtc_x, int crtc_y,
  174. unsigned int crtc_w, unsigned int crtc_h,
  175. uint32_t src_x, uint32_t src_y,
  176. uint32_t src_w, uint32_t src_h,
  177. struct drm_modeset_acquire_ctx *ctx);
  178. /**
  179. * @disable_plane:
  180. *
  181. * This is the legacy entry point to disable the plane. The DRM core
  182. * calls this method in response to a DRM_IOCTL_MODE_SETPLANE IOCTL call
  183. * with the frame buffer ID set to 0. Disabled planes must not be
  184. * processed by the CRTC.
  185. *
  186. * Drivers implementing atomic modeset should use
  187. * drm_atomic_helper_disable_plane() to implement this hook.
  188. *
  189. * RETURNS:
  190. *
  191. * 0 on success or a negative error code on failure.
  192. */
  193. int (*disable_plane)(struct drm_plane *plane,
  194. struct drm_modeset_acquire_ctx *ctx);
  195. /**
  196. * @destroy:
  197. *
  198. * Clean up plane resources. This is only called at driver unload time
  199. * through drm_mode_config_cleanup() since a plane cannot be hotplugged
  200. * in DRM.
  201. */
  202. void (*destroy)(struct drm_plane *plane);
  203. /**
  204. * @reset:
  205. *
  206. * Reset plane hardware and software state to off. This function isn't
  207. * called by the core directly, only through drm_mode_config_reset().
  208. * It's not a helper hook only for historical reasons.
  209. *
  210. * Atomic drivers can use drm_atomic_helper_plane_reset() to reset
  211. * atomic state using this hook.
  212. */
  213. void (*reset)(struct drm_plane *plane);
  214. /**
  215. * @set_property:
  216. *
  217. * This is the legacy entry point to update a property attached to the
  218. * plane.
  219. *
  220. * This callback is optional if the driver does not support any legacy
  221. * driver-private properties. For atomic drivers it is not used because
  222. * property handling is done entirely in the DRM core.
  223. *
  224. * RETURNS:
  225. *
  226. * 0 on success or a negative error code on failure.
  227. */
  228. int (*set_property)(struct drm_plane *plane,
  229. struct drm_property *property, uint64_t val);
  230. /**
  231. * @atomic_duplicate_state:
  232. *
  233. * Duplicate the current atomic state for this plane and return it.
  234. * The core and helpers guarantee that any atomic state duplicated with
  235. * this hook and still owned by the caller (i.e. not transferred to the
  236. * driver by calling &drm_mode_config_funcs.atomic_commit) will be
  237. * cleaned up by calling the @atomic_destroy_state hook in this
  238. * structure.
  239. *
  240. * Atomic drivers which don't subclass &struct drm_plane_state should use
  241. * drm_atomic_helper_plane_duplicate_state(). Drivers that subclass the
  242. * state structure to extend it with driver-private state should use
  243. * __drm_atomic_helper_plane_duplicate_state() to make sure shared state is
  244. * duplicated in a consistent fashion across drivers.
  245. *
  246. * It is an error to call this hook before &drm_plane.state has been
  247. * initialized correctly.
  248. *
  249. * NOTE:
  250. *
  251. * If the duplicate state references refcounted resources this hook must
  252. * acquire a reference for each of them. The driver must release these
  253. * references again in @atomic_destroy_state.
  254. *
  255. * RETURNS:
  256. *
  257. * Duplicated atomic state or NULL when the allocation failed.
  258. */
  259. struct drm_plane_state *(*atomic_duplicate_state)(struct drm_plane *plane);
  260. /**
  261. * @atomic_destroy_state:
  262. *
  263. * Destroy a state duplicated with @atomic_duplicate_state and release
  264. * or unreference all resources it references
  265. */
  266. void (*atomic_destroy_state)(struct drm_plane *plane,
  267. struct drm_plane_state *state);
  268. /**
  269. * @atomic_set_property:
  270. *
  271. * Decode a driver-private property value and store the decoded value
  272. * into the passed-in state structure. Since the atomic core decodes all
  273. * standardized properties (even for extensions beyond the core set of
  274. * properties which might not be implemented by all drivers) this
  275. * requires drivers to subclass the state structure.
  276. *
  277. * Such driver-private properties should really only be implemented for
  278. * truly hardware/vendor specific state. Instead it is preferred to
  279. * standardize atomic extension and decode the properties used to expose
  280. * such an extension in the core.
  281. *
  282. * Do not call this function directly, use
  283. * drm_atomic_plane_set_property() instead.
  284. *
  285. * This callback is optional if the driver does not support any
  286. * driver-private atomic properties.
  287. *
  288. * NOTE:
  289. *
  290. * This function is called in the state assembly phase of atomic
  291. * modesets, which can be aborted for any reason (including on
  292. * userspace's request to just check whether a configuration would be
  293. * possible). Drivers MUST NOT touch any persistent state (hardware or
  294. * software) or data structures except the passed in @state parameter.
  295. *
  296. * Also since userspace controls in which order properties are set this
  297. * function must not do any input validation (since the state update is
  298. * incomplete and hence likely inconsistent). Instead any such input
  299. * validation must be done in the various atomic_check callbacks.
  300. *
  301. * RETURNS:
  302. *
  303. * 0 if the property has been found, -EINVAL if the property isn't
  304. * implemented by the driver (which shouldn't ever happen, the core only
  305. * asks for properties attached to this plane). No other validation is
  306. * allowed by the driver. The core already checks that the property
  307. * value is within the range (integer, valid enum value, ...) the driver
  308. * set when registering the property.
  309. */
  310. int (*atomic_set_property)(struct drm_plane *plane,
  311. struct drm_plane_state *state,
  312. struct drm_property *property,
  313. uint64_t val);
  314. /**
  315. * @atomic_get_property:
  316. *
  317. * Reads out the decoded driver-private property. This is used to
  318. * implement the GETPLANE IOCTL.
  319. *
  320. * Do not call this function directly, use
  321. * drm_atomic_plane_get_property() instead.
  322. *
  323. * This callback is optional if the driver does not support any
  324. * driver-private atomic properties.
  325. *
  326. * RETURNS:
  327. *
  328. * 0 on success, -EINVAL if the property isn't implemented by the
  329. * driver (which should never happen, the core only asks for
  330. * properties attached to this plane).
  331. */
  332. int (*atomic_get_property)(struct drm_plane *plane,
  333. const struct drm_plane_state *state,
  334. struct drm_property *property,
  335. uint64_t *val);
  336. /**
  337. * @late_register:
  338. *
  339. * This optional hook can be used to register additional userspace
  340. * interfaces attached to the plane like debugfs interfaces.
  341. * It is called late in the driver load sequence from drm_dev_register().
  342. * Everything added from this callback should be unregistered in
  343. * the early_unregister callback.
  344. *
  345. * Returns:
  346. *
  347. * 0 on success, or a negative error code on failure.
  348. */
  349. int (*late_register)(struct drm_plane *plane);
  350. /**
  351. * @early_unregister:
  352. *
  353. * This optional hook should be used to unregister the additional
  354. * userspace interfaces attached to the plane from
  355. * @late_register. It is called from drm_dev_unregister(),
  356. * early in the driver unload sequence to disable userspace access
  357. * before data structures are torndown.
  358. */
  359. void (*early_unregister)(struct drm_plane *plane);
  360. /**
  361. * @atomic_print_state:
  362. *
  363. * If driver subclasses &struct drm_plane_state, it should implement
  364. * this optional hook for printing additional driver specific state.
  365. *
  366. * Do not call this directly, use drm_atomic_plane_print_state()
  367. * instead.
  368. */
  369. void (*atomic_print_state)(struct drm_printer *p,
  370. const struct drm_plane_state *state);
  371. /**
  372. * @format_mod_supported:
  373. *
  374. * This optional hook is used for the DRM to determine if the given
  375. * format/modifier combination is valid for the plane. This allows the
  376. * DRM to generate the correct format bitmask (which formats apply to
  377. * which modifier).
  378. *
  379. * Returns:
  380. *
  381. * True if the given modifier is valid for that format on the plane.
  382. * False otherwise.
  383. */
  384. bool (*format_mod_supported)(struct drm_plane *plane, uint32_t format,
  385. uint64_t modifier);
  386. };
  387. /**
  388. * enum drm_plane_type - uapi plane type enumeration
  389. *
  390. * For historical reasons not all planes are made the same. This enumeration is
  391. * used to tell the different types of planes apart to implement the different
  392. * uapi semantics for them. For userspace which is universal plane aware and
  393. * which is using that atomic IOCTL there's no difference between these planes
  394. * (beyong what the driver and hardware can support of course).
  395. *
  396. * For compatibility with legacy userspace, only overlay planes are made
  397. * available to userspace by default. Userspace clients may set the
  398. * DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate that they
  399. * wish to receive a universal plane list containing all plane types. See also
  400. * drm_for_each_legacy_plane().
  401. *
  402. * WARNING: The values of this enum is UABI since they're exposed in the "type"
  403. * property.
  404. */
  405. enum drm_plane_type {
  406. /**
  407. * @DRM_PLANE_TYPE_OVERLAY:
  408. *
  409. * Overlay planes represent all non-primary, non-cursor planes. Some
  410. * drivers refer to these types of planes as "sprites" internally.
  411. */
  412. DRM_PLANE_TYPE_OVERLAY,
  413. /**
  414. * @DRM_PLANE_TYPE_PRIMARY:
  415. *
  416. * Primary planes represent a "main" plane for a CRTC. Primary planes
  417. * are the planes operated upon by CRTC modesetting and flipping
  418. * operations described in the &drm_crtc_funcs.page_flip and
  419. * &drm_crtc_funcs.set_config hooks.
  420. */
  421. DRM_PLANE_TYPE_PRIMARY,
  422. /**
  423. * @DRM_PLANE_TYPE_CURSOR:
  424. *
  425. * Cursor planes represent a "cursor" plane for a CRTC. Cursor planes
  426. * are the planes operated upon by the DRM_IOCTL_MODE_CURSOR and
  427. * DRM_IOCTL_MODE_CURSOR2 IOCTLs.
  428. */
  429. DRM_PLANE_TYPE_CURSOR,
  430. };
  431. /**
  432. * struct drm_plane - central DRM plane control structure
  433. * @dev: DRM device this plane belongs to
  434. * @head: for list management
  435. * @name: human readable name, can be overwritten by the driver
  436. * @base: base mode object
  437. * @possible_crtcs: pipes this plane can be bound to
  438. * @format_types: array of formats supported by this plane
  439. * @format_count: number of formats supported
  440. * @format_default: driver hasn't supplied supported formats for the plane
  441. * @crtc: currently bound CRTC
  442. * @fb: currently bound fb
  443. * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by
  444. * drm_mode_set_config_internal() to implement correct refcounting.
  445. * @funcs: helper functions
  446. * @properties: property tracking for this plane
  447. * @type: type of plane (overlay, primary, cursor)
  448. * @zpos_property: zpos property for this plane
  449. * @rotation_property: rotation property for this plane
  450. * @helper_private: mid-layer private data
  451. */
  452. struct drm_plane {
  453. struct drm_device *dev;
  454. struct list_head head;
  455. char *name;
  456. /**
  457. * @mutex:
  458. *
  459. * Protects modeset plane state, together with the &drm_crtc.mutex of
  460. * CRTC this plane is linked to (when active, getting activated or
  461. * getting disabled).
  462. *
  463. * For atomic drivers specifically this protects @state.
  464. */
  465. struct drm_modeset_lock mutex;
  466. struct drm_mode_object base;
  467. uint32_t possible_crtcs;
  468. uint32_t *format_types;
  469. unsigned int format_count;
  470. bool format_default;
  471. uint64_t *modifiers;
  472. unsigned int modifier_count;
  473. struct drm_crtc *crtc;
  474. struct drm_framebuffer *fb;
  475. struct drm_framebuffer *old_fb;
  476. const struct drm_plane_funcs *funcs;
  477. struct drm_object_properties properties;
  478. enum drm_plane_type type;
  479. /**
  480. * @index: Position inside the mode_config.list, can be used as an array
  481. * index. It is invariant over the lifetime of the plane.
  482. */
  483. unsigned index;
  484. const struct drm_plane_helper_funcs *helper_private;
  485. /**
  486. * @state:
  487. *
  488. * Current atomic state for this plane.
  489. *
  490. * This is protected by @mutex. Note that nonblocking atomic commits
  491. * access the current plane state without taking locks. Either by going
  492. * through the &struct drm_atomic_state pointers, see
  493. * for_each_oldnew_plane_in_state(), for_each_old_plane_in_state() and
  494. * for_each_new_plane_in_state(). Or through careful ordering of atomic
  495. * commit operations as implemented in the atomic helpers, see
  496. * &struct drm_crtc_commit.
  497. */
  498. struct drm_plane_state *state;
  499. struct drm_property *zpos_property;
  500. struct drm_property *rotation_property;
  501. };
  502. #define obj_to_plane(x) container_of(x, struct drm_plane, base)
  503. __printf(9, 10)
  504. int drm_universal_plane_init(struct drm_device *dev,
  505. struct drm_plane *plane,
  506. uint32_t possible_crtcs,
  507. const struct drm_plane_funcs *funcs,
  508. const uint32_t *formats,
  509. unsigned int format_count,
  510. const uint64_t *format_modifiers,
  511. enum drm_plane_type type,
  512. const char *name, ...);
  513. int drm_plane_init(struct drm_device *dev,
  514. struct drm_plane *plane,
  515. uint32_t possible_crtcs,
  516. const struct drm_plane_funcs *funcs,
  517. const uint32_t *formats, unsigned int format_count,
  518. bool is_primary);
  519. void drm_plane_cleanup(struct drm_plane *plane);
  520. /**
  521. * drm_plane_index - find the index of a registered plane
  522. * @plane: plane to find index for
  523. *
  524. * Given a registered plane, return the index of that plane within a DRM
  525. * device's list of planes.
  526. */
  527. static inline unsigned int drm_plane_index(struct drm_plane *plane)
  528. {
  529. return plane->index;
  530. }
  531. struct drm_plane * drm_plane_from_index(struct drm_device *dev, int idx);
  532. void drm_plane_force_disable(struct drm_plane *plane);
  533. int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
  534. struct drm_property *property,
  535. uint64_t value);
  536. /**
  537. * drm_plane_find - find a &drm_plane
  538. * @dev: DRM device
  539. * @file_priv: drm file to check for lease against.
  540. * @id: plane id
  541. *
  542. * Returns the plane with @id, NULL if it doesn't exist. Simple wrapper around
  543. * drm_mode_object_find().
  544. */
  545. static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
  546. struct drm_file *file_priv,
  547. uint32_t id)
  548. {
  549. struct drm_mode_object *mo;
  550. mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_PLANE);
  551. return mo ? obj_to_plane(mo) : NULL;
  552. }
  553. /**
  554. * drm_for_each_plane_mask - iterate over planes specified by bitmask
  555. * @plane: the loop cursor
  556. * @dev: the DRM device
  557. * @plane_mask: bitmask of plane indices
  558. *
  559. * Iterate over all planes specified by bitmask.
  560. */
  561. #define drm_for_each_plane_mask(plane, dev, plane_mask) \
  562. list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
  563. for_each_if ((plane_mask) & (1 << drm_plane_index(plane)))
  564. /**
  565. * drm_for_each_legacy_plane - iterate over all planes for legacy userspace
  566. * @plane: the loop cursor
  567. * @dev: the DRM device
  568. *
  569. * Iterate over all legacy planes of @dev, excluding primary and cursor planes.
  570. * This is useful for implementing userspace apis when userspace is not
  571. * universal plane aware. See also &enum drm_plane_type.
  572. */
  573. #define drm_for_each_legacy_plane(plane, dev) \
  574. list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \
  575. for_each_if (plane->type == DRM_PLANE_TYPE_OVERLAY)
  576. /**
  577. * drm_for_each_plane - iterate over all planes
  578. * @plane: the loop cursor
  579. * @dev: the DRM device
  580. *
  581. * Iterate over all planes of @dev, include primary and cursor planes.
  582. */
  583. #define drm_for_each_plane(plane, dev) \
  584. list_for_each_entry(plane, &(dev)->mode_config.plane_list, head)
  585. #endif