dma-buf: drop dynamic_mapping flag
Instead use the pin() callback to detect dynamic DMA-buf handling. Since amdgpu is now migrated it doesn't make much sense to keep the extra flag. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/353997/?series=73646&rev=1
This commit is contained in:
@@ -524,11 +524,10 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (WARN_ON(exp_info->ops->cache_sgt_mapping &&
|
if (WARN_ON(exp_info->ops->cache_sgt_mapping &&
|
||||||
exp_info->ops->dynamic_mapping))
|
(exp_info->ops->pin || exp_info->ops->unpin)))
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
if (WARN_ON(!exp_info->ops->dynamic_mapping &&
|
if (WARN_ON(!exp_info->ops->pin != !exp_info->ops->unpin))
|
||||||
(exp_info->ops->pin || exp_info->ops->unpin)))
|
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
if (!try_module_get(exp_info->owner))
|
if (!try_module_get(exp_info->owner))
|
||||||
|
|||||||
@@ -364,7 +364,6 @@ static int amdgpu_dma_buf_begin_cpu_access(struct dma_buf *dma_buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const struct dma_buf_ops amdgpu_dmabuf_ops = {
|
const struct dma_buf_ops amdgpu_dmabuf_ops = {
|
||||||
.dynamic_mapping = true,
|
|
||||||
.attach = amdgpu_dma_buf_attach,
|
.attach = amdgpu_dma_buf_attach,
|
||||||
.detach = amdgpu_dma_buf_detach,
|
.detach = amdgpu_dma_buf_detach,
|
||||||
.pin = amdgpu_dma_buf_pin,
|
.pin = amdgpu_dma_buf_pin,
|
||||||
|
|||||||
@@ -42,18 +42,6 @@ struct dma_buf_ops {
|
|||||||
*/
|
*/
|
||||||
bool cache_sgt_mapping;
|
bool cache_sgt_mapping;
|
||||||
|
|
||||||
/**
|
|
||||||
* @dynamic_mapping:
|
|
||||||
*
|
|
||||||
* If true the framework makes sure that the map/unmap_dma_buf
|
|
||||||
* callbacks are always called with the dma_resv object locked.
|
|
||||||
*
|
|
||||||
* If false the framework makes sure that the map/unmap_dma_buf
|
|
||||||
* callbacks are always called without the dma_resv object locked.
|
|
||||||
* Mutual exclusive with @cache_sgt_mapping.
|
|
||||||
*/
|
|
||||||
bool dynamic_mapping;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @attach:
|
* @attach:
|
||||||
*
|
*
|
||||||
@@ -99,7 +87,8 @@ struct dma_buf_ops {
|
|||||||
* This is called by dma_buf_pin and lets the exporter know that the
|
* This is called by dma_buf_pin and lets the exporter know that the
|
||||||
* DMA-buf can't be moved any more.
|
* DMA-buf can't be moved any more.
|
||||||
*
|
*
|
||||||
* This is called with the dmabuf->resv object locked.
|
* This is called with the dmabuf->resv object locked and is mutual
|
||||||
|
* exclusive with @cache_sgt_mapping.
|
||||||
*
|
*
|
||||||
* This callback is optional and should only be used in limited use
|
* This callback is optional and should only be used in limited use
|
||||||
* cases like scanout and not for temporary pin operations.
|
* cases like scanout and not for temporary pin operations.
|
||||||
@@ -116,7 +105,8 @@ struct dma_buf_ops {
|
|||||||
* This is called by dma_buf_unpin and lets the exporter know that the
|
* This is called by dma_buf_unpin and lets the exporter know that the
|
||||||
* DMA-buf can be moved again.
|
* DMA-buf can be moved again.
|
||||||
*
|
*
|
||||||
* This is called with the dmabuf->resv object locked.
|
* This is called with the dmabuf->resv object locked and is mutual
|
||||||
|
* exclusive with @cache_sgt_mapping.
|
||||||
*
|
*
|
||||||
* This callback is optional.
|
* This callback is optional.
|
||||||
*/
|
*/
|
||||||
@@ -455,8 +445,7 @@ static inline void get_dma_buf(struct dma_buf *dmabuf)
|
|||||||
*/
|
*/
|
||||||
static inline bool dma_buf_is_dynamic(struct dma_buf *dmabuf)
|
static inline bool dma_buf_is_dynamic(struct dma_buf *dmabuf)
|
||||||
{
|
{
|
||||||
/* TODO: switch to using pin/unpin functions as indicator. */
|
return !!dmabuf->ops->pin;
|
||||||
return dmabuf->ops->dynamic_mapping;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user