Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: mripard@kernel.org, maarten.lankhorst@linux.intel.com,
	airlied@redhat.com, airlied@gmail.com, simona@ffwll.ch,
	admin@kodeit.net, gargaditya08@proton.me, paul@crapouillou.net,
	jani.nikula@linux.intel.com, mhklkml@zohomail.com,
	zack.rusin@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
	harry.wentland@amd.com, sunpeng.li@amd.com, siqueira@igalia.com,
	alexander.deucher@amd.com, rodrigo.vivi@intel.com,
	joonas.lahtinen@linux.intel.com, tursulin@ursulin.net,
	javierm@redhat.com, dmitry.osipenko@collabora.com,
	gurchetansingh@chromium.org, olvaffe@gmail.com,
	dri-devel@lists.freedesktop.org, linux-hyperv@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	linux-mips@vger.kernel.org, virtualization@lists.linux.dev,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v5 07/15] drm/damage-helper: Do not alter damage clips on modeset, but ignore them
Date: Sat, 5 Dec 2026 01:12:29 +0200	[thread overview]
Message-ID: <axNGjVDqcPbrEbxf@intel.com> (raw)
In-Reply-To: <20260610152505.260172-8-tzimmermann@suse.de>

On Wed, Jun 10, 2026 at 05:18:23PM +0200, Thomas Zimmermann wrote:
> User space supplies rectangles for damage clipping in a plane property.
> For full mode sets, drivers still require a full plane update. In this
> case, leave the information as-is and set the ignore_damage_clips flag
> instead. The damage iterator will later ignore any damage information.
> 
> Leaving the damage information as-is might be helpful to drivers that
> benefit from this information even on full modesets (e.g., for cache
> management). It will also help with consolidating the damage-handling
> logic.
> 
> Also add a new unit test that evaluates the ignore_damage_clips flag. It
> sets two damage clips plus the flag and tests if the reported damage
> covers the entire framebuffer.
> 
> v5:
> - clear ignore_damage_clips in a separate patch (Javier)
> v4:
> - slightly reword the commit description
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> Acked-by: Zack Rusin <zack.rusin@broadcom.com>
> ---
>  drivers/gpu/drm/drm_damage_helper.c           |  6 ++--
>  .../gpu/drm/tests/drm_damage_helper_test.c    | 28 +++++++++++++++++++
>  2 files changed, 30 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_damage_helper.c b/drivers/gpu/drm/drm_damage_helper.c
> index 74a7f4252ecf..945fac8dc27b 100644
> --- a/drivers/gpu/drm/drm_damage_helper.c
> +++ b/drivers/gpu/drm/drm_damage_helper.c
> @@ -78,10 +78,8 @@ void drm_atomic_helper_check_plane_damage(struct drm_atomic_commit *state,
>  		if (WARN_ON(!crtc_state))
>  			return;
>  
> -		if (drm_atomic_crtc_needs_modeset(crtc_state)) {
> -			drm_property_blob_put(plane_state->fb_damage_clips);
> -			plane_state->fb_damage_clips = NULL;
> -		}
> +		if (drm_atomic_crtc_needs_modeset(crtc_state))
> +			plane_state->ignore_damage_clips = true;

OK, so this part I like in that it stops clobbering the uapi state.

However what I was suggesting earlier that you could take this further
and just store the final merged damage into plane_state, at
which point drivers could just stop calling the merge() function
themselves. But maybe there's some reason that doesn't work for some
driver. Shrug.

Regardless this one is
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

But for i915/xe I think we'll want to just hand roll it all. The
uapi damage is just a very early starting point for us, after which
the path forks into two completely separate directions (FBC vs. PSR),
each of which operate in various different hardware coordinate spaces.
Or that's my plan anyway, the current state of the code is not great.

>  	}
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_check_plane_damage);
> diff --git a/drivers/gpu/drm/tests/drm_damage_helper_test.c b/drivers/gpu/drm/tests/drm_damage_helper_test.c
> index 0df2e1a54b0d..64f038a62ffe 100644
> --- a/drivers/gpu/drm/tests/drm_damage_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_damage_helper_test.c
> @@ -603,6 +603,33 @@ static void drm_test_damage_iter_damage_not_visible(struct kunit *test)
>  	KUNIT_EXPECT_EQ_MSG(test, num_hits, 0, "Should not return any damage.");
>  }
>  
> +static void drm_test_damage_iter_damage_ignore(struct kunit *test)
> +{
> +	struct drm_damage_mock *mock = test->priv;
> +	struct drm_atomic_helper_damage_iter iter;
> +	struct drm_property_blob damage_blob;
> +	struct drm_mode_rect damage[2];
> +	struct drm_rect clip;
> +	u32 num_hits = 0;
> +
> +	set_plane_src(&mock->old_state, 0, 0, 1024 << 16, 768 << 16);
> +	set_plane_src(&mock->state, 0, 0, 1024 << 16, 768 << 16);
> +	/* 2 damage clips, but ignore them. */
> +	set_damage_clip(&damage[0], 20, 30, 200, 180);
> +	set_damage_clip(&damage[1], 240, 200, 280, 250);
> +	set_damage_blob(&damage_blob, &damage[0], sizeof(damage));
> +	set_plane_damage(&mock->state, &damage_blob);
> +	mock->state.ignore_damage_clips = true;
> +	drm_atomic_helper_damage_iter_init(&iter, &mock->old_state, &mock->state);
> +	drm_atomic_for_each_plane_damage(&iter, &clip) {
> +		if (num_hits == 0)
> +			check_damage_clip(test, &clip, 0, 0, 1024, 768);
> +		num_hits++;
> +	}
> +
> +	KUNIT_EXPECT_EQ_MSG(test, num_hits, 1, "Should return full-framebuffer damage.");
> +}
> +
>  static struct kunit_case drm_damage_helper_tests[] = {
>  	KUNIT_CASE(drm_test_damage_iter_no_damage),
>  	KUNIT_CASE(drm_test_damage_iter_no_damage_fractional_src),
> @@ -625,6 +652,7 @@ static struct kunit_case drm_damage_helper_tests[] = {
>  	KUNIT_CASE(drm_test_damage_iter_damage_one_outside),
>  	KUNIT_CASE(drm_test_damage_iter_damage_src_moved),
>  	KUNIT_CASE(drm_test_damage_iter_damage_not_visible),
> +	KUNIT_CASE(drm_test_damage_iter_damage_ignore),
>  	{ }
>  };
>  
> -- 
> 2.54.0

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-12-04 23:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 15:18 [PATCH v5 00/15] drm: Improve logic behind damage handling Thomas Zimmermann
2026-06-10 15:18 ` [PATCH v5 01/15] drm/amd/display: Handle struct drm_plane_state.ignore_damage_clips Thomas Zimmermann
2026-06-11 10:10   ` Javier Martinez Canillas
2026-06-11 10:41     ` Thomas Zimmermann
2026-06-11 10:59       ` Javier Martinez Canillas
2026-06-11 11:09         ` Thomas Zimmermann
2026-06-24 16:06   ` Harry Wentland
2026-06-10 15:18 ` [PATCH v5 02/15] drm/i915/display: " Thomas Zimmermann
2026-06-11 10:11   ` Javier Martinez Canillas
2026-06-10 15:18 ` [PATCH v5 03/15] drm/vboxvideo: " Thomas Zimmermann
2026-06-11 10:12   ` Javier Martinez Canillas
2026-06-10 15:18 ` [PATCH v5 04/15] drm/vmwgfx: " Thomas Zimmermann
2026-06-11 10:12   ` Javier Martinez Canillas
2026-06-10 15:18 ` [PATCH v5 05/15] drm/appletbdrm: Allocate request/response buffers in begin_fb_access Thomas Zimmermann
2026-06-10 15:18 ` [PATCH v5 06/15] drm/damage-helper: Clear ignore_damage_clips in plane-state duplication Thomas Zimmermann
2026-06-10 15:18 ` [PATCH v5 07/15] drm/damage-helper: Do not alter damage clips on modeset, but ignore them Thomas Zimmermann
2026-12-04 23:12   ` Ville Syrjälä [this message]
2026-06-10 15:18 ` [PATCH v5 08/15] drm/atomic-helpers: Evaluate plane damage after atomic_check Thomas Zimmermann
2026-06-10 15:18 ` [PATCH v5 09/15] drm/ingenic: Remove calls to drm_atomic_helper_check_plane_damage() Thomas Zimmermann
2026-06-10 15:18 ` [PATCH v5 10/15] drm/atomic_helper: Do not evaluate plane damage before atomic_check Thomas Zimmermann
2026-06-10 15:18 ` [PATCH v5 11/15] drm/damage-helper: Test src coord in drm_atomic_helper_check_plane_damage() Thomas Zimmermann
2026-06-10 15:18 ` [PATCH v5 12/15] drm/damage-helper: Remove old state from drm_atomic_helper_damage_iter_init() Thomas Zimmermann
2026-06-10 15:18 ` [PATCH v5 13/15] drm/damage-helper: Remove old state from drm_atomic_helper_damage_merged() Thomas Zimmermann
2026-06-10 15:18 ` [PATCH v5 14/15] drm/damage-helper: Rename state parameters in damage helpers Thomas Zimmermann
2026-06-10 15:18 ` [PATCH v5 15/15] drm/vmwgfx: Remove unused field struct vmwgfx_du_update_plane.old_state Thomas Zimmermann
2026-06-10 17:08 ` ✓ i915.CI.BAT: success for drm: Improve logic behind damage handling (rev4) Patchwork
2026-06-11  9:34 ` ✓ i915.CI.Full: " Patchwork

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=axNGjVDqcPbrEbxf@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=admin@kodeit.net \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gargaditya08@proton.me \
    --cc=gurchetansingh@chromium.org \
    --cc=harry.wentland@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=javierm@redhat.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mhklkml@zohomail.com \
    --cc=mripard@kernel.org \
    --cc=olvaffe@gmail.com \
    --cc=paul@crapouillou.net \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=siqueira@igalia.com \
    --cc=sunpeng.li@amd.com \
    --cc=tursulin@ursulin.net \
    --cc=tzimmermann@suse.de \
    --cc=virtualization@lists.linux.dev \
    --cc=zack.rusin@broadcom.com \
    /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