From: Jiyu Yang Date: Tue, 13 Mar 2018 03:33:03 +0000 (+0800) Subject: gpu: mali internal fence wait signaled when return -ENOENT X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0a75bc5a837c4bdfac0feeb18b2b1decb35f8cf5;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_mali-driver.git gpu: mali internal fence wait signaled when return -ENOENT PD#160990 Note that the callback can be called from an atomic context. If fence is already signaled, this function will return -ENOENT (and *not* call the callback) Change-Id: I347e082b7b7639f8122f65734467977494a53445 --- diff --git a/mali/linux/mali_internal_sync.c b/mali/linux/mali_internal_sync.c index d8939dc..a951cef 100644 --- a/mali/linux/mali_internal_sync.c +++ b/mali/linux/mali_internal_sync.c @@ -95,7 +95,8 @@ static void mali_internal_fence_check_cb_func(struct dma_fence *fence, struct dm ret =sync_fence->fence->ops->signaled(sync_fence->fence); if (0 > ret) - MALI_PRINT_ERROR(("Mali internal sync:Failed to wait fence 0x%x for sync_fence 0x%x.\n", fence, sync_fence)); + trace_printk("Mali internal sync:fence signaled? ret=%d, fence 0x%p for sync_fence 0x%p.\n", ret, fence, sync_fence); + if (1 == ret) wake_up_all(&sync_fence->wq); #endif @@ -549,8 +550,10 @@ int mali_internal_sync_fence_wait_async(struct mali_internal_sync_fence *sync_fe else err = -1; - if (0 > err) + if (0 > err) { + trace_printk("Mali, line%d, signal error\n", __LINE__); return err; + } if (1 == err) return err; @@ -561,8 +564,12 @@ int mali_internal_sync_fence_wait_async(struct mali_internal_sync_fence *sync_fe err = fence_add_callback(sync_fence->fence, &waiter->cb, mali_internal_fence_check_cb_func); #endif - if (0 != err) + if (0 != err) { + trace_printk("Mali, fence_add_callback error %d\n", err); + if (-ENOENT == err) + err = 1; return err; + } init_waitqueue_func_entry(&waiter->work, mali_internal_sync_fence_wake_up_wq); waiter->work.private = sync_fence; @@ -572,7 +579,10 @@ int mali_internal_sync_fence_wait_async(struct mali_internal_sync_fence *sync_fe if (0 == err) __add_wait_queue_tail(&sync_fence->wq, &waiter->work); + spin_unlock_irqrestore(&sync_fence->wq.lock, flags); + if ((1 != err) && (0 != err)) + trace_printk("Mali, line%d, signal error\n", __LINE__); return err; #endif