From 9bcccb028b1321f02b228451db41321b449cb98c Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 27 Jul 2015 17:04:19 +0300 Subject: [PATCH] fixes --- modules/core/src/ocl.cpp | 9 ++++++++- modules/core/test/test_umat.cpp | 7 +++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 9e54da391c..3fa3bd0e37 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -4516,7 +4516,14 @@ public: } else { - // nothing with CL_MEM_USE_HOST_PTR + // CL_MEM_USE_HOST_PTR (nothing is required) and OTHER cases + 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); diff --git a/modules/core/test/test_umat.cpp b/modules/core/test/test_umat.cpp index ce0a6ab399..958f0c3d12 100644 --- a/modules/core/test/test_umat.cpp +++ b/modules/core/test/test_umat.cpp @@ -897,8 +897,9 @@ TEST(UMat, ReadBufferRect) EXPECT_MAT_NEAR(t, t2, 0); } + // Use iGPU or OPENCV_OPENCL_DEVICE=:CPU: to catch problem -TEST(UMat, DISABLED_synchronization_map_unmap) +TEST(UMat, synchronization_map_unmap) { class TestParallelLoopBody : public cv::ParallelLoopBody { @@ -935,6 +936,7 @@ TEST(UMat, DISABLED_synchronization_map_unmap) } } + TEST(UMat, async_unmap) { for (int i = 0; i < 20; i++) @@ -961,6 +963,7 @@ TEST(UMat, async_unmap) } } + TEST(UMat, unmap_in_class) { class Logic @@ -1024,7 +1027,7 @@ TEST(UMat, map_unmap_counting) -TEST(UMat, Test_same_behaviour_read_and_read) +TEST(UMat, DISABLED_Test_same_behaviour_read_and_read) { bool exceptionDetected = false; try