Normally, you need allocate a nvbuffer for Dest surface.
Then you can copy source image into Dest surface by convert for many times.
For each convert, you can use setDestRect to specify the destination rect by setDestRect in destination surface.
I follow your ideas to learn about the mmapi code, there are a few questions to ask.
1, is nvmm_buffer allocated for Dest surface queued to the VIC 's capture_plane ?
2, the VIC capture_plane->setupPlane() type is V4L2_MEMORY_DMABUF ?
3, if it is, capture_plane->qBuffer() need a NvBuffer *shared_buffer, how do I get NvBuffer by dma_fd, then used as shared_buffer
Hi lilin:
1, is nvmm_buffer allocated for Dest surface queued to the VIC 's capture_plane ?
Depends on which memory type you are using, if V4L2_MEMORY_DMABUF, no nvmmbuffer is allocated.
If V4L2_MEMORY_MMAP, then nvmmbuffer is allocated.
2, the VIC capture_plane->setupPlane() type is V4L2_MEMORY_DMABUF ?
I think both V4L2_MEMORY_MMAP and V4L2_MEMORY_DMABUF can be used.
If V4L2_MEMORY_MMAP, you can use nvbuffer on capture plane as destination buffer.
If V4L2_MEMORY_DMABUF, you can use nvbuffercreate to create a buffer as destination buffer, then use fd as input, you can refer to sample camera_recording about how fd is used.
3, if it is, capture_plane->qBuffer() need a NvBuffer *shared_buffer, how do I get NvBuffer by dma_fd, then used as shared_buffer
See camera recording sample about how V4L2_MEMORY_DMABUF is used.
I have modified 02_video_dec_cuda, to achieve the simple stitching function, I also found some problems during the test:
1, I used VIC to copy a decoded images to different target areas , I must wait for a VIC’s capture_plane callback function is called(VIC processing is completed), then let another VIC to copy another image, otherwise there will be Conflict occurred. I use VIC to copy the same decoded images to the non-overlapping target area, why would it conflict?
2, VIC processing image speed is slow, from the input of a frame image, to the output of a frame of synthetic images, the slowest to 25ms or so, the second VIC (my conv1)will take more time. is there any way to improve the processing speed
1, I used VIC to copy a decoded images to different target areas , I must wait for a VIC’s capture_plane callback function is called(VIC processing is completed), then let another VIC to copy another image, otherwise there will be Conflict occurred. I use VIC to copy the same decoded images to the non-overlapping target area, why would it conflict?
Yes You must wait for capture_plane callback function being called, then let another VIC to stitch.
2, VIC processing image speed is slow, from the input of a frame image, to the output of a frame of synthetic images, the slowest to 25ms or so, the second VIC (my conv1)will take more time. is there any way to improve the processing speed
Normally, it only need 1.5ms to do stitch. I need some time to investigate your code.
conv0 output_plane qBuffer frame[5] at 222 ms
conv0 capture_plane dqBuffer frame[5] at 228 ms
conv0 output_plane qBuffer frame[6] at 278 ms
conv0 capture_plane dqBuffer frame[6] at 288 ms
conv0 output_plane qBuffer frame[7] at 348 ms
conv0 capture_plane dqBuffer frame[7] at 352 ms
conv0 output_plane qBuffer frame[45] at 2000 ms
conv0 capture_plane dqBuffer frame[45] at 2005 ms
conv0 output_plane qBuffer frame[46] at 2046 ms
conv0 capture_plane dqBuffer frame[46] at 2056 ms
conv0 output_plane qBuffer frame[47] at 2088 ms
conv0 capture_plane dqBuffer frame[47] at 2093 ms