dma-buf: Wait on the reservation object when sync'ing before CPU access
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 15 Aug 2016 15:42:18 +0000 (16:42 +0100)
committerSumit Semwal <sumit.semwal@linaro.org>
Tue, 16 Aug 2016 07:01:35 +0000 (12:31 +0530)
commitae4e46b14bd7a12fb7908425846be7ceb0853bbc
treed34ce6b16f6e83e97b7041874c97f17a5b167428
parent90844f00049e9f42573fd31d7c32e8fd31d3fd07
dma-buf: Wait on the reservation object when sync'ing before CPU access

Rendering operations to the dma-buf are tracked implicitly via the
reservation_object (dmabuf->resv). This is used to allow poll() to
wait upon outstanding rendering (or just query the current status of
rendering). The dma-buf sync ioctl allows userspace to prepare the
dma-buf for CPU access, which should include waiting upon rendering.
(Some drivers may need to do more work to ensure that the dma-buf mmap
is coherent as well as complete.)

v2: Always wait upon the reservation object implicitly. We choose to do
it after the native handler in case it can do so more efficiently.

Testcase: igt/prime_vgem
Testcase: igt/gem_concurrent_blit # *vgem*
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Eric Anholt <eric@anholt.net>
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1471275738-31994-1-git-send-email-chris@chris-wilson.co.uk
drivers/dma-buf/dma-buf.c