xiaoxiang781216 commented on code in PR #7687: URL: https://github.com/apache/nuttx/pull/7687#discussion_r1040367738
########## drivers/video/video.c: ########## @@ -1180,9 +1202,51 @@ static int video_reqbufs(FAR struct video_mng_s *vmng, leave_critical_section(flags); + if ((ret == OK) && (reqbufs->memory == V4L2_MEMORY_MMAP)) + { + vmng->buf_count = reqbufs->count; + if (vmng->vmem_heap != NULL) + { + kmm_free(vmng->vmem_heap); + } + + vmng->vmem_heap = kmm_memalign(32, vmng->buf_count * vmng->buf_size); + if (vmng->vmem_heap == NULL) + { + ret = -ENOMEM; + } + } + return ret; } +static int video_querybuf(FAR struct video_mng_s *vmng, + FAR struct v4l2_buffer *buf) +{ + FAR video_type_inf_t *type_inf; + + if ((vmng == NULL) || (buf == NULL) || (buf->memory != V4L2_MEMORY_MMAP)) + { + return -EINVAL; + } + + type_inf = get_video_type_inf(vmng, buf->type); + if (type_inf == NULL) + { + return -EINVAL; + } + + if (buf->index > vmng->buf_count - 1) + { + return -EINVAL; + } + + buf->m.offset = vmng->buf_size * buf->index; + buf->length = vmng->buf_size; Review Comment: should you attach buffer before enqueue at line 1280 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org