Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Allow drivers to indicate the damage helpers to ignore damage clips

It allows drivers to set a struct drm_plane_state .ignore_damage_clips in
their plane's .atomic_check callback, as an indication to damage helpers
such as drm_atomic_helper_damage_iter_init() that the damage clips should
be ignored.

To be used by drivers that do per-buffer (e.g: virtio-gpu) uploads (rather
than per-plane uploads), since these type of drivers need to handle buffer
damages instead of frame damages.

That way, these drivers could force a full plane update if the framebuffer
attached to a plane's state has changed since the last update (page-flip).

Fixes: 01f05940a9a7 ("drm/virtio: Enable fb damage clips property for the primary plane")
Cc: <stable@vger.kernel.org> # v6.4+
Reported-by: nerdopolis <bluescreen_avenger@verizon.net>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218115
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Acked-by: Sima Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20231123221315.3579454-2-javierm@redhat.com

+14 -1
+2
Documentation/gpu/drm-kms.rst
··· 548 548 .. kernel-doc:: drivers/gpu/drm/drm_blend.c 549 549 :doc: overview 550 550 551 + .. _damage_tracking_properties: 552 + 551 553 Damage Tracking Properties 552 554 -------------------------- 553 555
+2 -1
drivers/gpu/drm/drm_damage_helper.c
··· 241 241 iter->plane_src.x2 = (src.x2 >> 16) + !!(src.x2 & 0xFFFF); 242 242 iter->plane_src.y2 = (src.y2 >> 16) + !!(src.y2 & 0xFFFF); 243 243 244 - if (!iter->clips || !drm_rect_equals(&state->src, &old_state->src)) { 244 + if (!iter->clips || state->ignore_damage_clips || 245 + !drm_rect_equals(&state->src, &old_state->src)) { 245 246 iter->clips = NULL; 246 247 iter->num_clips = 0; 247 248 iter->full_update = true;
+10
include/drm/drm_plane.h
··· 195 195 struct drm_property_blob *fb_damage_clips; 196 196 197 197 /** 198 + * @ignore_damage_clips: 199 + * 200 + * Set by drivers to indicate the drm_atomic_helper_damage_iter_init() 201 + * helper that the @fb_damage_clips blob property should be ignored. 202 + * 203 + * See :ref:`damage_tracking_properties` for more information. 204 + */ 205 + bool ignore_damage_clips; 206 + 207 + /** 198 208 * @src: 199 209 * 200 210 * source coordinates of the plane (in 16.16).