[Arm-netbook] allwinner-a10-video EncoderDemo can not work

Andrew Armenia andrew at asquaredlabs.com
Sat Aug 11 22:33:43 BST 2012


Hubert Liao <liao.hubertt <at> gmail.com> writes:

> 
> Hi:
> 
> I got the video source code from https://github.com/amery/allwinner-a10-video,
> and try the EncoderDemo on Mele A1000 with a usb webcam, when I run it, the
> output file h264.buf size is always 0.
> 
> ./EncoderDemo
> w: 640, h: 480, preview_left: 80, preview_top: 0, preview_h: 480,
> preview_w : 640
> video layer hdl:101
> MODE: 2, format: 13
> fb_layer hdl: 100
> open H264Enc ok
> to stream on
> V4L2Camera::v4l2StartStreaming
> V4L2Camera::v4l2StartStreaming OK
> cru: 1586005820, last: 1586005799, 21
> VIDIOC_DQBUF id: 0
> 
> I found it stop at
> g_pCedarV->encode(g_pCedarV);
> in the while(1) loop, main.c line 139
> 
> lack of the encode library source code, so I can not find the real stuck point
> using gdb, maybe it stop at InitSPS @H264enclib.c
> 
> (gdb) r
> Starting program:
> /root/Downloads/amery-allwinner-a10-video-9fa91df/a10_h264_encode/EncoderDemo
> [Thread debugging using libthread_db enabled]
> w: 640, h: 480, preview_left: 80, preview_top: 0, preview_h: 480,
> preview_w : 640
> video layer hdl:101
> MODE: 2, format: 13
> fb_layer hdl: 100
> open H264Enc ok
> to stream on
> V4L2Camera::v4l2StartStreaming
> V4L2Camera::v4l2StartStreaming OK
> cru: -1547703669, last: -1547703690, 21
> VIDIOC_DQBUF id: 0
> ^C
> Program received signal SIGINT, Interrupt.
> 0x0000d4c0 in InitSPS (pDev=0x21090) at F20/H264encLib.c:81
> 81	F20/H264encLib.c: No such file or directory.
> 	in F20/H264encLib.c
> (gdb) bt
> #0  0x0000d4c0 in InitSPS (pDev=0x21090) at F20/H264encLib.c:81
> #1  0x0000c1fc in H264EncEncode (pDev=0x21090) at F20/H264encDrv.c:843
> #2  0x0000a4dc in main () at main.c:139
> 
> Any help ? Thanks!
> 
> 


On my MK802, the module clock is gated by default, preventing the H.264
hardware from actually doing anything. I think it is getting stuck in a loop
in InitSPS polling some hardware flag; the flag never comes due to the lack
of clock. I threw together a small C program (included below) that will un-gate 
it; it sort of works for me but YMMV...

-Andrew

#include <stdio.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdint.h>

#define CCU_ADDR 0x01c20000

int main() {
        int fd = open("/dev/mem", O_RDWR);
        volatile uint8_t *iomem;
        volatile uint32_t *reg;

        if (fd < 0) {
                perror("open /dev/mem");
                return 1;
        }

        iomem = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 
CCU_ADDR);
        reg = (uint32_t *)(iomem + 0x0064);
        fprintf(stderr, "reg was 0x%08x ", *reg);
        *reg |= 0x00000001;
        fprintf(stderr, "now 0x%08x\n", *reg);

        reg = (uint32_t *)(iomem + 0x013c);
        fprintf(stderr, "reg was 0x%08x ", *reg);
        *reg = 0x80050000;
        fprintf(stderr, "now 0x%08x\n", *reg);
}





More information about the arm-netbook mailing list