linux-4.4.1/__vb2_queue_alloc()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#d1fc00e4]
#backlinks
*説明 [#f9810c58]
-パス: [[linux-4.4.1/drivers/media/v4l2-core/videobuf2-co...
-FIXME: これは何?
--説明
**引数 [#j21002e1]
-struct vb2_queue *q
--
--[[linux-4.4.1/vb2_queue]]
-enum vb2_memory memory
--
--[[linux-4.4.1/vb2_memory]]
-unsigned int num_buffers
--
-unsigned int num_planes
--
**返り値 [#q9733924]
-int
--
**参考 [#kb1f0a16]
*実装 [#m6fa5210]
/**
* __vb2_queue_alloc() - allocate videobuf buffer struct...
* video buffer memory for all buffers/planes on the que...
* queue
*
* Returns the number of buffers successfully allocated.
*/
static int __vb2_queue_alloc(struct vb2_queue *q, enum v...
unsigned int num_buffers, u...
{
unsigned int buffer;
struct vb2_buffer *vb;
int ret;
-
--[[linux-4.4.1/vb2_buffer]]
for (buffer = 0; buffer < num_buffers; ++buffer) {
/* Allocate videobuf buffer structures */
vb = kzalloc(q->buf_struct_size, GFP_KER...
if (!vb) {
dprintk(1, "memory alloc for buf...
break;
}
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/dprintk()]]
vb->state = VB2_BUF_STATE_DEQUEUED;
vb->vb2_queue = q;
vb->num_planes = num_planes;
vb->index = q->num_buffers + buffer;
vb->type = q->type;
vb->memory = memory;
/* Allocate video buffer memory for the ...
if (memory == VB2_MEMORY_MMAP) {
ret = __vb2_buf_mem_alloc(vb);
if (ret) {
dprintk(1, "failed alloc...
"buffer ...
kfree(vb);
break;
}
-
--[[linux-4.4.1/__vb2_buf_mem_alloc()]]
--[[linux-4.4.1/kfree()]]
/*
* Call the driver-provided buff...
* callback, if given. An error ...
* results in queue setup failure.
*/
ret = call_vb_qop(vb, buf_init, ...
if (ret) {
dprintk(1, "buffer %d %p...
" failed\n", buf...
__vb2_buf_mem_free(vb);
kfree(vb);
break;
}
-
--vb->vb2_queue->ops->buf_init が呼ばれる。
---vb->vb2_queue は struct vb2_queue * 型
---[[linux-4.4.1/vb2_queue]]
---vb->vb2_queue->ops は const struct vb2_ops * 型
---[[linux-4.4.1/vb2_ops]]
--[[linux-4.4.1/call_vb_qop()]]
--[[linux-4.4.1/__vb2_buf_mem_free()]]
}
q->bufs[q->num_buffers + buffer] = vb;
}
__setup_lengths(q, buffer);
if (memory == VB2_MEMORY_MMAP)
__setup_offsets(q, buffer);
-
--[[linux-4.4.1/__setup_lengths()]]
--[[linux-4.4.1/__setup_offsets()]]
dprintk(1, "allocated %d buffers, %d plane(s) ea...
buffer, num_planes);
return buffer;
}
*コメント [#h540a849]
終了行:
*参照元 [#d1fc00e4]
#backlinks
*説明 [#f9810c58]
-パス: [[linux-4.4.1/drivers/media/v4l2-core/videobuf2-co...
-FIXME: これは何?
--説明
**引数 [#j21002e1]
-struct vb2_queue *q
--
--[[linux-4.4.1/vb2_queue]]
-enum vb2_memory memory
--
--[[linux-4.4.1/vb2_memory]]
-unsigned int num_buffers
--
-unsigned int num_planes
--
**返り値 [#q9733924]
-int
--
**参考 [#kb1f0a16]
*実装 [#m6fa5210]
/**
* __vb2_queue_alloc() - allocate videobuf buffer struct...
* video buffer memory for all buffers/planes on the que...
* queue
*
* Returns the number of buffers successfully allocated.
*/
static int __vb2_queue_alloc(struct vb2_queue *q, enum v...
unsigned int num_buffers, u...
{
unsigned int buffer;
struct vb2_buffer *vb;
int ret;
-
--[[linux-4.4.1/vb2_buffer]]
for (buffer = 0; buffer < num_buffers; ++buffer) {
/* Allocate videobuf buffer structures */
vb = kzalloc(q->buf_struct_size, GFP_KER...
if (!vb) {
dprintk(1, "memory alloc for buf...
break;
}
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/dprintk()]]
vb->state = VB2_BUF_STATE_DEQUEUED;
vb->vb2_queue = q;
vb->num_planes = num_planes;
vb->index = q->num_buffers + buffer;
vb->type = q->type;
vb->memory = memory;
/* Allocate video buffer memory for the ...
if (memory == VB2_MEMORY_MMAP) {
ret = __vb2_buf_mem_alloc(vb);
if (ret) {
dprintk(1, "failed alloc...
"buffer ...
kfree(vb);
break;
}
-
--[[linux-4.4.1/__vb2_buf_mem_alloc()]]
--[[linux-4.4.1/kfree()]]
/*
* Call the driver-provided buff...
* callback, if given. An error ...
* results in queue setup failure.
*/
ret = call_vb_qop(vb, buf_init, ...
if (ret) {
dprintk(1, "buffer %d %p...
" failed\n", buf...
__vb2_buf_mem_free(vb);
kfree(vb);
break;
}
-
--vb->vb2_queue->ops->buf_init が呼ばれる。
---vb->vb2_queue は struct vb2_queue * 型
---[[linux-4.4.1/vb2_queue]]
---vb->vb2_queue->ops は const struct vb2_ops * 型
---[[linux-4.4.1/vb2_ops]]
--[[linux-4.4.1/call_vb_qop()]]
--[[linux-4.4.1/__vb2_buf_mem_free()]]
}
q->bufs[q->num_buffers + buffer] = vb;
}
__setup_lengths(q, buffer);
if (memory == VB2_MEMORY_MMAP)
__setup_offsets(q, buffer);
-
--[[linux-4.4.1/__setup_lengths()]]
--[[linux-4.4.1/__setup_offsets()]]
dprintk(1, "allocated %d buffers, %d plane(s) ea...
buffer, num_planes);
return buffer;
}
*コメント [#h540a849]
ページ名: