Skip to content

Commit 9a83a71

Browse files
Gustavo Padovandanvet
authored andcommitted
drm/fences: add DOC: for explicit fencing
Document IN_FENCE_FD and OUT_FENCE_PTR properties. v2: incorporate comments from Daniel Vetter Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> [danvet: s/async/nonblocking/ atomic commits.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1479773488-15048-1-git-send-email-gustavo@padovan.org
1 parent 8c0b55e commit 9a83a71

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

‎Documentation/gpu/drm-kms.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ Tile Group Property
293293
.. kernel-doc:: drivers/gpu/drm/drm_connector.c
294294
:doc: Tile group
295295

296+
Explicit Fencing Properties
297+
---------------------------
298+
299+
.. kernel-doc:: drivers/gpu/drm/drm_atomic.c
300+
:doc: explicit fencing properties
301+
296302
Existing KMS Properties
297303
-----------------------
298304

‎drivers/gpu/drm/drm_atomic.c‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,58 @@ void drm_atomic_clean_old_fb(struct drm_device *dev,
18161816
}
18171817
EXPORT_SYMBOL(drm_atomic_clean_old_fb);
18181818

1819+
/**
1820+
* DOC: explicit fencing properties
1821+
*
1822+
* Explicit fencing allows userspace to control the buffer synchronization
1823+
* between devices. A Fence or a group of fences are transfered to/from
1824+
* userspace using Sync File fds and there are two DRM properties for that.
1825+
* IN_FENCE_FD on each DRM Plane to send fences to the kernel and
1826+
* OUT_FENCE_PTR on each DRM CRTC to receive fences from the kernel.
1827+
*
1828+
* As a contrast, with implicit fencing the kernel keeps track of any
1829+
* ongoing rendering, and automatically ensures that the atomic update waits
1830+
* for any pending rendering to complete. For shared buffers represented with
1831+
* a struct &dma_buf this is tracked in &reservation_object structures.
1832+
* Implicit syncing is how Linux traditionally worked (e.g. DRI2/3 on X.org),
1833+
* whereas explicit fencing is what Android wants.
1834+
*
1835+
* "IN_FENCE_FD”:
1836+
* Use this property to pass a fence that DRM should wait on before
1837+
* proceeding with the Atomic Commit request and show the framebuffer for
1838+
* the plane on the screen. The fence can be either a normal fence or a
1839+
* merged one, the sync_file framework will handle both cases and use a
1840+
* fence_array if a merged fence is received. Passing -1 here means no
1841+
* fences to wait on.
1842+
*
1843+
* If the Atomic Commit request has the DRM_MODE_ATOMIC_TEST_ONLY flag
1844+
* it will only check if the Sync File is a valid one.
1845+
*
1846+
* On the driver side the fence is stored on the @fence parameter of
1847+
* struct &drm_plane_state. Drivers which also support implicit fencing
1848+
* should set the implicit fence using drm_atomic_set_fence_for_plane(),
1849+
* to make sure there's consistent behaviour between drivers in precedence
1850+
* of implicit vs. explicit fencing.
1851+
*
1852+
* "OUT_FENCE_PTR”:
1853+
* Use this property to pass a file descriptor pointer to DRM. Once the
1854+
* Atomic Commit request call returns OUT_FENCE_PTR will be filled with
1855+
* the file descriptor number of a Sync File. This Sync File contains the
1856+
* CRTC fence that will be signaled when all framebuffers present on the
1857+
* Atomic Commit * request for that given CRTC are scanned out on the
1858+
* screen.
1859+
*
1860+
* The Atomic Commit request fails if a invalid pointer is passed. If the
1861+
* Atomic Commit request fails for any other reason the out fence fd
1862+
* returned will be -1. On a Atomic Commit with the
1863+
* DRM_MODE_ATOMIC_TEST_ONLY flag the out fence will also be set to -1.
1864+
*
1865+
* Note that out-fences don't have a special interface to drivers and are
1866+
* internally represented by a struct &drm_pending_vblank_event in struct
1867+
* &drm_crtc_state, which is also used by the nonblocking atomic commit
1868+
* helpers and for the DRM event handling for existing userspace.
1869+
*/
1870+
18191871
static struct dma_fence *get_crtc_fence(struct drm_crtc *crtc)
18201872
{
18211873
struct dma_fence *fence;

0 commit comments

Comments
 (0)