|
|
|
@ -4571,17 +4571,13 @@ public: |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// CL_MEM_USE_HOST_PTR (nothing is required) and OTHER cases
|
|
|
|
|
if (u->flags & UMatData::USER_ALLOCATED) |
|
|
|
|
{ |
|
|
|
|
cl_int retval = 0; |
|
|
|
|
void* data = clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE, |
|
|
|
|
(CL_MAP_READ | CL_MAP_WRITE), |
|
|
|
|
0, u->size, 0, 0, 0, &retval); |
|
|
|
|
CV_OclDbgAssert(retval == CL_SUCCESS); |
|
|
|
|
CV_OclDbgAssert(clEnqueueUnmapMemObject(q, (cl_mem)u->handle, data, 0, 0, 0) == CL_SUCCESS); |
|
|
|
|
CV_OclDbgAssert(clFinish(q) == CL_SUCCESS); |
|
|
|
|
} |
|
|
|
|
cl_int retval = 0; |
|
|
|
|
void* data = clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE, |
|
|
|
|
(CL_MAP_READ | CL_MAP_WRITE), |
|
|
|
|
0, u->size, 0, 0, 0, &retval); |
|
|
|
|
CV_OclDbgAssert(retval == CL_SUCCESS); |
|
|
|
|
CV_OclDbgAssert(clEnqueueUnmapMemObject(q, (cl_mem)u->handle, data, 0, 0, 0) == CL_SUCCESS); |
|
|
|
|
CV_OclDbgAssert(clFinish(q) == CL_SUCCESS); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
u->markHostCopyObsolete(false); |
|
|
|
@ -4686,8 +4682,6 @@ public: |
|
|
|
|
|
|
|
|
|
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr(); |
|
|
|
|
|
|
|
|
|
// FIXIT Workaround for UMat synchronization issue
|
|
|
|
|
// if( u->refcount == 0 )
|
|
|
|
|
{ |
|
|
|
|
if( !u->copyOnMap() ) |
|
|
|
|
{ |
|
|
|
@ -4720,11 +4714,6 @@ public: |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if (!u->hostCopyObsolete()) // FIXIT Workaround for UMat synchronization issue
|
|
|
|
|
{ |
|
|
|
|
CV_Assert(u->data); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cl_int retval = 0; |
|
|
|
|
u->data = (uchar*)clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE, |
|
|
|
@ -4771,10 +4760,6 @@ 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->deviceMemMapped() ) |
|
|
|
@ -4800,7 +4785,8 @@ public: |
|
|
|
|
u->allocatorFlags_ &= ~svm::OPENCL_SVM_BUFFER_MAP; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
u->data = 0; |
|
|
|
|
if (u->refcount == 0) |
|
|
|
|
u->data = 0; |
|
|
|
|
u->markDeviceCopyObsolete(false); |
|
|
|
|
u->markHostCopyObsolete(true); |
|
|
|
|
return; |
|
|
|
@ -4813,7 +4799,9 @@ public: |
|
|
|
|
// required for multithreaded applications (see stitching test)
|
|
|
|
|
CV_OclDbgAssert(clFinish(q) == CL_SUCCESS); |
|
|
|
|
} |
|
|
|
|
u->data = 0; |
|
|
|
|
|
|
|
|
|
if (u->refcount == 0) |
|
|
|
|
u->data = 0; |
|
|
|
|
} |
|
|
|
|
else if( u->copyOnMap() && u->deviceCopyObsolete() ) |
|
|
|
|
{ |
|
|
|
|