This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

100% CPU usge when coping camera buffer on OMAP 5



I was going to post camera buffer to Java via callback interface (public void onPreviewFrame(byte[] data, Camera camera) ) on SDK level, Unfortunately, the CPU usge is reached to 100% for one A15 core.

I had indentified that the CPU is cost by following code.

File location: mydroid\hardware\ti\omap4xx\camera\AppCallbacknotifier.cpp

Function name: copy2Dto1D

else if (strcmp(pixelFormat, android::CameraParameters::PIXEL_FORMAT_YUV420SP) == 0 || strcmp(pixelFormat, android::CameraParameters::PIXEL_FORMAT_YUV420P) == 0)

{

for ( int i = 0 ; i < height ; i++) {
                memcpy(bufferDst, bufferSrc, row);
                bufferSrc += stride;
                bufferDst += row;
                if ( ( bufferSrc > bufferSrcEnd ) || ( bufferDst > bufferDstEnd ) ) {
                    break;
                }

}

Board information: UEVM5432G-02-12-00

Thanks,

Gancai

  • more information:

    Video resolution is 720P.

    I have done other tests, such as

    1)copy data from framebuffer on omap5,

    2)do same test on OMAP 4,

    all of them are as I expect.

    Thanks, Gancai

  • To understand the issue better:

    1. What is the stride? How do you compute it?

    2. Are you using TILER memory for camera buffers?

    3. Is there any other processing ongoing - like video recording?

  • 1. stride is 4096.   I got CPU usage via top.

    2. I did not change the format of camera buffer.  It's provided by TI.

    3. there is no other processing to process video.

    By the way, I was using Android SDK interface to get camera buffer. There is no change made by me.

    Thanks,

  • This issue should be Tiler memory copy issue in OMAP5. The camera's data in Tiler memory. When we copy it to another memory, it takes so long time that CPU load get too high. We did three tests both on OMAP5 and OMAP4. OMAP5 takes more long time than OMAP4, although OMAP5 has a more powerful ARM than OMAP4. So there may be something wrong on OMAP5 Tiler. Please help us look into this issue.

    The tests include:

    1. Write and Read one by one. Write 1920*(1080*3/2) data to Tiler and read back.
    2. Mem copy from Tiler mem1 to static memory. Copy 1920*(1080*3/2) data from Tiler memory to static memory. This case is same to copy camera’s data from Tiler (the issue we meet on OMAP5 board). And on OMAP5 board, copy camera’s one frame data (1080P YUV420), it used 82ms.
    3. Mem copy from Tiler mem2 to Tiler mem1. Allocated another same size Tiler memory. Copy 1920*(1080*3/2) data from the second Tiler memory to the first Tiler memory.

    The results are below:

     

    OMAP5

    OMAP4

    Test 1: Write and Read Tiler mem1 one by one.

    ~890ms

    ~983ms

    Test 2: Tiler Mem1 copy to static memory.

    ~82ms

    ~31ms

    Test 3: Tiler Mem2 copy to Tiler mem1.

    ~138ms

    ~36ms