.. | .. |
---|
27 | 27 | #include <linux/ctype.h> |
---|
28 | 28 | #include <drm/drm_mode_object.h> |
---|
29 | 29 | #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> |
---|
30 | 33 | |
---|
31 | 34 | struct drm_crtc; |
---|
32 | 35 | struct drm_printer; |
---|
.. | .. |
---|
66 | 69 | * |
---|
67 | 70 | * Optional fence to wait for before scanning out @fb. The core atomic |
---|
68 | 71 | * 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 |
---|
70 | 73 | * drm_atomic_set_fence_for_plane() to ensure that an explicit fence is |
---|
71 | 74 | * preserved. |
---|
72 | 75 | * |
---|
.. | .. |
---|
137 | 140 | * @zpos: |
---|
138 | 141 | * Priority of the given plane on crtc (optional). |
---|
139 | 142 | * |
---|
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. |
---|
144 | 148 | * |
---|
145 | 149 | * See drm_plane_create_zpos_property() and |
---|
146 | 150 | * drm_plane_create_zpos_immutable_property() for more details. |
---|
.. | .. |
---|
170 | 174 | */ |
---|
171 | 175 | enum drm_color_range color_range; |
---|
172 | 176 | |
---|
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 | + */ |
---|
175 | 207 | struct drm_rect src, dst; |
---|
176 | 208 | |
---|
177 | 209 | /** |
---|
.. | .. |
---|
795 | 827 | #define drm_for_each_plane(plane, dev) \ |
---|
796 | 828 | list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) |
---|
797 | 829 | |
---|
| 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 | +} |
---|
798 | 864 | |
---|
799 | 865 | #endif |
---|