From 3578f0afe95b9e182f86476629f333a9beaf6517 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 13 Mar 2014 16:39:54 +0400 Subject: [PATCH] ocl: workaround for synchronization issue in ::map() --- modules/core/src/ocl.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 2017300..9b4cf72 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -3798,11 +3798,16 @@ public: cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr(); - if( u->refcount == 0 ) + // FIXIT Workaround for UMat synchronization issue + // if( u->refcount == 0 ) { if( !u->copyOnMap() ) { - CV_Assert(u->data == 0); + if (u->data) // FIXIT Workaround for UMat synchronization issue + { + //CV_Assert(u->hostCopyObsolete() == false); + return; + } // because there can be other map requests for the same UMat with different access flags, // we use the universal (read-write) access mode. cl_int retval = 0; @@ -3844,6 +3849,10 @@ public: UMatDataAutoLock autolock(u); + // FIXIT Workaround for UMat synchronization issue + if(u->refcount > 0) + return; + cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr(); cl_int retval = 0; if( !u->copyOnMap() && u->data ) -- 2.7.4