Hi all.
I am working on code that read image from camera - add layer over it and dispaly it on the screen.
The System is jetson nano, using the x11-server
I use X11 lib for rendrenig image on screen.
I am using c cuda library and nvcc as the compiler
Here is my compiling string:
“nvcc -g -o SBPipe …sources… -lX11 -lxcb -lXau -lXdmcp -lpthread -ljpeg -lasound -ldl -lpng”
I recive Error code 719,
Or app crash.
Here is the scemtic code:
- I receive camera frame into byte array.
- I have the layer as CUDA manged array (cudaMallocManaged)
- I cudaMemcpy the frame to another cudaManaged array.
- I run Add layer function – Device function .
- Wait with cudaDeviceSynchronize();
- cudaMemcpy the results back to camera frame byte array
- Use
XLockDisplay(videoOut.dis);
videoOut.ximage = ximage;
XunlockDisplay(videoOut.dis);
To render frame on screen.
Here is Code Example:
*uint8_t tempBuffer = NULL;
//Create cuda Managed tempBuffer
cudaMallocManaged(&tempBuffer, videoIn.width * videoIn.height * 4);// Frame diamention – 4 //bytes per pixel.
//Copy frame data to tempBuffer.
cudaError_t t = cudaMemcpy(tempBuffer, ximage->data, videoIn.width * videoIn.height * 4, cudaMemcpyHostToDevice);
printf(“cudaMemcpy 1 error code: %d \n”, t);
//Run Add layer function
int blockSize = 256;
int numBlocks = (tmp.Size + blockSize - 1) / blockSize;
AddLayerCuda<<<1, blockSize>>>(tempBuffer, tmp.layer, tmp.Width, tmp.Height,
tmp.Size, ximage->width, ximage->height, 10,
10);
// Wait for GPU to finish before accessing on host
t = cudaDeviceSynchronize();
printf(“cudaDeviceSynchronize error code: %d \n”, t);
//Copy back tempBuffer to frame byte array
t = cudaMemcpy(ximage->data, tempBuffer, videoIn.width * videoIn.height * 4, cudaMemcpyDeviceToHost);
All of cuda error above are
“cudaDeviceSynchronize error code: 719
cudaMemcpy error code: 719 ”
…
//Render on screen
XLockDisplay(videoOut.dis);
videoOut.ximage = ximage;
XunlockDisplay(videoOut.dis);
Could you please advise me what is the problem? Thank you!