[PATCH 06/12] drm: remove prime sg_table caching

Hillf Danton hdanton at sina.com
Sat May 25 07:18:37 UTC 2019


On Tue, 16 Apr 2019 20:38:35 +0200 Christian König wrote:
> @ -331,14 +282,19 @@ EXPORT_SYMBOL(drm_gem_map_dma_buf);
>   * @sgt: scatterlist info of the buffer to unmap
>   * @dir: direction of DMA transfer
>   *
> - * Not implemented. The unmap is done at drm_gem_map_detach().  This can be
> - * used as the &dma_buf_ops.unmap_dma_buf callback.
> + * This can be used as the &dma_buf_ops.unmap_dma_buf callback.
>   */
>  void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
>  			   struct sg_table *sgt,
>  			   enum dma_data_direction dir)
>  {
> -	/* nothing to be done here */
> +	if (!sgt)

	if (WARN_ON(!sgt))   ?
> +		return;
> +
> +	dma_unmap_sg_attrs(attach->dev, sgt->sgl, sgt->nents, dir,
> +			   DMA_ATTR_SKIP_CPU_SYNC);
> +	sg_free_table(sgt);
> +	kfree(sgt);
>  }
>  EXPORT_SYMBOL(drm_gem_unmap_dma_buf);
>  
> -- 
> 2.17.1
> 
BR
Hillf



More information about the dri-devel mailing list