From af5d2d208ada4d84c7a7bd0e4e0c288d1276225f Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 16 Nov 2016 15:19:12 +0530 Subject: gpu: nvgpu: API to access fb memory Add IOCTL API NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY to read/write fb/vidmem memory Interface will accept dmabuf_fd of the buffer in vidmem, offset into the buffer to access, temporary buffer to copy data across API, size of read/write and command indicating either read or write operation API will first parse all the inputs, and then call gk20a_vidbuf_access_memory() to complete fb access gk20a_vidbuf_access_memory() will then just use gk20a_mem_rd_n() or gk20a_mem_wr_n() depending on the command issued Bug 1804714 Jira DNVGPU-192 Change-Id: Iba3c42410abe12c2884d3b603fa33d27782e4c56 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1255556 (cherry picked from commit 2c49a8a79d93fc526adbf6f808484fa9a3fa2498) Reviewed-on: http://git-master/r/1260471 GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani --- include/uapi/linux/nvgpu.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index b1c602db..b4c7e829 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -917,11 +917,28 @@ struct nvgpu_dbg_gpu_suspend_resume_contexts_args { _IOWR(NVGPU_DBG_GPU_IOCTL_MAGIC, 18, struct nvgpu_dbg_gpu_suspend_resume_contexts_args) +#define NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY_CMD_READ 1 +#define NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY_CMD_WRITE 2 + +struct nvgpu_dbg_gpu_access_fb_memory_args { + __u32 cmd; /* in: either read or write */ + + __s32 dmabuf_fd; /* in: dmabuf fd of the buffer in FB */ + __u64 offset; /* in: offset within buffer in FB, should be 4B aligned */ + + __u64 buffer; /* in/out: temp buffer to read/write from */ + __u64 size; /* in: size of the buffer i.e. size of read/write in bytes, should be 4B aligned */ +}; + +#define NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY \ + _IOWR(NVGPU_DBG_GPU_IOCTL_MAGIC, 19, struct nvgpu_dbg_gpu_access_fb_memory_args) + + #define NVGPU_DBG_GPU_IOCTL_LAST \ - _IOC_NR(NVGPU_DBG_GPU_IOCTL_SUSPEND_RESUME_CONTEXTS) + _IOC_NR(NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY) #define NVGPU_DBG_GPU_IOCTL_MAX_ARG_SIZE \ - sizeof(struct nvgpu_dbg_gpu_perfbuf_map_args) + sizeof(struct nvgpu_dbg_gpu_access_fb_memory_args) /* * /dev/nvhost-gpu device -- cgit v1.2.2