[PATCH 0/1] Damage rectangles interface for DRM

Lukasz Spintzyk lukasz.spintzyk at displaylink.com
Thu Dec 21 11:10:07 UTC 2017

	This is a draft of damage interface for drm. Alluding to the topic "RFC: page-flip with damage?" on dri-devel
The following patch is a proof of concept, how we can deliver dirty rectangles to the drm drivers.
Patch was tested on Chromium OS to deliver damage regions to atomic version of evdi driver. Hence this supports atomic drivers for now.
We should agree on the approach how this can be implemented.
In the patch, I intend to use drm blob properties to pass c-style array of drm_clip_rects.
Is DRM properties framework suitable for this solution? The only doubt I have is that it requires to create and destroy property blob every atomic_commit/page flip as this is the only way to update blob with damage regions. This is associated with kmalloc and free for each flip. Do you think if this approach relates to some performance risk?

	The proposed solution is attaching DIRTY_RECTS property to the drm_plane. The property means to hold list of rectangles in plane coordinates.
This is opposite to initial plan in thread from September 2017. I wanted to present our rationale for this.
Single rect vs rect list:
	Some compositors like Chromium can have quite precise damage information that would be lost if we would collapse them. 
Damage rectangles on crtc vs per plane
 	The property is attached to drm plane initially. We had a talk with guys from Chromium compositor. The plan is to use overlay planes more extensively. Also, Chromium compositor operates on dirty rects per plane so it would be easier to use them as is.
In my opinion this is more natural to deliver information about damage per plane. Damage information is used primarily for bandwidth savings. For driver that deliver plane data it is more useful to know what parts of the plane have changed so it can send only these memory areas.
I don't know if this reasoning is valid. Probably it depends on hardware and driver.
I can speak about use cases I have faced. One of them is additional cursor plane. With damage regions on crtc I don't know if it is related to primary plane, or it is connected to cursor movement. Also, user space applications must generate additional damage regions when such cursor plane is moving over primary plane. For such cases passing dirty rectangles for planes seems to be more straightforward.

This is draft with minimal functionality. I would like to hear what is your opinion on it.  
I am happy to hear what are the requirements of other driver vendors.

Lukasz Spintzyk

Lukasz Spintzyk (1):
  drm: Add dirty_rects atomic blob property for drm_plane

 drivers/gpu/drm/drm_atomic.c      | 10 ++++++++++
 drivers/gpu/drm/drm_mode_config.c |  6 ++++++
 drivers/gpu/drm/drm_plane.c       |  1 +
 include/drm/drm_mode_config.h     |  5 +++++
 include/drm/drm_plane.h           |  3 +++
 5 files changed, 25 insertions(+)


More information about the dri-devel mailing list