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 <skiminki@nvidia.com>
Reviewed-on: http://git-master/r/822845
Reviewed-on: http://git-master/r/833252
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Sami Kiminki
2015-10-26 19:23:54 +02:00
committed by Terje Bergstrom
parent 5a24e95fe6
commit 30632cec54
4 changed files with 72 additions and 2 deletions

View File

@@ -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)