Skip to content

RFC staging: Android sync driver

John Stultz dri-devel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest30 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/30staging: sync: Add synchronization frameworkdrivers/staging/android/Kconfig drivers/staging/android/Makefile drivers/staging/android/sync.c +1 more+849 -00 replies
2/30staging: sw_sync: Add cpu based sync driverdrivers/staging/android/Kconfig drivers/staging/android/Makefile drivers/staging/android/sw_sync.c +1 more+301 -00 replies
3/30staging: sync: Add timestamps to sync_ptsdrivers/staging/android/sync.c drivers/staging/android/sync.h+10 -00 replies
4/30staging: sync: Add debugfs supportdrivers/staging/android/sync.c drivers/staging/android/sync.h+191 -50 replies
5/30staging: sw_sync: Add debug supportdrivers/staging/android/sw_sync.c+19 -00 replies
6/30staging: sync: Add ioctl to get fence datadrivers/staging/android/sync.c drivers/staging/android/sync.h+138 -00 replies
7/30staging: sw_sync: Add fill_driver_data supportdrivers/staging/android/sw_sync.c+14 -00 replies
8/30staging: sync: Add poll supportdrivers/staging/android/sync.c+17 -00 replies
9/30staging: sync: Allow async waits to be canceleddrivers/staging/android/sync.c drivers/staging/android/sync.h+60 -220 replies
10/30staging: sync: Export sync API symbolsdrivers/staging/android/sync.c+14 -06 replies
11/30staging: sw_sync: Export sw_sync APIdrivers/staging/android/sw_sync.c+4 -10 replies
12/30staging: sync: Reorder sync_fence_releasedrivers/staging/android/sync.c+2 -20 replies
13/30staging: sync: Optimize fence mergesdrivers/staging/android/sync.c+51 -10 replies
14/30staging: sync: Add internal refcounting to fencesdrivers/staging/android/sync.c drivers/staging/android/sync.h+51 -80 replies
15/30staging: sync: Add reference counting to timelinesdrivers/staging/android/sync.c drivers/staging/android/sync.h+15 -160 replies
16/30staging: sync: Fix error pathsdrivers/staging/android/sync.c+7 -20 replies
17/30staging: sw_sync: Fix error pathsdrivers/staging/android/sw_sync.c+7 -20 replies
18/30staging: sync: Change wait timeout to mirror poll semanticsdrivers/staging/android/sync.c drivers/staging/android/sync.h+7 -70 replies
19/30staging: sync: Dump sync state to console on timeoutdrivers/staging/android/sync.c+32 -20 replies
20/30staging: sync: Improve timeout dump messagesdrivers/staging/android/sync.c+4 -10 replies
21/30staging: sync: Dump sync state on fence errorsdrivers/staging/android/sync.c+4 -10 replies
22/30staging: sync: Protect unlocked access to fence statusdrivers/staging/android/sync.c+17 -10 replies
23/30staging: sync: Update new fence status with sync_fence_signal_ptdrivers/staging/android/sync.c+13 -10 replies
24/30staging: sync: Use proper barriers when waiting indefinitelydrivers/staging/android/sync.c+2 -10 replies
25/30staging: sync: Refactor sync debug printingdrivers/staging/android/sync.c drivers/staging/android/sync.h+29 -80 replies
26/30staging: sw_sync: Convert to use new value_str debug opsdrivers/staging/android/sw_sync.c+17 -190 replies
27/30staging: sync: Add tracepoint supportdrivers/staging/android/sync.c drivers/staging/android/trace/sync.h+93 -00 replies
28/30staging: sync: Fix race condition between merge and signaldrivers/staging/android/sync.c+7 -30 replies
29/30staging: sync: Don't log wait timeouts when timeout = 0drivers/staging/android/sync.c+1 -10 replies
30/30staging: sync: Fix timeout = 0 wait behaviordrivers/staging/android/sync.c+6 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC][PATCH 00/30] staging: Android sync driver

As proposed yesterday, here's the Android sync driver patches for staging.

I've preserved the commit history, but moved all the changes over to be against the staging directory (instead of drivers/base).

The goal of submitting this driver to staging is to try to get more collaberation, as there are some similar efforts going on in the community with dmabuf-fences. My email from yesterday with more details for how I hope this goes is here:

	http://comments.gmane.org/gmane.linux.kernel/1448420

Erik also provided a nice background on the patch set in his reply yesterday, which I'll quote here:

