aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drm_plane.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/drm_plane.h')
-rw-r--r--include/drm/drm_plane.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 3701f56c3362..6078c700d9ba 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -173,6 +173,16 @@ struct drm_plane_state {
173 */ 173 */
174 enum drm_color_range color_range; 174 enum drm_color_range color_range;
175 175
176 /**
177 * @fb_damage_clips:
178 *
179 * Blob representing damage (area in plane framebuffer that changed
180 * since last plane update) as an array of &drm_mode_rect in framebuffer
181 * coodinates of the attached framebuffer. Note that unlike plane src,
182 * damage clips are not in 16.16 fixed point.
183 */
184 struct drm_property_blob *fb_damage_clips;
185
176 /** @src: clipped source coordinates of the plane (in 16.16) */ 186 /** @src: clipped source coordinates of the plane (in 16.16) */
177 /** @dst: clipped destination coordinates of the plane */ 187 /** @dst: clipped destination coordinates of the plane */
178 struct drm_rect src, dst; 188 struct drm_rect src, dst;
@@ -800,5 +810,37 @@ static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
800 810
801bool drm_any_plane_has_format(struct drm_device *dev, 811bool drm_any_plane_has_format(struct drm_device *dev,
802 u32 format, u64 modifier); 812 u32 format, u64 modifier);
813/**
814 * drm_plane_get_damage_clips_count - Returns damage clips count.
815 * @state: Plane state.
816 *
817 * Simple helper to get the number of &drm_mode_rect clips set by user-space
818 * during plane update.
819 *
820 * Return: Number of clips in plane fb_damage_clips blob property.
821 */
822static inline unsigned int
823drm_plane_get_damage_clips_count(const struct drm_plane_state *state)
824{
825 return (state && state->fb_damage_clips) ?
826 state->fb_damage_clips->length/sizeof(struct drm_mode_rect) : 0;
827}
828
829/**
830 * drm_plane_get_damage_clips - Returns damage clips.
831 * @state: Plane state.
832 *
833 * Note that this function returns uapi type &drm_mode_rect. Drivers might
834 * instead be interested in internal &drm_rect which can be obtained by calling
835 * drm_helper_get_plane_damage_clips().
836 *
837 * Return: Damage clips in plane fb_damage_clips blob property.
838 */
839static inline struct drm_mode_rect *
840drm_plane_get_damage_clips(const struct drm_plane_state *state)
841{
842 return (struct drm_mode_rect *)((state && state->fb_damage_clips) ?
843 state->fb_damage_clips->data : NULL);
844}
803 845
804#endif 846#endif