[mmapi] can dec's capture_plane use nvmm_buffer created by NvBufferCreate() ?

I modified the sample 02_video_dec_cuda ,let dec’s capture_plane use nvmm_buffer I created by NvBufferCreate() ,but I found that dec did not write data to nvmm_buffer. I sent nvmm_buffer to the VIC and renderer, that show a green screen.

I made these changes:

  1. dec->capture_plane.setupPlane(),set V4L2_MEMORY_DMABUF

  2. create some nvmm_buffer
    I did not find the format corresponding to V4L2_PIX_FMT_NV12M

if (-1 == NvBufferCreate(&fd, 1920, 1088,
            ERROR_RETURN("Failed to create NvBuffer");
  1. Enqueue all the empty buffer to dec’s capture_plane in query_and_set_capture()
v4l2_buf.index = i;
v4l2_buf.m.planes = planes;
v4l2_buf.m.planes[0].m.fd = (unsigned long)ctx->g_buff[i].dmabuff_fd;
v4l2_buf.m.planes[0].bytesused = 1; // byteused must be non-zero       
ret = dec->capture_plane.qBuffer(v4l2_buf, NULL);
  1. dequeue and enqueue frame in dec_capture_loop_fcn()
dec->capture_plane.dqBuffer(v4l2_buf, NULL, NULL, 0));

ctx->conv->output_plane.qBuffer(conv_output_buffer, NULL);

//wait vic's capture_plane callback render a frame
pthread_cond_wait(&ctx->queue_cond, &ctx->queue_lock);

ctx->dec->capture_plane.qBuffer(v4l2_buf, NULL);

Is there a problem with my code? Or dec does not support this usage?

Hi Li, it is not supported. dec’s capture_plane creates nvmm_buffer internally.

We can’t support to use buffer from app side as output in decode.
You can only use buffer created in capture_plane internally as output.

Hi, waynezhu, DaneLLL:

thank you for you replay .