mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge pull request #16608 from vpisarev:fix_mac_ocl_tests
* fixed several problems when running tests on Mac: * OCL_pyrUp * OCL_flip * some basic UMat tests * histogram badarg test (out of range access) * retained the storepix fix in ocl_flip only for 16U/16S datatype, where the OpenCL compiler on Mac generates incorrect code * moved deletion of ACCESS_FAST flag to non-SVM branch (where SVM is shared virtual memory (in OpenCL 2.x), not support vector machine) * force OpenCL to use read/write for GPU<=>CPU memory transfers on machines with discrete video only on Macs. On Windows/Linux the drivers are seemingly smart enough to implement map/unmap properly (and maybe more efficiently than explicit read/write)
This commit is contained in:
@@ -4705,6 +4705,8 @@ public:
|
||||
int createFlags = 0, flags0 = 0;
|
||||
getBestFlags(ctx, accessFlags, usageFlags, createFlags, flags0);
|
||||
|
||||
bool copyOnMap = (flags0 & UMatData::COPY_ON_MAP) != 0;
|
||||
|
||||
cl_context ctx_handle = (cl_context)ctx.ptr();
|
||||
int allocatorFlags = 0;
|
||||
int tempUMatFlags = 0;
|
||||
@@ -4764,8 +4766,15 @@ public:
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if( copyOnMap )
|
||||
accessFlags &= ~ACCESS_FAST;
|
||||
|
||||
tempUMatFlags = UMatData::TEMP_UMAT;
|
||||
if (CV_OPENCL_ENABLE_MEM_USE_HOST_PTR
|
||||
if (
|
||||
#ifdef __APPLE__
|
||||
!copyOnMap &&
|
||||
#endif
|
||||
CV_OPENCL_ENABLE_MEM_USE_HOST_PTR
|
||||
// There are OpenCL runtime issues for less aligned data
|
||||
&& (CV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR != 0
|
||||
&& u->origdata == cv::alignPtr(u->origdata, (int)CV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR))
|
||||
@@ -4793,7 +4802,7 @@ public:
|
||||
u->handle = handle;
|
||||
u->prevAllocator = u->currAllocator;
|
||||
u->currAllocator = this;
|
||||
u->flags |= tempUMatFlags;
|
||||
u->flags |= tempUMatFlags | flags0;
|
||||
u->allocatorFlags_ = allocatorFlags;
|
||||
}
|
||||
if(accessFlags & ACCESS_WRITE)
|
||||
|
||||
Reference in New Issue
Block a user