1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

5.x: cleanup compatibility code (2021-10)

This commit is contained in:
Alexander Alekhin
2021-10-16 14:24:50 +03:00
parent 7ba26ada12
commit fce4a19d0d
15 changed files with 30 additions and 118 deletions
+3 -22
View File
@@ -2985,7 +2985,7 @@ Device& Context::device(size_t idx) const
return !p || idx >= p->devices.size() ? dummy : p->devices[idx];
}
Context& Context::getDefault(bool initialize)
Context& Context::getDefault()
{
auto& c = OpenCLExecutionContext::getCurrent();
if (!c.empty())
@@ -2994,7 +2994,6 @@ Context& Context::getDefault(bool initialize)
return ctx;
}
CV_UNUSED(initialize);
static Context dummy;
return dummy;
}
@@ -3864,18 +3863,6 @@ bool Kernel::run_(int dims, size_t _globalsize[], size_t _localsize[],
}
static bool isRaiseErrorOnReuseAsyncKernel()
{
static bool initialized = false;
static bool value = false;
if (!initialized)
{
value = cv::utils::getConfigurationParameterBool("OPENCV_OPENCL_RAISE_ERROR_REUSE_ASYNC_KERNEL", false);
initialized = true;
}
return value;
}
bool Kernel::Impl::run(int dims, size_t globalsize[], size_t localsize[],
bool sync, int64* timeNS, const Queue& q)
{
@@ -3889,19 +3876,13 @@ bool Kernel::Impl::run(int dims, size_t globalsize[], size_t localsize[],
if (isAsyncRun)
{
CV_LOG_ERROR(NULL, "OpenCL kernel can't be reused in async mode: " << name);
if (isRaiseErrorOnReuseAsyncKernel())
CV_Assert(0);
return false; // OpenCV 5.0: raise error
CV_Error_(Error::StsError, ("OpenCL kernel can't be reused in async mode: %s", name.c_str()));
}
isAsyncRun = !sync;
if (isInProgress)
{
CV_LOG_ERROR(NULL, "Previous OpenCL kernel launch is not finished: " << name);
if (isRaiseErrorOnReuseAsyncKernel())
CV_Assert(0);
return false; // OpenCV 5.0: raise error
CV_Error_(Error::StsError, ("Previous OpenCL kernel launch is not finished: %s", name.c_str()));
}
#if CV_OPENCL_SYNC_RUN_KERNELS
+1 -1
View File
@@ -165,7 +165,7 @@ Program Context::getProg(const ProgramSource& prog, const String& buildopt, Stri
void Context::unloadProg(Program& prog) { }
/* static */
Context& Context::getDefault(bool initialize)
Context& Context::getDefault()
{
static Context dummy;
return dummy;
+1 -1
View File
@@ -178,7 +178,7 @@ Context& initializeContextFromVA(VADisplay display, bool tryInterop)
}
# endif // HAVE_VA_INTEL
{
Context& ctx = Context::getDefault(true);
Context& ctx = Context::getDefault();
return ctx;
}
#endif // !HAVE_VA