linux-4.4.1/vb2_core_expbuf()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#x5e93a01]
#backlinks
*説明 [#pf733a87]
-パス: [[linux-4.4.1/drivers/media/v4l2-core/videobuf2-co...
-FIXME: これは何?
--説明
**引数 [#d261ec0b]
-struct vb2_queue *q
--
--[[linux-4.4.1/vb2_queue]]
-int *fd
--
-unsigned int type
--
-unsigned int index
--
-unsigned int plane
--
-unsigned int flags
--
**返り値 [#ubefa3ff]
-int
--
**参考 [#u50f0daf]
*実装 [#z2ce41c9]
/**
* vb2_core_expbuf() - Export a buffer as a file descrip...
* @q: videobuf2 queue
* @fd: file descriptor associated with DMABUF (...
* @type: buffer type
* @index: id number of the buffer
* @plane: index of the plane to be exported, 0 for...
* @flags: flags for newly created file, currently ...
* supported, refer to manual of open sysca...
*
* The return values from this function are intended to ...
* from vidioc_expbuf handler in driver.
*/
int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsign...
unsigned int index, unsigned int plane, ...
{
struct vb2_buffer *vb = NULL;
struct vb2_plane *vb_plane;
int ret;
struct dma_buf *dbuf;
-
--[[linux-4.4.1/vb2_buffer]]
--[[linux-4.4.1/vb2_plane]]
--[[linux-4.4.1/dma_buf]]
if (q->memory != VB2_MEMORY_MMAP) {
dprintk(1, "queue is not currently set u...
return -EINVAL;
}
-
--[[linux-4.4.1/dprintk()]]
if (!q->mem_ops->get_dmabuf) {
dprintk(1, "queue does not support DMA b...
return -EINVAL;
}
-q->mem_ops は const struct vb2_mem_ops * 型
--[[linux-4.4.1/vb2_mem_ops]]
if (flags & ~(O_CLOEXEC | O_ACCMODE)) {
dprintk(1, "queue does support only O_CL...
return -EINVAL;
}
if (type != q->type) {
dprintk(1, "invalid buffer type\n");
return -EINVAL;
}
if (index >= q->num_buffers) {
dprintk(1, "buffer index out of range\n");
return -EINVAL;
}
vb = q->bufs[index];
-q->bufs は struct vb2_buffer *[VB2_MAX_FRAME] 型
--[[linux-4.4.1/vb2_buffer]]
--[[linux-4.4.1/VB2_MAX_FRAME]]
if (plane >= vb->num_planes) {
dprintk(1, "buffer plane out of range\n");
return -EINVAL;
}
if (vb2_fileio_is_active(q)) {
dprintk(1, "expbuf: file io in progress\...
return -EBUSY;
}
-
--[[linux-4.4.1/vb2_fileio_is_active()]]
vb_plane = &vb->planes[plane];
-vb->planes は struct vb2_plane[VB2_MAX_PLANES] 型
--[[linux-4.4.1/vb2_plane]]
--[[linux-4.4.1/VB2_MAX_PLANES]]
dbuf = call_ptr_memop(vb, get_dmabuf, vb_plane->m...
flags & O_ACCMODE);
-vb->vb2_queue->mem_ops->get_dmabuf を呼び出す。
--vb->vb2_queue は struct vb2_queue * 型
--vb->vb2_queue->mem_ops は const struct vb2_mem_ops * 型
--[[linux-4.4.1/vb2_queue]]
--[[linux-4.4.1/vb2_mem_ops]]
--[[linux-4.4.1/call_ptr_memop()]]
if (IS_ERR_OR_NULL(dbuf)) {
dprintk(1, "failed to export buffer %d, ...
index, plane);
return -EINVAL;
}
-
--[[linux-4.4.1/IS_ERR_OR_NULL()]]
ret = dma_buf_fd(dbuf, flags & ~O_ACCMODE);
if (ret < 0) {
dprintk(3, "buffer %d, plane %d failed t...
index, plane, ret);
dma_buf_put(dbuf);
return ret;
}
-
--[[linux-4.4.1/dma_buf_fd()]]
--[[linux-4.4.1/dma_buf_put()]]
dprintk(3, "buffer %d, plane %d exported as %d d...
index, plane, ret);
*fd = ret;
return 0;
}
EXPORT_SYMBOL_GPL(vb2_core_expbuf);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#p66cec3a]
終了行:
*参照元 [#x5e93a01]
#backlinks
*説明 [#pf733a87]
-パス: [[linux-4.4.1/drivers/media/v4l2-core/videobuf2-co...
-FIXME: これは何?
--説明
**引数 [#d261ec0b]
-struct vb2_queue *q
--
--[[linux-4.4.1/vb2_queue]]
-int *fd
--
-unsigned int type
--
-unsigned int index
--
-unsigned int plane
--
-unsigned int flags
--
**返り値 [#ubefa3ff]
-int
--
**参考 [#u50f0daf]
*実装 [#z2ce41c9]
/**
* vb2_core_expbuf() - Export a buffer as a file descrip...
* @q: videobuf2 queue
* @fd: file descriptor associated with DMABUF (...
* @type: buffer type
* @index: id number of the buffer
* @plane: index of the plane to be exported, 0 for...
* @flags: flags for newly created file, currently ...
* supported, refer to manual of open sysca...
*
* The return values from this function are intended to ...
* from vidioc_expbuf handler in driver.
*/
int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsign...
unsigned int index, unsigned int plane, ...
{
struct vb2_buffer *vb = NULL;
struct vb2_plane *vb_plane;
int ret;
struct dma_buf *dbuf;
-
--[[linux-4.4.1/vb2_buffer]]
--[[linux-4.4.1/vb2_plane]]
--[[linux-4.4.1/dma_buf]]
if (q->memory != VB2_MEMORY_MMAP) {
dprintk(1, "queue is not currently set u...
return -EINVAL;
}
-
--[[linux-4.4.1/dprintk()]]
if (!q->mem_ops->get_dmabuf) {
dprintk(1, "queue does not support DMA b...
return -EINVAL;
}
-q->mem_ops は const struct vb2_mem_ops * 型
--[[linux-4.4.1/vb2_mem_ops]]
if (flags & ~(O_CLOEXEC | O_ACCMODE)) {
dprintk(1, "queue does support only O_CL...
return -EINVAL;
}
if (type != q->type) {
dprintk(1, "invalid buffer type\n");
return -EINVAL;
}
if (index >= q->num_buffers) {
dprintk(1, "buffer index out of range\n");
return -EINVAL;
}
vb = q->bufs[index];
-q->bufs は struct vb2_buffer *[VB2_MAX_FRAME] 型
--[[linux-4.4.1/vb2_buffer]]
--[[linux-4.4.1/VB2_MAX_FRAME]]
if (plane >= vb->num_planes) {
dprintk(1, "buffer plane out of range\n");
return -EINVAL;
}
if (vb2_fileio_is_active(q)) {
dprintk(1, "expbuf: file io in progress\...
return -EBUSY;
}
-
--[[linux-4.4.1/vb2_fileio_is_active()]]
vb_plane = &vb->planes[plane];
-vb->planes は struct vb2_plane[VB2_MAX_PLANES] 型
--[[linux-4.4.1/vb2_plane]]
--[[linux-4.4.1/VB2_MAX_PLANES]]
dbuf = call_ptr_memop(vb, get_dmabuf, vb_plane->m...
flags & O_ACCMODE);
-vb->vb2_queue->mem_ops->get_dmabuf を呼び出す。
--vb->vb2_queue は struct vb2_queue * 型
--vb->vb2_queue->mem_ops は const struct vb2_mem_ops * 型
--[[linux-4.4.1/vb2_queue]]
--[[linux-4.4.1/vb2_mem_ops]]
--[[linux-4.4.1/call_ptr_memop()]]
if (IS_ERR_OR_NULL(dbuf)) {
dprintk(1, "failed to export buffer %d, ...
index, plane);
return -EINVAL;
}
-
--[[linux-4.4.1/IS_ERR_OR_NULL()]]
ret = dma_buf_fd(dbuf, flags & ~O_ACCMODE);
if (ret < 0) {
dprintk(3, "buffer %d, plane %d failed t...
index, plane, ret);
dma_buf_put(dbuf);
return ret;
}
-
--[[linux-4.4.1/dma_buf_fd()]]
--[[linux-4.4.1/dma_buf_put()]]
dprintk(3, "buffer %d, plane %d exported as %d d...
index, plane, ret);
*fd = ret;
return 0;
}
EXPORT_SYMBOL_GPL(vb2_core_expbuf);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#p66cec3a]
ページ名: