Skip to content

Commit

Permalink
issue 126: fix vulkaninfo segfault on 1.0 devices
Browse files Browse the repository at this point in the history
We didn't quite get the check on whether a format can be legally
queried on a particular GPU quite right.  We were checking against
the instance version only.  We need to check agains the driver's
supported API version as well.
  • Loading branch information
lunarpapillo committed Jan 22, 2019
1 parent 927e74e commit 0140238
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vulkaninfo/vulkaninfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1987,8 +1987,10 @@ static struct FormatRange {

// Helper function to determine whether a format range is currently supported.
bool FormatRangeSupported(const struct FormatRange *format_range, const struct AppGpu *gpu) {
// True if standard and supported by this instance
if (format_range->minimum_instance_version > 0 && gpu->inst->instance_version >= format_range->minimum_instance_version) {
// True if standard and supported by both this instance and this GPU
if (format_range->minimum_instance_version > 0 &&
gpu->inst->instance_version >= format_range->minimum_instance_version &&
gpu->props.apiVersion >= format_range->minimum_instance_version) {
return true;
}

Expand Down

6 comments on commit 0140238

@arunsivaramanneo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Commit Broke Linux Vulkaninfo.. getting Segmentation Fault

ERROR: [Loader Message] Code 0 : /usr/lib/i386-linux-gnu/libvulkan_intel.so: wrong ELF class: ELFCLASS32
ERROR: [Loader Message] Code 0 : /usr/lib/i386-linux-gnu/libvulkan_radeon.so: wrong ELF class: ELFCLASS32
Xlib: extension "NV-GLX" missing on display ":0".

VULKANINFO

Vulkan Instance Version: 1.1.97

INTEL-MESA: warning: ../../../src/intel/vulkan/anv_device.c:1239: FINISHME: Implement pop-free point clipping

Instance Extensions:

Instance Extensions count = 17
VK_EXT_acquire_xlib_display : extension revision 1
VK_EXT_debug_report : extension revision 9
VK_EXT_debug_utils : extension revision 1
VK_EXT_direct_mode_display : extension revision 1
VK_EXT_display_surface_counter : extension revision 1
VK_KHR_device_group_creation : extension revision 1
VK_KHR_display : extension revision 21
VK_KHR_external_fence_capabilities : extension revision 1
VK_KHR_external_memory_capabilities : extension revision 1
VK_KHR_external_semaphore_capabilities: extension revision 1
VK_KHR_get_display_properties2 : extension revision 1
VK_KHR_get_physical_device_properties2: extension revision 1
VK_KHR_get_surface_capabilities2 : extension revision 1
VK_KHR_surface : extension revision 25
VK_KHR_wayland_surface : extension revision 6
VK_KHR_xcb_surface : extension revision 6
VK_KHR_xlib_surface : extension revision 6
Layers: count = 3

VK_LAYER_LUNARG_standard_validation (LunarG Standard Validation Layer) Vulkan version 1.0.77, layer version 1
Layer Extensions count = 0
Devices count = 1
GPU id : 0 (Intel(R) HD Graphics 630 (Kaby Lake GT2))
Layer-Device Extensions count = 0

VK_LAYER_VALVE_steam_overlay_32 (Steam Overlay Layer) Vulkan version 1.1.73, layer version 1
Layer Extensions count = 0
Devices count = 1
GPU id : 0 (Intel(R) HD Graphics 630 (Kaby Lake GT2))
Layer-Device Extensions count = 0

VK_LAYER_VALVE_steam_overlay_64 (Steam Overlay Layer) Vulkan version 1.1.73, layer version 1
Layer Extensions count = 0
Devices count = 1
GPU id : 0 (Intel(R) HD Graphics 630 (Kaby Lake GT2))
Layer-Device Extensions count = 0

Presentable Surfaces:

GPU id : 0 (Intel(R) HD Graphics 630 (Kaby Lake GT2))
Surface type : VK_KHR_xcb_surface
Formats: count = 2
B8G8R8A8_SRGB
B8G8R8A8_UNORM
Present Modes: count = 3
IMMEDIATE_KHR
MAILBOX_KHR
FIFO_KHR
VkSurfaceCapabilitiesKHR:
minImageCount = 2
maxImageCount = 0
currentExtent:
width = 256
height = 256
minImageExtent:
width = 256
height = 256
maxImageExtent:
width = 256
height = 256
maxImageArrayLayers = 1
supportedTransform:
VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
currentTransform:
VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
supportedCompositeAlpha:
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
supportedUsageFlags:
VK_IMAGE_USAGE_TRANSFER_SRC_BIT
VK_IMAGE_USAGE_TRANSFER_DST_BIT
VK_IMAGE_USAGE_SAMPLED_BIT
VK_IMAGE_USAGE_STORAGE_BIT
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
VkSurfaceCapabilities2EXT:
supportedSurfaceCounters:
None

GPU id : 0 (Intel(R) HD Graphics 630 (Kaby Lake GT2))
Surface type : VK_KHR_xlib_surface
Formats: count = 2
B8G8R8A8_SRGB
B8G8R8A8_UNORM
Present Modes: count = 3
IMMEDIATE_KHR
MAILBOX_KHR
FIFO_KHR
VkSurfaceCapabilitiesKHR:
minImageCount = 2
maxImageCount = 0
currentExtent:
width = 256
height = 256
minImageExtent:
width = 256
height = 256
maxImageExtent:
width = 256
height = 256
maxImageArrayLayers = 1
supportedTransform:
VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
currentTransform:
VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
supportedCompositeAlpha:
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
supportedUsageFlags:
VK_IMAGE_USAGE_TRANSFER_SRC_BIT
VK_IMAGE_USAGE_TRANSFER_DST_BIT
VK_IMAGE_USAGE_SAMPLED_BIT
VK_IMAGE_USAGE_STORAGE_BIT
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
VkSurfaceCapabilities2EXT:
supportedSurfaceCounters:
None

Groups :

Device Group Properties (Group 0) :
	physicalDeviceCount = 1

		Intel(R) HD Graphics 630 (Kaby Lake GT2) (ID: 0)

	subsetAllocation = 0

Device Group Present Capabilities (Group 0) :

	Intel(R) HD Graphics 630 (Kaby Lake GT2) (ID: 0)
	Can present images from the following devices:
		Intel(R) HD Graphics 630 (Kaby Lake GT2) (ID: 0)

	Present modes:
		VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR

Device Properties and Extensions :

GPU0
VkPhysicalDeviceProperties:

apiVersion     = 0x401060  (1.1.96)
driverVersion  = 75903075 (0x4863063)
vendorID       = 0x8086
deviceID       = 0x591b
deviceType     = INTEGRATED_GPU
deviceName     = Intel(R) HD Graphics 630 (Kaby Lake GT2)
VkPhysicalDeviceLimits:
-----------------------
	maxImageDimension1D                     = 16384
	maxImageDimension2D                     = 16384
	maxImageDimension3D                     = 2048
	maxImageDimensionCube                   = 16384
	maxImageArrayLayers                     = 2048
	maxTexelBufferElements                  = 0x8000000
	maxUniformBufferRange                   = 0x8000000
	maxStorageBufferRange                   = 0x40000000
	maxPushConstantsSize                    = 128
	maxMemoryAllocationCount                = 4294967295
	maxSamplerAllocationCount               = 65536
	bufferImageGranularity                  = 0x40
	sparseAddressSpaceSize                  = 0x0
	maxBoundDescriptorSets                  = 8
	maxPerStageDescriptorSamplers           = 128
	maxPerStageDescriptorUniformBuffers     = 64
	maxPerStageDescriptorStorageBuffers     = 64
	maxPerStageDescriptorSampledImages      = 128
	maxPerStageDescriptorStorageImages      = 64
	maxPerStageDescriptorInputAttachments   = 64
	maxPerStageResources                    = 250
	maxDescriptorSetSamplers                = 768
	maxDescriptorSetUniformBuffers          = 384
	maxDescriptorSetUniformBuffersDynamic   = 8
	maxDescriptorSetStorageBuffers          = 384
	maxDescriptorSetStorageBuffersDynamic   = 8
	maxDescriptorSetSampledImages           = 768
	maxDescriptorSetStorageImages           = 384
	maxDescriptorSetInputAttachments        = 256
	maxVertexInputAttributes                = 28
	maxVertexInputBindings                  = 28
	maxVertexInputAttributeOffset           = 0x7ff
	maxVertexInputBindingStride             = 0x800
	maxVertexOutputComponents               = 128
	maxTessellationGenerationLevel          = 64
	maxTessellationPatchSize                        = 32
	maxTessellationControlPerVertexInputComponents  = 128
	maxTessellationControlPerVertexOutputComponents = 128
	maxTessellationControlPerPatchOutputComponents  = 128
	maxTessellationControlTotalOutputComponents     = 2048
	maxTessellationEvaluationInputComponents        = 128
	maxTessellationEvaluationOutputComponents       = 128
	maxGeometryShaderInvocations            = 32
	maxGeometryInputComponents              = 64
	maxGeometryOutputComponents             = 128
	maxGeometryOutputVertices               = 256
	maxGeometryTotalOutputComponents        = 1024
	maxFragmentInputComponents              = 112
	maxFragmentOutputAttachments            = 8
	maxFragmentDualSrcAttachments           = 1
	maxFragmentCombinedOutputResources      = 8
	maxComputeSharedMemorySize              = 0x8000
	maxComputeWorkGroupCount[0]             = 65535
	maxComputeWorkGroupCount[1]             = 65535
	maxComputeWorkGroupCount[2]             = 65535
	maxComputeWorkGroupInvocations          = 896
	maxComputeWorkGroupSize[0]              = 896
	maxComputeWorkGroupSize[1]              = 896
	maxComputeWorkGroupSize[2]              = 896
	subPixelPrecisionBits                   = 4
	subTexelPrecisionBits                   = 4
	mipmapPrecisionBits                     = 4
	maxDrawIndexedIndexValue                = 4294967295
	maxDrawIndirectCount                    = 4294967295
	maxSamplerLodBias                       = 16.000000
	maxSamplerAnisotropy                    = 16.000000
	maxViewports                            = 16
	maxViewportDimensions[0]                = 16384
	maxViewportDimensions[1]                = 16384
	viewportBoundsRange[0]                  = -32768.000000
	viewportBoundsRange[1]                  =  32767.000000
	viewportSubPixelBits                    = 13
	minMemoryMapAlignment                   = 4096
	minTexelBufferOffsetAlignment           = 0x1
	minUniformBufferOffsetAlignment         = 0x20
	minStorageBufferOffsetAlignment         = 0x4
	minTexelOffset                          =  -8
	maxTexelOffset                          =   7
	minTexelGatherOffset                    = -32
	maxTexelGatherOffset                    =  31
	minInterpolationOffset                  = -0.500000
	maxInterpolationOffset                  =  0.437500
	subPixelInterpolationOffsetBits         = 4
	maxFramebufferWidth                     = 16384
	maxFramebufferHeight                    = 16384
	maxFramebufferLayers                    = 2048
	framebufferColorSampleCounts            = 31
	framebufferDepthSampleCounts            = 31
	framebufferStencilSampleCounts          = 31
	framebufferNoAttachmentsSampleCounts    = 31
	maxColorAttachments                     = 8
	sampledImageColorSampleCounts           = 31
	sampledImageDepthSampleCounts           = 31
	sampledImageStencilSampleCounts         = 31
	sampledImageIntegerSampleCounts         = 1
	storageImageSampleCounts                = 1
	maxSampleMaskWords                      = 1
	timestampComputeAndGraphics             = 0
	timestampPeriod                         = 83.333336
	maxClipDistances                        = 8
	maxCullDistances                        = 8
	maxCombinedClipAndCullDistances         = 8
	discreteQueuePriorities                 = 2
	pointSizeRange[0]                       = 0.125000
	pointSizeRange[1]                       = 255.875000
	lineWidthRange[0]                       = 0.000000
	lineWidthRange[1]                       = 7.992188
	pointSizeGranularity                    = 0.125000
	lineWidthGranularity                    = 0.007812
	strictLines                             = 0
	standardSampleLocations                 = 1
	optimalBufferCopyOffsetAlignment        = 0x80
	optimalBufferCopyRowPitchAlignment      = 0x80
	nonCoherentAtomSize                     = 0x40
VkPhysicalDeviceSparseProperties:
---------------------------------
	residencyStandard2DBlockShape            = 0
	residencyStandard2DMultisampleBlockShape = 0
	residencyStandard3DBlockShape            = 0
	residencyAlignedMipSize                  = 0
	residencyNonResidentStrict               = 0

VkPhysicalDevicePointClippingProperties:

pointClippingBehavior               = 0

VkPhysicalDevicePushDescriptorProperties:

maxPushDescriptors               = 32

VkPhysicalDeviceMultiviewProperties:

maxMultiviewViewCount     = 16
maxMultiviewInstanceIndex = 268435455

VkPhysicalDeviceMaintenance3Properties:

maxPerSetDescriptors    = 1024
maxMemoryAllocationSize = 2147483648

VkPhysicalDeviceIDProperties:

deviceUUID      = 0877374d-04a0-fce6-4ad7-893fa00506c5
driverUUID      = 6a07251f-cccd-e4a8-580f-eefbf8da7e1b
deviceLUIDValid = false

VkPhysicalDeviceDriverProperties:

driverID   = 6
driverName = Intel open-source Mesa driver
driverInfo = Mesa 19.0.0-devel - padoka PPA
conformanceVersion:
	major    = 1
	minor    = 1
	subminor = 2
	patch    = 0

VkPhysicalDevicePCIBusInfoProperties

pciDomain   = 0
pciBus      = 0
pciDevice   = 2
pciFunction = 0

Device Extensions count = 45
VK_EXT_calibrated_timestamps : extension revision 1
VK_EXT_conditional_rendering : extension revision 1
VK_EXT_display_control : extension revision 1
VK_EXT_external_memory_dma_buf : extension revision 1
VK_EXT_global_priority : extension revision 1
VK_EXT_pci_bus_info : extension revision 2
VK_EXT_post_depth_coverage : extension revision 1
VK_EXT_sampler_filter_minmax : extension revision 1
VK_EXT_scalar_block_layout : extension revision 1
VK_EXT_shader_stencil_export : extension revision 1
VK_EXT_shader_viewport_index_layer : extension revision 1
VK_EXT_vertex_attribute_divisor : extension revision 3
VK_GOOGLE_decorate_string : extension revision 1
VK_GOOGLE_hlsl_functionality1 : extension revision 1
VK_KHR_16bit_storage : extension revision 1
VK_KHR_8bit_storage : extension revision 1
VK_KHR_bind_memory2 : extension revision 1
VK_KHR_create_renderpass2 : extension revision 1
VK_KHR_dedicated_allocation : extension revision 1
VK_KHR_depth_stencil_resolve : extension revision 1
VK_KHR_descriptor_update_template : extension revision 1
VK_KHR_device_group : extension revision 1
VK_KHR_draw_indirect_count : extension revision 1
VK_KHR_driver_properties : extension revision 1
VK_KHR_external_fence : extension revision 1
VK_KHR_external_fence_fd : extension revision 1
VK_KHR_external_memory : extension revision 1
VK_KHR_external_memory_fd : extension revision 1
VK_KHR_external_semaphore : extension revision 1
VK_KHR_external_semaphore_fd : extension revision 1
VK_KHR_get_memory_requirements2 : extension revision 1
VK_KHR_image_format_list : extension revision 1
VK_KHR_incremental_present : extension revision 1
VK_KHR_maintenance1 : extension revision 1
VK_KHR_maintenance2 : extension revision 1
VK_KHR_maintenance3 : extension revision 1
VK_KHR_multiview : extension revision 1
VK_KHR_push_descriptor : extension revision 1
VK_KHR_relaxed_block_layout : extension revision 1
VK_KHR_sampler_mirror_clamp_to_edge : extension revision 1
VK_KHR_sampler_ycbcr_conversion : extension revision 1
VK_KHR_shader_draw_parameters : extension revision 1
VK_KHR_storage_buffer_storage_class : extension revision 1
VK_KHR_swapchain : extension revision 68
VK_KHR_variable_pointers : extension revision 1

Segmentation fault (core dumped)

@lunarpapillo
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @arunsivaramanneo -
Can you help me get more information on this segfault, please?

Please start with a clean debuggable build:

rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make

Then run in the debugger:

gdb vulkaninfo
(gdb) r

When the crash appears, get a backtrace:

(gdb) bt

and please post that here.

Thank you for your assistance!

@arunsivaramanneo
Copy link

@arunsivaramanneo arunsivaramanneo commented on 0140238 Jan 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lunarpapillo below is the trace

Thread 1 "vulkaninfo" received signal SIGSEGV, Segmentation fault.
0x00007ffff7bb91ce in xcb_send_request_with_fds64 ()
from /usr/lib/x86_64-linux-gnu/libxcb.so.1
(gdb) bt
#0 0x00007ffff7bb91ce in xcb_send_request_with_fds64 ()
from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#1 0x00007ffff7bb9729 in xcb_send_request ()
from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2 0x00007ffff7bc8054 in xcb_query_extension ()
from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3 0x00007fffed771e8b in ?? ()
from /usr/lib/x86_64-linux-gnu/libvulkan_intel.so
#4 0x00007fffed77261a in ?? ()
from /usr/lib/x86_64-linux-gnu/libvulkan_intel.so
#5 0x00007ffff743c657 in terminator_GetPhysicalDeviceSurfaceSupportKHR (
physicalDevice=0x555555a2c5b0, queueFamilyIndex=0, surface=0x555555b3afc0,
pSupported=0x7fffffffda80)
at /home/neothenoone/Documents/Vulkan/Vulkan-Loader/loader/wsi.c:240
#6 0x00007ffff743c4c7 in vkGetPhysicalDeviceSurfaceSupportKHR (
physicalDevice=0x555555a2c710, queueFamilyIndex=0, surface=0x555555b3afc0,
pSupported=0x7fffffffda80)
at /home/neothenoone/Documents/Vulkan/Vulkan-Loader/loader/wsi.c:206
#7 0x000055555556609a in AppGpuDumpQueueProps ()
#8 0x0000555555567161 in AppGpuDump ()
#9 0x00005555555691c0 in main ()
(gdb)

@lunarpapillo
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arunsivaramanneo Thanks for your help and rapid response.

The stack trace above seems to include a debuggable Vulkan-Loader, but not a debuggable vulkaninfo, as I would have expected to see line numbers and parameters for AppGpuDump() and AppGpuDumpQueueProps(). Could I ask you to ensure that you're using a clean debuggable build of vulkaninfo?

Looking at the code change, the only affected code is in FormatRangeSupported(), which is only called from AppDevDump(), which is the last major function call from AppGpuDump().

But according to the stack trace, the crash is occurring in AppGpuDumpQueueProps(), which is also called from AppGpuDump(), but before AppDevDump() is called.

It would be very unusual for the changed code to be causing a crash even before it gets a chance to execute.

May I ask how you determined that this commit caused the failure? Were you able to do a git bisect to identify the code change decisively, or did you use another means to determine which code change was responsible?

Thanks for your continued help...

@arunsivaramanneo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lunarpapillo Till this Commit vulkaninfo: shorten format dump in console, Vulkaninfo was working fine on my linux machine and i do pull the latest commits everyday. I thought it might be due to Vulkan-Headers or Vulkan-loader not updated but the Pull for both two showed that i had the latest version of Headers and loaders. I even did fresh installation of Vulkan-tools and still vulkaninfo is throwing an error.

@lunarpapillo
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arunsivaramanneo
I'm trying to be certain, as this seems a confusing problem.
Can I ask you to try to build with the commit just before the last change, 927e74e, and make sure the problem doesn't also appear there?

git checkout 927e74e

I'm asking because I notice that commit 3a7c6a8 (two commits ago) introduced the call to vkGetPhysicalDeviceSurfaceSupportKHR that seems to appear in the crash backtrace.

I want to make sure we're looking at the right commit if we're going to debug this problem.

Please sign in to comment.