AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "James Lin" <PingLei.Lin@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/amd/display: advertise PIXEL_NONE and PREMULTI blend mode for DCE
Date: Mon, 16 Nov 2026 19:38:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-217587@kernel.org> (raw)
In-Reply-To: <20261116001326.2360302-3-PingLei.Lin@amd.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] drm/amd/display: missing drm_plane_cleanup() on error in
  amdgpu_dm_plane_init() [1]
--

commit f9cd4d4e16a60ec76ad85f33f53d77691bb25467
Author: Melissa Wen <mwen@igalia.com>

drm/amd/display: advertise PIXEL_NONE and PREMULTI blend mode for DCE

This commit exposes the pixel blend mode property with PIXEL_NONE and
PREMULTI on non-DCN planes in amdgpu_dm_plane_init().

Link: https://patch.msgid.link/20260826104143.39077-4-mwen@igalia.com

> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> index 9d7be2fd29aae..db07b6d9110c7 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
> @@ -2233,14 +2233,24 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>  	if (res)
>  		return res;
>  
> -	/* TODO: Check which blend modes are supported in DCE-generation
> -	 * planes, i.e. DC_PLANE_TYPE_DCE_RGB/UNDERLAY and expose blend mode
> -	 * property accordingly.
> +	/* Blend mode support varies on DCE generations according to HW caps
> +	 * and number of planes per CRTC. However, as current driver
> +	 * implementation only creates one primary and one cursor plane per
> +	 * CRTC for DCE (overlay is only created if
> +	 * DC_PLANE_TYPE_DCN_UNIVERSAL), the primary plane blend mode is
> +	 * ignored across DCE versions. Keep PREMULTI to avoid uAPI
> +	 * regressions: it was the default/mandatory mode for many years and,
> +	 * with no overlay plane, primary composes on top of a black
> +	 * background, where PREMULTI and PIXEL_NONE are equivalent.
>  	 */
> -	if ((plane->type == DRM_PLANE_TYPE_OVERLAY ||
> -	     plane->type == DRM_PLANE_TYPE_PRIMARY) &&
> -	    plane_cap && plane_cap->per_pixel_alpha &&
> -	    plane_cap->type == DC_PLANE_TYPE_DCN_UNIVERSAL) {
> +	if (plane_cap && plane_cap->type != DC_PLANE_TYPE_DCN_UNIVERSAL) {
> +		unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
> +					  BIT(DRM_MODE_BLEND_PREMULTI);
> +
> +		drm_plane_create_blend_mode_property(plane, blend_caps);
> +	} else if ((plane->type == DRM_PLANE_TYPE_OVERLAY ||
> +		    plane->type == DRM_PLANE_TYPE_PRIMARY) &&
> +		   plane_cap && plane_cap->per_pixel_alpha) {
>  		unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
>  					  BIT(DRM_MODE_BLEND_PREMULTI) |
>  					  BIT(DRM_MODE_BLEND_COVERAGE);

[Severity: Medium]
This problem wasn't introduced by this patch, but does amdgpu_dm_plane_init()
miss calling drm_plane_cleanup(plane) when failing after
drm_universal_plane_init() [1]?

Later in amdgpu_dm_plane_init():

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c:amdgpu_dm_plane_init() {
	...
	res = dm_plane_init_colorops(plane);
	if (res)
		return res;
	...
}

If dm_plane_init_colorops() fails, returning without drm_plane_cleanup()
leaks the internal plane allocations and leaves the plane linked on
dev->mode_config.plane_list.  When initialize_plane() or
amdgpu_dm_crtc_init() then frees the plane, the dangling list entry causes a
use-after-free and double free in drm_mode_config_cleanup() during probe
teardown.

[1] https://sashiko.dev/#/bug/linux-c73cfe01-2981-40a4-9f20-42eb58a1bc98

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116001326.2360302-2-PingLei.Lin@amd.com?part=2

      reply	other threads:[~2026-11-16 19:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 23:59 [PATCH 0/2] drm/amd/display: sync blend mode property fixes from drm-next James Lin
2026-11-15 23:59 ` [PATCH 1/2] drm/amd/display: fix missing blend-mode-prop warning for DCN James Lin
2026-11-15 23:59 ` [PATCH 2/2] drm/amd/display: advertise PIXEL_NONE and PREMULTI blend mode for DCE James Lin
2026-11-16 19:38   ` sashiko-bot [this message]

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-217587@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=PingLei.Lin@amd.com \
    --cc=amd-gfx@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox