Commit d76b41b5 authored by Alexander Alekhin's avatar Alexander Alekhin

ocl: CL_MEM_USE_HOST_PTR workaround test

parent 7ea5029a
...@@ -4666,7 +4666,9 @@ public: ...@@ -4666,7 +4666,9 @@ public:
#endif #endif
{ {
tempUMatFlags = UMatData::TEMP_UMAT; tempUMatFlags = UMatData::TEMP_UMAT;
if (u->origdata == cv::alignPtr(u->origdata, 4)) // There are OpenCL runtime issues for less aligned data if (u->origdata == cv::alignPtr(u->origdata, 4) // There are OpenCL runtime issues for less aligned data
&& !(u->originalUMatData && u->originalUMatData->handle) // Avoid sharing of host memory between OpenCL buffers
)
{ {
handle = clCreateBuffer(ctx_handle, CL_MEM_USE_HOST_PTR|createFlags, handle = clCreateBuffer(ctx_handle, CL_MEM_USE_HOST_PTR|createFlags,
u->size, u->origdata, &retval); u->size, u->origdata, &retval);
......
...@@ -381,6 +381,7 @@ UMat Mat::getUMat(int accessFlags, UMatUsageFlags usageFlags) const ...@@ -381,6 +381,7 @@ UMat Mat::getUMat(int accessFlags, UMatUsageFlags usageFlags) const
if(!a) if(!a)
a = a0; a = a0;
new_u = a->allocate(dims, size.p, type(), data, step.p, accessFlags, usageFlags); new_u = a->allocate(dims, size.p, type(), data, step.p, accessFlags, usageFlags);
new_u->originalUMatData = u;
} }
bool allocated = false; bool allocated = false;
CV_TRY CV_TRY
...@@ -404,7 +405,6 @@ UMat Mat::getUMat(int accessFlags, UMatUsageFlags usageFlags) const ...@@ -404,7 +405,6 @@ UMat Mat::getUMat(int accessFlags, UMatUsageFlags usageFlags) const
CV_Assert(new_u->tempUMat()); CV_Assert(new_u->tempUMat());
} }
#endif #endif
new_u->originalUMatData = u;
CV_XADD(&(u->refcount), 1); CV_XADD(&(u->refcount), 1);
CV_XADD(&(u->urefcount), 1); CV_XADD(&(u->urefcount), 1);
} }
......
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