Lines Matching defs:device
117 get_device_extensions(const struct v3dv_physical_device *device,
142 .KHR_performance_query = device->caps.perfmon,
273 v3dv_physical_device_free_disk_cache(struct v3dv_physical_device *device)
276 if (device->disk_cache)
277 disk_cache_destroy(device->disk_cache);
279 assert(device->disk_cache == NULL);
284 physical_device_finish(struct v3dv_physical_device *device)
286 v3dv_wsi_finish(device);
287 v3dv_physical_device_free_disk_cache(device);
288 v3d_compiler_free(device->compiler);
290 util_sparse_array_finish(&device->bo_map);
292 close(device->render_fd);
293 if (device->display_fd >= 0)
294 close(device->display_fd);
295 if (device->master_fd >= 0)
296 close(device->master_fd);
298 free(device->name);
301 v3d_simulator_destroy(device->sim_file);
304 vk_physical_device_finish(&device->vk);
305 mtx_destroy(&device->mutex);
318 /* We support at most one physical device. */
410 v3dv_drm_handle_device(void *data, struct wl_drm *drm, const char *device)
413 info->fd = open(device, O_RDWR | O_CLOEXEC);
417 device, strerror(errno));
450 .device = v3dv_drm_handle_device,
513 wl_display_roundtrip(display); /* For the DRM device event */
569 * authenticated device also for Xlib.
625 v3d_has_feature(struct v3dv_physical_device *device, enum drm_v3d_param feature)
630 if (v3dv_ioctl(device->render_fd, DRM_IOCTL_V3D_GET_PARAM, &p) != 0)
636 device_has_expected_features(struct v3dv_physical_device *device)
638 return v3d_has_feature(device, DRM_V3D_PARAM_SUPPORTS_TFU) &&
639 v3d_has_feature(device, DRM_V3D_PARAM_SUPPORTS_CSD) &&
640 v3d_has_feature(device, DRM_V3D_PARAM_SUPPORTS_CACHE_FLUSH);
645 init_uuids(struct v3dv_physical_device *device)
650 return vk_errorf(device->vk.instance,
657 return vk_errorf(device->vk.instance,
662 memcpy(device->driver_build_sha1, build_id_data(note), 20);
664 uint32_t vendor_id = v3dv_physical_device_vendor_id(device);
665 uint32_t device_id = v3dv_physical_device_device_id(device);
672 * invalid. It needs both a driver build and the PCI ID of the device.
678 memcpy(device->pipeline_cache_uuid, sha1, VK_UUID_SIZE);
682 * share memory need to also check the device UUID (below) so all this
685 memcpy(device->driver_uuid, build_id_data(note), VK_UUID_SIZE);
687 /* The device UUID uniquely identifies the given device within the machine.
688 * Since we never have more than one device, this doesn't need to be a real
695 memcpy(device->device_uuid, sha1, VK_UUID_SIZE);
701 v3dv_physical_device_init_disk_cache(struct v3dv_physical_device *device)
705 _mesa_sha1_format(timestamp, device->driver_build_sha1);
707 assert(device->name);
708 device->disk_cache = disk_cache_create(device->name, timestamp, 0);
710 device->disk_cache = NULL;
715 physical_device_init(struct v3dv_physical_device *device,
730 result = vk_physical_device_init(&device->vk, &instance->vk, NULL,
746 * display device now for the v3dv_wsi_init() call below. For anything else
762 device->has_primary = primary_path;
763 if (device->has_primary) {
771 device->primary_devid = primary_stat.st_rdev;
780 device->has_render = true;
781 device->render_devid = render_stat.st_rdev;
784 device->device_id = drm_render_device->deviceinfo.pci->device_id;
789 /* Open the primary node on the vc4 display device */
793 /* There is only one device with primary and render nodes.
801 device->sim_file = v3d_simulator_init(render_fd);
804 device->render_fd = render_fd; /* The v3d render node */
805 device->display_fd = -1; /* Authenticated vc4 primary node */
806 device->master_fd = master_fd; /* Master vc4 primary node */
808 if (!v3d_get_device_info(device->render_fd, &device->devinfo, &v3dv_ioctl)) {
813 if (device->devinfo.ver < 42) {
818 if (!device_has_expected_features(device)) {
823 device->caps.multisync =
824 v3d_has_feature(device, DRM_V3D_PARAM_SUPPORTS_MULTISYNC_EXT);
826 device->caps.perfmon =
827 v3d_has_feature(device, DRM_V3D_PARAM_SUPPORTS_PERFMON);
829 result = init_uuids(device);
833 device->compiler = v3d_compiler_init(&device->devinfo,
835 device->next_program_id = 0;
838 asprintf(&device->name, "V3D %d.%d",
839 device->devinfo.ver / 10, device->devinfo.ver % 10);
842 v3dv_physical_device_init_disk_cache(device);
845 VkPhysicalDeviceMemoryProperties *mem = &device->memory;
859 util_sparse_array_init(&device->bo_map, sizeof(struct v3dv_bo), 512);
861 device->options.merge_jobs = !(V3D_DEBUG & V3D_DEBUG_NO_MERGE_JOBS);
863 device->drm_syncobj_type = vk_drm_syncobj_get_type(device->render_fd);
869 device->drm_syncobj_type.features &= ~VK_SYNC_FEATURE_TIMELINE;
895 device->drm_syncobj_type.import_sync_file = NULL;
896 device->drm_syncobj_type.export_sync_file = NULL;
902 device->drm_syncobj_type.features |= VK_SYNC_FEATURE_GPU_MULTI_WAIT;
904 device->sync_timeline_type =
905 vk_sync_timeline_get_type(&device->drm_syncobj_type);
907 device->sync_types[0] = &device->drm_syncobj_type;
908 device->sync_types[1] = &device->sync_timeline_type.sync;
909 device->sync_types[2] = NULL;
910 device->vk.supported_sync_types = device->sync_types;
912 result = v3dv_wsi_init(device);
918 get_device_extensions(device, &device->vk.supported_extensions);
920 mtx_init(&device->mutex, mtx_plain);
925 vk_physical_device_finish(&device->vk);
972 * display server to provide the device fd (with DRI3), so we
973 * here we only check that the device is present but we don't
1339 v3dv_GetDeviceGroupPeerMemoryFeatures(VkDevice device,
1714 /* Do nothing, not even logging. This is a non-PCI device, so we will
1757 V3DV_FROM_HANDLE(v3dv_physical_device, device, physicalDevice);
1758 *pMemoryProperties = device->memory;
1852 drmSyncobjDestroy(queue->device->pdevice->render_fd,
1859 queue_init(struct v3dv_device *device, struct v3dv_queue *queue,
1863 VkResult result = vk_queue_init(&queue->vk, &device->vk, create_info,
1872 queue->device = device;
1877 int ret = drmSyncobjCreate(device->pdevice->render_fd,
1881 result = vk_errorf(device, VK_ERROR_INITIALIZATION_FAILED,
1907 init_device_meta(struct v3dv_device *device)
1909 mtx_init(&device->meta.mtx, mtx_plain);
1910 v3dv_meta_clear_init(device);
1911 v3dv_meta_blit_init(device);
1912 v3dv_meta_texel_buffer_copy_init(device);
1916 destroy_device_meta(struct v3dv_device *device)
1918 mtx_destroy(&device->meta.mtx);
1919 v3dv_meta_clear_finish(device);
1920 v3dv_meta_blit_finish(device);
1921 v3dv_meta_texel_buffer_copy_finish(device);
1933 struct v3dv_device *device;
1946 device = vk_zalloc2(&physical_device->vk.instance->alloc, pAllocator,
1947 sizeof(*device), 8,
1949 if (!device)
1957 result = vk_device_init(&device->vk, &physical_device->vk,
1960 vk_free(&device->vk.alloc, device);
1964 device->instance = instance;
1965 device->pdevice = physical_device;
1967 mtx_init(&device->query_mutex, mtx_plain);
1968 cnd_init(&device->query_ended);
1970 vk_device_set_drm_fd(&device->vk, physical_device->render_fd);
1971 vk_device_enable_threaded_submit(&device->vk);
1973 result = queue_init(device, &device->queue,
1978 device->devinfo = physical_device->devinfo;
1988 memcpy(&device->features, &features2->features,
1989 sizeof(device->features));
1991 memcpy(&device->features, pCreateInfo->pEnabledFeatures,
1992 sizeof(device->features));
1995 if (device->features.robustBufferAccess)
1999 v3dv_X(device, device_check_prepacked_sizes)();
2001 init_device_meta(device);
2002 v3dv_bo_cache_init(device);
2003 v3dv_pipeline_cache_init(&device->default_pipeline_cache, device, 0,
2004 device->instance->default_pipeline_cache_enabled);
2005 device->default_attribute_float =
2006 v3dv_pipeline_create_default_attribute_values(device, NULL);
2008 device->device_address_mem_ctx = ralloc_context(NULL);
2009 util_dynarray_init(&device->device_address_bo_list,
2010 device->device_address_mem_ctx);
2012 *pDevice = v3dv_device_to_handle(device);
2017 cnd_destroy(&device->query_ended);
2018 mtx_destroy(&device->query_mutex);
2019 queue_finish(&device->queue);
2020 destroy_device_meta(device);
2021 v3dv_pipeline_cache_finish(&device->default_pipeline_cache);
2022 vk_device_finish(&device->vk);
2023 vk_free(&device->vk.alloc, device);
2032 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2034 device->vk.dispatch_table.DeviceWaitIdle(_device);
2035 queue_finish(&device->queue);
2036 destroy_device_meta(device);
2037 v3dv_pipeline_cache_finish(&device->default_pipeline_cache);
2039 if (device->default_attribute_float) {
2040 v3dv_bo_free(device, device->default_attribute_float);
2041 device->default_attribute_float = NULL;
2044 ralloc_free(device->device_address_mem_ctx);
2049 v3dv_bo_cache_destroy(device);
2051 cnd_destroy(&device->query_ended);
2052 mtx_destroy(&device->query_mutex);
2054 vk_device_finish(&device->vk);
2055 vk_free2(&device->vk.alloc, pAllocator, device);
2059 device_alloc(struct v3dv_device *device,
2066 mem->bo = v3dv_bo_alloc(device, size, "device_alloc", false);
2089 device_free(struct v3dv_device *device, struct v3dv_device_memory *mem)
2092 * display device to free the allocated dumb BO.
2095 device_free_wsi_dumb(device->instance->physicalDevice.display_fd,
2099 v3dv_bo_free(device, mem->bo);
2103 device_unmap(struct v3dv_device *device, struct v3dv_device_memory *mem)
2106 v3dv_bo_unmap(device, mem->bo);
2110 device_map(struct v3dv_device *device, struct v3dv_device_memory *mem)
2131 bool ok = v3dv_bo_map(device, mem->bo, mem->bo->size);
2139 device_import_bo(struct v3dv_device *device,
2151 int render_fd = device->pdevice->render_fd;
2168 *bo = v3dv_device_lookup_bo(device->pdevice, handle);
2180 device_alloc_for_wsi(struct v3dv_device *device,
2187 * hardware we need to allocate our winsys BOs on the vc4 display device
2191 return device_alloc(device, mem, size);
2194 * we should've initialized the display device. However, Zink doesn't
2196 * display device and we need to do it now.
2199 struct v3dv_instance *instance = device->instance;
2200 struct v3dv_physical_device *pdevice = &device->instance->physicalDevice;
2228 result = device_import_bo(device, pAllocator, fd, size, &mem->bo);
2246 device_add_device_address_bo(struct v3dv_device *device,
2249 util_dynarray_append(&device->device_address_bo_list,
2255 device_remove_device_address_bo(struct v3dv_device *device,
2258 util_dynarray_delete_unordered(&device->device_address_bo_list,
2269 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2271 struct v3dv_physical_device *pdevice = &device->instance->physicalDevice;
2278 mem = vk_object_zalloc(&device->vk, pAllocator, sizeof(*mem),
2320 /* We always allocate device memory in multiples of a page, so round up
2329 result = device_alloc_for_wsi(device, pAllocator, mem, alloc_size);
2333 result = device_import_bo(device, pAllocator,
2338 result = device_alloc(device, mem, alloc_size);
2343 vk_object_free(&device->vk, pAllocator, mem);
2344 return vk_error(device, result);
2358 device_add_device_address_bo(device, mem->bo);
2370 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2380 device_remove_device_address_bo(device, mem->bo);
2382 device_free(device, mem);
2384 vk_object_free(&device->vk, pAllocator, mem);
2395 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2410 VkResult result = device_map(device, mem);
2412 return vk_error(device, result);
2422 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2428 device_unmap(device, mem);
2448 v3dv_GetImageMemoryRequirements2(VkDevice device,
2524 v3dv_GetBufferMemoryRequirements2(VkDevice device,
2573 v3dv_BindBufferMemory2(VkDevice device,
2589 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2598 buffer = vk_object_zalloc(&device->vk, pAllocator, sizeof(*buffer),
2601 return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
2610 vk_free(&device->vk.alloc, buffer);
2624 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2630 vk_object_free(&device->vk, pAllocator, buffer);
2639 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2646 framebuffer = vk_object_zalloc(&device->vk, pAllocator, size,
2649 return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
2687 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2693 vk_object_free(&device->vk, pAllocator, fb);
2702 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2703 struct v3dv_physical_device *pdevice = &device->instance->physicalDevice;
2711 return vk_error(device, VK_ERROR_INVALID_EXTERNAL_HANDLE);
2720 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2728 ret = drmPrimeHandleToFD(device->pdevice->render_fd,
2732 return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
2745 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2747 vk_object_zalloc(&device->vk, pAllocator, sizeof(*event),
2750 return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
2764 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2770 vk_object_free(&device->vk, pAllocator, event);
2802 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2807 sampler = vk_object_zalloc(&device->vk, pAllocator, sizeof(*sampler),
2810 return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
2819 v3dv_X(device, pack_sampler_state)(sampler, pCreateInfo, bc_info);
2831 V3DV_FROM_HANDLE(v3dv_device, device, _device);
2837 vk_object_free(&device->vk, pAllocator, sampler);
2841 v3dv_GetDeviceMemoryCommitment(VkDevice device,
2850 VkDevice device,
2860 VkDevice device,
2922 v3dv_GetBufferDeviceAddress(VkDevice device,
2930 v3dv_GetBufferOpaqueCaptureAddress(VkDevice device,
2939 VkDevice device,