tegra: nvmap: dmabuf fd for range from list of handles

It returns dmabuf fd from list of nvmap handles
for a range between offset and size.

The range should fall under total size of all of the handles.
Range may lie between sub set of handles.

Bug 3494980

Change-Id: I5c688f832a7a3bb0b6e3713ec6462224bb6fbfc5
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2789431
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Puneet Saxena
2022-10-14 16:13:14 +05:30
committed by Laxman Dewangan
parent f1e2cd8dea
commit c4a88d6515
9 changed files with 335 additions and 3 deletions

View File

@@ -263,6 +263,15 @@ struct nvmap_handle {
* read-only.
*/
bool is_ro;
/* list node in case this handle's pages are referenced */
struct list_head pg_ref;
/* list of all the handles whose
* pages are refernced in this handle
*/
struct list_head pg_ref_h;
struct mutex pg_ref_h_lock;
bool is_subhandle;
};
struct nvmap_handle_info {
@@ -401,6 +410,13 @@ struct nvmap_device {
bool co_cache_flush_at_alloc;
};
struct handles_range {
u32 start; /* start handle no where buffer range starts */
u32 end; /* end handle no where buffer range ends */
u64 offs_start; /* keep track of intermediate offset */
u64 offs; /* user passed offset */
u64 sz; /* user passed size */
};
extern struct nvmap_device *nvmap_dev;
extern ulong nvmap_init_time;
@@ -906,4 +922,8 @@ void nvmap_dma_mark_declared_memory_unoccupied(struct device *dev,
extern void __dma_flush_area(const void *cpu_va, size_t size);
extern void __dma_map_area(const void *cpu_va, size_t size, int dir);
int nvmap_assign_pages_to_handle(struct nvmap_client *client,
struct nvmap_handle **hs, struct nvmap_handle *h,
struct handles_range *rng);
#endif /* __VIDEO_TEGRA_NVMAP_NVMAP_H */