diff options
author | Lauri Peltonen <lpeltonen@nvidia.com> | 2014-07-18 09:02:23 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:10:44 -0400 |
commit | 574ee40e51bf3f4fe989f8e572e611ae4ffa0795 (patch) | |
tree | 4083fb74ed6861d679299131f3577c09c33ff99d /drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | |
parent | c8faa10d1dc9bb0c4c2815c38fb71d8acdd1108d (diff) |
gpu: nvgpu: Add compression state IOCTLs
Bug 1409151
Change-Id: I29a325d7c2b481764fc82d945795d50bcb841961
Signed-off-by: Lauri Peltonen <lpeltonen@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c index 9128959f..e5628c3f 100644 --- a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/nvhost_gpu_ioctl.h> | 21 | #include <linux/nvhost_gpu_ioctl.h> |
22 | 22 | ||
23 | #include "gk20a.h" | 23 | #include "gk20a.h" |
24 | #include "fence_gk20a.h" | ||
24 | 25 | ||
25 | int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp) | 26 | int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp) |
26 | { | 27 | { |
@@ -78,6 +79,72 @@ gk20a_ctrl_ioctl_gpu_characteristics( | |||
78 | return err; | 79 | return err; |
79 | } | 80 | } |
80 | 81 | ||
82 | static int gk20a_ctrl_prepare_compressible_read( | ||
83 | struct gk20a *g, | ||
84 | struct nvhost_gpu_prepare_compressible_read_args *args) | ||
85 | { | ||
86 | struct nvhost_fence fence; | ||
87 | struct gk20a_fence *fence_out = NULL; | ||
88 | int ret = 0; | ||
89 | int flags = args->submit_flags; | ||
90 | |||
91 | fence.syncpt_id = args->fence.syncpt_id; | ||
92 | fence.value = args->fence.syncpt_value; | ||
93 | |||
94 | gk20a_busy(g->dev); | ||
95 | ret = gk20a_prepare_compressible_read(g, args->handle, | ||
96 | args->request_compbits, args->offset, | ||
97 | args->compbits_hoffset, args->compbits_voffset, | ||
98 | args->width, args->height, args->block_height_log2, | ||
99 | flags, &fence, &args->valid_compbits, | ||
100 | &fence_out); | ||
101 | gk20a_idle(g->dev); | ||
102 | |||
103 | if (ret) | ||
104 | return ret; | ||
105 | |||
106 | /* Convert fence_out to something we can pass back to user space. */ | ||
107 | if (flags & NVHOST_SUBMIT_GPFIFO_FLAGS_FENCE_GET) { | ||
108 | if (flags & NVHOST_SUBMIT_GPFIFO_FLAGS_SYNC_FENCE) { | ||
109 | if (fence_out) { | ||
110 | int fd = gk20a_fence_install_fd(fence_out); | ||
111 | if (fd < 0) | ||
112 | ret = fd; | ||
113 | else | ||
114 | args->fence.fd = fd; | ||
115 | } else { | ||
116 | args->fence.fd = -1; | ||
117 | } | ||
118 | } else { | ||
119 | if (fence_out) { | ||
120 | args->fence.syncpt_id = fence_out->syncpt_id; | ||
121 | args->fence.syncpt_value = | ||
122 | fence_out->syncpt_value; | ||
123 | } else { | ||
124 | args->fence.syncpt_id = -1; | ||
125 | args->fence.syncpt_value = 0; | ||
126 | } | ||
127 | } | ||
128 | } | ||
129 | gk20a_fence_put(fence_out); | ||
130 | |||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | static int gk20a_ctrl_mark_compressible_write( | ||
135 | struct gk20a *g, | ||
136 | struct nvhost_gpu_mark_compressible_write_args *args) | ||
137 | { | ||
138 | int ret = 0; | ||
139 | |||
140 | gk20a_busy(g->dev); | ||
141 | ret = gk20a_mark_compressible_write(g, args->handle, | ||
142 | args->valid_compbits, args->offset); | ||
143 | gk20a_idle(g->dev); | ||
144 | |||
145 | return ret; | ||
146 | } | ||
147 | |||
81 | long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 148 | long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
82 | { | 149 | { |
83 | struct platform_device *dev = filp->private_data; | 150 | struct platform_device *dev = filp->private_data; |
@@ -225,7 +292,14 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg | |||
225 | err = gk20a_ctrl_ioctl_gpu_characteristics( | 292 | err = gk20a_ctrl_ioctl_gpu_characteristics( |
226 | g, (struct nvhost_gpu_get_characteristics *)buf); | 293 | g, (struct nvhost_gpu_get_characteristics *)buf); |
227 | break; | 294 | break; |
228 | 295 | case NVHOST_GPU_IOCTL_PREPARE_COMPRESSIBLE_READ: | |
296 | err = gk20a_ctrl_prepare_compressible_read(g, | ||
297 | (struct nvhost_gpu_prepare_compressible_read_args *)buf); | ||
298 | break; | ||
299 | case NVHOST_GPU_IOCTL_MARK_COMPRESSIBLE_WRITE: | ||
300 | err = gk20a_ctrl_mark_compressible_write(g, | ||
301 | (struct nvhost_gpu_mark_compressible_write_args *)buf); | ||
302 | break; | ||
229 | default: | 303 | default: |
230 | gk20a_err(dev_from_gk20a(g), "unrecognized gpu ioctl cmd: 0x%x", cmd); | 304 | gk20a_err(dev_from_gk20a(g), "unrecognized gpu ioctl cmd: 0x%x", cmd); |
231 | err = -ENOTTY; | 305 | err = -ENOTTY; |