mirror of https://gitlab.freedesktop.org/mesa/mesa
venus: directly use vk drm and pci props in renderer info
We don't have to fill sType or pNext, and the default renderer info has been zero-init already. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Tested-by: Oskar Viljasaar <oskar.viljasaar@gmail.com> Reviewed-by: Oskar Viljasaar <oskar.viljasaar@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29180>
This commit is contained in:
parent
b1e2293f8c
commit
0197924d63
|
@ -1843,36 +1843,21 @@ vn_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
|
|||
/* clang-format on */
|
||||
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT: {
|
||||
VkPhysicalDeviceDrmPropertiesEXT *out_props = (void *)out;
|
||||
const struct vn_renderer_info *info =
|
||||
&physical_dev->instance->renderer->info;
|
||||
|
||||
out_props->hasPrimary = info->drm.has_primary;
|
||||
out_props->primaryMajor = info->drm.primary_major;
|
||||
out_props->primaryMinor = info->drm.primary_minor;
|
||||
out_props->hasRender = info->drm.has_render;
|
||||
out_props->renderMajor = info->drm.render_major;
|
||||
out_props->renderMinor = info->drm.render_minor;
|
||||
const VkPhysicalDeviceDrmPropertiesEXT *drm =
|
||||
&physical_dev->instance->renderer->info.drm.props;
|
||||
vk_copy_struct_guts(out, (VkBaseInStructure *)drm, sizeof(*drm));
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT:
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT: {
|
||||
/* this is used by WSI */
|
||||
if (physical_dev->instance->renderer->info.pci.has_bus_info) {
|
||||
VkPhysicalDevicePCIBusInfoPropertiesEXT *out_props = (void *)out;
|
||||
const struct vn_renderer_info *info =
|
||||
&physical_dev->instance->renderer->info;
|
||||
|
||||
out_props->pciDomain = info->pci.domain;
|
||||
out_props->pciBus = info->pci.bus;
|
||||
out_props->pciDevice = info->pci.device;
|
||||
out_props->pciFunction = info->pci.function;
|
||||
} else {
|
||||
assert(VN_DEBUG(VTEST));
|
||||
vk_copy_struct_guts(out,
|
||||
(VkBaseInStructure *)&in_props->pci_bus_info,
|
||||
sizeof(in_props->pci_bus_info));
|
||||
}
|
||||
const struct vn_renderer_info *info =
|
||||
&physical_dev->instance->renderer->info;
|
||||
const VkPhysicalDevicePCIBusInfoPropertiesEXT *pci =
|
||||
info->pci.has_bus_info ? &info->pci.props
|
||||
: &in_props->pci_bus_info;
|
||||
vk_copy_struct_guts(out, (VkBaseInStructure *)pci, sizeof(*pci));
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: {
|
||||
VkPhysicalDevicePresentationPropertiesANDROID *out_props =
|
||||
(void *)out;
|
||||
|
|
|
@ -42,12 +42,7 @@ struct vn_renderer_sync {
|
|||
|
||||
struct vn_renderer_info {
|
||||
struct {
|
||||
bool has_primary;
|
||||
int primary_major;
|
||||
int primary_minor;
|
||||
bool has_render;
|
||||
int render_major;
|
||||
int render_minor;
|
||||
VkPhysicalDeviceDrmPropertiesEXT props;
|
||||
} drm;
|
||||
|
||||
struct {
|
||||
|
@ -55,10 +50,7 @@ struct vn_renderer_info {
|
|||
uint16_t device_id;
|
||||
|
||||
bool has_bus_info;
|
||||
uint16_t domain;
|
||||
uint8_t bus;
|
||||
uint8_t device;
|
||||
uint8_t function;
|
||||
VkPhysicalDevicePCIBusInfoPropertiesEXT props;
|
||||
} pci;
|
||||
|
||||
bool has_dma_buf_import;
|
||||
|
|
|
@ -1348,24 +1348,26 @@ virtgpu_init_renderer_info(struct virtgpu *gpu)
|
|||
{
|
||||
struct vn_renderer_info *info = &gpu->base.info;
|
||||
|
||||
info->drm.has_primary = gpu->has_primary;
|
||||
info->drm.primary_major = gpu->primary_major;
|
||||
info->drm.primary_minor = gpu->primary_minor;
|
||||
info->drm.has_render = true;
|
||||
info->drm.render_major = gpu->render_major;
|
||||
info->drm.render_minor = gpu->render_minor;
|
||||
info->drm.props = (VkPhysicalDeviceDrmPropertiesEXT){
|
||||
.hasPrimary = gpu->has_primary,
|
||||
.hasRender = true,
|
||||
.primaryMajor = gpu->primary_major,
|
||||
.primaryMinor = gpu->primary_minor,
|
||||
.renderMajor = gpu->render_major,
|
||||
.renderMinor = gpu->render_minor,
|
||||
};
|
||||
|
||||
info->pci.vendor_id = VIRTGPU_PCI_VENDOR_ID;
|
||||
info->pci.device_id = VIRTGPU_PCI_DEVICE_ID;
|
||||
|
||||
if (gpu->bustype == DRM_BUS_PCI) {
|
||||
info->pci.has_bus_info = true;
|
||||
info->pci.domain = gpu->pci_bus_info.domain;
|
||||
info->pci.bus = gpu->pci_bus_info.bus;
|
||||
info->pci.device = gpu->pci_bus_info.dev;
|
||||
info->pci.function = gpu->pci_bus_info.func;
|
||||
} else {
|
||||
info->pci.has_bus_info = false;
|
||||
info->pci.props = (VkPhysicalDevicePCIBusInfoPropertiesEXT){
|
||||
.pciDomain = gpu->pci_bus_info.domain,
|
||||
.pciBus = gpu->pci_bus_info.bus,
|
||||
.pciDevice = gpu->pci_bus_info.dev,
|
||||
.pciFunction = gpu->pci_bus_info.func,
|
||||
};
|
||||
}
|
||||
|
||||
info->has_dma_buf_import = true;
|
||||
|
|
|
@ -925,13 +925,6 @@ vtest_init_renderer_info(struct vtest *vtest)
|
|||
{
|
||||
struct vn_renderer_info *info = &vtest->base.info;
|
||||
|
||||
info->drm.has_primary = false;
|
||||
info->drm.primary_major = 0;
|
||||
info->drm.primary_minor = 0;
|
||||
info->drm.has_render = false;
|
||||
info->drm.render_major = 0;
|
||||
info->drm.render_minor = 0;
|
||||
|
||||
info->pci.vendor_id = VTEST_PCI_VENDOR_ID;
|
||||
info->pci.device_id = VTEST_PCI_DEVICE_ID;
|
||||
|
||||
|
|
Loading…
Reference in New Issue