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

@@ -259,6 +259,17 @@ struct nvmap_duplicate_handle {
__u32 dup_handle;
};
/**
* Struct used while duplicating memory handle
*/
struct nvmap_fd_for_range_from_list {
__u32 *handles; /* Head of handles list */
__u32 num_handles; /* Number of handles in the list */
__u64 offset; /* Offset aligned by page size in the buffers */
__u64 size; /* Size of the sub buffer for which fd to be returned */
__s32 fd; /* Sub range Dma Buf fd to be returned*/
};
#define NVMAP_IOC_MAGIC 'N'
/* Creates a new memory handle. On input, the argument is the size of the new
@@ -361,6 +372,10 @@ struct nvmap_duplicate_handle {
#define NVMAP_IOC_DUP_HANDLE _IOWR(NVMAP_IOC_MAGIC, 106, \
struct nvmap_duplicate_handle)
#define NVMAP_IOC_MAXNR (_IOC_NR(NVMAP_IOC_DUP_HANDLE))
/* Get for range from list of NvRmMemHandles */
#define NVMAP_IOC_GET_FD_FOR_RANGE_FROM_LIST _IOR(NVMAP_IOC_MAGIC, 107, \
struct nvmap_fd_for_range_from_list)
#define NVMAP_IOC_MAXNR (_IOC_NR(NVMAP_IOC_GET_FD_FOR_RANGE_FROM_LIST))
#endif /* __UAPI_LINUX_NVMAP_H */