BACKPORT: dma-buf/sync_file: Allow multiple sync_files to wrap a single dma-fence
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 28 Jul 2017 21:29:51 +0000 (22:29 +0100)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 7 Aug 2018 10:14:50 +0000 (03:14 -0700)
commit3491d1638b74c2e67241d1b1917634e8875b9256
tree599fc2334fc790fe3907292712b75faa5cdf0471
parentbb1ee7b2993005e8ceb9791286a177bdb90e69c7
BACKPORT: dma-buf/sync_file: Allow multiple sync_files to wrap a single dma-fence

Up until recently sync_file were create to export a single dma-fence to
userspace, and so we could canabalise a bit insie dma-fence to mark
whether or not we had enable polling for the sync_file itself. However,
with the advent of syncobj, we do allow userspace to create multiple
sync_files for a single dma-fence. (Similarly, that the sw-sync
validation framework also started returning multiple sync-files wrapping
a single dma-fence for a syncpt also triggering the problem.)

This patch reverts my suggestion in commit e24165537312
("dma-buf/sync_file: only enable fence signalling on poll()") to use a
single bit in the shared dma-fence and restores the sync_file->flags for
tracking the bits individually.

Reported-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Fixes: f1e8c67123cf ("dma-buf/sw-sync: Use an rbtree to sort fences in the timeline")
Fixes: e9083420bbac ("drm: introduce sync objects (v4)")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170728212951.7818-1-chris@chris-wilson.co.uk
[astrachan: rediffed against changed context lines in 4.9]
Bug: 79383895
PD#170298 [1/3]
Change-Id: I70d1f19796c6cb33cd4c19e40276d7298aa4ba5d
Signed-off-by: Alistair Strachan <astrachan@google.com>
drivers/dma-buf/sync_file.c
include/linux/sync_file.h