From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH v3 04/10] drm/damage-helper: Test src coord in drm_atomic_helper_check_plane_damage()
Date: Wed, 27 May 2026 15:11:57 +0000 [thread overview]
Message-ID: <20260527151157.C79751F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260527145113.241595-5-tzimmermann@suse.de>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Comparing plane `src` coordinates before `atomic_check` clips them causes unintended full frame updates for partially off-screen planes.
- [Low] Removal of unit tests for `src` coordinate changes without replacing them causes a loss of critical test coverage.
--
commit 70283d9d64d3987145c43d7d6e7df2c84b0de6ae
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/damage-helper: Test src coord in drm_atomic_helper_check_plane_damage()
This commit evaluates plane source coordinate changes during the atomic check
phase instead of the atomic commit phase. It sets the ignore_damage_clips flag
in the plane state if coordinates change and removes related unit tests.
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1034,7 +1034,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
>
> drm_atomic_helper_plane_changed(state, old_plane_state, new_plane_state, plane);
>
> - drm_atomic_helper_check_plane_damage(state, new_plane_state);
> + drm_atomic_helper_check_plane_damage(state, old_plane_state, new_plane_state);
[Severity: Medium]
Is there a risk of unintended full frame updates for partially off-screen
planes here?
When userspace requests an update, the DRM core provides unclipped coordinates
into new_plane_state->src. The old_plane_state->src retains the coordinates
from the previous commit, which were already clipped during that commit's
atomic check phase via drm_atomic_helper_check_plane_state().
Because drm_atomic_helper_check_plane_damage() now performs the
drm_rect_equals check before atomic_check scales and clips the new
coordinates, does it erroneously detect a change in src and permanently latch
ignore_damage_clips = true? This could cause any plane positioned partially
off-screen to continuously ignore damage clips and perform a full update on
every single frame.
Note: This regression is fixed later in the patch series by commit
"drm/atomic_helper: Do not evaluate plane damage before atomic_check".
>
> if (!funcs || !funcs->atomic_check)
> continue;
[ ... ]
> diff --git a/drivers/gpu/drm/tests/drm_damage_helper_test.c b/drivers/gpu/drm/tests/drm_damage_helper_test.c
> --- a/drivers/gpu/drm/tests/drm_damage_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_damage_helper_test.c
[ ... ]
> -static void drm_test_damage_iter_no_damage_src_moved(struct kunit *test)
> -{
> - struct drm_damage_mock *mock = test->priv;
> - struct drm_atomic_helper_damage_iter iter;
> - struct drm_rect clip;
> - u32 num_hits = 0;
> -
> - /* Plane src moved since old plane state. */
> - set_plane_src(&mock->old_state, 0, 0, 1024 << 16, 768 << 16);
> - set_plane_src(&mock->state, 10 << 16, 10 << 16,
> - (10 + 1024) << 16, (10 + 768) << 16);
> - drm_atomic_helper_damage_iter_init(&iter, &mock->old_state, &mock->state);
> - drm_atomic_for_each_plane_damage(&iter, &clip)
> - num_hits++;
> -
> - KUNIT_EXPECT_EQ_MSG(test, num_hits, 1, "Should return plane src as damage.");
> - check_damage_clip(test, &clip, 10, 10, 1034, 778);
> -}
[Severity: Low]
Does the removal of these unit tests cause a loss of valuable test coverage?
The commit message mentions there is a separate unit test for when
ignore_damage_clips is true, but without these removed tests, there are no
longer any tests ensuring that moving the src coordinates actually correctly
sets ignore_damage_clips = true via drm_atomic_helper_check_plane_damage().
Instead of completely deleting these tests, could they have been adapted to
call drm_atomic_helper_check_plane_damage() prior to initializing the
iterator, preserving the validation of the source coordinate tracking logic?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260527145113.241595-1-tzimmermann@suse.de?part=4
next prev parent reply other threads:[~2026-05-27 15:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 14:46 [PATCH v3 00/10] Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 01/10] drm/damage-helper: Do not alter damage clips on modeset, but ignore them Thomas Zimmermann
2026-05-27 15:19 ` sashiko-bot
2026-05-28 6:14 ` Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 02/10] drm/atomic-helpers: Evaluate plane damage after atomic_check Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 03/10] drm/ingenic: Remove calls to drm_atomic_helper_check_plane_damage() Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 04/10] drm/damage-helper: Test src coord in drm_atomic_helper_check_plane_damage() Thomas Zimmermann
2026-05-27 15:11 ` sashiko-bot [this message]
2026-05-27 14:46 ` [PATCH v3 05/10] drm/appletbdrm: Allocate request/response buffers in begin_fb_access Thomas Zimmermann
2026-05-27 15:42 ` sashiko-bot
2026-05-28 6:26 ` Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 06/10] drm/damage-helper: Remove old state from drm_atomic_helper_damage_iter_init() Thomas Zimmermann
2026-05-27 15:07 ` sashiko-bot
2026-05-27 14:46 ` [PATCH v3 07/10] drm/damage-helper: Remove old state from drm_atomic_helper_damage_merged() Thomas Zimmermann
2026-05-27 15:10 ` sashiko-bot
2026-05-28 6:20 ` Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 08/10] drm/atomic_helper: Do not evaluate plane damage before atomic_check Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 09/10] drm/damage-helper: Rename state parameters in damage helpers Thomas Zimmermann
2026-05-27 14:46 ` [PATCH v3 10/10] drm/vmwgfx: Remove unused field struct vmwgfx_du_update_plane.old_state Thomas Zimmermann
2026-05-27 15:22 ` sashiko-bot
2026-05-28 6:21 ` Thomas Zimmermann
2026-05-27 15:17 ` [PATCH v3 00/10] drm: Improve logic behind damage handling Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260527151157.C79751F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox