mirror of https://github.com/OpenIPC/firmware.git
50 lines
1.6 KiB
Diff
50 lines
1.6 KiB
Diff
diff -drupN a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
|
|
--- a/drivers/dma-buf/sync_file.c 2018-08-06 17:23:04.000000000 +0300
|
|
+++ b/drivers/dma-buf/sync_file.c 2022-06-12 05:28:14.000000000 +0300
|
|
@@ -46,6 +46,7 @@ static struct sync_file *sync_file_alloc
|
|
init_waitqueue_head(&sync_file->wq);
|
|
|
|
INIT_LIST_HEAD(&sync_file->cb.node);
|
|
+ sync_file->cb.func = NULL;
|
|
|
|
return sync_file;
|
|
|
|
@@ -279,8 +280,7 @@ static void sync_file_free(struct kref *
|
|
struct sync_file *sync_file = container_of(kref, struct sync_file,
|
|
kref);
|
|
|
|
- if (test_bit(POLL_ENABLED, &sync_file->fence->flags))
|
|
- fence_remove_callback(sync_file->fence, &sync_file->cb);
|
|
+ fence_remove_callback(sync_file->fence, &sync_file->cb);
|
|
fence_put(sync_file->fence);
|
|
kfree(sync_file);
|
|
}
|
|
@@ -296,13 +296,24 @@ static int sync_file_release(struct inod
|
|
static unsigned int sync_file_poll(struct file *file, poll_table *wait)
|
|
{
|
|
struct sync_file *sync_file = file->private_data;
|
|
+ unsigned long flags;
|
|
+ bool add = 0;
|
|
|
|
poll_wait(file, &sync_file->wq, wait);
|
|
|
|
- if (!poll_does_not_wait(wait) &&
|
|
- !test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) {
|
|
+ /* JetCui: if you modify it think about the gpu source code,
|
|
+ * if not the kernel original, tell gpu department
|
|
+ */
|
|
+ spin_lock_irqsave(sync_file->fence->lock, flags);
|
|
+ if (sync_file->cb.func == NULL) {
|
|
+ sync_file->cb.func = fence_check_cb_func;
|
|
+ add = 1;
|
|
+ }
|
|
+ spin_unlock_irqrestore(sync_file->fence->lock, flags);
|
|
+
|
|
+ if (add) {
|
|
if (fence_add_callback(sync_file->fence, &sync_file->cb,
|
|
- fence_check_cb_func) < 0)
|
|
+ fence_check_cb_func) < 0)
|
|
wake_up_all(&sync_file->wq);
|
|
}
|
|
|