How to convert iFrame to cv::Mat (Libargus)

I am using tx2 with this sample →
to get image from csi camera and convert it to a cv::Mat . I convert to mat successfully but it is so slow at cvtColor part.
image resolution is :3840x2160

auto t1 = duration_cast(system_clock::now().time_since_epoch()).count();

IFrame *iFrame = interface_cast<IFrame>(frame);
if (!iFrame)
    ORIGINATE_ERROR("Failed to get IFrame interface");

// Get the IImageNativeBuffer extension interface.
NV::IImageNativeBuffer *iNativeBuffer =
if (!iNativeBuffer)
    ORIGINATE_ERROR("IImageNativeBuffer not supported by Image.");

auto t2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
int fd = iNativeBuffer->createNvBuffer(m_resolution, 

auto t3 = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
void *pdata = NULL;
NvBufferMemMap(fd, 0, NvBufferMem_Read, &pdata);

auto t4 = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
NvBufferMemSyncForCpu(fd, 0, &pdata);

auto t5 = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();    
mat = cv::Mat(m_resolution.height(),m_resolution.width(), CV_8UC4, pdata);

auto t6 = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
cv::cvtColor(mat, mat, cv::COLOR_BGRA2BGR);

auto t7 = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
NvBufferMemUnMap(fd, 0, &pdata);

t2-t1: 0ms.
t3-t2: 11ms.
t4-t3: 1ms.
t5-t4: 0ms.
t6-t5: 0ms.
t7-t6: 121ms.

When directly converting iFrame to jpeg , it took 20-40ms. So i suprised when i see this result of converting to cv::Mat.
What is the fastest way to get cv::Mat from iFrame object?

hi ikoc:
from time test:all the steps are fast (0 + 11 + 1 + 0 + 0 =12ms),except t6-t7 is 121ms,

auto t6 = duration_cast(system_clock::now().time_since_epoch()).count();
cv::cvtColor(mat, mat, cv::COLOR_BGRA2BGR);
this color space transform seems not must for your code. at t5-t6 you have got mat, so could you remove BGRA2BGR ?