"In Honeycomb where we introduced the Hardware Composer HAL. This is a userspace layer that allows composition acceleration on a per platform basis. Different SoC vendors have implemented this using overlays, 2d blitters, a combinations of both, or other clever/disgusting means. Along with the HWC we consolidated a lot of our camera and media pipeline to allow their input to be fed into the GPU or display(overlay.) In order to exploit parallelism the the graphics pipeline, this introduced lots of implicit synchronization dependancies. After a couple years of working with many different SoC vendors, we found that it was really difficult to communicate our system's expectations of the implicit contract and it was difficult for the SoC vendors to properly implement the implicit contract in each of their IP blocks (display, gpu, camera, video codecs). It was also incredibly difficult to debug when problems/deadlocks arose.

In an effort to clean up the situation we decided to create set of simple synchronization primitives and have our compositor (SurfaceFlinger) manage the synchronization contract explicitly. We designed these primitives so that they can be passed across processes (much like ion/dma_buf handles), can be backed by hardware synchronization primitives, and can be combined with other sync dependancies in a heterogeneous manner. We also added enough debugging information to make pinpointing a synchronization deadlock bug easier. There are also OpenGL extensions added (which I believe have been ratified by Khronos) to convert a "native" sync object to a gl fence object and vise versa.

So far shipped this system on two products (the Nexus 10 and 4) with two different SoCs (Samsung Exynos5250 and Qualcomm MSM8064.) These two projects were much easier to work out the kinks in the graphics/compositing pipelines. In addition we were able to use the telemetry and tracing features to track down the causes of dropped frames aka "jank."

As for the implementation, I started with having the main driver op primitive be a wait() op. I quickly noticed that most of the tricky race condition prone code was ending up in the drivers wait() op. It also made handling asynchronous waits of more than one type of sync_pt difficult to manage. In the end I opted for something roughly like poll() where all the heavy lifting is done at the high level and the drivers only need to implement a simple check function."

Anyway, let me know what you think of the patches, and hopefully this is something that could be considered for staging for 3.10

thanks
-john

Cc Maarten Lankhorst <[email protected]>
Cc Erik Gilling <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Rob Clark <[email protected]>
Cc Sumit Semwal <[email protected]>
Cc Greg KH <[email protected]>
Cc Android Kernel Team <[email protected]>

Erik Gilling (26):
staging: sync: Add synchronization framework
staging: sw_sync: Add cpu based sync driver
staging: sync: Add timestamps to sync_pts
staging: sync: Add debugfs support
staging: sw_sync: Add debug support
staging: sync: Add ioctl to get fence data
staging: sw_sync: Add fill_driver_data support
staging: sync: Add poll support
staging: sync: Allow async waits to be canceled
staging: sync: Export sync API symbols
staging: sw_sync: Export sw_sync API
staging: sync: Reorder sync_fence_release
staging: sync: Optimize fence merges
staging: sync: Add internal refcounting to fences
staging: sync: Add reference counting to timelines
staging: sync: Change wait timeout to mirror poll semantics
staging: sync: Dump sync state to console on timeout
staging: sync: Improve timeout dump messages
staging: sync: Dump sync state on fence errors
staging: sync: Protect unlocked access to fence status
staging: sync: Update new fence status with sync_fence_signal_pt
staging: sync: Use proper barriers when waiting indefinitely
staging: sync: Refactor sync debug printing
staging: sw_sync: Convert to use new value_str debug ops
staging: sync: Add tracepoint support
staging: sync: Don't log wait timeouts when timeout = 0

Jamie Gennis (1):
staging: sync: Fix timeout = 0 wait behavior

Rebecca Schultz Zavin (2):
staging: sync: Fix error paths
staging: sw_sync: Fix error paths

Ørjan Eide (1):
staging: sync: Fix race condition between merge and signal

 drivers/staging/android/Kconfig      |   27 +
 drivers/staging/android/Makefile     |    2 +
 drivers/staging/android/sw_sync.c    |  263 +++++++++
 drivers/staging/android/sw_sync.h    |   58 ++
 drivers/staging/android/sync.c       | 1016 ++++++++++++++++++++++++++++++++++
 drivers/staging/android/sync.h       |  426 ++++++++++++++
 drivers/staging/android/trace/sync.h |   82 +++
 7 files changed, 1874 insertions(+)
 create mode 100644 drivers/staging/android/sw_sync.c
 create mode 100644 drivers/staging/android/sw_sync.h
 create mode 100644 drivers/staging/android/sync.c
 create mode 100644 drivers/staging/android/sync.h
 create mode 100644 drivers/staging/android/trace/sync.h
Signature · 1 line
1.7.10.4