diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index 1c3fc99c5465..8e995148f56e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | |||
@@ -208,44 +208,6 @@ static int amdgpu_cgs_alloc_gpu_mem(void *cgs_device, | |||
208 | return ret; | 208 | return ret; |
209 | } | 209 | } |
210 | 210 | ||
211 | static int amdgpu_cgs_import_gpu_mem(void *cgs_device, int dmabuf_fd, | ||
212 | cgs_handle_t *handle) | ||
213 | { | ||
214 | CGS_FUNC_ADEV; | ||
215 | int r; | ||
216 | uint32_t dma_handle; | ||
217 | struct drm_gem_object *obj; | ||
218 | struct amdgpu_bo *bo; | ||
219 | struct drm_device *dev = adev->ddev; | ||
220 | struct drm_file *file_priv = NULL, *priv; | ||
221 | |||
222 | mutex_lock(&dev->struct_mutex); | ||
223 | list_for_each_entry(priv, &dev->filelist, lhead) { | ||
224 | rcu_read_lock(); | ||
225 | if (priv->pid == get_pid(task_pid(current))) | ||
226 | file_priv = priv; | ||
227 | rcu_read_unlock(); | ||
228 | if (file_priv) | ||
229 | break; | ||
230 | } | ||
231 | mutex_unlock(&dev->struct_mutex); | ||
232 | r = dev->driver->prime_fd_to_handle(dev, | ||
233 | file_priv, dmabuf_fd, | ||
234 | &dma_handle); | ||
235 | spin_lock(&file_priv->table_lock); | ||
236 | |||
237 | /* Check if we currently have a reference on the object */ | ||
238 | obj = idr_find(&file_priv->object_idr, dma_handle); | ||
239 | if (obj == NULL) { | ||
240 | spin_unlock(&file_priv->table_lock); | ||
241 | return -EINVAL; | ||
242 | } | ||
243 | spin_unlock(&file_priv->table_lock); | ||
244 | bo = gem_to_amdgpu_bo(obj); | ||
245 | *handle = (cgs_handle_t)bo; | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static int amdgpu_cgs_free_gpu_mem(void *cgs_device, cgs_handle_t handle) | 211 | static int amdgpu_cgs_free_gpu_mem(void *cgs_device, cgs_handle_t handle) |
250 | { | 212 | { |
251 | struct amdgpu_bo *obj = (struct amdgpu_bo *)handle; | 213 | struct amdgpu_bo *obj = (struct amdgpu_bo *)handle; |
@@ -810,7 +772,6 @@ static const struct cgs_ops amdgpu_cgs_ops = { | |||
810 | }; | 772 | }; |
811 | 773 | ||
812 | static const struct cgs_os_ops amdgpu_cgs_os_ops = { | 774 | static const struct cgs_os_ops amdgpu_cgs_os_ops = { |
813 | amdgpu_cgs_import_gpu_mem, | ||
814 | amdgpu_cgs_add_irq_source, | 775 | amdgpu_cgs_add_irq_source, |
815 | amdgpu_cgs_irq_get, | 776 | amdgpu_cgs_irq_get, |
816 | amdgpu_cgs_irq_put | 777 | amdgpu_cgs_irq_put |