VPU: failed fill VPU input buffer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VPU: failed fill VPU input buffer

919 Views
BrilliantovKiri
Senior Contributor I

Hello!

I try write application with imx-lib without GStremamer (VPU firmware version: 1.4.41, VPU library version: 5.3.2), follow my code configure VPU input buffer:

static vpu_mem_desc in_frame_desc;

static FrameBuffer in_frame;

in_frame_desc.size = encop.picWidth * encop.picHeight * 3 / 2;

if (IOGetPhyMem(&in_frame_desc)) {

      daemon_error("Failed obtain physical memory for input buffer");

      return -1;

}

if (!in_frame_desc.phy_addr) {

    daemon_error("Incorrect physical memory address for input buffer");

    return -1;

}

in_frame_desc.virt_uaddr = IOGetVirtMem(&in_frame_desc);

if (in_frame_desc.virt_uaddr <= 0) {

    daemon_error("Failed obtain virtual memory for input buffer");

    return -1;

}

in_frame.bufY = in_frame_desc.phy_addr;

in_frame.bufCb = in_frame.bufY + encop.picWidth * encop.picHeight;

in_frame.bufCr = in_frame.bufCb + encop.picWidth * encop.picHeight / 4;

in_frame.strideY = encop.picWidth * encop.picHeight;

in_frame.strideC = encop.picWidth / 2;

And code for fill it:

//debug output

daemon_info("%s: %p (%u) -> %p (%u, phys %p)",

            __func__,in, in_len, in_frame_desc.virt_uaddr, in_frame_desc.size, in_frame_desc.phy_addr);

if (in_len > in_frame_desc.size) {

    daemon_error("Input buffer too big, buffer %u, available %u",

                 in_len, in_frame_desc.size);

    return -1;

}

//copy buffer after CSC IPU to VPU

memcpy(&in_frame_desc.virt_uaddr, in, in_len);

Unfortunally programm exit in this point with message *** buffer overflow detected ***: encoderd terminated

I add debug output and not see any reason for this error:  vpu_encode: 0x2c711008 (1382400) -> 0x2c9f3000 (1382400, phys 0x75000000)

Because my matrix send data in YUV422 I have to convert it to YUV420 on ColorSpaceConvertion IPU, after this copy to VPU input buffer.

How should  configure and fill VPU input buffer?

Thank you and excuse my bad english.

Update:

Because vpu_mem_desc.virt_uaddr is a address, I modify memcpy((void *)in_frame_desc.virt_uaddr, in, in_len)

Сообщение отредактировано: Kirill Brilliantov

Labels (1)
Tags (1)
0 Kudos
1 Reply

425 Views
BrilliantovKiri
Senior Contributor I

Very strange, I increase VPU buffer size, but I get same error:

vpu_encode: 0x2c711008 (1382400) -> 0x2c9f3000 (2764800, phys 0x75000..

*** buffer overflow detected ***

0 Kudos