All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Beat M. Liechti" <beat@softbase.tech>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/msm/dpu: don't reassign resources on color management changes
Date: Sun, 01 Nov 2026 10:15:02 +0000	[thread overview]
Message-ID: <sashiko-outbox-192352@kernel.org> (raw)
In-Reply-To: <20261101095754.33840-1-beat@softbase.tech>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/msm/dpu: legacy CTM check in msm_atomic_check() overrides dpu_crtc_check_mode_changed()
--

commit d6607b12584d4668388dbb5415d60630f0aba092
Author: Beat M. Liechti <beat@softbase.tech>

drm/msm/dpu: don't reassign resources on color management changes

This commit stops reallocating hardware resources in dpu_crtc_atomic_check()
on plain color_mgmt_changed updates, and instead forces a full modeset in
dpu_crtc_check_mode_changed() when the combined CTM or GAMMA_LUT requirement
for DSPP blocks changes on an enabled CRTC.

> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 77a2d1f6700d0..d1cd3c6e2e3ab 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -1516,6 +1516,20 @@ int dpu_crtc_check_mode_changed(struct drm_crtc_state *old_crtc_state,
>  	    (!clone_mode_requested && clone_mode_enabled))
>  		new_crtc_state->mode_changed = true;
>  
> +	/*
> +	 * DSPP blocks are reserved only when CTM or GAMMA_LUT is set (see
> +	 * dpu_crtc_get_topology()), so enabling or disabling color management
> +	 * changes the hardware topology. Changing resources on an active CRTC
> +	 * requires a full modeset; otherwise the CTL/LM blocks get swapped
> +	 * underneath a running pipeline.
> +	 */
> +	if (new_crtc_state->enable &&
> +	    (!!(old_crtc_state->ctm || old_crtc_state->gamma_lut) !=
> +	     !!(new_crtc_state->ctm || new_crtc_state->gamma_lut))) {
> +		new_crtc_state->mode_changed = true;
> +		new_crtc_state->state->allow_modeset = true;
> +	}

[Severity: Medium]
In dpu_crtc_check_mode_changed(), this check tests the combined
(ctm || gamma_lut) state on an enabled CRTC so that a modeset is only forced
when DSPP block reservation in dpu_crtc_get_topology() actually changes.

However, msm_atomic_check() in drivers/gpu/drm/msm/msm_atomic.c runs right
before kms->funcs->check_mode_changed() and still contains the earlier
CTM-only loop:

drivers/gpu/drm/msm/msm_atomic.c:msm_atomic_check() {
	/*
	 * FIXME: stop setting allow_modeset and move this check to the DPU
	 * driver.
	 */
	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
				      new_crtc_state, i) {
		if ((old_crtc_state->ctm && !new_crtc_state->ctm) ||
		    (!old_crtc_state->ctm && new_crtc_state->ctm)) {
			new_crtc_state->mode_changed = true;
			state->allow_modeset = true;
		}
	}

	if (kms && kms->funcs && kms->funcs->check_mode_changed)
		ret = kms->funcs->check_mode_changed(kms, state);
}

Because msm_atomic_check() unconditionally sets new_crtc_state->mode_changed
and state->allow_modeset whenever ctm is toggled, won't toggling ctm while
gamma_lut is already active still force an unnecessary full modeset and
resource reallocation even though DSPP blocks are already reserved, and also
bypass the new_crtc_state->enable guard when disabling a CRTC that had ctm
set?

Since DPU is the only sub-driver in drivers/gpu/drm/msm/ that enables color
management via drm_crtc_enable_color_mgmt(), should that CTM loop in
msm_atomic_check() be removed now that dpu_crtc_check_mode_changed() handles
both ctm and gamma_lut?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261101095754.33840-1-beat@softbase.tech?part=1

  reply	other threads:[~2026-11-01 10:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01  9:57 [PATCH] drm/msm/dpu: don't reassign resources on color management changes Beat M. Liechti
2026-11-01 10:15 ` sashiko-bot [this message]
2026-11-01 10:58 ` Dmitry Baryshkov
2026-11-01 12:26 ` [PATCH v2 0/2] drm/msm: fix CTL/LM swap " Beat M. Liechti
2026-11-01 12:26   ` [PATCH v2 1/2] drm/msm/dpu: don't reassign resources " Beat M. Liechti
2026-11-01 12:26   ` [PATCH v2 2/2] drm/msm: drop the CTM modeset hack from msm_atomic_check() Beat M. Liechti

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=sashiko-outbox-192352@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=beat@softbase.tech \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.