mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 10:11:26 +03:00
video: tegra: nvmap: Add support for sgt caching
Deferred dmabuf unmapping is being removed from kernel. So, add similar support to cache sgt in NvMap. During map_dma_buf() call, NvMap will create a mapping and an sgt corresponding to it. It will also cache this sgt. When unmap_dma_buf() is called for same sgt, NvMap will not unmap the mappings. It will simply return from there. Next time when the mapping request comes for same dmabuf, it will look for existing sgt in cache and return it. This significantly reduces mapping overhead for same buffer when it's mapped and unmapped multiple times. Free the sgt and unmap only when corresponding buffer is freed. When all references from a buffer are removed, dmabuf_release() will be called where sgt will be freed. Bug 4064339 Change-Id: I7ed767ecaaac7aa44e6576e701b28537b84986ec Signed-off-by: Ashish Mhetre <amhetre@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2925224 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
ad2857ccaa
commit
9207ceb10a
@@ -1464,6 +1464,10 @@ int __init nvmap_probe(struct platform_device *pdev)
|
||||
nvmap_stats_init(nvmap_debug_root);
|
||||
platform_set_drvdata(pdev, dev);
|
||||
|
||||
e = nvmap_dmabuf_stash_init();
|
||||
if (e)
|
||||
goto fail_heaps;
|
||||
|
||||
for (i = 0; i < dev->nr_carveouts; i++)
|
||||
if (dev->heaps[i].heap_bit & NVMAP_HEAP_CARVEOUT_GENERIC)
|
||||
generic_carveout_present = 1;
|
||||
@@ -1526,6 +1530,7 @@ int nvmap_remove(struct platform_device *pdev)
|
||||
#ifdef NVMAP_CONFIG_SCIIPC
|
||||
nvmap_sci_ipc_exit();
|
||||
#endif
|
||||
nvmap_dmabuf_stash_deinit();
|
||||
debugfs_remove_recursive(dev->debug_root);
|
||||
misc_deregister(&dev->dev_user);
|
||||
#ifdef NVMAP_CONFIG_PAGE_POOLS
|
||||
|
||||
Reference in New Issue
Block a user