Bug 110999 - 19.1.0: assert in vkAllocateDescriptorSets using immutable samplers on Ivy Bridge
Summary: 19.1.0: assert in vkAllocateDescriptorSets using immutable samplers on Ivy Br...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/intel (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-25 19:04 UTC by sjb
Modified: 2019-06-25 19:53 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description sjb 2019-06-25 19:04:29 UTC
Hi,

I've got what looks like a regression moving from 19.0.6 -> 19.1.0 running the intel vulkan driver on IvyBridge.  It seems that calling vkAllocateDescriptorSets with a COMBINED_IMAGE_SAMPLER that uses an immutable sampler causes a segfault.

I can reproduce this as an assert using a debug build from git today (8ea7ee153649ac07c8418cc0d4aa5a4e123d19d1), here is the top of the callstack:

#0  0x00007ffff7bd9755 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff7bc4851 in abort () from /usr/lib/libc.so.6
#2  0x00007ffff7bc4727 in __assert_fail_base.cold () from /usr/lib/libc.so.6
#3  0x00007ffff7bd2026 in __assert_fail () from /usr/lib/libc.so.6
#4  0x00007ffff72f233a in anv_descriptor_set_write_image_view (device=0x5555561e9880, set=0x55555621a668, 
    info=0x7fffffff8740, type=VK_DESCRIPTOR_TYPE_SAMPLER, binding=0, element=0)
    at ../src/intel/vulkan/anv_descriptor_set.c:1203
#5  0x00007ffff72f16f9 in anv_descriptor_set_create (device=0x5555561e9880, pool=0x55555621a5d0, 
    layout=0x5555561220a0, out_set=0x7fffffff87c8) at ../src/intel/vulkan/anv_descriptor_set.c:971
#6  0x00007ffff72f19c8 in anv_AllocateDescriptorSets (_device=0x5555561e9880, pAllocateInfo=0x7fffffff9a58, 
    pDescriptorSets=0x7fffffff8900) at ../src/intel/vulkan/anv_descriptor_set.c:1030

It seems that anv_descriptor_set_create() calls anv_descriptor_set_write_image_view() to set up some stuff from the immutable sampler, but due to recent changes anv_descriptor_set_write_image_view() assumes that a layout that has the ANV_DESCRIPTOR_TEXTURE_SWIZZLE bit set always has a non-null image_view (which we do not since we are only creating the descriptor set at this stage).

If I patch the ANV_DESCRIPTOR_TEXTURE_SWIZZLE block at the end of anv_descriptor_set_write_image_view() to only update the swizzle descriptors if there is a non-null image_view, then my app goes back to running as expected.  I do not know if this is the correct fix for this issue though!
Comment 1 Jason Ekstrand 2019-06-25 19:29:57 UTC
Can you give this MR a try:

https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1181
Comment 2 sjb 2019-06-25 19:36:05 UTC
Yep that MR is the same change that I tried locally, this seems to fix the issue for me.
Comment 3 Jason Ekstrand 2019-06-25 19:43:54 UTC
Cool.  Merged.
Comment 4 sjb 2019-06-25 19:51:54 UTC
Thanks for the extremely fast fix!
Comment 5 Jason Ekstrand 2019-06-25 19:53:20 UTC
Thanks for doing all the debugging work for me.  Maybe next time, you should just make the MR since you already wrote the same patch.  It's pretty easy to do.  :-)


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.