Bug 101956 - segfault when calling vkGetPhysicalDeviceFormatProperties with VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG
Summary: segfault when calling vkGetPhysicalDeviceFormatProperties with VK_FORMAT_PVRT...
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/intel (show other bugs)
Version: 17.1
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
Depends on:
Reported: 2017-07-27 20:10 UTC by Mike Schuchardt
Modified: 2017-08-04 02:52 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Patch to try (2.21 KB, patch)
2017-07-27 22:06 UTC, Jason Ekstrand
Details | Splinter Review

Description Mike Schuchardt 2017-07-27 20:10:14 UTC
Steps to reproduce:

Call vkGetPhysicalDeviceFormatProperties with format parameter of VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG.

The latest version of vulkaninfo from https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers does this.

Actual Results:

Segmentation fault

Expected Results:

vkGetPhysicalDeviceFormatProperties should populate pFormatProperties indicating no support for the VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG image format
Comment 1 Jason Ekstrand 2017-07-27 22:06:24 UTC
Created attachment 133083 [details] [review]
Patch to try

Is it even valid to pass VK_FORMAT_PVRT1_2BPP_UNORM_BLOCK_IMG into the driver if it doesn't support the relevant extension?  I guess if it's a device extension, we wouldn't be able to rely on that for a PhysicalDevice query.  I've attached a driver patch that should make us handle it correctly anyway.  Mind giving it a try?
Comment 2 Mike Schuchardt 2017-07-28 17:28:02 UTC
This patch fixes the reported issue.

After more consideration I'm not sure this is a valid use case because of the documented interaction between physical-device-level extension functionality and device extensions.

From the spec 31.2.1, last paragraph:
In order to avoid using an instance extension, which often requires loader support, the VK_KHR_get_physical_device_properties2 extension allows physical-device-level extension functionality to be implemented within device extensions (which must depend on the VK_KHR_get_physical_device_properties2 extension).

It is further muddled by the fact that VK_IMG_format_pvrtc predates VK_KHR_get_physical_device_properties2, but I believe the intent is the same.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.