Merge tag 'keys-namespace-20190627' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / include / drm / drm_plane.h
index 0a0834b..6078c70 100644 (file)
@@ -173,6 +173,16 @@ struct drm_plane_state {
         */
        enum drm_color_range color_range;
 
+       /**
+        * @fb_damage_clips:
+        *
+        * Blob representing damage (area in plane framebuffer that changed
+        * since last plane update) as an array of &drm_mode_rect in framebuffer
+        * coodinates of the attached framebuffer. Note that unlike plane src,
+        * damage clips are not in 16.16 fixed point.
+        */
+       struct drm_property_blob *fb_damage_clips;
+
        /** @src: clipped source coordinates of the plane (in 16.16) */
        /** @dst: clipped destination coordinates of the plane */
        struct drm_rect src, dst;
@@ -798,5 +808,39 @@ static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
 #define drm_for_each_plane(plane, dev) \
        list_for_each_entry(plane, &(dev)->mode_config.plane_list, head)
 
+bool drm_any_plane_has_format(struct drm_device *dev,
+                             u32 format, u64 modifier);
+/**
+ * drm_plane_get_damage_clips_count - Returns damage clips count.
+ * @state: Plane state.
+ *
+ * Simple helper to get the number of &drm_mode_rect clips set by user-space
+ * during plane update.
+ *
+ * Return: Number of clips in plane fb_damage_clips blob property.
+ */
+static inline unsigned int
+drm_plane_get_damage_clips_count(const struct drm_plane_state *state)
+{
+       return (state && state->fb_damage_clips) ?
+               state->fb_damage_clips->length/sizeof(struct drm_mode_rect) : 0;
+}
+
+/**
+ * drm_plane_get_damage_clips - Returns damage clips.
+ * @state: Plane state.
+ *
+ * Note that this function returns uapi type &drm_mode_rect. Drivers might
+ * instead be interested in internal &drm_rect which can be obtained by calling
+ * drm_helper_get_plane_damage_clips().
+ *
+ * Return: Damage clips in plane fb_damage_clips blob property.
+ */
+static inline struct drm_mode_rect *
+drm_plane_get_damage_clips(const struct drm_plane_state *state)
+{
+       return (struct drm_mode_rect *)((state && state->fb_damage_clips) ?
+                                       state->fb_damage_clips->data : NULL);
+}
 
 #endif