* [PATCH 0/2] drm/amd/display: sync blend mode property fixes from drm-next
@ 2026-11-15 23:59 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
0 siblings, 2 replies; 4+ messages in thread
From: James Lin @ 2026-11-15 23:59 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander Deucher, Leo Li, Harry Wentland, James Lin
Sync two blend mode property fixes from drm-next to amd-staging-drm-next:
- drm/amd/display: fix missing blend-mode-prop warning for DCN
(drm-next: f0c75da0a6b4)
- drm/amd/display: advertise PIXEL_NONE and PREMULTI blend mode for DCE
(drm-next: 332ad707e38f)
Both patches are cherry-picked from drm-next without code changes.
Melissa Wen (2):
drm/amd/display: fix missing blend-mode-prop warning for DCN
drm/amd/display: advertise PIXEL_NONE and PREMULTI blend mode for DCE
.../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 31 +++++++++++++++++--
1 file changed, 28 insertions(+), 3 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] drm/amd/display: fix missing blend-mode-prop warning for DCN
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 ` James Lin
2026-11-15 23:59 ` [PATCH 2/2] drm/amd/display: advertise PIXEL_NONE and PREMULTI blend mode for DCE James Lin
1 sibling, 0 replies; 4+ messages in thread
From: James Lin @ 2026-11-15 23:59 UTC (permalink / raw)
To: amd-gfx
Cc: Alexander Deucher, Leo Li, Harry Wentland, James Lin, Melissa Wen,
Mikhail Gavrilov, Dan Wheeler, Timur Kristóf, Alex Hung,
Leandro Ribeiro
From: Melissa Wen <mwen@igalia.com>
validate_blend_mode_for_alpha_formats() warns when a plane supports
formats with alpha but doesn't expose the blend mode property. Fix this
by adding the same overlay plane blend modes to primary plane, since
they are all universal planes in DCN-generation. Cursor planes support
ARGB8888 format and CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA is set by
default (other color formats are not implemented), so only expose
support to PREMULTI, which is the default blend mode on DRM.
Fixes: 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Melissa Wen <mwen@igalia.com>
Link: https://patch.msgid.link/20260826104143.39077-3-mwen@igalia.com
(cherry picked from commit f0c75da0a6b4084e00cd6faefebcc976ffaccf52)
Signed-off-by: James Lin <PingLei.Lin@amd.com>
---
.../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 21 ++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
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 06d9ff2c32c5..9d7be2fd29aa 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,16 +2233,31 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
if (res)
return res;
- if (plane->type == DRM_PLANE_TYPE_OVERLAY &&
- plane_cap && plane_cap->per_pixel_alpha) {
+ /* 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.
+ */
+ 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) {
unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
BIT(DRM_MODE_BLEND_PREMULTI) |
BIT(DRM_MODE_BLEND_COVERAGE);
- drm_plane_create_alpha_property(plane);
drm_plane_create_blend_mode_property(plane, blend_caps);
+
+ if (plane->type == DRM_PLANE_TYPE_OVERLAY)
+ drm_plane_create_alpha_property(plane);
}
+ /* Cursor color format is set to CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA
+ * by default, so only advertise DRM_MODE_BLEND_PREMULTI blend mode for
+ * this type of plane.
+ */
+ if (plane->type == DRM_PLANE_TYPE_CURSOR)
+ drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_PREMULTI));
+
if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
/*
* Allow OVERLAY planes to be used as underlays by assigning an
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drm/amd/display: advertise PIXEL_NONE and PREMULTI blend mode for DCE
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 ` James Lin
2026-11-16 19:38 ` sashiko-bot
1 sibling, 1 reply; 4+ messages in thread
From: James Lin @ 2026-11-15 23:59 UTC (permalink / raw)
To: amd-gfx
Cc: Alexander Deucher, Leo Li, Harry Wentland, James Lin, Melissa Wen,
Viktor Jägersküpper, Dan Wheeler, Timur Kristóf,
Alex Hung, Leandro Ribeiro
From: Melissa Wen <mwen@igalia.com>
DCE can support PREMULTI and COVERAGE blend mode depending on its
generation, however current driver implementation either doesn't expose
more than primary and cursor plane, or doesn't program registers for any
blend mode other than PIXEL_NONE. To fix the missing-blend-mode-prop
warning according to current DCE plane caps, create blend mode property
with PIXEL_NONE and PREMULTI for primary planes. As long as the
background is black and there is no overlay plane, PIXEL_NONE and
PREMULTI are equivalent, and PREMULTI has been the mandatory/default
mode for years, so keep it to avoid regressions.
Fixes: 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
Tested-by: Viktor Jägersküpper <viktor_jaegerskuepper@freenet.de>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com> #v3
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Leandro Ribeiro <leandro.ribeiro@collabora.com> #v2
Signed-off-by: Melissa Wen <mwen@igalia.com>
Link: https://patch.msgid.link/20260826104143.39077-4-mwen@igalia.com
(cherry picked from commit 332ad707e38fb82dd998b4d0782c15579e5784f1)
Signed-off-by: James Lin <PingLei.Lin@amd.com>
---
.../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 24 +++++++++++++------
1 file changed, 17 insertions(+), 7 deletions(-)
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 9d7be2fd29aa..db07b6d9110c 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);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] drm/amd/display: advertise PIXEL_NONE and PREMULTI blend mode for DCE
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
0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-11-16 19:38 UTC (permalink / raw)
To: James Lin, amd-gfx
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-16 19:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox