Lines Matching defs:dev
42 static int amdgpu_bo_create(amdgpu_device_handle dev,
54 r = handle_table_insert(&dev->bo_handles, handle, bo);
61 bo->dev = dev;
70 drm_public int amdgpu_bo_alloc(amdgpu_device_handle dev,
86 r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_CREATE,
91 pthread_mutex_lock(&dev->bo_table_mutex);
92 r = amdgpu_bo_create(dev, alloc_buffer->alloc_size, args.out.handle,
94 pthread_mutex_unlock(&dev->bo_table_mutex);
96 drmCloseBufferHandle(dev->fd, args.out.handle);
121 return drmCommandWriteRead(bo->dev->fd,
142 r = drmCommandWriteRead(bo->dev->fd, DRM_AMDGPU_GEM_METADATA,
156 r = drmCommandWriteRead(bo->dev->fd, DRM_AMDGPU_GEM_OP,
184 fd = bo->dev->fd;
190 if (bo->dev->flink_fd != bo->dev->fd) {
191 r = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC,
194 r = drmPrimeFDToHandle(bo->dev->flink_fd, dma_fd, &handle);
199 fd = bo->dev->flink_fd;
210 if (bo->dev->flink_fd != bo->dev->fd)
211 drmCloseBufferHandle(bo->dev->flink_fd, handle);
213 pthread_mutex_lock(&bo->dev->bo_table_mutex);
214 r = handle_table_insert(&bo->dev->bo_flink_names, bo->flink_name, bo);
215 pthread_mutex_unlock(&bo->dev->bo_table_mutex);
241 return drmPrimeHandleToFD(bo->dev->fd, bo->handle,
248 drm_public int amdgpu_bo_import(amdgpu_device_handle dev,
263 pthread_mutex_lock(&dev->bo_table_mutex);
270 r = drmPrimeFDToHandle(dev->fd, shared_handle, &handle);
289 bo = handle_table_lookup(&dev->bo_flink_names, shared_handle);
293 bo = handle_table_lookup(&dev->bo_handles, shared_handle);
310 pthread_mutex_unlock(&dev->bo_table_mutex);
321 r = drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_OPEN, &open_arg);
328 if (dev->flink_fd != dev->fd) {
329 r = drmPrimeHandleToFD(dev->flink_fd, handle,
333 r = drmPrimeFDToHandle(dev->fd, dma_fd, &handle);
337 r = drmCloseBufferHandle(dev->flink_fd,
356 r = amdgpu_bo_create(dev, alloc_size, handle, &bo);
362 r = handle_table_insert(&dev->bo_flink_names, flink_name,
371 pthread_mutex_unlock(&dev->bo_table_mutex);
376 drmCloseBufferHandle(dev->flink_fd, open_arg.handle);
381 drmCloseBufferHandle(dev->fd, handle);
383 pthread_mutex_unlock(&dev->bo_table_mutex);
389 struct amdgpu_device *dev;
393 dev = bo->dev;
394 pthread_mutex_lock(&dev->bo_table_mutex);
398 handle_table_remove(&dev->bo_handles, bo->handle);
401 handle_table_remove(&dev->bo_flink_names,
410 drmCloseBufferHandle(dev->fd, bo->handle);
415 pthread_mutex_unlock(&dev->bo_table_mutex);
450 r = drmCommandWriteRead(bo->dev->fd, DRM_AMDGPU_GEM_MMAP, &args,
459 bo->dev->fd, args.out.addr_ptr);
499 drm_public int amdgpu_query_buffer_size_alignment(amdgpu_device_handle dev,
502 info->size_local = dev->dev_info.pte_fragment_size;
503 info->size_remote = dev->dev_info.gart_page_size;
518 r = drmCommandWriteRead(bo->dev->fd, DRM_AMDGPU_GEM_WAIT_IDLE,
530 drm_public int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev,
548 pthread_mutex_lock(&dev->bo_table_mutex);
549 for (i = 0; i < dev->bo_handles.max_key; i++) {
550 bo = handle_table_lookup(&dev->bo_handles, i);
558 if (i < dev->bo_handles.max_key) {
567 pthread_mutex_unlock(&dev->bo_table_mutex);
572 drm_public int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
584 r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_USERPTR,
589 pthread_mutex_lock(&dev->bo_table_mutex);
590 r = amdgpu_bo_create(dev, size, args.handle, buf_handle);
591 pthread_mutex_unlock(&dev->bo_table_mutex);
593 drmCloseBufferHandle(dev->fd, args.handle);
600 drm_public int amdgpu_bo_list_create_raw(amdgpu_device_handle dev,
614 r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_BO_LIST,
621 drm_public int amdgpu_bo_list_destroy_raw(amdgpu_device_handle dev,
630 return drmCommandWriteRead(dev->fd, DRM_AMDGPU_BO_LIST,
634 drm_public int amdgpu_bo_list_create(amdgpu_device_handle dev,
676 r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_BO_LIST,
684 (*result)->dev = dev;
698 r = drmCommandWriteRead(list->dev->fd, DRM_AMDGPU_BO_LIST,
742 r = drmCommandWriteRead(handle->dev->fd, DRM_AMDGPU_BO_LIST,
755 amdgpu_device_handle dev = bo->dev;
759 return amdgpu_bo_va_op_raw(dev, bo, offset, size, addr,
765 drm_public int amdgpu_bo_va_op_raw(amdgpu_device_handle dev,
788 r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_VA, &va, sizeof(va));