Commit 935a70ba authored by Lionel Landwerlin's avatar Lionel Landwerlin
Browse files

anv: implement VK_EXT_physical_device_drm


Signed-off-by: Lionel Landwerlin's avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
parent b2034d6a
Pipeline #259966 waiting for manual action with stages
in 9 seconds
......@@ -24,7 +24,9 @@
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <sys/sysmacros.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include "drm-uapi/drm_fourcc.h"
......@@ -550,6 +552,24 @@ anv_physical_device_try_create(struct anv_instance *instance,
}
device->master_fd = master_fd;
struct stat st;
if (stat(path, &st) != 0) {
result = vk_errorfi(instance, NULL, VK_ERROR_INITIALIZATION_FAILED,
"failed to stat DRM node %s", path);
goto fail_disk_cache;
}
device->local_node[0] = (int64_t) major(st.st_rdev);
device->local_node[1] = (int64_t) minor(st.st_rdev);
if (master_fd != -1) {
if (stat(primary_path, &st) != 0) {
result = vk_errorfi(instance, NULL, VK_ERROR_INITIALIZATION_FAILED,
"failed to stat DRM node %s", primary_path);
goto fail_disk_cache;
}
device->master_node[0] = (int64_t) major(st.st_rdev);
device->master_node[1] = (int64_t) minor(st.st_rdev);
}
result = anv_init_wsi(device);
if (result != VK_SUCCESS)
goto fail_disk_cache;
......@@ -1899,6 +1919,22 @@ void anv_GetPhysicalDeviceProperties2(
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT: {
VkPhysicalDeviceDrmPropertiesEXT *props =
(VkPhysicalDeviceDrmPropertiesEXT *)ext;
if (pdevice->master_fd != -1) {
props->hasPrimary = true;
props->primaryMajor = pdevice->master_node[0];
props->primaryMinor = pdevice->master_node[1];
} else {
props->hasPrimary = false;
}
props->hasRender = true;
props->renderMajor = pdevice->local_node[0];
props->renderMinor = pdevice->local_node[1];
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT: {
VkPhysicalDeviceExternalMemoryHostPropertiesEXT *props =
(VkPhysicalDeviceExternalMemoryHostPropertiesEXT *) ext;
......
......@@ -148,6 +148,7 @@ EXTENSIONS = [
Extension('VK_EXT_line_rasterization', 1, True),
Extension('VK_EXT_memory_budget', 1, 'device->has_mem_available'),
Extension('VK_EXT_pci_bus_info', 2, True),
Extension('VK_EXT_physical_device_drm', 1, True),
Extension('VK_EXT_pipeline_creation_cache_control', 3, True),
Extension('VK_EXT_pipeline_creation_feedback', 1, True),
Extension('VK_EXT_post_depth_coverage', 1, 'device->info.gen >= 9'),
......
......@@ -30,6 +30,7 @@
#include <pthread.h>
#include <assert.h>
#include <stdint.h>
#include "drm-uapi/i915_drm.h"
#ifdef HAVE_VALGRIND
......@@ -1145,6 +1146,12 @@ struct anv_physical_device {
struct wsi_device wsi_device;
int local_fd;
int master_fd;
/**
* Major & minor DRM numbers.
*/
int64_t local_node[2];
int64_t master_node[2];
};
struct anv_app_info {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment