Commit 82f4322d authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #13269 from alalek:ocl_fix_kernels_with_use_host_mem

parents 36b6bcb6 9fd822f9
......@@ -2777,6 +2777,7 @@ struct Kernel::Impl
for( int i = 0; i < MAX_ARRS; i++ )
u[i] = 0;
haveTempDstUMats = false;
haveTempSrcUMats = false;
}
void cleanupUMats()
......@@ -2793,6 +2794,7 @@ struct Kernel::Impl
}
nu = 0;
haveTempDstUMats = false;
haveTempSrcUMats = false;
}
void addUMat(const UMat& m, bool dst)
......@@ -2803,6 +2805,8 @@ struct Kernel::Impl
nu++;
if(dst && m.u->tempUMat())
haveTempDstUMats = true;
if(m.u->originalUMatData == NULL && m.u->tempUMat())
haveTempSrcUMats = true; // UMat is created on RAW memory (without proper lifetime management, even from Mat)
}
void addImage(const Image2D& image)
......@@ -2840,6 +2844,7 @@ struct Kernel::Impl
int nu;
std::list<Image2D> images;
bool haveTempDstUMats;
bool haveTempSrcUMats;
};
}} // namespace cv::ocl
......@@ -3113,6 +3118,8 @@ bool Kernel::Impl::run(int dims, size_t globalsize[], size_t localsize[],
cl_command_queue qq = getQueue(q);
if (haveTempDstUMats)
sync = true;
if (haveTempSrcUMats)
sync = true;
if (timeNS)
sync = true;
cl_event asyncEvent = 0;
......
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