From: Alexander Alekhin Date: Thu, 13 Mar 2014 12:39:54 +0000 (+0400) Subject: ocl: workaround for synchronization issue in ::map() X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~3303^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3578f0afe95b9e182f86476629f333a9beaf6517;p=platform%2Fupstream%2Fopencv.git ocl: workaround for synchronization issue in ::map() --- 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 )