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) /* SPDX-License-Identifier: GPL-2.0 OR MIT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /**************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 2018 VMware, Inc., Palo Alto, CA., USA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Permission is hereby granted, free of charge, to any person obtaining a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * copy of this software and associated documentation files (the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * "Software"), to deal in the Software without restriction, including
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * without limitation the rights to use, copy, modify, merge, publish,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * distribute, sub license, and/or sell copies of the Software, and to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * permit persons to whom the Software is furnished to do so, subject to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * the following conditions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * The above copyright notice and this permission notice (including the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * next paragraph) shall be included in all copies or substantial portions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * of the Software.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * USE OR OTHER DEALINGS IN THE SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * Authors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * Deepak Rawat <drawat@vmware.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  **************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #ifndef DRM_DAMAGE_HELPER_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define DRM_DAMAGE_HELPER_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <drm/drm_atomic_helper.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  * drm_atomic_for_each_plane_damage - Iterator macro for plane damage.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * @iter: The iterator to advance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * @rect: Return a rectangle in fb coordinate clipped to plane src.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * Note that if the first call to iterator macro return false then no need to do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * plane update. Iterator will return full plane src when damage is not passed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * by user-space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define drm_atomic_for_each_plane_damage(iter, rect) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	while (drm_atomic_helper_damage_iter_next(iter, rect))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * struct drm_atomic_helper_damage_iter - Closure structure for damage iterator.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  * This structure tracks state needed to walk the list of plane damage clips.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) struct drm_atomic_helper_damage_iter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	/* private: Plane src in whole number. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	struct drm_rect plane_src;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	/* private: Rectangles in plane damage blob. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	const struct drm_rect *clips;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	/* private: Number of rectangles in plane damage blob. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	uint32_t num_clips;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	/* private: Current clip iterator is advancing on. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	uint32_t curr_clip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	/* private: Whether need full plane update. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	bool full_update;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) void drm_plane_enable_fb_damage_clips(struct drm_plane *plane);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) void drm_atomic_helper_check_plane_damage(struct drm_atomic_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 					  struct drm_plane_state *plane_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 			      struct drm_file *file_priv, unsigned int flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 			      unsigned int color, struct drm_clip_rect *clips,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 			      unsigned int num_clips);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) drm_atomic_helper_damage_iter_init(struct drm_atomic_helper_damage_iter *iter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 				   const struct drm_plane_state *old_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 				   const struct drm_plane_state *new_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) drm_atomic_helper_damage_iter_next(struct drm_atomic_helper_damage_iter *iter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 				   struct drm_rect *rect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) bool drm_atomic_helper_damage_merged(const struct drm_plane_state *old_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 				     struct drm_plane_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 				     struct drm_rect *rect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * drm_helper_get_plane_damage_clips - Returns damage clips in &drm_rect.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * @state: Plane state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * Returns plane damage rectangles in internal &drm_rect. Currently &drm_rect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * can be obtained by simply typecasting &drm_mode_rect. This is because both
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  * are signed 32 and during drm_atomic_check_only() it is verified that damage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  * clips are inside fb.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  * Return: Clips in plane fb_damage_clips blob property.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) static inline struct drm_rect *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) drm_helper_get_plane_damage_clips(const struct drm_plane_state *state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	return (struct drm_rect *)drm_plane_get_damage_clips(state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #endif