hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/drm/drm_plane.h
....@@ -27,6 +27,9 @@
2727 #include <linux/ctype.h>
2828 #include <drm/drm_mode_object.h>
2929 #include <drm/drm_color_mgmt.h>
30
+#include <drm/drm_rect.h>
31
+#include <drm/drm_modeset_lock.h>
32
+#include <drm/drm_util.h>
3033
3134 struct drm_crtc;
3235 struct drm_printer;
....@@ -66,7 +69,7 @@
6669 *
6770 * Optional fence to wait for before scanning out @fb. The core atomic
6871 * code will set this when userspace is using explicit fencing. Do not
69
- * write this directly for a driver's implicit fence, use
72
+ * write this field directly for a driver's implicit fence, use
7073 * drm_atomic_set_fence_for_plane() to ensure that an explicit fence is
7174 * preserved.
7275 *
....@@ -137,10 +140,11 @@
137140 * @zpos:
138141 * Priority of the given plane on crtc (optional).
139142 *
140
- * Note that multiple active planes on the same crtc can have an
141
- * identical zpos value. The rule to solving the conflict is to compare
142
- * the plane object IDs; the plane with a higher ID must be stacked on
143
- * top of a plane with a lower ID.
143
+ * User-space may set mutable zpos properties so that multiple active
144
+ * planes on the same CRTC have identical zpos values. This is a
145
+ * user-space bug, but drivers can solve the conflict by comparing the
146
+ * plane object IDs; the plane with a higher ID is stacked on top of a
147
+ * plane with a lower ID.
144148 *
145149 * See drm_plane_create_zpos_property() and
146150 * drm_plane_create_zpos_immutable_property() for more details.
....@@ -170,8 +174,36 @@
170174 */
171175 enum drm_color_range color_range;
172176
173
- /** @src: clipped source coordinates of the plane (in 16.16) */
174
- /** @dst: clipped destination coordinates of the plane */
177
+ /**
178
+ * @fb_damage_clips:
179
+ *
180
+ * Blob representing damage (area in plane framebuffer that changed
181
+ * since last plane update) as an array of &drm_mode_rect in framebuffer
182
+ * coodinates of the attached framebuffer. Note that unlike plane src,
183
+ * damage clips are not in 16.16 fixed point.
184
+ */
185
+ struct drm_property_blob *fb_damage_clips;
186
+
187
+ /**
188
+ * @src:
189
+ *
190
+ * source coordinates of the plane (in 16.16).
191
+ *
192
+ * When using drm_atomic_helper_check_plane_state(),
193
+ * the coordinates are clipped, but the driver may choose
194
+ * to use unclipped coordinates instead when the hardware
195
+ * performs the clipping automatically.
196
+ */
197
+ /**
198
+ * @dst:
199
+ *
200
+ * clipped destination coordinates of the plane.
201
+ *
202
+ * When using drm_atomic_helper_check_plane_state(),
203
+ * the coordinates are clipped, but the driver may choose
204
+ * to use unclipped coordinates instead when the hardware
205
+ * performs the clipping automatically.
206
+ */
175207 struct drm_rect src, dst;
176208
177209 /**
....@@ -795,5 +827,39 @@
795827 #define drm_for_each_plane(plane, dev) \
796828 list_for_each_entry(plane, &(dev)->mode_config.plane_list, head)
797829
830
+bool drm_any_plane_has_format(struct drm_device *dev,
831
+ u32 format, u64 modifier);
832
+/**
833
+ * drm_plane_get_damage_clips_count - Returns damage clips count.
834
+ * @state: Plane state.
835
+ *
836
+ * Simple helper to get the number of &drm_mode_rect clips set by user-space
837
+ * during plane update.
838
+ *
839
+ * Return: Number of clips in plane fb_damage_clips blob property.
840
+ */
841
+static inline unsigned int
842
+drm_plane_get_damage_clips_count(const struct drm_plane_state *state)
843
+{
844
+ return (state && state->fb_damage_clips) ?
845
+ state->fb_damage_clips->length/sizeof(struct drm_mode_rect) : 0;
846
+}
847
+
848
+/**
849
+ * drm_plane_get_damage_clips - Returns damage clips.
850
+ * @state: Plane state.
851
+ *
852
+ * Note that this function returns uapi type &drm_mode_rect. Drivers might
853
+ * instead be interested in internal &drm_rect which can be obtained by calling
854
+ * drm_helper_get_plane_damage_clips().
855
+ *
856
+ * Return: Damage clips in plane fb_damage_clips blob property.
857
+ */
858
+static inline struct drm_mode_rect *
859
+drm_plane_get_damage_clips(const struct drm_plane_state *state)
860
+{
861
+ return (struct drm_mode_rect *)((state && state->fb_damage_clips) ?
862
+ state->fb_damage_clips->data : NULL);
863
+}
798864
799865 #endif