ocl: add map tests

pull/4233/head
Alexander Alekhin 9 years ago
parent b36f565d13
commit cd5c70691a
  1. 2
      modules/core/src/umatrix.cpp
  2. 31
      modules/core/test/test_umat.cpp

@ -606,7 +606,7 @@ void* UMat::handle(int accessFlags) const
// check flags: if CPU copy is newer, copy it back to GPU.
if( u->deviceCopyObsolete() )
{
CV_Assert(u->refcount == 0);
CV_Assert(u->refcount == 0 || u->origdata);
u->currAllocator->unmap(u);
}

@ -935,9 +935,7 @@ TEST(UMat, DISABLED_synchronization_map_unmap)
}
}
} } // namespace cvtest::ocl
TEST(UMat, DISABLED_bug_with_unmap)
TEST(UMat, async_unmap)
{
for (int i = 0; i < 20; i++)
{
@ -963,7 +961,7 @@ TEST(UMat, DISABLED_bug_with_unmap)
}
}
TEST(UMat, DISABLED_bug_with_unmap_in_class)
TEST(UMat, unmap_in_class)
{
class Logic
{
@ -1004,6 +1002,28 @@ TEST(UMat, DISABLED_bug_with_unmap_in_class)
}
}
TEST(UMat, map_unmap_counting)
{
if (!cv::ocl::useOpenCL())
{
std::cout << "OpenCL is not enabled. Skip test" << std::endl;
return;
}
std::cout << "Host memory: " << cv::ocl::Device::getDefault().hostUnifiedMemory() << std::endl;
Mat m(Size(10, 10), CV_8UC1);
UMat um = m.getUMat(ACCESS_RW);
{
Mat d = um.getMat(ACCESS_RW);
d.release();
}
void* h = NULL;
EXPECT_NO_THROW(h = um.handle(ACCESS_RW));
std::cout << "Handle: " << h << std::endl;
}
TEST(UMat, Test_same_behaviour_read_and_read)
{
bool exceptionDetected = false;
@ -1070,3 +1090,6 @@ TEST(UMat, DISABLED_Test_same_behaviour_write_and_write)
}
ASSERT_TRUE(exceptionDetected); // data race
}
} } // namespace cvtest::ocl

Loading…
Cancel
Save