zink: use maint7 to capture venus driver and more accurately use workarounds
maint7 provides the ability for virtualized drivers to pass along the real driver's info, which allows for the enablement of per-driver workarounds based on the underlying hardware Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29964>
This commit is contained in:

committed by
Marge Bot

parent
7e9d5c7b12
commit
9e37ec9cb6
@@ -407,6 +407,9 @@ struct zink_device_info {
|
||||
%endfor
|
||||
|
||||
VkPhysicalDeviceProperties props;
|
||||
VkPhysicalDeviceProperties vk_layered_props;
|
||||
VkPhysicalDeviceLayeredApiPropertiesKHR layered_props;
|
||||
VkPhysicalDeviceDriverPropertiesKHR vk_layered_driver_props;
|
||||
%for version in versions:
|
||||
VkPhysicalDeviceVulkan${version.struct()}Properties props${version.struct()};
|
||||
%endfor
|
||||
@@ -545,6 +548,7 @@ zink_get_physical_device_info(struct zink_screen *screen)
|
||||
}
|
||||
|
||||
// check for device properties
|
||||
bool copy_layered_props = false;
|
||||
if (screen->vk.GetPhysicalDeviceProperties2) {
|
||||
VkPhysicalDeviceProperties2 props = {0};
|
||||
props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
||||
@@ -590,8 +594,34 @@ zink_get_physical_device_info(struct zink_screen *screen)
|
||||
props.pNext = &info->subgroup;
|
||||
}
|
||||
|
||||
/* set up structs to capture underlying driver info */
|
||||
VkPhysicalDeviceLayeredApiVulkanPropertiesKHR vk_layered_props = {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_API_VULKAN_PROPERTIES_KHR,
|
||||
};
|
||||
vk_layered_props.properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
||||
info->vk_layered_driver_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
|
||||
if (support_KHR_driver_properties || info->have_vulkan12)
|
||||
vk_layered_props.properties.pNext = &info->vk_layered_driver_props;
|
||||
info->layered_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_API_PROPERTIES_KHR;
|
||||
info->layered_props.pNext = &vk_layered_props;
|
||||
VkPhysicalDeviceLayeredApiPropertiesListKHR layered_props_list = {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_API_PROPERTIES_LIST_KHR,
|
||||
props.pNext,
|
||||
1,
|
||||
&info->layered_props
|
||||
};
|
||||
if (support_KHR_maintenance7)
|
||||
props.pNext = &layered_props_list;
|
||||
|
||||
// note: setting up local VkPhysicalDeviceProperties2.
|
||||
screen->vk.GetPhysicalDeviceProperties2(screen->pdev, &props);
|
||||
|
||||
if (support_KHR_maintenance7 && layered_props_list.layeredApiCount) {
|
||||
info->vk_layered_props = vk_layered_props.properties.properties;
|
||||
} else {
|
||||
info->vk_layered_props = info->props;
|
||||
copy_layered_props = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* We re-apply the fields from VkPhysicalDeviceVulkanXYFeatures struct
|
||||
@@ -630,6 +660,9 @@ zink_get_physical_device_info(struct zink_screen *screen)
|
||||
%endif
|
||||
%endfor
|
||||
|
||||
if (copy_layered_props)
|
||||
info->vk_layered_driver_props = info->driver_props;
|
||||
|
||||
// enable the extensions if they match the conditions given by ext.enable_conds
|
||||
if (screen->vk.GetPhysicalDeviceProperties2) {
|
||||
%for ext in extensions:
|
||||
|
@@ -1157,9 +1157,7 @@ zink_get_shader_param(struct pipe_screen *pscreen,
|
||||
* with what we need for GL, so we can still force a conformant value here
|
||||
*/
|
||||
if (zink_driverid(screen) == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA ||
|
||||
zink_driverid(screen) == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS ||
|
||||
(zink_driverid(screen) == VK_DRIVER_ID_MESA_VENUS
|
||||
&& screen->info.props.vendorID == 0x8086))
|
||||
zink_driverid(screen) == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS)
|
||||
return 32;
|
||||
max = screen->info.props.limits.maxFragmentInputComponents / 4;
|
||||
break;
|
||||
@@ -2810,7 +2808,7 @@ static void
|
||||
init_driver_workarounds(struct zink_screen *screen)
|
||||
{
|
||||
/* enable implicit sync for all non-mesa drivers */
|
||||
screen->driver_workarounds.implicit_sync = true;
|
||||
screen->driver_workarounds.implicit_sync = screen->info.driver_props.driverID != VK_DRIVER_ID_MESA_VENUS;
|
||||
switch (zink_driverid(screen)) {
|
||||
case VK_DRIVER_ID_MESA_RADV:
|
||||
case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA:
|
||||
@@ -2818,7 +2816,6 @@ init_driver_workarounds(struct zink_screen *screen)
|
||||
case VK_DRIVER_ID_MESA_TURNIP:
|
||||
case VK_DRIVER_ID_MESA_V3DV:
|
||||
case VK_DRIVER_ID_MESA_PANVK:
|
||||
case VK_DRIVER_ID_MESA_VENUS:
|
||||
screen->driver_workarounds.implicit_sync = false;
|
||||
break;
|
||||
default:
|
||||
@@ -2930,7 +2927,6 @@ init_driver_workarounds(struct zink_screen *screen)
|
||||
case VK_DRIVER_ID_MESA_RADV:
|
||||
case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA:
|
||||
case VK_DRIVER_ID_MESA_LLVMPIPE:
|
||||
case VK_DRIVER_ID_MESA_VENUS:
|
||||
case VK_DRIVER_ID_NVIDIA_PROPRIETARY:
|
||||
case VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS:
|
||||
case VK_DRIVER_ID_IMAGINATION_PROPRIETARY:
|
||||
@@ -2942,7 +2938,6 @@ init_driver_workarounds(struct zink_screen *screen)
|
||||
/* these drivers don't use VK_PIPELINE_CREATE_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT, so it can always be set */
|
||||
switch (zink_driverid(screen)) {
|
||||
case VK_DRIVER_ID_MESA_LLVMPIPE:
|
||||
case VK_DRIVER_ID_MESA_VENUS:
|
||||
case VK_DRIVER_ID_NVIDIA_PROPRIETARY:
|
||||
case VK_DRIVER_ID_IMAGINATION_PROPRIETARY:
|
||||
screen->driver_workarounds.always_feedback_loop_zs = screen->info.have_EXT_attachment_feedback_loop_layout;
|
||||
@@ -3015,7 +3010,6 @@ init_driver_workarounds(struct zink_screen *screen)
|
||||
/* these drivers can successfully do INVALID <-> LINEAR dri3 modifier swap */
|
||||
switch (zink_driverid(screen)) {
|
||||
case VK_DRIVER_ID_MESA_TURNIP:
|
||||
case VK_DRIVER_ID_MESA_VENUS:
|
||||
case VK_DRIVER_ID_MESA_NVK:
|
||||
screen->driver_workarounds.can_do_invalid_linear_modifier = true;
|
||||
break;
|
||||
@@ -3610,7 +3604,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
|
||||
}
|
||||
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_AUTO) {
|
||||
/* descriptor buffer is not performant with virt yet */
|
||||
if (zink_driverid(screen) == VK_DRIVER_ID_MESA_VENUS)
|
||||
if (screen->info.driver_props.driverID == VK_DRIVER_ID_MESA_VENUS)
|
||||
zink_descriptor_mode = ZINK_DESCRIPTOR_MODE_LAZY;
|
||||
else
|
||||
zink_descriptor_mode = can_db ? ZINK_DESCRIPTOR_MODE_DB : ZINK_DESCRIPTOR_MODE_LAZY;
|
||||
|
@@ -133,7 +133,10 @@ zink_create_semaphore(struct zink_screen *screen);
|
||||
static inline VkDriverId
|
||||
zink_driverid(const struct zink_screen *screen)
|
||||
{
|
||||
return screen->info.driver_props.driverID;
|
||||
if (!screen->info.have_KHR_maintenance7 || screen->info.layered_props.layeredAPI != VK_PHYSICAL_DEVICE_LAYERED_API_VULKAN_KHR)
|
||||
return screen->info.driver_props.driverID;
|
||||
/* if maint7 is supported, codegen ensures this will always be the "right" value */
|
||||
return screen->info.vk_layered_driver_props.driverID;
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user