anv: expose primary node to VK_EXT_physical_device_drm even when VK_KHR_display is not enabled

Fixes: e9e1e0362b ("anv: implement VK_EXT_physical_device_drm")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11616>
This commit is contained in:
Ella-0 2021-06-27 19:29:08 +00:00 committed by Marge Bot
parent 24292cc003
commit 86fe8db4aa
2 changed files with 35 additions and 17 deletions

View File

@ -991,6 +991,28 @@ anv_physical_device_try_create(struct anv_instance *instance,
*device_out = device;
struct stat st;
if (stat(primary_path, &st) == 0) {
device->has_master = true;
device->master_major = major(st.st_rdev);
device->master_minor = minor(st.st_rdev);
} else {
device->has_master = false;
device->master_major = 0;
device->master_minor = 0;
}
if (stat(path, &st) == 0) {
device->has_local = true;
device->local_major = major(st.st_rdev);
device->local_minor = minor(st.st_rdev);
} else {
device->has_local = false;
device->local_major = 0;
device->local_minor = 0;
}
return VK_SUCCESS;
fail_engine_info:
@ -2351,25 +2373,15 @@ void anv_GetPhysicalDeviceProperties2(
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->hasPrimary = pdevice->has_master;
props->primaryMajor = pdevice->master_major;
props->primaryMinor = pdevice->master_minor;
props->hasRender = pdevice->has_local;
props->renderMajor = pdevice->local_major;
props->renderMinor = pdevice->local_minor;
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;
}

View File

@ -988,7 +988,13 @@ struct anv_physical_device {
struct wsi_device wsi_device;
int local_fd;
bool has_local;
int64_t local_major;
int64_t local_minor;
int master_fd;
bool has_master;
int64_t master_major;
int64_t master_minor;
struct drm_i915_query_engine_info * engine_info;
void (*cmd_emit_timestamp)(struct anv_batch *, struct anv_bo *, uint32_t );