How to share the buffer in process context?

In the producer process, please refer to the pseudo code to get information of the buffers:

struct nvbuf_param {
    NvBufferParams params;
    NvBufferParamsEx paramsEx;

NvBufferParams params;
NvBufferParamsEx paramsEx;
nvbuf_param buf_par;
NvBufferGetParams(dmabuf_fd, &params);
NvBufferGetParamsEx(dmabuf_fd, &paramsEx);
buf_par.params = params;
buf_par.paramsEx = paramsEx;

And send the information(buf_par) to consumer process through unix socket.

In consumer process, the fd from producer is source buffer. Please create an NvBuffer as destination buffer and then call like:

static void transform_nvbuf(int src_fd, nvbuf_param *src_buf_par, int dst_fd)
    NvBufferParams src_params = src_buf_par->params;
    NvBufferParamsEx src_paramsEx = src_buf_par->paramsEx;
    NvBufferParams dst_params;
    NvBufferParamsEx dst_paramsEx;
    NvBufferGetParams(dst_fd, &dst_params);
    NvBufferGetParamsEx(dst_fd, &dst_paramsEx);

    NvBufferTransformParams trans_params;
    memset(&trans_params, 0, sizeof(trans_params));
    trans_params.src_rect = {0, 0, src_params.width[0], src_params.height[0]};
    trans_params.dst_rect = {0, 0, dst_params.width[0], dst_params.height[0]};

    NvBufferTransformEx(src_fd, &src_paramsEx, dst_fd, &dst_paramsEx, &trans_params);

Please check above suggestion and give it a try.