[PATCH 0/6] mesa: support for EGL_ANDROID_native_fence_sync

Rob Clark robdclark at gmail.com
Fri Aug 19 22:39:49 UTC 2016


On Fri, Aug 19, 2016 at 5:57 PM, Rob Clark <robdclark at gmail.com> wrote:
> Ok, quick update on state of explicit fence fd's /
> EGL_ANDROID_native_fence_sync:
>
> For folks working on other drivers wishing to add support, we don't
> have a "real" userspace yet.  But Gustavo has added atomic support to
> kmscube (as well as all of his work for in/out fences in atomic ioctl,
> plus destaging sync-file stuff, etc).  On top of that I have hacked up
> support for using fence fd's (via EGL_ANDROID_native_fence_sync plus
> atomic in/out fence support in libdrm+kernel) rather than pageflip
> events to synchronize rendering and kms.  This should give some
> reasonable toy code for other folks working on other driver support to
> get started:
>
>   https://github.com/robclark/kmscube/commits/atomic-fence
>
> The core and egl mesa patches are largely unchanged, other than a
> small addition of wiring up fence extension for gbm/drm.  The gallium
> bits have gotten a bit simpler thanks to Marek's deferred-flush
> changes (although I haven't had a chance to add deferred-flush support
> in freedreno yet, so do your eglWaitSyncKHR() calls right before
> eglSwapBuffers() if you don't want perf to suck).  I have also wired
> up freedreno support and Gustavo has started on virgl support.. it
> would be interesting to see some more drivers added to the mix.
> Anyways, what I have so far is here:
>
>   https://github.com/freedreno/mesa/commits/wip-fence
>
> This and kmscube bits also depends on some libdrm changes here:
>
>   https://github.com/freedreno/libdrm/commits/fences
>
> With all these bits, the (relatively trivial) kmscube is working, and
> not even leaking fd's or tearing or anything ;-)
>
> I think for the kms atomic/fence bits, the consensus is that we need a
> real userspace to get them merged.  Which we are still waiting on.  I
> think on the gpu side (mesa + libdrm_$drivername + submit/execbuf/etc
> ioctl bits on kernel side) the main thing we need is piglit tests.
> (Last time I checked, android/dEQP did not have any real tests for the
> ANDROID_native_fence_sync extension, other than perhaps checking that
> the driver advertised it.. which isn't really a test at all :-/).  I'm
> not really sure how much bandwidth I'll have to work on this in the
> near future, so if some other interested party wants to step up and
> write some piglit tests, that would be great.  Otherwise, at least for
> now the above kernel/libdrm/mesa/kmscube branches should give anyone
> else working on their drivers all the bits they need to get started on
> fence-fd support.

Oh, I forgot to mention, kernel bits here:

  https://github.com/freedreno/kernel-msm/commits/integration-linux-qcomlt-fences

BR,
-R

>
>
> On Fri, Apr 1, 2016 at 4:29 PM, Rob Clark <robdclark at gmail.com> wrote:
>> From: Rob Clark <robclark at freedesktop.org>
>>
>> This patchset implements support for EGL_ANDROID_native_fence_sync[1]
>> for egl and gallium.  This extension provides support for native fence
>> fd's (file descriptors) for the GPU.  In a similar way to dma-buf fd's,
>> which provide a reference-counted userspace handle to buffers which
>> can be shared across drivers and across processes, native fence fd's
>> provide a reference-counted userspace handle to fences which can be
>> shared across drivers and across processes.
>>
>> This extension is already in use on android, and should be useful in
>> other environments.
>>
>> This is almost an RFC at this point (but I'd still like to get review
>> comments), since no driver actually supports this yet, and the upstream
>> kernel support for native fence fd's is work-in-progress[2][3][4].  But
>> it is a needed piece to fully wire up explicit synchronization across
>> devices, and needed to have an open source userspace for the ongoing
>> kernel work.
>>
>> [1] https://www.khronos.org/registry/egl/extensions/ANDROID/EGL_ANDROID_native_fence_sync.txt
>> [2] https://lists.freedesktop.org/archives/dri-devel/2016-March/103060.html
>> [3] https://lists.freedesktop.org/archives/dri-devel/2016-March/103451.html
>> [4] https://lists.freedesktop.org/archives/dri-devel/2016-March/103108.html
>>
>> Rob Clark (6):
>>   egl: initialize SyncCondition after attr parsing
>>   dri: extend fence extension to support native fd fences
>>   egl: add EGL_ANDROID_native_fence_sync
>>   gallium: add way for drivers to create fences without flushing
>>   gallium: wire up server_wait_sync
>>   gallium: support for native fence fd's
>>
>>  include/GL/internal/dri_interface.h   | 44 ++++++++++++++++++-
>>  src/egl/drivers/dri2/egl_dri2.c       | 48 +++++++++++++++++++++
>>  src/egl/main/eglapi.c                 | 36 ++++++++++++++--
>>  src/egl/main/eglapi.h                 |  2 +
>>  src/egl/main/egldisplay.h             |  1 +
>>  src/egl/main/eglfallbacks.c           |  1 +
>>  src/egl/main/eglsync.c                | 32 +++++++++++---
>>  src/egl/main/eglsync.h                |  1 +
>>  src/gallium/include/pipe/p_context.h  | 47 ++++++++++++++++++++
>>  src/gallium/include/pipe/p_defines.h  |  1 +
>>  src/gallium/include/pipe/p_screen.h   |  8 ++++
>>  src/gallium/state_trackers/dri/dri2.c | 80 +++++++++++++++++++++++++++++------
>>  12 files changed, 278 insertions(+), 23 deletions(-)
>>
>> --
>> 2.5.5
>>


More information about the dri-devel mailing list