*参照元 [#o8dada66]
#backlinks

*説明 [#r658aab4]
-パス: [[linux-4.4.1/include/linux/dma-buf.h]]

-FIXME: これは何?
--説明
--同じ名前の「変数」もあるので非常にややこしい。
--[[linux-4.4.1/dma_buf_ops]]: dma_buf で定義されている「型」の名前。
--[[linux-4.4.1/dma_buf_ops(global)]]: ION で使っている「static 変数」の名前。

-最低限、実装が必要なメンバ
--map_dma_buf
--unmap_dma_buf
--release
--kmap_atomic
--kmap
--mmap


**参考 [#vf5b7b45]

-実装の一覧。
実装の一覧。

-
--[[linux-4.4.1/udl_dmabuf_ops(global)]]
--[[linux-4.4.1/i915_dmabuf_ops(global)]]
--[[linux-4.4.1/tegra_gem_prime_dmabuf_ops(global)]]
--[[linux-4.4.1/armada_gem_prime_dmabuf_ops(global)]]
--[[linux-4.4.1/drm_gem_prime_dmabuf_ops(global)]]
--[[linux-4.4.1/vmw_prime_dmabuf_ops(global)]]
--[[linux-4.4.1/omap_dmabuf_ops(global)]]
-Video For Linux 2 (V4L2)
--[[linux-4.4.1/vb2_dc_dmabuf_ops(global)]]
--[[linux-4.4.1/vb2_vmalloc_dmabuf_ops(global)]]
--[[linux-4.4.1/vb2_dma_sg_dmabuf_ops(global)]]
-Android ION
--[[linux-4.4.1/dma_buf_ops(global)]]

一覧を作る元にした検索結果。

 $ grep -r 'struct dma_buf_ops' | grep =
 drivers/gpu/drm/udl/udl_dmabuf.c:static struct dma_buf_ops udl_dmabuf_ops = {
 drivers/gpu/drm/i915/i915_gem_dmabuf.c:static const struct dma_buf_ops i915_dmabuf_ops =  {
 drivers/gpu/drm/tegra/gem.c:static const struct dma_buf_ops tegra_gem_prime_dmabuf_ops = {
 drivers/gpu/drm/armada/armada_gem.c:static const struct dma_buf_ops armada_gem_prime_dmabuf_ops = {
 drivers/gpu/drm/drm_prime.c:static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
 drivers/gpu/drm/vmwgfx/vmwgfx_prime.c:const struct dma_buf_ops vmw_prime_dmabuf_ops =  {
 drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c:static struct dma_buf_ops omap_dmabuf_ops = {
 drivers/media/v4l2-core/videobuf2-dma-contig.c:static struct dma_buf_ops vb2_dc_dmabuf_ops = {
 drivers/media/v4l2-core/videobuf2-vmalloc.c:static struct dma_buf_ops vb2_vmalloc_dmabuf_ops = {
 drivers/media/v4l2-core/videobuf2-dma-sg.c:static struct dma_buf_ops vb2_dma_sg_dmabuf_ops = {
 drivers/staging/android/ion/ion.c:static struct dma_buf_ops dma_buf_ops = {


*実装 [#u4a291b9]
 /**
  * struct dma_buf_ops - operations possible on struct dma_buf
  * @attach: [optional] allows different devices to 'attach' themselves to the
  *          given buffer. It might return -EBUSY to signal that backing storage
  *          is already allocated and incompatible with the requirements
  *          of requesting device.
  * @detach: [optional] detach a given device from this buffer.
  * @map_dma_buf: returns list of scatter pages allocated, increases usecount
  *               of the buffer. Requires atleast one attach to be called
  *               before. Returned sg list should already be mapped into
  *               _device_ address space. This call may sleep. May also return
  *               -EINTR. Should return -EINVAL if attach hasn't been called yet.
  * @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter
  *                 pages.
  * @release: release this buffer; to be called after the last dma_buf_put.
  * @begin_cpu_access: [optional] called before cpu access to invalidate cpu
  *                    caches and allocate backing storage (if not yet done)
  *                    respectively pin the objet into memory.
  * @end_cpu_access: [optional] called after cpu access to flush caches.
  * @kmap_atomic: maps a page from the buffer into kernel address
  *               space, users may not block until the subsequent unmap call.
  *               This callback must not sleep.
  * @kunmap_atomic: [optional] unmaps a atomically mapped page from the buffer.
  *                 This Callback must not sleep.
  * @kmap: maps a page from the buffer into kernel address space.
  * @kunmap: [optional] unmaps a page from the buffer.
  * @mmap: used to expose the backing storage to userspace. Note that the
  *        mapping needs to be coherent - if the exporter doesn't directly
  *        support this, it needs to fake coherency by shooting down any ptes
  *        when transitioning away from the cpu domain.
  * @vmap: [optional] creates a virtual mapping for the buffer into kernel
  *        address space. Same restrictions as for vmap and friends apply.
  * @vunmap: [optional] unmaps a vmap from the buffer
  */
 struct dma_buf_ops {
         int (*attach)(struct dma_buf *, struct device *,
                         struct dma_buf_attachment *);
 
         void (*detach)(struct dma_buf *, struct dma_buf_attachment *);
 
-
--[[linux-4.4.1/dma_buf]]
--[[linux-4.4.1/device]]
--[[linux-4.4.1/dma_buf_attachment]]

         /* For {map,unmap}_dma_buf below, any specific buffer attributes
          * required should get added to device_dma_parameters accessible
          * via dev->dma_params.
          */
         struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
                                                 enum dma_data_direction);
         void (*unmap_dma_buf)(struct dma_buf_attachment *,
                                                 struct sg_table *,
                                                 enum dma_data_direction);
         /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
          * if the call would block.
          */
 
-
--[[linux-4.4.1/dma_data_direction]]
--[[linux-4.4.1/sg_table]]

         /* after final dma_buf_put() */
         void (*release)(struct dma_buf *);
 
         int (*begin_cpu_access)(struct dma_buf *, size_t, size_t,
                                 enum dma_data_direction);
         void (*end_cpu_access)(struct dma_buf *, size_t, size_t,
                                enum dma_data_direction);
-

         void *(*kmap_atomic)(struct dma_buf *, unsigned long);
         void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *);
         void *(*kmap)(struct dma_buf *, unsigned long);
         void (*kunmap)(struct dma_buf *, unsigned long, void *);
 
-

         int (*mmap)(struct dma_buf *, struct vm_area_struct *vma);
 
         void *(*vmap)(struct dma_buf *);
         void (*vunmap)(struct dma_buf *, void *vaddr);
-
--[[linux-4.4.1/vm_area_struct]]

 };


*コメント [#uead091b]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS