* [PATCH 0/2] drm/virtio: Damage clip fixes
@ 2026-09-03 21:15 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
0 siblings, 2 replies; 4+ messages in thread
From: Lyude Paul @ 2026-09-03 21:15 UTC (permalink / raw)
To: dri-devel, virtualization, linux-kernel
Cc: Dmitry Osipenko, David Airlie, Maarten Lankhorst, linux-kernel,
Simona Vetter, Gerd Hoffmann, Thomas Zimmermann, Maxime Ripard,
Christian Hergert, Lyude Paul
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
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [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
1 sibling, 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-03 21:27 ` sashiko-bot
1 sibling, 1 reply; 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 2/2] drm/virtio: Recalculate ignore_damage_clips on every update
2026-09-03 21:15 ` [PATCH 2/2] drm/virtio: Recalculate ignore_damage_clips on every update Lyude Paul
@ 2026-09-03 21:27 ` sashiko-bot
0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-09-03 21:27 UTC (permalink / raw)
To: Lyude Paul; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Preexisting bug in vmwgfx: Plane state duplication permanently preserves ignore_damage_clips, disabling partial updates.
--
commit 18671312bd2be6fe18c7092369d0bbfb67a39103
Author: Christian Hergert <christian@sourceandstack.com>
drm/virtio: Recalculate ignore_damage_clips on every update
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.
> 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;
[Severity: High]
This is a pre-existing issue, but does the same problem exist in vmwgfx?
Looking at vmw_du_primary_plane_atomic_check() in
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c:
if (old_fb != new_fb)
new_state->ignore_damage_clips = true;
When old_fb == new_fb, it fails to clear the flag.
Once the flag is set to true during a page flip, won't it remain permanently
true across future state duplications?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903211914.1109100-1-lyude@redhat.com?part=2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-03 21:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-03 21:27 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox