* [PATCH 1/2] drm/virtio: preserve damage clips for rendered resources
2026-09-03 21:15 [PATCH 0/2] drm/virtio: Damage clip fixes Lyude Paul
@ 2026-09-03 21:15 ` Lyude Paul
2026-09-03 21:15 ` [PATCH 2/2] drm/virtio: Recalculate ignore_damage_clips on every update Lyude Paul
2026-09-07 12:45 ` [PATCH 0/2] drm/virtio: Damage clip fixes Dmitry Osipenko
2 siblings, 0 replies; 4+ messages in thread
From: Lyude Paul @ 2026-09-03 21:15 UTC (permalink / raw)
To: dri-devel, virtualization, linux-kernel
Cc: Christian Hergert, Dmitry Osipenko, David Airlie,
Maarten Lankhorst, linux-kernel, Simona Vetter, Gerd Hoffmann,
Thomas Zimmermann, Maxime Ripard, Lyude Paul
From: Christian Hergert <christian@sourceandstack.com>
virtio_gpu_plane_atomic_check() unconditionally ignores FB_DAMAGE_CLIPS
when the framebuffer changes. This forces a full resource flush on every
page flip when a compositor rotates through multiple framebuffers, even
when userspace supplies accumulated per-buffer damage.
The full update is required for dumb buffers because their contents are
uploaded per buffer. Rendered resources are already coherent on the host,
so replacing their damage with the full plane only discards useful
information.
Restrict ignore_damage_clips to dumb buffers. This allows damage-aware
compositors to propagate partial updates through RESOURCE_FLUSH while
preserving the existing full-upload behavior for dumb buffers.
Signed-off-by: Christian Hergert <christian@sourceandstack.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
---
drivers/gpu/drm/virtio/virtgpu_plane.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index 1d1b27ece62a7..d9579a4b4714c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -103,6 +103,7 @@ static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
plane);
struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state,
plane);
+ struct virtio_gpu_object *bo;
bool is_cursor = plane->type == DRM_PLANE_TYPE_CURSOR;
struct drm_crtc_state *crtc_state;
int ret;
@@ -113,9 +114,12 @@ static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
/*
* Ignore damage clips if the framebuffer attached to the plane's state
* has changed since the last plane update (page-flip). In this case, a
- * full plane update should happen because uploads are done per-buffer.
+ * full plane update should happen for dumb buffers because uploads are
+ * done per-buffer. Rendered resources are already coherent on the host,
+ * so preserve userspace's accumulated per-buffer damage for those.
*/
- if (old_plane_state->fb != new_plane_state->fb)
+ bo = gem_to_virtio_gpu_obj(new_plane_state->fb->obj[0]);
+ if (old_plane_state->fb != new_plane_state->fb && bo->dumb)
new_plane_state->ignore_damage_clips = true;
crtc_state = drm_atomic_get_crtc_state(state,
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drm/virtio: Recalculate ignore_damage_clips on every update
2026-09-03 21:15 [PATCH 0/2] drm/virtio: Damage clip fixes Lyude Paul
2026-09-03 21:15 ` [PATCH 1/2] drm/virtio: preserve damage clips for rendered resources Lyude Paul
@ 2026-09-03 21:15 ` Lyude Paul
2026-09-07 12:45 ` [PATCH 0/2] drm/virtio: Damage clip fixes Dmitry Osipenko
2 siblings, 0 replies; 4+ messages in thread
From: Lyude Paul @ 2026-09-03 21:15 UTC (permalink / raw)
To: dri-devel, virtualization, linux-kernel
Cc: Christian Hergert, Dmitry Osipenko, David Airlie,
Maarten Lankhorst, linux-kernel, Simona Vetter, Gerd Hoffmann,
Thomas Zimmermann, Maxime Ripard, Lyude Paul
From: Christian Hergert <christian@sourceandstack.com>
Plane state duplication preserves ignore_damage_clips. Once fbdev sets
it for a dumb buffer, later updates using rendered resources continue to
ignore damage because the flag is never cleared.
Assign ignore_damage_clips on every atomic check so rendered resources
can use supplied damage after an earlier dumb-buffer update.
Signed-off-by: Christian Hergert <christian@sourceandstack.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
---
drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index d9579a4b4714c..95ec688690d3a 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -119,8 +119,8 @@ static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
* so preserve userspace's accumulated per-buffer damage for those.
*/
bo = gem_to_virtio_gpu_obj(new_plane_state->fb->obj[0]);
- if (old_plane_state->fb != new_plane_state->fb && bo->dumb)
- new_plane_state->ignore_damage_clips = true;
+ new_plane_state->ignore_damage_clips =
+ old_plane_state->fb != new_plane_state->fb && bo->dumb;
crtc_state = drm_atomic_get_crtc_state(state,
new_plane_state->crtc);
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] drm/virtio: Damage clip fixes
2026-09-03 21:15 [PATCH 0/2] drm/virtio: Damage clip fixes Lyude Paul
2026-09-03 21:15 ` [PATCH 1/2] drm/virtio: preserve damage clips for rendered resources Lyude Paul
2026-09-03 21:15 ` [PATCH 2/2] drm/virtio: Recalculate ignore_damage_clips on every update Lyude Paul
@ 2026-09-07 12:45 ` Dmitry Osipenko
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2026-09-07 12:45 UTC (permalink / raw)
To: Lyude Paul, dri-devel, virtualization, linux-kernel
Cc: David Airlie, Maarten Lankhorst, linux-kernel, Simona Vetter,
Gerd Hoffmann, Thomas Zimmermann, Maxime Ripard,
Christian Hergert
On 9/4/26 00:15, Lyude Paul wrote:
> A previous associate of mine asked if someone would be able to help with
> upstreaming some work that they had done recently for virtio, and I was
> more then happy to help. These fixes help maintain FB damage clips
> between framebuffer changes, which were previously discarded even when
> userspace provided accumulated per-buffer damage.
>
> Patches apply on top of drm-misc/drm-misc-next.
>
> Christian Hergert (2):
> drm/virtio: preserve damage clips for rendered resources
> drm/virtio: Recalculate ignore_damage_clips on every update
>
> drivers/gpu/drm/virtio/virtgpu_plane.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
>
> base-commit: f9c2f70ee41544717b3c209083073db1e21f919b
Looks okay. Will merge after testing.
--
Best regards,
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread