Re: [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations

[email protected]
Newsgroups org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Calling drm_plane_create_blend_mode_property() without PREMULTI support triggers a kernel warning (WARN_ON) and fails to create the property.
--

--- Patch [3]: [PATCH v3 3/3] drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations ---
commit 44681caffc8bcfc7085bcfe1ec288a0eafc8c992
Author: Melissa Wen <[email protected]>

drm/amd/display: advertise PIXEL_NONE as blend mode for DCE generations

This commit changes the blend mode property creation for primary planes on
DCE generations. It modifies the driver to create the blend mode property
with PIXEL_NONE only, instead of the DRM default PREMULTI mode.

> 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 423e3cd7b9c98..e02cbafc8c5d0 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
[ ... ]
> @@ -2208,14 +2208,18 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
[ ... ]
> -	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) {
> +		drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_PIXEL_NONE));

[Severity: High]
Does this trigger a kernel warning and fail to create the property?

Looking at drm_plane_create_blend_mode_property() in drm_blend.c, the DRM
core explicitly enforces that DRM_MODE_BLEND_PREMULTI must be supported:

int drm_plane_create_blend_mode_property(struct drm_plane *plane,
					 unsigned int supported_modes)
{
	...
	if (WARN_ON((supported_modes & ~valid_mode_mask) ||
		    ((supported_modes & BIT(DRM_MODE_BLEND_PREMULTI)) == 0)))
		return -EINVAL;
	...
}

Since amdgpu_dm_plane_init() now passes only BIT(DRM_MODE_BLEND_PIXEL_NONE),
this will trigger the WARN_ON and return -EINVAL during device probe,
meaning the property is not created at all.

> +	} 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);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.