Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU) GPU
• DeepStream Version 5.0 Beta
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only) 10.2
• Issue Type( questions, new requirements, bugs) questions
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
I want to copy the NvBufSurface structure in gst-buffer from CUDA device to CPU, I try to create a new surface in CPU and then apply NvBufSurfaceCopy function. but it says “buffer size mismatch” and failed to copy.
As I dig into this, the ip_surf_cuda structure have batchSize=4 and numFilled=2, only the firest 2 entry have dataSize>2. Is there any reference solution to conduct the copy process?
GstMapInfo inmap = GST_MAP_INFO_INIT;
if (!gst_buffer_map (buf, &inmap, GST_MAP_READ)) {
NVGSTDS_ERR_MSG_V ("Input buffer mapinfo failed.");
return;
}
NvBufSurface *ip_surf_cuda = (NvBufSurface *) inmap.data;
// FIXME: copy content from CUDA to CPU accessible memory. or set memory type to NVBUF_MEM_CUDA_UNIFIED
NvBufSurface *ip_surf = NULL;
NvBufSurfaceCreateParams params = {
.size = ip_surf_cuda->surfaceList[0].dataSize,
.memType = NVBUF_MEM_SYSTEM
};
NvBufSurfaceCreate (&ip_surf, ip_surf_cuda->numFilled, ¶ms);
ip_surf->batchSize = ip_surf_cuda->batchSize;
ip_surf->numFilled = ip_surf_cuda->numFilled;
ip_surf->memType = NVBUF_MEM_SYSTEM;
for (int i=0; i < ip_surf_cuda->batchSize; i++) {
ip_surf->surfaceList[i].dataSize = ip_surf_cuda->surfaceList[i].dataSize;
}
// abort();
if (NvBufSurfaceCopy (ip_surf_cuda, ip_surf) != 0) {
GST_CAT_DEBUG (NVDS_APP, "Fail to copy surface to cpu, mem type = %d",
ip_surf->memType);
goto done;
} else {
GST_CAT_DEBUG (NVDS_APP, "Successfully copy surface to cpu, mem type = %d",
ip_surf->memType);
}
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)