Lines Matching refs:dev
132 static void amdgpu_device_free_internal(amdgpu_device_handle dev) in amdgpu_device_free_internal() argument
134 amdgpu_vamgr_deinit(dev->vamgr); in amdgpu_device_free_internal()
135 free(dev->vamgr); in amdgpu_device_free_internal()
136 amdgpu_vamgr_deinit(dev->vamgr_32); in amdgpu_device_free_internal()
137 free(dev->vamgr_32); in amdgpu_device_free_internal()
138 util_hash_table_destroy(dev->bo_flink_names); in amdgpu_device_free_internal()
139 util_hash_table_destroy(dev->bo_handles); in amdgpu_device_free_internal()
140 pthread_mutex_destroy(&dev->bo_table_mutex); in amdgpu_device_free_internal()
141 util_hash_table_remove(fd_tab, UINT_TO_PTR(dev->fd)); in amdgpu_device_free_internal()
142 close(dev->fd); in amdgpu_device_free_internal()
143 if ((dev->flink_fd >= 0) && (dev->fd != dev->flink_fd)) in amdgpu_device_free_internal()
144 close(dev->flink_fd); in amdgpu_device_free_internal()
145 free(dev); in amdgpu_device_free_internal()
175 struct amdgpu_device *dev; in amdgpu_device_initialize() local
193 dev = util_hash_table_get(fd_tab, UINT_TO_PTR(fd)); in amdgpu_device_initialize()
194 if (dev) { in amdgpu_device_initialize()
195 r = amdgpu_get_auth(dev->fd, &flag_authexist); in amdgpu_device_initialize()
201 dev->flink_fd = dup(fd); in amdgpu_device_initialize()
203 *major_version = dev->major_version; in amdgpu_device_initialize()
204 *minor_version = dev->minor_version; in amdgpu_device_initialize()
205 amdgpu_device_reference(device_handle, dev); in amdgpu_device_initialize()
210 dev = calloc(1, sizeof(struct amdgpu_device)); in amdgpu_device_initialize()
211 if (!dev) { in amdgpu_device_initialize()
216 dev->fd = -1; in amdgpu_device_initialize()
217 dev->flink_fd = -1; in amdgpu_device_initialize()
219 atomic_set(&dev->refcount, 1); in amdgpu_device_initialize()
234 dev->fd = dup(fd); in amdgpu_device_initialize()
235 dev->flink_fd = dev->fd; in amdgpu_device_initialize()
236 dev->major_version = version->version_major; in amdgpu_device_initialize()
237 dev->minor_version = version->version_minor; in amdgpu_device_initialize()
240 dev->bo_flink_names = util_hash_table_create(handle_hash, in amdgpu_device_initialize()
242 dev->bo_handles = util_hash_table_create(handle_hash, handle_compare); in amdgpu_device_initialize()
243 pthread_mutex_init(&dev->bo_table_mutex, NULL); in amdgpu_device_initialize()
246 r = amdgpu_query_info(dev, AMDGPU_INFO_ACCEL_WORKING, 4, &accel_working); in amdgpu_device_initialize()
254 r = amdgpu_query_gpu_info_init(dev); in amdgpu_device_initialize()
258 dev->vamgr = calloc(1, sizeof(struct amdgpu_bo_va_mgr)); in amdgpu_device_initialize()
259 if (dev->vamgr == NULL) in amdgpu_device_initialize()
262 amdgpu_vamgr_init(dev->vamgr, dev->dev_info.virtual_address_offset, in amdgpu_device_initialize()
263 dev->dev_info.virtual_address_max, in amdgpu_device_initialize()
264 dev->dev_info.virtual_address_alignment); in amdgpu_device_initialize()
266 max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff); in amdgpu_device_initialize()
267 start = amdgpu_vamgr_find_va(dev->vamgr, in amdgpu_device_initialize()
268 max - dev->dev_info.virtual_address_offset, in amdgpu_device_initialize()
269 dev->dev_info.virtual_address_alignment, 0); in amdgpu_device_initialize()
273 dev->vamgr_32 = calloc(1, sizeof(struct amdgpu_bo_va_mgr)); in amdgpu_device_initialize()
274 if (dev->vamgr_32 == NULL) in amdgpu_device_initialize()
276 amdgpu_vamgr_init(dev->vamgr_32, start, max, in amdgpu_device_initialize()
277 dev->dev_info.virtual_address_alignment); in amdgpu_device_initialize()
279 *major_version = dev->major_version; in amdgpu_device_initialize()
280 *minor_version = dev->minor_version; in amdgpu_device_initialize()
281 *device_handle = dev; in amdgpu_device_initialize()
282 util_hash_table_set(fd_tab, UINT_TO_PTR(dev->fd), dev); in amdgpu_device_initialize()
289 amdgpu_vamgr_free_va(dev->vamgr, start, in amdgpu_device_initialize()
290 max - dev->dev_info.virtual_address_offset); in amdgpu_device_initialize()
291 amdgpu_vamgr_deinit(dev->vamgr); in amdgpu_device_initialize()
292 free(dev->vamgr); in amdgpu_device_initialize()
295 if (dev->fd >= 0) in amdgpu_device_initialize()
296 close(dev->fd); in amdgpu_device_initialize()
297 free(dev); in amdgpu_device_initialize()
302 int amdgpu_device_deinitialize(amdgpu_device_handle dev) in amdgpu_device_deinitialize() argument
304 amdgpu_device_reference(&dev, NULL); in amdgpu_device_deinitialize()
308 const char *amdgpu_get_marketing_name(amdgpu_device_handle dev) in amdgpu_get_marketing_name() argument
313 if ((t->did == dev->info.asic_id) && in amdgpu_get_marketing_name()
314 (t->rid == dev->info.pci_rev_id)) in amdgpu_get_marketing_name()