Commit 58934f1e authored by Vladimir Dudnik's avatar Vladimir Dudnik

add condition to skip unmapping for internally allocated host memory. this…

add condition to skip unmapping for internally allocated host memory. this should fix map_unmap_counting UMat test.
parent 8e5ce69e
...@@ -4572,13 +4572,16 @@ public: ...@@ -4572,13 +4572,16 @@ public:
else else
{ {
// CL_MEM_USE_HOST_PTR (nothing is required) and OTHER cases // CL_MEM_USE_HOST_PTR (nothing is required) and OTHER cases
cl_int retval = 0; if (u->flags & UMatData::USER_ALLOCATED)
void* data = clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE, {
(CL_MAP_READ | CL_MAP_WRITE), cl_int retval = 0;
0, u->size, 0, 0, 0, &retval); void* data = clEnqueueMapBuffer(q, (cl_mem)u->handle, CL_TRUE,
CV_OclDbgAssert(retval == CL_SUCCESS); (CL_MAP_READ | CL_MAP_WRITE),
CV_OclDbgAssert(clEnqueueUnmapMemObject(q, (cl_mem)u->handle, data, 0, 0, 0) == CL_SUCCESS); 0, u->size, 0, 0, 0, &retval);
CV_OclDbgAssert(clFinish(q) == CL_SUCCESS); 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); u->markHostCopyObsolete(false);
......
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