ocl: fix kernels launching with USE_HOST_PTR UMat

created from RAW memory buffers (without proper lifetime management)
pull/13269/head
Alexander Alekhin 6 years ago
parent dc80f9d0fb
commit 9fd822f97e
  1. 7
      modules/core/src/ocl.cpp

@ -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;

Loading…
Cancel
Save