anv: implement VK_EXT_physical_device_drm
v2: add docs update error messages (Sagar) v3: Use fstat() (Jason) v4: Do fstat() on demand (Jason) v5: clear major/minor values if not present (Jason) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8649>
This commit is contained in:
parent
6a2e3d2736
commit
e9e1e0362b
|
@ -533,6 +533,7 @@ Khronos extensions that are not part of any Vulkan version:
|
||||||
VK_EXT_memory_budget DONE (anv, radv, tu)
|
VK_EXT_memory_budget DONE (anv, radv, tu)
|
||||||
VK_EXT_memory_priority DONE (radv)
|
VK_EXT_memory_priority DONE (radv)
|
||||||
VK_EXT_pci_bus_info DONE (anv, radv)
|
VK_EXT_pci_bus_info DONE (anv, radv)
|
||||||
|
VK_EXT_physical_device_drm DONE (anv)
|
||||||
VK_EXT_pipeline_creation_cache_control DONE (anv, radv)
|
VK_EXT_pipeline_creation_cache_control DONE (anv, radv)
|
||||||
VK_EXT_pipeline_creation_feedback DONE (anv, radv)
|
VK_EXT_pipeline_creation_feedback DONE (anv, radv)
|
||||||
VK_EXT_post_depth_coverage DONE (anv/gfx10+, lvp, radv)
|
VK_EXT_post_depth_coverage DONE (anv/gfx10+, lvp, radv)
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "drm-uapi/drm_fourcc.h"
|
#include "drm-uapi/drm_fourcc.h"
|
||||||
|
@ -281,6 +283,7 @@ get_device_extensions(const struct anv_physical_device *device,
|
||||||
.EXT_line_rasterization = true,
|
.EXT_line_rasterization = true,
|
||||||
.EXT_memory_budget = device->has_mem_available,
|
.EXT_memory_budget = device->has_mem_available,
|
||||||
.EXT_pci_bus_info = true,
|
.EXT_pci_bus_info = true,
|
||||||
|
.EXT_physical_device_drm = true,
|
||||||
.EXT_pipeline_creation_cache_control = true,
|
.EXT_pipeline_creation_cache_control = true,
|
||||||
.EXT_pipeline_creation_feedback = true,
|
.EXT_pipeline_creation_feedback = true,
|
||||||
.EXT_post_depth_coverage = device->info.ver >= 9,
|
.EXT_post_depth_coverage = device->info.ver >= 9,
|
||||||
|
@ -2248,6 +2251,31 @@ void anv_GetPhysicalDeviceProperties2(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT: {
|
||||||
|
VkPhysicalDeviceDrmPropertiesEXT *props =
|
||||||
|
(VkPhysicalDeviceDrmPropertiesEXT *)ext;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
props->hasPrimary = fstat(pdevice->master_fd, &st) == 0;
|
||||||
|
if (props->hasPrimary) {
|
||||||
|
props->primaryMajor = (int64_t) major(st.st_rdev);
|
||||||
|
props->primaryMinor = (int64_t) minor(st.st_rdev);
|
||||||
|
} else {
|
||||||
|
props->primaryMajor = 0;
|
||||||
|
props->primaryMinor = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
props->hasRender = fstat(pdevice->local_fd, &st) == 0;
|
||||||
|
if (props->hasRender) {
|
||||||
|
props->renderMajor = (int64_t) major(st.st_rdev);
|
||||||
|
props->renderMinor = (int64_t) minor(st.st_rdev);
|
||||||
|
} else {
|
||||||
|
props->renderMajor = 0;
|
||||||
|
props->renderMinor = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT: {
|
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT: {
|
||||||
VkPhysicalDeviceExternalMemoryHostPropertiesEXT *props =
|
VkPhysicalDeviceExternalMemoryHostPropertiesEXT *props =
|
||||||
(VkPhysicalDeviceExternalMemoryHostPropertiesEXT *) ext;
|
(VkPhysicalDeviceExternalMemoryHostPropertiesEXT *) ext;
|
||||||
|
|
Loading…
Reference in New Issue