|
|
|
@ -4514,6 +4514,7 @@ public: |
|
|
|
|
CV_Assert(u->refcount >= 0); |
|
|
|
|
|
|
|
|
|
CV_Assert(u->handle != 0 && u->urefcount == 0); |
|
|
|
|
CV_Assert(u->mapcount == 0); |
|
|
|
|
if(u->tempUMat()) |
|
|
|
|
{ |
|
|
|
|
CV_Assert(u->origdata); |
|
|
|
@ -4572,6 +4573,9 @@ public: |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
cl_int retval = 0; |
|
|
|
|
if (u->tempUMat()) |
|
|
|
|
{ |
|
|
|
|
CV_Assert(u->mapcount == 0); |
|
|
|
|
void* data = clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE, |
|
|
|
|
(CL_MAP_READ | CL_MAP_WRITE), |
|
|
|
|
0, u->size, 0, 0, 0, &retval); |
|
|
|
@ -4580,6 +4584,7 @@ public: |
|
|
|
|
CV_OclDbgAssert(clFinish(q) == CL_SUCCESS); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
u->markHostCopyObsolete(false); |
|
|
|
|
} |
|
|
|
|
#ifdef HAVE_OPENCL_SVM |
|
|
|
@ -4715,10 +4720,15 @@ public: |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
cl_int retval = 0; |
|
|
|
|
cl_int retval = CL_SUCCESS; |
|
|
|
|
if (!u->deviceMemMapped()) |
|
|
|
|
{ |
|
|
|
|
CV_Assert(u->refcount == 1); |
|
|
|
|
CV_Assert(u->mapcount++ == 0); |
|
|
|
|
u->data = (uchar*)clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE, |
|
|
|
|
(CL_MAP_READ | CL_MAP_WRITE), |
|
|
|
|
0, u->size, 0, 0, 0, &retval); |
|
|
|
|
} |
|
|
|
|
if (u->data && retval == CL_SUCCESS) |
|
|
|
|
{ |
|
|
|
|
u->markHostCopyObsolete(false); |
|
|
|
@ -4765,7 +4775,6 @@ public: |
|
|
|
|
if( !u->copyOnMap() && u->deviceMemMapped() ) |
|
|
|
|
{ |
|
|
|
|
CV_Assert(u->data != NULL); |
|
|
|
|
u->markDeviceMemMapped(false); |
|
|
|
|
#ifdef HAVE_OPENCL_SVM |
|
|
|
|
if ((u->allocatorFlags_ & svm::OPENCL_SVM_BUFFER_MASK) != 0) |
|
|
|
|
{ |
|
|
|
@ -4792,6 +4801,9 @@ public: |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if (u->refcount == 0) |
|
|
|
|
{ |
|
|
|
|
CV_Assert(u->mapcount-- == 1); |
|
|
|
|
CV_Assert((retval = clEnqueueUnmapMemObject(q, |
|
|
|
|
(cl_mem)u->handle, u->data, 0, 0, 0)) == CL_SUCCESS); |
|
|
|
|
if (Device::getDefault().isAMD()) |
|
|
|
@ -4799,9 +4811,11 @@ public: |
|
|
|
|
// required for multithreaded applications (see stitching test)
|
|
|
|
|
CV_OclDbgAssert(clFinish(q) == CL_SUCCESS); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (u->refcount == 0) |
|
|
|
|
u->markDeviceMemMapped(false); |
|
|
|
|
u->data = 0; |
|
|
|
|
u->markDeviceCopyObsolete(false); |
|
|
|
|
u->markHostCopyObsolete(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if( u->copyOnMap() && u->deviceCopyObsolete() ) |
|
|
|
|
{ |
|
|
|
@ -4811,10 +4825,10 @@ public: |
|
|
|
|
#endif |
|
|
|
|
CV_Assert( (retval = clEnqueueWriteBuffer(q, (cl_mem)u->handle, CL_TRUE, 0, |
|
|
|
|
u->size, alignedPtr.getAlignedPtr(), 0, 0, 0)) == CL_SUCCESS ); |
|
|
|
|
} |
|
|
|
|
u->markDeviceCopyObsolete(false); |
|
|
|
|
u->markHostCopyObsolete(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool checkContinuous(int dims, const size_t sz[], |
|
|
|
|
const size_t srcofs[], const size_t srcstep[], |
|
|
|
|