radv: remove the ability to create NULL devices with RADV_FORCE_FAMILY

On Linux, drm-shim is the replacement.

On Windows, the project to support a compile-only device has been
abandonned since a while, so it's fine to not allow creating NULL
devices for now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38544>
This commit is contained in:
Samuel Pitoiset
2025-11-20 09:46:11 +01:00
committed by Marge Bot
parent 77030f296e
commit 9a61eaa1e3
3 changed files with 13 additions and 49 deletions

View File

@@ -1502,10 +1502,6 @@ RADV driver environment variables
``validatevas``
Enable tracking of VA ranges for radv_build_is_valid_va.
.. envvar:: RADV_FORCE_FAMILY
create a null device to compile shaders without a AMD GPU (e.g. VEGA10)
.. envvar:: RADV_FORCE_VRS
allow to force per-pipeline vertex VRS rates on GFX10.3+. This is only

View File

@@ -369,6 +369,12 @@ radv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationC
struct radv_instance *instance;
VkResult result;
/* Report RADV_FORCE_FAMILY as deprecated for one or two release cycles. */
if (os_get_option("RADV_FORCE_FAMILY")) {
fprintf(stderr, "radv: RADV_FORCE_FAMILY=<family> has been removed. Please use AMDGPU drm-shim now.\n");
return VK_ERROR_INITIALIZATION_FAILED;
}
if (!pAllocator)
pAllocator = vk_default_allocator();
@@ -423,15 +429,7 @@ radv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationC
fprintf(stderr, "radv: Failed to open log file: %s.\n", filename);
}
/* When RADV_FORCE_FAMILY is set, the driver creates a null
* device that allows to test the compiler without having an
* AMDGPU instance.
*/
if (os_get_option("RADV_FORCE_FAMILY"))
instance->vk.physical_devices.enumerate = create_null_physical_device;
else
instance->vk.physical_devices.try_create_for_drm = create_drm_physical_device;
instance->vk.physical_devices.try_create_for_drm = create_drm_physical_device;
instance->vk.physical_devices.destroy = radv_physical_device_destroy;
if (instance->debug_flags & RADV_DEBUG_STARTUP)

View File

@@ -2220,35 +2220,19 @@ radv_is_gpu_supported(const struct radeon_info *info)
return true;
}
static const struct vk_sync_type *const dummy_types[2] = {
&vk_sync_dummy_type,
NULL,
};
static VkResult
radv_create_null_device(struct radv_instance *instance, struct radv_physical_device *pdev)
{
const char *family = os_get_option("RADV_FORCE_FAMILY");
if (!ac_null_device_create(&pdev->info, family))
return vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, "Unknown family: %s\n", family);
pdev->vk.supported_sync_types = dummy_types;
return VK_SUCCESS;
}
static VkResult
radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm_device,
struct radv_physical_device **pdev_out)
{
#ifdef _WIN32
assert(drm_device == NULL);
return VK_ERROR_INCOMPATIBLE_DRIVER;
#else
VkResult result;
int fd = -1;
int master_fd = -1;
#ifdef _WIN32
assert(drm_device == NULL);
#else
bool is_virtio = false;
if (drm_device) {
const char *path = drm_device->nodes[DRM_NODE_RENDER];
drmVersionPtr version;
@@ -2292,7 +2276,6 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
if (instance->debug_flags & RADV_DEBUG_STARTUP)
fprintf(stderr, "radv: info: Found device '%s'.\n", path);
}
#endif
struct radv_physical_device *pdev =
vk_zalloc2(&instance->vk.alloc, NULL, sizeof(*pdev), 8, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
@@ -2310,11 +2293,6 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
goto fail_alloc;
}
#ifdef _WIN32
result = radv_create_null_device(instance, pdev);
if (result != VK_SUCCESS)
goto fail_base;
#else
if (drm_device) {
bool reserve_vmid = instance->vk.trace_mode & RADV_TRACE_MODE_RGP;
@@ -2358,14 +2336,7 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
result = VK_ERROR_INITIALIZATION_FAILED;
goto fail_wsi;
}
} else {
/* Create NULL device if no DRM device was provided. */
result = radv_create_null_device(instance, pdev);
if (result != VK_SUCCESS)
goto fail_base;
}
#endif
pdev->master_fd = master_fd;
pdev->local_fd = fd;
@@ -2478,7 +2449,6 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
radv_physical_device_get_supported_extensions(pdev, &pdev->vk.supported_extensions);
radv_physical_device_get_features(pdev, &pdev->vk.supported_features);
#ifndef _WIN32
if (drm_device) {
struct stat primary_stat = {0}, render_stat = {0};
@@ -2501,7 +2471,6 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
}
pdev->render_devid = render_stat.st_rdev;
}
#endif
radv_physical_device_init_cache_key(pdev);
@@ -2582,6 +2551,7 @@ fail_fd:
if (master_fd != -1)
close(master_fd);
return result;
#endif
}
VkResult