Re: [REPOST PATCH 4/8] android: convert sync to fence api, v5

From: Thierry Reding
Date: Thu Jun 19 2014 - 07:51:50 EST


On Thu, Jun 19, 2014 at 08:37:27AM +0200, Daniel Vetter wrote:
> On Wed, Jun 18, 2014 at 06:15:56PM -0700, Greg KH wrote:
> > On Wed, Jun 18, 2014 at 12:37:11PM +0200, Maarten Lankhorst wrote:
> > > Just to show it's easy.
> > >
> > > Android syncpoints can be mapped to a timeline. This removes the need
> > > to maintain a separate api for synchronization. I've left the android
> > > trace events in place, but the core fence events should already be
> > > sufficient for debugging.
> > >
> > > v2:
> > > - Call fence_remove_callback in sync_fence_free if not all fences have fired.
> > > v3:
> > > - Merge Colin Cross' bugfixes, and the android fence merge optimization.
> > > v4:
> > > - Merge with the upstream fixes.
> > > v5:
> > > - Fix small style issues pointed out by Thomas Hellstrom.
> > >
> > > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxx>
> > > Acked-by: John Stultz <john.stultz@xxxxxxxxxx>
> > > ---
> > > drivers/staging/android/Kconfig | 1
> > > drivers/staging/android/Makefile | 2
> > > drivers/staging/android/sw_sync.c | 6
> > > drivers/staging/android/sync.c | 913 +++++++++++-----------------------
> > > drivers/staging/android/sync.h | 79 ++-
> > > drivers/staging/android/sync_debug.c | 247 +++++++++
> > > drivers/staging/android/trace/sync.h | 12
> > > 7 files changed, 609 insertions(+), 651 deletions(-)
> > > create mode 100644 drivers/staging/android/sync_debug.c
> >
> > With these changes, can we pull the android sync logic out of
> > drivers/staging/ now?
>
> Afaik the google guys never really looked at this and acked it. So I'm not
> sure whether they'll follow along. The other issue I have as the
> maintainer of gfx driver is that I don't want to implement support for two
> different sync object primitives (once for dma-buf and once for android
> syncpts), and my impression thus far has been that even with this we're
> not there.
>
> I'm trying to get our own android guys to upstream their i915 syncpts
> support, but thus far I haven't managed to convince them to throw people's
> time at this.

This has been discussed a fair bit internally recently and some of our
GPU experts have raised concerns that this may result in seriously
degraded performance in our proprietary graphics stack. Now I don't care
very much for the proprietary graphics stack, but by extension I would
assume that the same restrictions are relevant for any open-source
driver as well.

I'm still trying to fully understand all the implications and at the
same time get some of the people who raised concerns to join in this
discussion. As I understand it the concern is mostly about explicit vs.
implicit synchronization and having this mechanism in the kernel will
implicitly synchronize all accesses to these buffers even in cases where
it's not needed (read vs. write locks, etc.). In one particular instance
it was even mentioned that this kind of implicit synchronization can
lead to deadlocks in some use-cases (this was mentioned for Android
compositing, but I suspect that the same may happen for Wayland or X
compositors).

Thierry

Attachment: pgpSkuFGZqnpn.pgp
Description: PGP signature