radv: implement VK_EXT_physical_device_drm
This adds support for the Vulkan extension introduced in [1]. The extension allows to get a VkPhysicalDevice's DRM node device IDs. [1]: https://github.com/KhronosGroup/Vulkan-Docs/pull/1356 Signed-off-by: Simon Ser <contact@emersion.fr> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8390>
This commit is contained in:
parent
60ff9dea27
commit
7aaa54feb5
|
@ -533,7 +533,7 @@ Khronos extensions that are not part of any Vulkan version:
|
|||
VK_EXT_memory_budget DONE (anv, radv, tu)
|
||||
VK_EXT_memory_priority DONE (radv)
|
||||
VK_EXT_pci_bus_info DONE (anv, radv)
|
||||
VK_EXT_physical_device_drm DONE (anv)
|
||||
VK_EXT_physical_device_drm DONE (anv, radv)
|
||||
VK_EXT_pipeline_creation_cache_control DONE (anv, radv)
|
||||
VK_EXT_pipeline_creation_feedback DONE (anv, radv)
|
||||
VK_EXT_post_depth_coverage DONE (anv/gfx10+, lvp, radv)
|
||||
|
|
|
@ -2,5 +2,6 @@ zink supports GL_ARB_texture_filter_minmax, GL_ARB_shader_clock
|
|||
VK_EXT_provoking_vertex on RADV.
|
||||
VK_EXT_extended_dynamic_state2 on RADV.
|
||||
VK_EXT_global_priority_query on RADV.
|
||||
VK_EXT_physical_device_drm on RADV.
|
||||
32-bit x86 builds now default disable x87 math and use sse2.
|
||||
GL ES 3.1 on GT21x hardware.
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/types.h>
|
||||
#elif !defined(_WIN32)
|
||||
#include <sys/sysmacros.h>
|
||||
#endif
|
||||
|
||||
#include "util/debug.h"
|
||||
#include "util/disk_cache.h"
|
||||
#include "radv_cs.h"
|
||||
|
@ -469,6 +475,9 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
|
|||
.EXT_memory_budget = true,
|
||||
.EXT_memory_priority = true,
|
||||
.EXT_pci_bus_info = true,
|
||||
#ifndef _WIN32
|
||||
.EXT_physical_device_drm = true,
|
||||
#endif
|
||||
.EXT_pipeline_creation_cache_control = true,
|
||||
.EXT_pipeline_creation_feedback = true,
|
||||
.EXT_post_depth_coverage = device->rad_info.chip_class >= GFX10,
|
||||
|
@ -698,8 +707,30 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
|
|||
radv_physical_device_get_supported_extensions(device, &device->vk.supported_extensions);
|
||||
|
||||
#ifndef _WIN32
|
||||
if (drm_device)
|
||||
if (drm_device) {
|
||||
struct stat primary_stat = {0}, render_stat = {0};
|
||||
|
||||
device->available_nodes = drm_device->available_nodes;
|
||||
device->bus_info = *drm_device->businfo.pci;
|
||||
|
||||
if ((drm_device->available_nodes & (1 << DRM_NODE_PRIMARY)) &&
|
||||
stat(drm_device->nodes[DRM_NODE_PRIMARY], &primary_stat) != 0) {
|
||||
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"failed to stat DRM primary node %s",
|
||||
drm_device->nodes[DRM_NODE_PRIMARY]);
|
||||
goto fail_disk_cache;
|
||||
}
|
||||
device->primary_devid = primary_stat.st_rdev;
|
||||
|
||||
if ((drm_device->available_nodes & (1 << DRM_NODE_RENDER)) &&
|
||||
stat(drm_device->nodes[DRM_NODE_RENDER], &render_stat) != 0) {
|
||||
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"failed to stat DRM render node %s",
|
||||
drm_device->nodes[DRM_NODE_RENDER]);
|
||||
goto fail_disk_cache;
|
||||
}
|
||||
device->render_devid = render_stat.st_rdev;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((device->instance->debug_flags & RADV_DEBUG_INFO))
|
||||
|
@ -2308,6 +2339,26 @@ radv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
|
|||
props->minAccelerationStructureScratchOffsetAlignment = 128;
|
||||
break;
|
||||
}
|
||||
#ifndef _WIN32
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT: {
|
||||
VkPhysicalDeviceDrmPropertiesEXT *props = (VkPhysicalDeviceDrmPropertiesEXT *)ext;
|
||||
if (pdevice->available_nodes & (1 << DRM_NODE_PRIMARY)) {
|
||||
props->hasPrimary = true;
|
||||
props->primaryMajor = (int64_t)major(pdevice->primary_devid);
|
||||
props->primaryMinor = (int64_t)minor(pdevice->primary_devid);
|
||||
} else {
|
||||
props->hasPrimary = false;
|
||||
}
|
||||
if (pdevice->available_nodes & (1 << DRM_NODE_RENDER)) {
|
||||
props->hasRender = true;
|
||||
props->renderMajor = (int64_t)major(pdevice->render_devid);
|
||||
props->renderMinor = (int64_t)minor(pdevice->render_devid);
|
||||
} else {
|
||||
props->hasRender = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -304,7 +304,11 @@ struct radv_physical_device {
|
|||
unsigned heaps;
|
||||
|
||||
#ifndef _WIN32
|
||||
int available_nodes;
|
||||
drmPciBusInfo bus_info;
|
||||
|
||||
dev_t primary_devid;
|
||||
dev_t render_devid;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue