From 30632cec54048944ee364781b4b8c2676ae5dfed Mon Sep 17 00:00:00 2001 From: Sami Kiminki Date: Mon, 26 Oct 2015 19:23:54 +0200 Subject: gpu: nvgpu: Implement NVGPU_GPU_IOCTL_GET_BUFFER_INFO Implement NVGPU_GPU_IOCTL_GET_BUFFER_INFO. The new IOCTL can be used to identify buffers and retrieve their sizes. This allows the userspace to be agnostic to the dmabuf implementation, as the generic dmabuf fd interface does not have a reliable way for buffer identification. Bug 1614735 Bug 1623949 Bug 1660392 Change-Id: Ic3dd0a9385c9852778110ccb80636dd6f4f36208 Signed-off-by: Sami Kiminki Reviewed-on: http://git-master/r/822845 Reviewed-on: http://git-master/r/833252 Reviewed-by: Terje Bergstrom --- include/uapi/linux/nvgpu.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 6024edee..6a8e44c5 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -314,6 +314,22 @@ struct nvgpu_gpu_vsms_mapping { __u64 vsms_map_buf_addr; }; +struct nvgpu_gpu_get_buffer_info_args { + union { + struct { + __u32 dmabuf_fd; /* dma-buf fd */ + } in; + struct { + __u64 id; /* Unique within live + * buffers */ + __u64 length; /* Allocated length of the + * buffer */ + __u64 reserved0; + __u64 reserved1; + } out; + }; +}; + #define NVGPU_GPU_IOCTL_ZCULL_GET_CTX_SIZE \ _IOR(NVGPU_GPU_IOCTL_MAGIC, 1, struct nvgpu_gpu_zcull_get_ctx_size_args) #define NVGPU_GPU_IOCTL_ZCULL_GET_INFO \ @@ -352,9 +368,11 @@ struct nvgpu_gpu_vsms_mapping { _IOWR(NVGPU_GPU_IOCTL_MAGIC, 18, struct nvgpu_gpu_num_vsms) #define NVGPU_GPU_IOCTL_VSMS_MAPPING \ _IOWR(NVGPU_GPU_IOCTL_MAGIC, 19, struct nvgpu_gpu_vsms_mapping) +#define NVGPU_GPU_IOCTL_GET_BUFFER_INFO \ + _IOWR(NVGPU_GPU_IOCTL_MAGIC, 20, struct nvgpu_gpu_get_buffer_info_args) #define NVGPU_GPU_IOCTL_LAST \ - _IOC_NR(NVGPU_GPU_IOCTL_VSMS_MAPPING) + _IOC_NR(NVGPU_GPU_IOCTL_GET_BUFFER_INFO) #define NVGPU_GPU_IOCTL_MAX_ARG_SIZE \ sizeof(struct nvgpu_gpu_prepare_compressible_read_args) -- cgit v1.2.2