linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 00/30] staging: Android sync driver
@ 2013-03-01  0:42 John Stultz
  2013-03-01  0:42 ` [PATCH 01/30] staging: sync: Add synchronization framework John Stultz
                   ` (31 more replies)
  0 siblings, 32 replies; 41+ messages in thread
From: John Stultz @ 2013-03-01  0:42 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Maarten Lankhorst, Erik Gilling, Daniel Vetter,
	Rob Clark, Sumit Semwal, Greg KH, dri-devel, linaro-mm-sig,
	Android Kernel Team

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 <maarten.lankhorst@canonical.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Rob Clark <robclark@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: Android Kernel Team <kernel-team@android.com>


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

-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2013-03-03 18:58 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-01  0:42 [RFC][PATCH 00/30] staging: Android sync driver John Stultz
2013-03-01  0:42 ` [PATCH 01/30] staging: sync: Add synchronization framework John Stultz
2013-03-01  0:42 ` [PATCH 02/30] staging: sw_sync: Add cpu based sync driver John Stultz
2013-03-01  0:42 ` [PATCH 03/30] staging: sync: Add timestamps to sync_pts John Stultz
2013-03-01  0:43 ` [PATCH 04/30] staging: sync: Add debugfs support John Stultz
2013-03-01  0:43 ` [PATCH 05/30] staging: sw_sync: Add debug support John Stultz
2013-03-01  0:43 ` [PATCH 06/30] staging: sync: Add ioctl to get fence data John Stultz
2013-03-01  0:43 ` [PATCH 07/30] staging: sw_sync: Add fill_driver_data support John Stultz
2013-03-01  0:43 ` [PATCH 08/30] staging: sync: Add poll support John Stultz
2013-03-01  0:43 ` [PATCH 09/30] staging: sync: Allow async waits to be canceled John Stultz
2013-03-01  0:43 ` [PATCH 10/30] staging: sync: Export sync API symbols John Stultz
2013-03-01  2:00   ` Greg KH
2013-03-01  3:59     ` John Stultz
2013-03-01  8:21       ` Erik Gilling
2013-03-01 13:55         ` Greg KH
2013-03-01 16:30           ` Erik Gilling
2013-03-01 22:47         ` Erik Gilling
2013-03-01  0:43 ` [PATCH 11/30] staging: sw_sync: Export sw_sync API John Stultz
2013-03-01  0:43 ` [PATCH 12/30] staging: sync: Reorder sync_fence_release John Stultz
2013-03-01  0:43 ` [PATCH 13/30] staging: sync: Optimize fence merges John Stultz
2013-03-01  0:43 ` [PATCH 14/30] staging: sync: Add internal refcounting to fences John Stultz
2013-03-01  0:43 ` [PATCH 15/30] staging: sync: Add reference counting to timelines John Stultz
2013-03-01  0:43 ` [PATCH 16/30] staging: sync: Fix error paths John Stultz
2013-03-01  0:43 ` [PATCH 17/30] staging: sw_sync: " John Stultz
2013-03-01  0:43 ` [PATCH 18/30] staging: sync: Change wait timeout to mirror poll semantics John Stultz
2013-03-01  0:43 ` [PATCH 19/30] staging: sync: Dump sync state to console on timeout John Stultz
2013-03-01  0:43 ` [PATCH 20/30] staging: sync: Improve timeout dump messages John Stultz
2013-03-01  0:43 ` [PATCH 21/30] staging: sync: Dump sync state on fence errors John Stultz
2013-03-01  0:43 ` [PATCH 22/30] staging: sync: Protect unlocked access to fence status John Stultz
2013-03-01  0:43 ` [PATCH 23/30] staging: sync: Update new fence status with sync_fence_signal_pt John Stultz
2013-03-01  0:43 ` [PATCH 24/30] staging: sync: Use proper barriers when waiting indefinitely John Stultz
2013-03-01  0:43 ` [PATCH 25/30] staging: sync: Refactor sync debug printing John Stultz
2013-03-01  0:43 ` [PATCH 26/30] staging: sw_sync: Convert to use new value_str debug ops John Stultz
2013-03-01  0:43 ` [PATCH 27/30] staging: sync: Add tracepoint support John Stultz
2013-03-01  0:43 ` [PATCH 28/30] staging: sync: Fix race condition between merge and signal John Stultz
2013-03-01  0:43 ` [PATCH 29/30] staging: sync: Don't log wait timeouts when timeout = 0 John Stultz
2013-03-01  0:43 ` [PATCH 30/30] staging: sync: Fix timeout = 0 wait behavior John Stultz
2013-03-01  1:59 ` [RFC][PATCH 00/30] staging: Android sync driver Greg KH
2013-03-01 16:20   ` Erik Gilling
2013-03-03 18:42 ` Daniel Vetter
2013-03-03 18:52   ` animelovin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).