In the case of a legacy cursor update, only update the cursor plane. Keep
other planes clear from changes. Setting the 'partial_update' flag when
these planes don't have damage-clipping areas acts as if no update will
be performed.

Signed-off-by: Thomas Zimmermann <tzimmerm...@suse.de>
---
 drivers/gpu/drm/drm_damage_helper.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/drm_damage_helper.c 
b/drivers/gpu/drm/drm_damage_helper.c
index 16f0d5a97ee3..a603a3563c03 100644
--- a/drivers/gpu/drm/drm_damage_helper.c
+++ b/drivers/gpu/drm/drm_damage_helper.c
@@ -69,6 +69,7 @@ void drm_atomic_helper_check_plane_damage(struct 
drm_atomic_state *state,
                                          struct drm_plane_state 
*new_plane_state)
 {
        struct drm_crtc_state *new_crtc_state;
+       struct drm_plane *plane = new_plane_state->plane;
        struct drm_crtc *new_crtc = new_plane_state->crtc;
        bool partial_update = false;
 
@@ -83,6 +84,17 @@ void drm_atomic_helper_check_plane_damage(struct 
drm_atomic_state *state,
                 */
                if (drm_atomic_crtc_needs_modeset(new_crtc_state))
                        goto out;
+
+               /*
+                * On a legacy cursor update, only update the affected cursor
+                * plane, but ignore all other planes. The non-cursor planes
+                * won't have damage-clipping areas, so setting the flag for
+                * a partial update acts like not doing any update.
+                */
+               if (state->legacy_cursor_update) {
+                       if (plane != new_crtc->cursor)
+                               partial_update = true;
+               }
        }
 
        /*
-- 
2.37.3

Reply via email to