Bug 102955 - HyperZ related rendering issue in ARK: Survival Evolved
Summary: HyperZ related rendering issue in ARK: Survival Evolved
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/radeonsi (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-23 23:25 UTC by Elliot Thomas
Modified: 2019-09-25 18:00 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
The back buffer of apitrace frame 1017, showing red lines along what looks like primitive edges. (1.13 MB, image/png)
2017-09-23 23:25 UTC, Elliot Thomas
Details
glxinfo.log (101.84 KB, text/plain)
2017-09-23 23:32 UTC, Elliot Thomas
Details

Description Elliot Thomas 2017-09-23 23:25:05 UTC
Created attachment 134449 [details]
The back buffer of apitrace frame 1017, showing red lines along what looks like primitive edges.

Hi,

I've been poking "ARK: Survival Evolved", trying to get it playable.
The game is notoriously buggy, particularly under Linux, however the biggest issue I've had seems to be a Mesa/Radeon bug.

Blocky "pixelated" lines are drawn across what look like edges (see attached). These lines are most frequently red, black or cyan in colour, and seem to disappear when the scene complexity is lower (like when looking at the floor or an area with no foliage or rocks).

Setting R600_DEBUG=nohyperz resolves the issue.

I've tested an apitrace of the game on both Mesa git, and 17.2.1 on a desktop with a POLARIS10 (RX580 8GiB), running the latest amd-staging-drm-next kernel, and on a laptop with both Intel integrated graphics and a HAINAN (Sun XT? 8670M), running a stock Archlinux kernel.

Both AMD cards have this rendering issue with HyperZ enabled. The Intel card renders without this particular problem (if slowly), and llvmpipe (eventually) renders without issue too.

Apitrace (~600MiB!):
https://drive.google.com/open?id=0B6RX1ZACoaJ5UmhDWDM3ZC03eUk


Desktop:
Linux 4.13.0-rc5-43dd6fde5df4 #3 SMP PREEMPT Thu Sep 21 19:15:33 BST 2017 x86_64 GNU/Linux
Mesa 17.3.0-devel (git hash #52ed3bca91ff13217378196d6800ca7113641a63)
libdrm 2.4.83, LLVM 5.0.0

Laptop:
Linux 4.12.13-1-ARCH #1 SMP PREEMPT Fri Sep 15 06:36:43 UTC 2017 x86_64 GNU/Linux
Mesa 1.7.12,
libdrm 2.4.83, LLVM 5.0.0


The corruption does look somewhat like that of this bug, but applied to terrain as well. https://bugs.freedesktop.org/show_bug.cgi?id=74784
Comment 1 Elliot Thomas 2017-09-23 23:32:15 UTC
Created attachment 134450 [details]
glxinfo.log

Oh, should have probably mentioned X versions and such.
* Xorg 1.19.3
* xf86-video-amdgpu 1.4.0

Added glxinfo output.
Comment 2 Christian Lanig 2017-10-01 07:13:21 UTC
I confirm this issue and that R600_DEBUG=nohyperz does fix it.

Thanks to Elliot Thomas for finding a temporary solution.
Comment 3 Marek Olšák 2017-10-02 16:01:05 UTC
Workaround:

diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index 67972a2..dc71742 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -903,6 +903,14 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers,
                        sctx->db_stencil_clear = true;
                        si_mark_atom_dirty(sctx, &sctx->db_render_state);
                }
+
+               /* TODO: Find out what's wrong here. Fast depth clear with
+                * a dirty DB cache causes corruption in ARK: Survival Evolved.
+                * https://bugs.freedesktop.org/show_bug.cgi?id=102955
+                *
+                * This hack massively decreases back-to-back ClearDepth performance.
+                */
+               sctx->b.flags |= SI_CONTEXT_FLUSH_AND_INV_DB;
        }
 
        si_blitter_begin(ctx, SI_CLEAR);
Comment 4 Elliot Thomas 2017-10-03 21:31:27 UTC
I can confirm Marek's workaround works.

For what it's worth, I couldn't really measure a difference in performance between the explicit DB flush/invalidation patch and using R600_DEBUG=nohyperz.
Comment 5 Samuel Pitoiset 2017-10-06 08:19:26 UTC
Should be "fixed" with c4d1a199f8379b3982a53fb18fe2b50fafd682df.
Comment 6 Elliot Thomas 2017-10-10 21:51:37 UTC
The DB metadata flush workaround is broken as of mesa git 69ccb9dae7616038dd54d3833da9e7c68e28067d, "radeonsi: use new VS blit shaders (VS inputs in SGPRs)".

The R600_DEBUG=nohyperz workaround still works.
Comment 7 Samuel Pitoiset 2017-10-27 08:50:53 UTC
Should be fixed with dd79aa4ad30df205076be25f6bbf42768abea20a.
Comment 8 noel.kuntze+freedesktop 2019-07-21 18:17:42 UTC
Broken again in at latest 19.1.2.
Comment 9 GitLab Migration User 2019-09-25 18:00:22 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1283.


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.