In my project, I'm using the CVBS video output, and I set the screen to rotate, by setting display_rotate=1 on /boot/config.txt, which worked fine. This way, the screen have a resolution of 480 pixels for the width, and 720 pixels for the height. The image is 480x640 pixels. Since it is in YUV420, the file have 480x640x1.5 pixels, which means exactly 460,800 bytes. If I upload this file to rawpixels.net, set the desired width and heght, and image format to IYUV, it shows the image perfectly.
In order to show the image on the screen, I tried to modify the hello_dispmanx.c example at /opv/vc/src/hello_pi/hello_dispmanx folder. I am able to show the image on the screen with this code:
If anyone is curious, the frame file can be found here:
The code is a bit weird, since I had to create two buffers. One buffer, with 460,800 bytes to hold the data from the file (that's OK), and another one with 614,400 bytes (thats 640 * 480 * 2), where I need to copy the data from the frames into it. This is the buffer that goes to dispmanx, with the command vc_dispmanx_resource_write_data. I kinda found this size by trial and error (lots of errors, by the way). Apart the weirdness, the code works and shows perfectly the image on the screen.
What is bottering me is the output of the command /opt/vc/bin/vcdbg reloc. Before calling my program, that puts the image on the screen, here is the output of vcdbg, which looks fine:
Right after running my program, here is the output:
Code: Select all
Relocatable heap version 4 found at 0x3b400000 total space allocated is 56M, with 56M relocatable, 0 legacy and 0 offline 0 legacy blocks of size 2359296 free list at 0x3e99dce0 54M free memory in 1 free block(s) largest free block is 54M bytes 0x3b400000: free 54M [ 5] 0x3e99dd00: used 576 (refcount 1 lock count 0, size 512, align 4, data 0x3e99dd20, d0rual) 'ILCS VC buffer pool' [ 4] 0x3e99df40: used 1.0M (refcount 1 lock count 8, size 1091584, align 4096, data 0x3e99e000, d1rual) 'ARM FB' [ 3] 0x3eaa9760: used 1.3M (refcount 2 lock count 8, size 1382400, align 32, data 0x3eaa9780, d1rual) 'transpose buffer0' [ 2] 0x3ebfafa0: used 16K (refcount 1 lock count 0, size 16384, align 32, data 0x3ebfafc0, d0ruAl) 'audioplus_tmp_buf' [ 1] 0x3ebfefe0: used 4.0K (refcount 1 lock count 0, size 0, align 4096, data 0x3ebff000, d1rual) 'camera fast alloc arena' small allocs not requested
It doesn't look that good...
Code: Select all
Relocatable heap version 4 found at 0x3b400000 total space allocated is 56M, with 56M relocatable, 0 legacy and 0 offline 0 legacy blocks of size 2359296 free list at 0x3e99dce0 54M free memory in 1 free block(s) largest free block is 54M bytes 0x3b400000: free 54M 0x3e99dd00: corrupt entry (space 0x0) could not resync heap corruption detected small allocs not requested
My question here is:
- Do I have to be concerned about that output and the messages of heap corruption (I'm quite sure that yes, I must be concerned about it)?
- What am I doing wrong in my code?
- Do anyone have any example code that is able to show a YUV image on the screen of the Raspberry?
- Should I use any other way to show the image on the screen (like EGL or something else)? If yes, do anyone have any documentation that explains how can I do it?
Thank you in advance for any help!
With best regards