]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/amd/display: Reset plane when tiling flags change
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tue, 28 Jul 2020 13:59:53 +0000 (09:59 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 6 Aug 2020 19:46:19 +0000 (15:46 -0400)
[Why]
Enabling or disable DCC or switching between tiled and linear formats
can require bandwidth updates.

They're currently skipping all DC validation by being treated as purely
surface updates.

[How]
Treat tiling_flag changes (which encode DCC state) as a condition for
resetting the plane.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Hersen Wu <hersenxs.wu@amd.com>
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 81eeaff3acb1a41c9a5769d76507e522a4ad2730..89083210855d6f1b963beba877b2bf5f2493ebdf 100644 (file)
@@ -8258,6 +8258,8 @@ static bool should_reset_plane(struct drm_atomic_state *state,
         * TODO: Come up with a more elegant solution for this.
         */
        for_each_oldnew_plane_in_state(state, other, old_other_state, new_other_state, i) {
+               struct dm_plane_state *old_dm_plane_state, *new_dm_plane_state;
+
                if (other->type == DRM_PLANE_TYPE_CURSOR)
                        continue;
 
@@ -8268,9 +8270,20 @@ static bool should_reset_plane(struct drm_atomic_state *state,
                if (old_other_state->crtc != new_other_state->crtc)
                        return true;
 
-               /* TODO: Remove this once we can handle fast format changes. */
-               if (old_other_state->fb && new_other_state->fb &&
-                   old_other_state->fb->format != new_other_state->fb->format)
+               /* Framebuffer checks fall at the end. */
+               if (!old_other_state->fb || !new_other_state->fb)
+                       continue;
+
+               /* Pixel format changes can require bandwidth updates. */
+               if (old_other_state->fb->format != new_other_state->fb->format)
+                       return true;
+
+               old_dm_plane_state = to_dm_plane_state(old_other_state);
+               new_dm_plane_state = to_dm_plane_state(new_other_state);
+
+               /* Tiling and DCC changes also require bandwidth updates. */
+               if (old_dm_plane_state->tiling_flags !=
+                   new_dm_plane_state->tiling_flags)
                        return true;
        }