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.

DM8168 mmap映射video0设备出现问题。



在写采集程序是,我通过V4L2_MEMORY_MMAP方式调用ioctl VIDIOC_QUERYBUF来获得一块内核地址空间,然后想通过mmap函数将这块内核空间映射到应用层,但当调用mmap函数时,却报出了下面这个错误提示:

(NULL device *): dma_alloc_coherent size 1245184 failed

应用程序具体的操作代码如下:

for (i = 0; i < capt.reqbuf.count; i++) {
       /* Query physical address of the buffers */
       buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
       buf.index = i;
       buf.memory = V4L2_MEMORY_MMAP;
       ret = ioctl(capt.fd, VIDIOC_QUERYBUF, &buf);
       if (ret < 0) {
               perror("VIDIOC_QUERYCAP\n");
               return -1;
        }

        /* Mmap the buffers in application space */
        capture_buff_info[i].length = buf.length;
        capture_buff_info[i].index = i;
        capture_buff_info[i].start =
        mmap(NULL, buf.length, PROT_READ | PROT_WRITE,
                    MAP_SHARED, capt.fd, buf.m.offset);

        if (capture_buff_info[i].start == MAP_FAILED) {
                printf("Cannot mmap = %d buffer\n", i);
                return -1;
         }
        /* It is better to zero buffers */
         memset(capture_buff_info[i].start, 0x80,
                         capture_buff_info[i].length);
}

请问问题出现可能的原因是?DM8168 ezsdk