Commit 3656a1aa authored by Andrey Pavlenko's avatar Andrey Pavlenko

fixing 'map_unmap_counting'

parent f6b75869
...@@ -4683,8 +4683,6 @@ public: ...@@ -4683,8 +4683,6 @@ public:
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr(); cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
// FIXIT Workaround for UMat synchronization issue
// if( u->refcount == 0 )
{ {
if( !u->copyOnMap() ) if( !u->copyOnMap() )
{ {
...@@ -4717,11 +4715,6 @@ public: ...@@ -4717,11 +4715,6 @@ public:
return; return;
} }
#endif #endif
if (!u->hostCopyObsolete()) // FIXIT Workaround for UMat synchronization issue
{
CV_Assert(u->data);
return;
}
cl_int retval = 0; cl_int retval = 0;
u->data = (uchar*)clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE, u->data = (uchar*)clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE,
...@@ -4768,10 +4761,6 @@ public: ...@@ -4768,10 +4761,6 @@ public:
UMatDataAutoLock autolock(u); 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_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
cl_int retval = 0; cl_int retval = 0;
if( !u->copyOnMap() && u->deviceMemMapped() ) if( !u->copyOnMap() && u->deviceMemMapped() )
...@@ -4797,7 +4786,8 @@ public: ...@@ -4797,7 +4786,8 @@ public:
u->allocatorFlags_ &= ~svm::OPENCL_SVM_BUFFER_MAP; u->allocatorFlags_ &= ~svm::OPENCL_SVM_BUFFER_MAP;
} }
} }
u->data = 0; if (u->refcount == 0)
u->data = 0;
u->markDeviceCopyObsolete(false); u->markDeviceCopyObsolete(false);
u->markHostCopyObsolete(true); u->markHostCopyObsolete(true);
return; return;
...@@ -4810,7 +4800,9 @@ public: ...@@ -4810,7 +4800,9 @@ public:
// required for multithreaded applications (see stitching test) // required for multithreaded applications (see stitching test)
CV_OclDbgAssert(clFinish(q) == CL_SUCCESS); CV_OclDbgAssert(clFinish(q) == CL_SUCCESS);
} }
u->data = 0;
if (u->refcount == 0)
u->data = 0;
} }
else if( u->copyOnMap() && u->deviceCopyObsolete() ) else if( u->copyOnMap() && u->deviceCopyObsolete() )
{ {
......
...@@ -1035,8 +1035,9 @@ TEST(UMat, map_unmap_counting) ...@@ -1035,8 +1035,9 @@ TEST(UMat, map_unmap_counting)
Mat m(Size(10, 10), CV_8UC1); Mat m(Size(10, 10), CV_8UC1);
UMat um = m.getUMat(ACCESS_RW); UMat um = m.getUMat(ACCESS_RW);
{ {
Mat d = um.getMat(ACCESS_RW); Mat d1 = um.getMat(ACCESS_RW);
d.release(); //Mat d2 = um.getMat(ACCESS_RW);
d1.release();
} }
void* h = NULL; void* h = NULL;
EXPECT_NO_THROW(h = um.handle(ACCESS_RW)); EXPECT_NO_THROW(h = um.handle(ACCESS_RW));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment