[PATCH 0/5] drm/damage-helper: Improve damage-clipping heuristics

Thomas Zimmermann tzimmermann at suse.de
Tue Sep 20 13:56:14 UTC 2022


DRM Drivers can minimize a plane update by looking at damage clipping
information provided by userspace. So far, not having damage information
starts a full-plane update. Improve the heuristics for detecting partial
and full-plane updates by looking at the various state variables of a
plane update.

The current scheme of interpreting 'no damage information' as 'do full
update' works for hardware with a single primary plane. For hardware with
multiple planes, missing damage information can generate significant
overhead. For example, ast supports a primary plane and a cursor plane.
DRM performs an atomic update when the cursor plane is being updated in
some way (e.g., moved). The lack of damage information on the primary
plane results in a full-plane update of the primary plane as well. Using
shadow planes that need to be memcpy'd to video memory creates a full
redraw of the entire primary plane whenever the user moves the mouse
cursor.

The patchset improves the current heuristics by looking at various
state variables to detect whether a full update is necessary.

Patch #2 decouples full-plane updates from the (non-)existence of
damage information. Full-plane updates are still the default, but
the dedicated flag in the plane state allows for more fine-grained
control.

Patches #3 to #5 enable partial plane updates on various conditions.

The patchset has been tested by converting ast to SHMEM and running
Gnome on X11, Gnome in Wayland mode, and Weston. The new heuristics
reduce each environment's unnecessary updates of the primary plane to
no-ops: DRM still invokes the primary plane's atomic_update, but the
costly memcpy to video memory is being avoided.

Thomas Zimmermann (5):
  drm/damage-helper: Style changes
  drm/damage-helper: Decouple partial plane updates from damage clipping
  drm/damage-helper: Do partial updates on legacy cursor changes
  drm/damage-helper: Do partial updates if framebuffer has not been
    changed
  drm/damage-helper: Avoid partial updates for DIRTYFB without damage

 drivers/gpu/drm/drm_atomic_helper.c       |  3 +
 drivers/gpu/drm/drm_atomic_state_helper.c |  3 +
 drivers/gpu/drm/drm_damage_helper.c       | 99 +++++++++++++++++------
 include/drm/drm_plane.h                   | 23 ++++++
 4 files changed, 105 insertions(+), 23 deletions(-)


base-commit: d8deedaa0fcd8192715a052a0239bee3f74a8fb1
-- 
2.37.3



More information about the dri-devel mailing list