drm/fence: add out-fences support

Support DRM out-fences through a new CRTC propery called OUT_FENCE_FD,
it receives an empty sync file fd that will be signaled by DRM when the
buffer is scanned out.

The fence must be an empty fence, once it is send in the atomic request it
will become a promise from the DRM driver that it will complete.

WIP: add check to make sure we have an empty fence.

v2: Comment by Rob Clark:
	- Squash commit that adds DRM_MODE_ATOMIC_OUT_FENCE flag here.

    Comment by Daniel Vetter:
	- Add clean up code for out_fences

v3: Comments by Daniel Vetter:
	- create DRM_MODE_ATOMIC_EVENT_MASK
	- userspace should fill out_fences_ptr with the crtc_ids for which
	it wants fences back.

v4: Refactor implementation and remove the drm_out_fences array and
DRM_MODE_ATOMIC_OUT_FENCE flags, now the OUT_FENCE is *passed* to the
kernel in the OUT_FENCE_FD property in the CRTC.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
4 files changed