All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hugo Sales" <hugo@hsal.es>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 4/5] drm/amd/display: Commit panel_power_savings writes from the kernel
Date: Fri, 13 Nov 2026 21:28:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-213714@kernel.org> (raw)
In-Reply-To: <20261113-abm-sysfs-commit-v2-4-5808d17a7e89@hsal.es>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/amd/display: overlay plane loss in
  panel_power_savings_apply() with VRR
--

commit f07b9f0f5284e550d50d58da3cfcd7dcb7eae3b4
Author: Hugo Sales <hugo@hsal.es>

drm/amd/display: Commit panel_power_savings writes from the kernel

This commit updates panel_power_savings_store() to apply ABM level changes
through a non-modeset atomic commit instead of sending a hotplug uevent.

> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
> index 27546febf90d3..8487ac0661396 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c

[ ... ]

> @@ -712,13 +727,100 @@ ssize_t panel_power_savings_show(struct device *device,
>  }
>  EXPORT_IF_KUNIT(panel_power_savings_show);
>  
> +static int panel_power_savings_apply(struct drm_connector *connector,
> +				     unsigned int level)
> +{
> +	struct drm_connector_state *conn_state;
> +	struct dm_connector_state *dm_state;
> +	struct drm_device *dev = connector->dev;
> +	struct drm_modeset_acquire_ctx ctx;
> +	struct drm_atomic_commit *state;
> +	bool forbidden, unchanged;
> +	int ret, idx;

[ ... ]

> +retry:
> +	conn_state = drm_atomic_get_connector_state(state, connector);
> +	if (IS_ERR(conn_state)) {
> +		ret = PTR_ERR(conn_state);
> +		goto out;
> +	}
> +
> +	dm_state = to_dm_connector_state(conn_state);
> +	if (dm_state->abm_sysfs_forbidden) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +
> +	if (dm_state->abm_level == level) {
> +		ret = 0;
> +		goto out;
> +	}
> +
> +	dm_state->abm_level = level;
> +
> +	ret = drm_atomic_commit(state);

[Severity: High]
Can this commit drop active overlay planes from DC when VRR is enabled on
the CRTC?

panel_power_savings_apply() builds a non-modeset commit containing only
the connector and its CRTC, with no planes.  In amdgpu_dm_atomic_check(),
the loop that pulls in all primary and overlay planes on a CRTC runs
before drm_atomic_helper_check_planes(), while state still has no planes,
so it skips the CRTC.  Later, drm_atomic_helper_check_planes() calls
amdgpu_dm_crtc_helper_atomic_check():

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c:amdgpu_dm_crtc_helper_atomic_check() {
	...
	if (!state->legacy_cursor_update && amdgpu_dm_crtc_vrr_active(dm_crtc_state)) {
		struct drm_plane_state *primary_state;

		/* Pull in primary plane for correct VRR handling */
		primary_state = drm_atomic_get_plane_state(state, crtc->primary);
		if (IS_ERR(primary_state))
			return PTR_ERR(primary_state);
	}
	...
}

That adds only crtc->primary to state after the plane-gathering loop has
already run.  In amdgpu_dm_commit_planes(), planes_count is then 1, and
update_planes_and_stream_state() sees stream_status->plane_count !=
surface_count, elevates the update to UPDATE_TYPE_FULL, and calls
dc_state_rem_all_planes_for_stream() followed by
dc_state_add_all_planes_for_stream() with only the primary plane,
detaching any enabled overlay plane in DC while DRM state still tracks it
as active.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113-abm-sysfs-commit-v2-0-5808d17a7e89@hsal.es?part=4

  reply	other threads:[~2026-11-13 21:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 20:24 [PATCH v2 0/5] drm/amd/display: Commit panel_power_savings writes from the kernel Hugo Sales
2026-11-13 20:24 ` Hugo Sales via B4 Relay
2026-11-13 20:24 ` [PATCH v2 1/5] drm/amd/display: Render the panel power savings kernel-doc Hugo Sales
2026-11-13 20:24   ` Hugo Sales via B4 Relay
2026-11-13 20:24 ` [PATCH v2 2/5] drm/amd/display: Don't force a modeset when the ABM level changes Hugo Sales
2026-11-13 20:24   ` Hugo Sales via B4 Relay
2026-11-13 21:07   ` sashiko-bot
2026-11-13 20:24 ` [PATCH v2 3/5] drm/amd/display: Give the panel_power_savings store tests a full pipe Hugo Sales
2026-11-13 20:24   ` Hugo Sales via B4 Relay
2026-11-13 20:24 ` [PATCH v2 4/5] drm/amd/display: Commit panel_power_savings writes from the kernel Hugo Sales
2026-11-13 20:24   ` Hugo Sales via B4 Relay
2026-11-13 21:28   ` sashiko-bot [this message]
2026-11-13 20:24 ` [PATCH v2 5/5] drm/amd/display: Test panel_power_savings commits Hugo Sales
2026-11-13 20:24   ` Hugo Sales via B4 Relay

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-213714@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hugo@hsal.es \
    --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.