drm/amd/display: Fix direct scanout alpha on some DRM_FORMATs
[email protected]
maintainerPATCH 1/1 drm/amd/display: Fix direct scanout alpha on some DRM_FORMATs
From: Leo Li <[email protected]>
[Why]
DM was declaring it's own list of has_alpha DRM formats to check against for enabling alpha blending, when the format->has_alpha already does that for us.
The self-declared list missed some has_alpha formats, causing direct-scanout planes with such formats to appear opaque.
[How]
Drop the self-declared list, instead use the format->has_alpha field directly.
--- .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +1 -19
@@ -113,25 +113,7 @@ void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_stateif (plane_state->pixel_blend_mode ==DRM_MODE_BLEND_PREMULTI || plane_state->pixel_blend_mode ==DRM_MODE_BLEND_COVERAGE ) { -static const uint32_t alpha_formats[] = { -DRM_FORMAT_ARGB8888 , -DRM_FORMAT_RGBA8888 , -DRM_FORMAT_ABGR8888 , -DRM_FORMAT_ARGB2101010 , -DRM_FORMAT_ABGR2101010 , -DRM_FORMAT_ARGB16161616 , -DRM_FORMAT_ABGR16161616 , -DRM_FORMAT_ARGB16161616F , - }; -uint32_t format = plane_state->fb->format->format; -unsigned int i; - -for (i =0 ; i <ARRAY_SIZE (alpha_formats); ++i) { -if (format == alpha_formats[i]) { - *per_pixel_alpha = true; -break ; - } - } + *per_pixel_alpha = plane_state->fb->format->has_alpha;if (*per_pixel_alpha && plane_state->pixel_blend_mode ==DRM_MODE_BLEND_COVERAGE ) *pre_multiplied_alpha = false;
Signature · 1 line
2.55.0
Quoted 11 lines · On 2026-09-30 12:25, [email protected] wrote:
From: Leo Li <[email protected]>
[Why]
DM was declaring it's own list of
has_alphaDRM formats to check against for enabling alpha blending, when theformat->has_alphaalready does that for us.The self-declared list missed some
has_alphaformats, causing direct-scanout planes with such formats to appear opaque.
Quoted 7 lines
[How]
Drop the self-declared list, instead use the
format->has_alphafield directly.Signed-off-by Leo Li <[email protected]>
Harry
Quoted 35 lines
--- .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +1
-19@@ -113,25 +113,7 @@ void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_stateif (plane_state->pixel_blend_mode ==DRM_MODE_BLEND_PREMULTI || plane_state->pixel_blend_mode ==DRM_MODE_BLEND_COVERAGE ) { -static const uint32_t alpha_formats[] = { -DRM_FORMAT_ARGB8888 , -DRM_FORMAT_RGBA8888 , -DRM_FORMAT_ABGR8888 , -DRM_FORMAT_ARGB2101010 , -DRM_FORMAT_ABGR2101010 , -DRM_FORMAT_ARGB16161616 , -DRM_FORMAT_ABGR16161616 , -DRM_FORMAT_ARGB16161616F , - }; -uint32_t format = plane_state->fb->format->format; -unsigned int i; - -for (i =0 ; i <ARRAY_SIZE (alpha_formats); ++i) { -if (format == alpha_formats[i]) { - *per_pixel_alpha = true; -break ; - } - } + *per_pixel_alpha = plane_state->fb->format->has_alpha;if (*per_pixel_alpha && plane_state->pixel_blend_mode ==DRM_MODE_BLEND_COVERAGE ) *pre_multiplied_alpha = false;