From: Jiyu Yang Date: Wed, 27 Sep 2017 11:42:17 +0000 (+0800) Subject: gpu: fixed sync leak in AOSP common kernel or LTS kernel 4.10 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=22f0e67f96dbce31ae872f08232fbca96f5a767f;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_mali-driver.git gpu: fixed sync leak in AOSP common kernel or LTS kernel 4.10 PD#151104 Change-Id: I1d1b1481b4579be486525c44378205326c372dd4 --- diff --git a/mali/linux/mali_internal_sync.c b/mali/linux/mali_internal_sync.c index 3a9f03a..ea9557a 100755 --- a/mali/linux/mali_internal_sync.c +++ b/mali/linux/mali_internal_sync.c @@ -289,6 +289,10 @@ struct mali_internal_sync_fence *mali_internal_sync_fence_merge( return NULL; } + fence_remove_callback(new_sync_fence->cb[0].fence, &new_sync_fence->cb[0].cb); + new_sync_fence->num_fences = 0; + atomic_dec(&new_sync_fence->status); + for (; i < num_fence1 && j < num_fence2;) { struct fence *fence1 = sync_fence1->cbs[i].fence; struct fence *fence2 = sync_fence2->cbs[j].fence; @@ -468,7 +472,13 @@ struct mali_internal_sync_fence *mali_internal_sync_fence_merge( MALI_PRINT_ERROR(("Mali internal sync:Failed to create the mali internal sync fence when merging sync fence.\n")); goto sync_fence_alloc_failed; } - + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) + fence_put(fences[0]); +#else + dma_fence_put(fences[0]); +#endif + if (mali_internal_sync_fence_set_fence_array(sync_fence, fences, real_num_fences) < 0) { MALI_PRINT_ERROR(("Mali internal sync:Failed to set fence for sync fence.\n")); goto sync_fence_set_failed; diff --git a/mali/linux/mali_sync.c b/mali/linux/mali_sync.c index 2bba431..1712cfd 100755 --- a/mali/linux/mali_sync.c +++ b/mali/linux/mali_sync.c @@ -613,6 +613,12 @@ struct mali_internal_sync_fence *mali_sync_flag_create_fence(struct mali_sync_fl return NULL; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) + fence_put(&sync_pt->base); +#else + dma_fence_put(&sync_pt->base); +#endif + return sync_fence; } #endif