dma_buf_ops 之 attach函数

attach函数:

This is called from dma_buf_attach() to make sure that a given &dma_buf_attachment.dev can access the provided &dma_buf. Exporters which support buffer objects in special locations like VRAM or device-specific carveout areas should check whether the buffer could be move to system memory (or directly accessed by the provided device), and otherwise need to fail the attach operation.

The exporter should also in general check whether the current allocation fulfills the DMA constraints of the new device. If this is not the case, and the allocation cannot be moved, it should also fail the attach operation. Any exporter-private housekeeping data can be stored in the &dma_buf_attachment.priv pointer.

绿色代表输入参数,淡蓝色代表结构体包括的内容

1、分配一块临时内存,这块内存,赋值给输入参数struct dma_buf_attachment *attachment 的私有数据,并回传
      同时将dev也传入到dma_heap_attachment中

2、对内存中的数据进行整理,输入参数dmabuf的sg_table做一次dup,然后赋值给临时内存dma_heap_attachment的table
     这样这个attchment对应的table就有了,同样dmabuf也有了

3、buffer维护的attachments的list,添加这个新的attachment信息

  • 5
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值