| From 533b1f467c143dc4a77774946b9cdfcde84fa94f Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Fri, 6 Feb 2026 23:38:28 +0100 |
| Subject: drm/amd/display: Use same max plane scaling limits for all 64 bpp |
| formats |
| |
| From: Mario Kleiner <mario.kleiner.de@gmail.com> |
| |
| [ Upstream commit f0157ce46cf0e5e2257e19d590c9b16036ce26d4 ] |
| |
| The plane scaling hw seems to have the same min/max plane scaling limits |
| for all 16 bpc / 64 bpp interleaved pixel color formats. |
| |
| Therefore add cases to amdgpu_dm_plane_get_min_max_dc_plane_scaling() for |
| all the 16 bpc fixed-point / unorm formats to use the same .fp16 |
| up/downscaling factor limits as used by the fp16 floating point formats. |
| |
| So far, 16 bpc unorm formats were not handled, and the default: path |
| returned max/min factors for 32 bpp argb8888 formats, which were wrong |
| and bigger than what many DCE / DCN hw generations could handle. |
| |
| The result sometimes was misscaling of framebuffers with |
| DRM_FORMAT_XRGB16161616, DRM_FORMAT_ARGB16161616, DRM_FORMAT_XBGR16161616, |
| DRM_FORMAT_ABGR16161616, leading to very wrong looking display, as tested |
| on Polaris11 / DCE-11.2. |
| |
| So far this went unnoticed, because only few userspace clients used such |
| 16 bpc unorm framebuffers, and those didn't use hw plane scaling, so they |
| did not experience this issue. |
| |
| With upcoming Mesa 26 exposing 16 bpc unorm formats under both OpenGL |
| and Vulkan under Wayland, and the upcoming GNOME 50 Mutter Wayland |
| compositor allowing for direct scanout of these formats, the scaling |
| hw will be used on these formats if possible for HiDPI display scaling, |
| so it is important to use the correct hw scaling limits to avoid wrong |
| display. |
| |
| Tested on AMD Polaris 11 / DCE 11.2 with upcoming Mesa 26 and GNOME 50 |
| on HiDPI displays with scaling enabled. The mutter Wayland compositor now |
| correctly falls back to scaling via desktop compositing instead of direct |
| scanout, thereby avoiding wrong image display. For unscaled mode, it |
| correctly uses direct scanout. |
| |
| Fixes: 580204038f5b ("drm/amd/display: Enable support for 16 bpc fixed-point framebuffers.") |
| Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> |
| Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com> |
| Cc: Alex Deucher <alexander.deucher@amd.com> |
| Cc: Harry Wentland <harry.wentland@amd.com> |
| Cc: Leo Li <sunpeng.li@amd.com> |
| Signed-off-by: Alex Deucher <alexander.deucher@amd.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 5 +++++ |
| 1 file changed, 5 insertions(+) |
| |
| 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 e027798ece032..9bb7475e80bad 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 |
| @@ -1059,10 +1059,15 @@ static void amdgpu_dm_plane_get_min_max_dc_plane_scaling(struct drm_device *dev, |
| *min_downscale = plane_cap->max_downscale_factor.nv12; |
| break; |
| |
| + /* All 64 bpp formats have the same fp16 scaling limits */ |
| case DRM_FORMAT_XRGB16161616F: |
| case DRM_FORMAT_ARGB16161616F: |
| case DRM_FORMAT_XBGR16161616F: |
| case DRM_FORMAT_ABGR16161616F: |
| + case DRM_FORMAT_XRGB16161616: |
| + case DRM_FORMAT_ARGB16161616: |
| + case DRM_FORMAT_XBGR16161616: |
| + case DRM_FORMAT_ABGR16161616: |
| *max_upscale = plane_cap->max_upscale_factor.fp16; |
| *min_downscale = plane_cap->max_downscale_factor.fp16; |
| break; |
| -- |
| 2.51.0 |
| |