Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Copyright (C) 2014 Red Hat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) 2014 Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Permission is hereby granted, free of charge, to any person obtaining a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * copy of this software and associated documentation files (the "Software"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * to deal in the Software without restriction, including without limitation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * and/or sell copies of the Software, and to permit persons to whom the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * Software is furnished to do so, subject to the following conditions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * The above copyright notice and this permission notice shall be included in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * all copies or substantial portions of the Software.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * OTHER DEALINGS IN THE SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * Authors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * Rob Clark <robdclark@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * Daniel Vetter <daniel.vetter@ffwll.ch>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #ifndef DRM_ATOMIC_HELPER_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define DRM_ATOMIC_HELPER_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <drm/drm_crtc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <drm/drm_modeset_helper_vtables.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <drm/drm_modeset_helper.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <drm/drm_atomic_state_helper.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <drm/drm_util.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) struct drm_atomic_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) struct drm_private_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) struct drm_private_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) int drm_atomic_helper_check_modeset(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 				struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 					const struct drm_crtc_state *crtc_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 					int min_scale,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 					int max_scale,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 					bool can_position,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 					bool can_update_disabled);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) int drm_atomic_helper_check_planes(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 			       struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) int drm_atomic_helper_check(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 			    struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) void drm_atomic_helper_commit_tail(struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) void drm_atomic_helper_commit_tail_rpm(struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) int drm_atomic_helper_commit(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 			     struct drm_atomic_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 			     bool nonblock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) int drm_atomic_helper_async_check(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 				  struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) void drm_atomic_helper_async_commit(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 				    struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 					struct drm_atomic_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 					bool pre_swap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 					struct drm_atomic_state *old_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 					  struct drm_atomic_state *old_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 					      struct drm_atomic_state *old_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 					       struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 					  struct drm_atomic_state *old_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) int drm_atomic_helper_prepare_planes(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 				     struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) #define DRM_PLANE_COMMIT_ACTIVE_ONLY			BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #define DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET	BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) void drm_atomic_helper_commit_planes(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 				     struct drm_atomic_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 				     uint32_t flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) void drm_atomic_helper_cleanup_planes(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 				      struct drm_atomic_state *old_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) void drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 					 bool atomic);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) int __must_check drm_atomic_helper_swap_state(struct drm_atomic_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 					      bool stall);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) /* nonblocking commit helpers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 				   bool nonblock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) void drm_atomic_helper_fake_vblank(struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /* implementations for legacy interfaces */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) int drm_atomic_helper_update_plane(struct drm_plane *plane,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 				   struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 				   struct drm_framebuffer *fb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 				   int crtc_x, int crtc_y,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 				   unsigned int crtc_w, unsigned int crtc_h,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 				   uint32_t src_x, uint32_t src_y,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 				   uint32_t src_w, uint32_t src_h,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 				   struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) int drm_atomic_helper_disable_plane(struct drm_plane *plane,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 				    struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) int drm_atomic_helper_set_config(struct drm_mode_set *set,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 				 struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) int drm_atomic_helper_disable_all(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 				  struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) void drm_atomic_helper_shutdown(struct drm_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) struct drm_atomic_state *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) drm_atomic_helper_duplicate_state(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 				  struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 					      struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) int drm_atomic_helper_resume(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 			     struct drm_atomic_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 				struct drm_framebuffer *fb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 				struct drm_pending_vblank_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 				uint32_t flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 				struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) int drm_atomic_helper_page_flip_target(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 				struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 				struct drm_framebuffer *fb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 				struct drm_pending_vblank_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 				uint32_t flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 				uint32_t target,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 				struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 				       u16 *red, u16 *green, u16 *blue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 				       uint32_t size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 				       struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  * @plane: the loop cursor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  * @crtc:  the CRTC whose planes are iterated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  * This iterates over the current state, useful (for example) when applying
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  * atomic state after it has been checked and swapped.  To iterate over the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  * planes which *will* be attached (more useful in code called from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  * &drm_mode_config_funcs.atomic_check) see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  * drm_atomic_crtc_state_for_each_plane().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) #define drm_atomic_crtc_for_each_plane(plane, crtc) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	drm_for_each_plane_mask(plane, (crtc)->dev, (crtc)->state->plane_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  * drm_crtc_atomic_state_for_each_plane - iterate over attached planes in new state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)  * @plane: the loop cursor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  * @crtc_state: the incoming CRTC state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)  * attached if the specified state is applied.  Useful during for example
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  * in code called from &drm_mode_config_funcs.atomic_check operations, to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)  * validate the incoming state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) #define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * drm_crtc_atomic_state_for_each_plane_state - iterate over attached planes in new state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  * @plane: the loop cursor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  * @plane_state: loop cursor for the plane's state, must be const
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  * @crtc_state: the incoming CRTC state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)  * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  * attached if the specified state is applied.  Useful during for example
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  * in code called from &drm_mode_config_funcs.atomic_check operations, to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  * validate the incoming state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  * Compared to just drm_atomic_crtc_state_for_each_plane() this also fills in a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)  * const plane_state. This is useful when a driver just wants to peek at other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  * active planes on this CRTC, but does not need to change it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) #define drm_atomic_crtc_state_for_each_plane_state(plane, plane_state, crtc_state) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		for_each_if ((plane_state = \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 			      __drm_atomic_get_current_plane_state((crtc_state)->state, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 								   plane)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  * drm_atomic_plane_disabling - check whether a plane is being disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  * @old_plane_state: old atomic plane state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  * @new_plane_state: new atomic plane state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * Checks the atomic state of a plane to determine whether it's being disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  * or not. This also WARNs if it detects an invalid state (both CRTC and FB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * need to either both be NULL or both be non-NULL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  * True if the plane is being disabled, false otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) static inline bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) drm_atomic_plane_disabling(struct drm_plane_state *old_plane_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 			   struct drm_plane_state *new_plane_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	 * When disabling a plane, CRTC and FB should always be NULL together.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	 * Anything else should be considered a bug in the atomic core, so we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	 * gently warn about it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	WARN_ON((new_plane_state->crtc == NULL && new_plane_state->fb != NULL) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		(new_plane_state->crtc != NULL && new_plane_state->fb == NULL));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	return old_plane_state->crtc && !new_plane_state->crtc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) u32 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 					struct drm_bridge_state *bridge_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 					struct drm_crtc_state *crtc_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 					struct drm_connector_state *conn_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 					u32 output_fmt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 					unsigned int *num_input_fmts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) #endif /* DRM_ATOMIC_HELPER_H_ */