*参照元 [#sb4ad13a] #backlinks *説明 [#cd1e9a32] -パス: [[linux-4.4.1/drivers/media/v4l2-core/videobuf2-core.c]] -FIXME: これは何? --説明 **引数 [#m8bd4f30] -struct vb2_buffer *vb -- --[[linux-4.4.1/vb2_buffer]] **返り値 [#h76e5237] -int -- **参考 [#f136c285] *実装 [#j7a8f2cc] /** * __vb2_buf_mem_alloc() - allocate video memory for the given buffer */ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb) { struct vb2_queue *q = vb->vb2_queue; enum dma_data_direction dma_dir = q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE; void *mem_priv; int plane; - --[[linux-4.4.1/vb2_queue]] --[[linux-4.4.1/dma_data_direction]] /* * Allocate memory for all planes in this buffer * NOTE: mmapped areas should be page aligned */ for (plane = 0; plane < vb->num_planes; ++plane) { unsigned long size = PAGE_ALIGN(q->plane_sizes[plane]); - --[[linux-4.4.1/PAGE_ALIGN()]] mem_priv = call_ptr_memop(vb, alloc, q->alloc_ctx[plane], size, dma_dir, q->gfp_flags); if (IS_ERR_OR_NULL(mem_priv)) goto free; - --vb->vb2_queue->mem_ops->alloc が呼ばれる。 ---vb->vb2_queue は struct vb2_queue * 型 ---[[linux-4.4.1/vb2_queue()]] ---[[linux-4.4.1/vb2_queue]] ---vb->vb2_queue->mem_ops は const struct vb2_mem_ops * 型 ---[[linux-4.4.1/vb2_mem_ops()]] ---[[linux-4.4.1/vb2_mem_ops]] --[[linux-4.4.1/call_ptr_memop()]] --[[linux-4.4.1/IS_ERR_OR_NULL()]] /* Associate allocator private data with this plane */ vb->planes[plane].mem_priv = mem_priv; vb->planes[plane].length = q->plane_sizes[plane]; } return 0; free: /* Free already allocated memory if one of the allocations failed */ for (; plane > 0; --plane) { call_void_memop(vb, put, vb->planes[plane - 1].mem_priv); vb->planes[plane - 1].mem_priv = NULL; } - --vb->vb2_queue->mem_ops->put が呼ばれる。 --[[linux-4.4.1/call_void_memop()]] return -ENOMEM; } *コメント [#g9df5eb3]