* [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage
@ 2023-11-15 13:15 Javier Martinez Canillas
2023-11-15 13:15 ` [PATCH v2 2/5] drm/virtio: Disable damage clipping if FB changed since last page-flip Javier Martinez Canillas
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2023-11-15 13:15 UTC (permalink / raw)
To: linux-kernel
Cc: Maxime Ripard, Bilal Elmoussaoui, Simon Ser, Erico Nunes,
Pekka Paalanen, Thomas Zimmermann, Sima Vetter,
Javier Martinez Canillas, Chia-I Wu, Daniel Vetter, David Airlie,
David Airlie, Gerd Hoffmann, Gurchetan Singh, Jonathan Corbet,
Maarten Lankhorst, VMware Graphics Reviewers, Zack Rusin,
dri-devel, linux-doc, virtualization
Hello,
This series is to fix an issue that surfaced after damage clipping was
enabled for the virtio-gpu by commit 01f05940a9a7 ("drm/virtio: Enable
fb damage clips property for the primary plane").
After that change, flickering artifacts was reported to be present with
both weston and wlroots wayland compositors when running in a virtual
machine. The cause was identified by Sima Vetter, who pointed out that
virtio-gpu does per-buffer uploads and for this reason it needs to do
a buffer damage handling, instead of frame damage handling.
Their suggestion was to extend the damage helpers to cover that case
and given that there's isn't a buffer damage accumulation algorithm
(e.g: buffer age), just do a full plane update if the framebuffer that
is attached to a plane changed since the last plane update (page-flip).
It is a v2 that addresses issues pointed out by Thomas Zimmermann in v1:
https://lists.freedesktop.org/archives/dri-devel/2023-November/430138.html
Patch #1 adds a ignore_damage_clips field to struct drm_plane_state to be
set by drivers that want the damage helpers to ignore the damage clips.
Patch #2 fixes the virtio-gpu damage handling logic by asking the damage
helper to ignore the damage clips if the framebuffer attached to a plane
has changed since the last page-flip.
Patch #3 does the same but for the vmwgfx driver that also needs to handle
buffer damage and should have the same issue (although I haven't tested it
due not having a VMWare setup).
Patch #4 adds to the KMS damage tracking kernel-doc some paragraphs about
damage tracking types and references to links that explain frame damage vs
buffer damage.
Finally patch #5 adds an item to the DRM todo, about the need to implement
some buffer damage accumulation algorithm instead of just doing full plane
updates in this case.
Because commit 01f05940a9a7 landed in v6.4, the first 2 patches are marked
as Fixes and Cc stable.
I've tested this on a VM with weston, was able to reproduce the issue
reported and the patches did fix the problem.
Best regards,
Javier
Changes in v2:
- Add a struct drm_plane_state .ignore_damage_clips to set in the plane's
.atomic_check, instead of having different helpers (Thomas Zimmermann).
- Set struct drm_plane_state .ignore_damage_clips in virtio-gpu plane's
.atomic_check instead of using a different helpers (Thomas Zimmermann).
- Set struct drm_plane_state .ignore_damage_clips in vmwgfx plane's
.atomic_check instead of using a different helpers (Thomas Zimmermann).
Javier Martinez Canillas (5):
drm: Allow drivers to indicate the damage helpers to ignore damage
clips
drm/virtio: Disable damage clipping if FB changed since last page-flip
drm/vmwgfx: Disable damage clipping if FB changed since last page-flip
drm/plane: Extend damage tracking kernel-doc
drm/todo: Add entry about implementing buffer age for damage tracking
Documentation/gpu/todo.rst | 20 ++++++++++++++++++++
drivers/gpu/drm/drm_damage_helper.c | 3 ++-
drivers/gpu/drm/drm_plane.c | 20 ++++++++++++++++++++
drivers/gpu/drm/virtio/virtgpu_plane.c | 10 ++++++++++
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 11 +++++++++++
include/drm/drm_plane.h | 8 ++++++++
6 files changed, 71 insertions(+), 1 deletion(-)
--
2.41.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/5] drm/virtio: Disable damage clipping if FB changed since last page-flip
2023-11-15 13:15 [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage Javier Martinez Canillas
@ 2023-11-15 13:15 ` Javier Martinez Canillas
2023-11-16 4:04 ` [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage Zack Rusin
2023-11-16 12:07 ` Thomas Zimmermann
2 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2023-11-15 13:15 UTC (permalink / raw)
To: linux-kernel
Cc: Maxime Ripard, Bilal Elmoussaoui, Simon Ser, Erico Nunes,
Pekka Paalanen, Thomas Zimmermann, Sima Vetter,
Javier Martinez Canillas, stable, nerdopolis, Chia-I Wu,
Daniel Vetter, David Airlie, Gerd Hoffmann, Gurchetan Singh,
Maarten Lankhorst, dri-devel, virtualization
The driver does per-buffer uploads and needs to force a full plane update
if the plane's attached framebuffer has change since the last 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: Sima Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
Changes in v2:
- Set struct drm_plane_state .ignore_damage_clips in virtio-gpu plane's
.atomic_check instead of using a different helpers (Thomas Zimmermann).
drivers/gpu/drm/virtio/virtgpu_plane.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index a2e045f3a000..a1ef657eba07 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -79,6 +79,8 @@ static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
{
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
plane);
+ struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state,
+ plane);
bool is_cursor = plane->type == DRM_PLANE_TYPE_CURSOR;
struct drm_crtc_state *crtc_state;
int ret;
@@ -86,6 +88,14 @@ static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc))
return 0;
+ /*
+ * 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.
+ */
+ if (old_plane_state->fb != new_plane_state->fb)
+ new_plane_state->ignore_damage_clips = true;
+
crtc_state = drm_atomic_get_crtc_state(state,
new_plane_state->crtc);
if (IS_ERR(crtc_state))
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage
2023-11-15 13:15 [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage Javier Martinez Canillas
2023-11-15 13:15 ` [PATCH v2 2/5] drm/virtio: Disable damage clipping if FB changed since last page-flip Javier Martinez Canillas
@ 2023-11-16 4:04 ` Zack Rusin
2023-11-16 7:46 ` Javier Martinez Canillas
2023-11-16 12:07 ` Thomas Zimmermann
2 siblings, 1 reply; 5+ messages in thread
From: Zack Rusin @ 2023-11-16 4:04 UTC (permalink / raw)
To: linux-kernel@vger.kernel.org, javierm@redhat.com
Cc: corbet@lwn.net, olvaffe@gmail.com, daniel.vetter@ffwll.ch,
nunes.erico@gmail.com, airlied@redhat.com,
pekka.paalanen@collabora.com, tzimmermann@suse.de,
belmouss@redhat.com, mripard@kernel.org, daniel@ffwll.ch,
gurchetansingh@chromium.org, maarten.lankhorst@linux.intel.com,
dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org,
kraxel@redhat.com, virtualization@lists.linux.dev,
airlied@gmail.com, Linux-graphics-maintainer, contact@emersion.fr
On Wed, 2023-11-15 at 14:15 +0100, Javier Martinez Canillas wrote:
> Hello,
>
> This series is to fix an issue that surfaced after damage clipping was
> enabled for the virtio-gpu by commit 01f05940a9a7 ("drm/virtio: Enable
> fb damage clips property for the primary plane").
>
> After that change, flickering artifacts was reported to be present with
> both weston and wlroots wayland compositors when running in a virtual
> machine. The cause was identified by Sima Vetter, who pointed out that
> virtio-gpu does per-buffer uploads and for this reason it needs to do
> a buffer damage handling, instead of frame damage handling.
>
> Their suggestion was to extend the damage helpers to cover that case
> and given that there's isn't a buffer damage accumulation algorithm
> (e.g: buffer age), just do a full plane update if the framebuffer that
> is attached to a plane changed since the last plane update (page-flip).
>
> It is a v2 that addresses issues pointed out by Thomas Zimmermann in v1:
> https://lists.freedesktop.org/archives/dri-devel/2023-November/430138.html
>
> Patch #1 adds a ignore_damage_clips field to struct drm_plane_state to be
> set by drivers that want the damage helpers to ignore the damage clips.
>
> Patch #2 fixes the virtio-gpu damage handling logic by asking the damage
> helper to ignore the damage clips if the framebuffer attached to a plane
> has changed since the last page-flip.
>
> Patch #3 does the same but for the vmwgfx driver that also needs to handle
> buffer damage and should have the same issue (although I haven't tested it
> due not having a VMWare setup).
>
> Patch #4 adds to the KMS damage tracking kernel-doc some paragraphs about
> damage tracking types and references to links that explain frame damage vs
> buffer damage.
>
> Finally patch #5 adds an item to the DRM todo, about the need to implement
> some buffer damage accumulation algorithm instead of just doing full plane
> updates in this case.
>
> Because commit 01f05940a9a7 landed in v6.4, the first 2 patches are marked
> as Fixes and Cc stable.
>
> I've tested this on a VM with weston, was able to reproduce the issue
> reported and the patches did fix the problem.
>
> Best regards,
> Javier
>
> Changes in v2:
> - Add a struct drm_plane_state .ignore_damage_clips to set in the plane's
> .atomic_check, instead of having different helpers (Thomas Zimmermann).
> - Set struct drm_plane_state .ignore_damage_clips in virtio-gpu plane's
> .atomic_check instead of using a different helpers (Thomas Zimmermann).
> - Set struct drm_plane_state .ignore_damage_clips in vmwgfx plane's
> .atomic_check instead of using a different helpers (Thomas Zimmermann).
The series looks good to me, thanks for tackling this. I'm surprised that we don't
have any IGT tests for this. Seems like it shouldn't be too hard to test it in a
generic way with just a couple of dumb buffers.
z
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage
2023-11-16 4:04 ` [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage Zack Rusin
@ 2023-11-16 7:46 ` Javier Martinez Canillas
0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2023-11-16 7:46 UTC (permalink / raw)
To: Zack Rusin, linux-kernel@vger.kernel.org
Cc: corbet@lwn.net, olvaffe@gmail.com, daniel.vetter@ffwll.ch,
nunes.erico@gmail.com, airlied@redhat.com,
pekka.paalanen@collabora.com, tzimmermann@suse.de,
belmouss@redhat.com, mripard@kernel.org, daniel@ffwll.ch,
gurchetansingh@chromium.org, maarten.lankhorst@linux.intel.com,
dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org,
kraxel@redhat.com, virtualization@lists.linux.dev,
airlied@gmail.com, Linux-graphics-maintainer, contact@emersion.fr
Zack Rusin <zackr@vmware.com> writes:
Hello Zack,
> On Wed, 2023-11-15 at 14:15 +0100, Javier Martinez Canillas wrote:
[...]
>>
>> Changes in v2:
>> - Add a struct drm_plane_state .ignore_damage_clips to set in the plane's
>> .atomic_check, instead of having different helpers (Thomas Zimmermann).
>> - Set struct drm_plane_state .ignore_damage_clips in virtio-gpu plane's
>> .atomic_check instead of using a different helpers (Thomas Zimmermann).
>> - Set struct drm_plane_state .ignore_damage_clips in vmwgfx plane's
>> .atomic_check instead of using a different helpers (Thomas Zimmermann).
>
> The series looks good to me, thanks for tackling this. I'm surprised that we don't
Thanks. Can I get your r-b or a-b ?
> have any IGT tests for this. Seems like it shouldn't be too hard to test it in a
> generic way with just a couple of dumb buffers.
>
Yes, I haven't looked at it but also think that shouldn't be that hard.
> z
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage
2023-11-15 13:15 [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage Javier Martinez Canillas
2023-11-15 13:15 ` [PATCH v2 2/5] drm/virtio: Disable damage clipping if FB changed since last page-flip Javier Martinez Canillas
2023-11-16 4:04 ` [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage Zack Rusin
@ 2023-11-16 12:07 ` Thomas Zimmermann
2 siblings, 0 replies; 5+ messages in thread
From: Thomas Zimmermann @ 2023-11-16 12:07 UTC (permalink / raw)
To: Javier Martinez Canillas, linux-kernel
Cc: Maxime Ripard, Bilal Elmoussaoui, Simon Ser, Erico Nunes,
Pekka Paalanen, Sima Vetter, Chia-I Wu, Daniel Vetter,
David Airlie, David Airlie, Gerd Hoffmann, Gurchetan Singh,
Jonathan Corbet, Maarten Lankhorst, VMware Graphics Reviewers,
Zack Rusin, dri-devel, linux-doc, virtualization
[-- Attachment #1.1: Type: text/plain, Size: 3985 bytes --]
Hi Javier,
please take my
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
for the whole patch set. Maybe consider my comment on patch 4.
Best regards
Thomas
Am 15.11.23 um 14:15 schrieb Javier Martinez Canillas:
> Hello,
>
> This series is to fix an issue that surfaced after damage clipping was
> enabled for the virtio-gpu by commit 01f05940a9a7 ("drm/virtio: Enable
> fb damage clips property for the primary plane").
>
> After that change, flickering artifacts was reported to be present with
> both weston and wlroots wayland compositors when running in a virtual
> machine. The cause was identified by Sima Vetter, who pointed out that
> virtio-gpu does per-buffer uploads and for this reason it needs to do
> a buffer damage handling, instead of frame damage handling.
>
> Their suggestion was to extend the damage helpers to cover that case
> and given that there's isn't a buffer damage accumulation algorithm
> (e.g: buffer age), just do a full plane update if the framebuffer that
> is attached to a plane changed since the last plane update (page-flip).
>
> It is a v2 that addresses issues pointed out by Thomas Zimmermann in v1:
> https://lists.freedesktop.org/archives/dri-devel/2023-November/430138.html
>
> Patch #1 adds a ignore_damage_clips field to struct drm_plane_state to be
> set by drivers that want the damage helpers to ignore the damage clips.
>
> Patch #2 fixes the virtio-gpu damage handling logic by asking the damage
> helper to ignore the damage clips if the framebuffer attached to a plane
> has changed since the last page-flip.
>
> Patch #3 does the same but for the vmwgfx driver that also needs to handle
> buffer damage and should have the same issue (although I haven't tested it
> due not having a VMWare setup).
>
> Patch #4 adds to the KMS damage tracking kernel-doc some paragraphs about
> damage tracking types and references to links that explain frame damage vs
> buffer damage.
>
> Finally patch #5 adds an item to the DRM todo, about the need to implement
> some buffer damage accumulation algorithm instead of just doing full plane
> updates in this case.
>
> Because commit 01f05940a9a7 landed in v6.4, the first 2 patches are marked
> as Fixes and Cc stable.
>
> I've tested this on a VM with weston, was able to reproduce the issue
> reported and the patches did fix the problem.
>
> Best regards,
> Javier
>
> Changes in v2:
> - Add a struct drm_plane_state .ignore_damage_clips to set in the plane's
> .atomic_check, instead of having different helpers (Thomas Zimmermann).
> - Set struct drm_plane_state .ignore_damage_clips in virtio-gpu plane's
> .atomic_check instead of using a different helpers (Thomas Zimmermann).
> - Set struct drm_plane_state .ignore_damage_clips in vmwgfx plane's
> .atomic_check instead of using a different helpers (Thomas Zimmermann).
>
> Javier Martinez Canillas (5):
> drm: Allow drivers to indicate the damage helpers to ignore damage
> clips
> drm/virtio: Disable damage clipping if FB changed since last page-flip
> drm/vmwgfx: Disable damage clipping if FB changed since last page-flip
> drm/plane: Extend damage tracking kernel-doc
> drm/todo: Add entry about implementing buffer age for damage tracking
>
> Documentation/gpu/todo.rst | 20 ++++++++++++++++++++
> drivers/gpu/drm/drm_damage_helper.c | 3 ++-
> drivers/gpu/drm/drm_plane.c | 20 ++++++++++++++++++++
> drivers/gpu/drm/virtio/virtgpu_plane.c | 10 ++++++++++
> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 11 +++++++++++
> include/drm/drm_plane.h | 8 ++++++++
> 6 files changed, 71 insertions(+), 1 deletion(-)
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-11-16 12:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-15 13:15 [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage Javier Martinez Canillas
2023-11-15 13:15 ` [PATCH v2 2/5] drm/virtio: Disable damage clipping if FB changed since last page-flip Javier Martinez Canillas
2023-11-16 4:04 ` [PATCH v2 0/5] drm: Allow the damage helpers to handle buffer damage Zack Rusin
2023-11-16 7:46 ` Javier Martinez Canillas
2023-11-16 12:07 ` Thomas Zimmermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox