Bug 105506 - Vulkan MSAA is broken on SI
Summary: Vulkan MSAA is broken on SI
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: git
Hardware: All All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-14 14:49 UTC by Turo Lamminen
Modified: 2018-03-16 14:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Screenshot (73.75 KB, image/png)
2018-03-14 14:49 UTC, Turo Lamminen
Details
vulkaninfo output (99.62 KB, text/x-log)
2018-03-14 14:50 UTC, Turo Lamminen
Details
dmesg output (50.65 KB, text/x-log)
2018-03-14 14:50 UTC, Turo Lamminen
Details
vktrace trace (7.75 MB, application/octet-stream)
2018-03-14 14:59 UTC, Turo Lamminen
Details
vktrace trace from the fixed app (2.81 MB, application/gzip)
2018-03-15 13:19 UTC, Turo Lamminen
Details

Description Turo Lamminen 2018-03-14 14:49:56 UTC
Created attachment 138105 [details]
Screenshot

MSAA is broken on Vulkan with SI card (Pitcairn) causing graphical artefacts. All MSAA modes are affected. OpenGL works. The same code works on Windows with AMD's driver and on Nvidia GPU with their proprietary drivers. No warnings from Vulkan validation layers. Broken versions are 17.3.6 (Debian package), 18.0.0rc4 (likewise) and master fcf267ba087dd00c48ceaf9277424dac079f9319 (self-built, with LLVM 6.0). Kernel is 4.14.17 from Debian testing.

The test program is here:
https://github.com/turol/smaaDemo
Use command line parameters "-m msaa -q 8" to get directly to the broken effect.

#103999 is possibly related but I'm using RGBA8srgb instead of RG32F.
Comment 1 Turo Lamminen 2018-03-14 14:50:25 UTC
Created attachment 138106 [details]
vulkaninfo output
Comment 2 Turo Lamminen 2018-03-14 14:50:41 UTC
Created attachment 138107 [details]
dmesg output
Comment 3 Turo Lamminen 2018-03-14 14:59:19 UTC
Created attachment 138108 [details]
vktrace trace
Comment 4 Bas Nieuwenhuizen 2018-03-14 20:18:53 UTC
As discussed on #dri-devel, the example application contains several layout issues such as

1) using UNDEFINED as the source layout for the vkCmdResolveImage.
2) using UNDEFINED as the initial layout for the second renderpass when you want to preserve contents.

These caused issues with MSAA on a Vega. I am not completely certain that fixing these will fix SI. Please fix these and then take a look in renderdoc on where it is going wrong.

If you still suspect the driver after that we can take another look.
Comment 5 Jason Ekstrand 2018-03-14 20:41:49 UTC
I recommend you file a bug against the validation layers as at least the first of the two comments Bas made should be invalid.  The second is valid but does not do what you want.
Comment 6 Turo Lamminen 2018-03-15 13:13:58 UTC
Looks like there's already a validation layer issue about this: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/1656. I added my report there.

The bad layouts were caused by a bug in the program where it failed to correctly track the current layout. I fixed this but the artifacts still occur so reopening.

If debugging in RenderDoc you can pass "--trace" command line parameter and smaaDemo will set readable names for the various objects. Whether this helps or not is of course up to preference.
Comment 7 Turo Lamminen 2018-03-15 13:19:51 UTC
Created attachment 138130 [details]
vktrace trace from the fixed app
Comment 8 Turo Lamminen 2018-03-16 14:05:06 UTC
Looks like this might have been my bug after all.

I was specifying subpass dependencies with separate VkSubpassDependency for color and depthstencil attachments but the same srcSubPass and dstSubPass. The idea was that the driver would be able to use finer-grained barriers if it wanted. The other drivers treated these as union of dependencies, radv was only taking the last one and missing some color writes. ORing everything together makes this work.

In case my explanation was unclear here is the fix: https://github.com/turol/smaaDemo/commit/34a79f076ebab7a661d8705c4adcb2d5b3258281

The Vulkan spec doesn't seem clear on whether this is allowed or not. I think in theory it would be useful to specify for example that depth test/write can proceed differently from color write.


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.