Bug 108245 - RADV/Vega: Low mip levels of large BCn textures get corrupted by vkCmdCopyBufferToImage
Summary: RADV/Vega: Low mip levels of large BCn textures get corrupted by vkCmdCopyBuf...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-04 16:33 UTC by Alex Smith
Modified: 2018-11-27 09:22 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Test case (56.06 KB, application/gzip)
2018-10-04 16:33 UTC, Alex Smith
Details
Screenshot from the test case (4.23 KB, image/png)
2018-10-04 16:34 UTC, Alex Smith
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Smith 2018-10-04 16:33:55 UTC
Created attachment 141899 [details]
Test case

On Vega, the lowest mip levels (with at least one dimension smaller than the block size) of large block compressed textures can get corrupted when data is copied to them with vkCmdCopyBufferToImage(). It seems as though it only affects textures with non-power-of-two size, and also doesn't occur on smaller textures (1024x3072 is affected but 32x96 is not).

The attached test case creates a 1024x3072 BC1_SRGB texture, with a complete mip chain, and then uses vkCmdCopyBufferToImage() to initialise each mip level with zero data. It then draws a quad sampling from mip level 9 (2x6) of that texture. This should render black, but instead it usually renders garbage (for example see the attached screenshot). Sometimes, though, it does correctly render black.

If a RenderDoc capture is taken you can see that mip levels 9 to 12 are all corrupted.

Reproduces on Vega 64 with Mesa git 5f0567a4f6 and 18.2, with LLVM 7.0. Doesn't occur on non-Vega cards, or on AMDVLK.
Comment 1 Alex Smith 2018-10-04 16:34:23 UTC
Created attachment 141900 [details]
Screenshot from the test case
Comment 2 Alex Smith 2018-10-10 07:34:57 UTC
This also seems to be sometimes causing VM faults - I get a bunch of faults in the game that's affected by this bug, which go away if I skip vkCmdCopyBufferToImage calls which would get corrupted.
Comment 3 Samuel Pitoiset 2018-10-10 09:00:33 UTC
I can confirm that vega fails. I will try to look at it today.
Comment 4 Alex Smith 2018-10-30 09:38:47 UTC
Were you able to look at this at all?
Comment 5 Samuel Pitoiset 2018-10-30 10:13:48 UTC
Not yet sorry, I will let you know.
Comment 6 Bas Nieuwenhuizen 2018-11-24 22:33:14 UTC
https://patchwork.freedesktop.org/patch/263716/ fixes the testcase (and hopefully does not regress anything else)


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.