How to enqueue HW buffer as a multiplanar v4l2_buffer?

I want to feed encoder output with HW buffers.

Encoder output is configured for V4L2_PIX_FMT_YUV420M and V4L2_MEMORY_DMABUF
Hence it wants a separate fd for each of 3 plains:

v4l2_encode_output.m.planes[0].m.fd = ?
v4l2_encode_output.m.planes[1].m.fd = ?
v4l2_encode_output.m.planes[2].m.fd = ?

But NvBufferCreateEx() gives me just one fd for a buffer as a whole.

Buffers for the encoder output are created like this:

NvBufferCreateParams nv_buf_encoder_output = { 0 };

nv_buf_encoder_output.payloadType = NvBufferPayload_SurfArray;
nv_buf_encoder_output.width = _property_encoder_format_width;
nv_buf_encoder_output.height = _property_encoder_format_height;
nv_buf_encoder_output.layout = NvBufferLayout_Pitch;
nv_buf_encoder_output.nvbuf_tag = NvBufferTag_VIDEO_ENC;
nv_buf_encoder_output.colorFormat = NvBufferColorFormat_YUV420;

How could I possibly get fds for multiplanar?

One NvBuffer with multiple planes has only one fd. Please set all planes to same fd. Please also check the sample 01_video_encode.