Re: [Mesa-dev] [PATCH v2] radeonsi: update hack for HTILE corruption in ARK: Survival Evolved

2017-10-27 Thread Samuel Pitoiset

Pushed with "clear_db_cache_before_clear", Thanks Marek.

On 10/26/2017 10:42 PM, Marek Olšák wrote:

Please "clear_db_cache_before_clear" and the option too. With that,
the patch is:

Reviewed-by: Marek Olšák 

Thanks,
Marek

On Thu, Oct 26, 2017 at 6:08 PM, Samuel Pitoiset
 wrote:

It appears that flushing the DB metadata is actually not sufficient
since the driver uses the new VS blit shaders. This looks quite
strange though, but it seems like we need to flush DB for fixing
the corruption.

v2: rename the drirc option

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102955
Fixes: 69ccb9dae7 (radeonsi: use new VS blit shaders (VS inputs in SGPRs)
Signed-off-by: Samuel Pitoiset 
---
  src/gallium/drivers/radeonsi/driinfo_radeonsi.h |  2 +-
  src/gallium/drivers/radeonsi/si_blit.c  | 10 +-
  src/gallium/drivers/radeonsi/si_pipe.c  |  4 ++--
  src/gallium/drivers/radeonsi/si_pipe.h  |  2 +-
  src/util/drirc  |  2 +-
  src/util/xmlpool/t_options.h|  6 +++---
  6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/driinfo_radeonsi.h 
b/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
index 402d3406d4..ef264b7d5e 100644
--- a/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
+++ b/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
@@ -6,5 +6,5 @@ DRI_CONF_SECTION_PERFORMANCE
  DRI_CONF_SECTION_END

  DRI_CONF_SECTION_DEBUG
-   DRI_CONF_RADEONSI_CLEAR_DB_META_BEFORE_CLEAR("false")
+   DRI_CONF_RADEONSI_CLEAR_DB_BEFORE_CLEAR("false")
  DRI_CONF_SECTION_END
diff --git a/src/gallium/drivers/radeonsi/si_blit.c 
b/src/gallium/drivers/radeonsi/si_blit.c
index fd8559ac98..ce1b5a3e1a 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -901,16 +901,16 @@ static void si_clear(struct pipe_context *ctx, unsigned 
buffers,
  * corruption in ARK: Survival Evolved, but that may just be
  * a coincidence and the root cause is elsewhere.
  *
-* The corruption can be fixed by putting the DB metadata flush
-* before or after the depth clear. (suprisingly)
+* The corruption can be fixed by putting the DB flush before
+* or after the depth clear. (surprisingly)
  *
  * https://bugs.freedesktop.org/show_bug.cgi?id=102955 
(apitrace)
  *
  * This hack decreases back-to-back ClearDepth performance.
  */
-   if (sctx->screen->clear_db_meta_before_clear)
-   sctx->b.flags |= SI_CONTEXT_FLUSH_AND_INV_DB_META |
-SI_CONTEXT_PS_PARTIAL_FLUSH;
+   if (sctx->screen->clear_db_before_clear) {
+   sctx->b.flags |= SI_CONTEXT_FLUSH_AND_INV_DB;
+   }
 }

 si_blitter_begin(ctx, SI_CLEAR);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index 759d539471..21266611c7 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -1072,8 +1072,8 @@ struct pipe_screen *radeonsi_screen_create(struct 
radeon_winsys *ws,
 driQueryOptionb(config->options, 
"radeonsi_assume_no_z_fights");
 sscreen->commutative_blend_add =
 driQueryOptionb(config->options, 
"radeonsi_commutative_blend_add");
-   sscreen->clear_db_meta_before_clear =
-   driQueryOptionb(config->options, 
"radeonsi_clear_db_meta_before_clear");
+   sscreen->clear_db_before_clear =
+   driQueryOptionb(config->options, 
"radeonsi_clear_db_before_clear");
 sscreen->has_msaa_sample_loc_bug = (sscreen->b.family >= CHIP_POLARIS10 
&&
 sscreen->b.family <= 
CHIP_POLARIS12) ||
sscreen->b.family == CHIP_VEGA10 ||
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index c162a0fcd6..8138d4234a 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -98,7 +98,7 @@ struct si_screen {
 boolhas_out_of_order_rast;
 boolassume_no_z_fights;
 boolcommutative_blend_add;
-   boolclear_db_meta_before_clear;
+   boolclear_db_before_clear;
 boolhas_msaa_sample_loc_bug;
 booldpbb_allowed;
 booldfsm_allowed;
diff --git a/src/util/drirc b/src/util/drirc
index 39ac3c858c..2d1f53ccbc 100644
--- a/src/util/drirc
+++ b/src/util/drirc
@@ -264,7 +264,7 @@ 

Re: [Mesa-dev] [PATCH v2] radeonsi: update hack for HTILE corruption in ARK: Survival Evolved

2017-10-26 Thread Marek Olšák
Please "clear_db_cache_before_clear" and the option too. With that,
the patch is:

Reviewed-by: Marek Olšák 

Thanks,
Marek

On Thu, Oct 26, 2017 at 6:08 PM, Samuel Pitoiset
 wrote:
> It appears that flushing the DB metadata is actually not sufficient
> since the driver uses the new VS blit shaders. This looks quite
> strange though, but it seems like we need to flush DB for fixing
> the corruption.
>
> v2: rename the drirc option
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102955
> Fixes: 69ccb9dae7 (radeonsi: use new VS blit shaders (VS inputs in SGPRs)
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/drivers/radeonsi/driinfo_radeonsi.h |  2 +-
>  src/gallium/drivers/radeonsi/si_blit.c  | 10 +-
>  src/gallium/drivers/radeonsi/si_pipe.c  |  4 ++--
>  src/gallium/drivers/radeonsi/si_pipe.h  |  2 +-
>  src/util/drirc  |  2 +-
>  src/util/xmlpool/t_options.h|  6 +++---
>  6 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/driinfo_radeonsi.h 
> b/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
> index 402d3406d4..ef264b7d5e 100644
> --- a/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
> +++ b/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
> @@ -6,5 +6,5 @@ DRI_CONF_SECTION_PERFORMANCE
>  DRI_CONF_SECTION_END
>
>  DRI_CONF_SECTION_DEBUG
> -   DRI_CONF_RADEONSI_CLEAR_DB_META_BEFORE_CLEAR("false")
> +   DRI_CONF_RADEONSI_CLEAR_DB_BEFORE_CLEAR("false")
>  DRI_CONF_SECTION_END
> diff --git a/src/gallium/drivers/radeonsi/si_blit.c 
> b/src/gallium/drivers/radeonsi/si_blit.c
> index fd8559ac98..ce1b5a3e1a 100644
> --- a/src/gallium/drivers/radeonsi/si_blit.c
> +++ b/src/gallium/drivers/radeonsi/si_blit.c
> @@ -901,16 +901,16 @@ static void si_clear(struct pipe_context *ctx, unsigned 
> buffers,
>  * corruption in ARK: Survival Evolved, but that may just be
>  * a coincidence and the root cause is elsewhere.
>  *
> -* The corruption can be fixed by putting the DB metadata 
> flush
> -* before or after the depth clear. (suprisingly)
> +* The corruption can be fixed by putting the DB flush before
> +* or after the depth clear. (surprisingly)
>  *
>  * https://bugs.freedesktop.org/show_bug.cgi?id=102955 
> (apitrace)
>  *
>  * This hack decreases back-to-back ClearDepth performance.
>  */
> -   if (sctx->screen->clear_db_meta_before_clear)
> -   sctx->b.flags |= SI_CONTEXT_FLUSH_AND_INV_DB_META |
> -SI_CONTEXT_PS_PARTIAL_FLUSH;
> +   if (sctx->screen->clear_db_before_clear) {
> +   sctx->b.flags |= SI_CONTEXT_FLUSH_AND_INV_DB;
> +   }
> }
>
> si_blitter_begin(ctx, SI_CLEAR);
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
> b/src/gallium/drivers/radeonsi/si_pipe.c
> index 759d539471..21266611c7 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -1072,8 +1072,8 @@ struct pipe_screen *radeonsi_screen_create(struct 
> radeon_winsys *ws,
> driQueryOptionb(config->options, 
> "radeonsi_assume_no_z_fights");
> sscreen->commutative_blend_add =
> driQueryOptionb(config->options, 
> "radeonsi_commutative_blend_add");
> -   sscreen->clear_db_meta_before_clear =
> -   driQueryOptionb(config->options, 
> "radeonsi_clear_db_meta_before_clear");
> +   sscreen->clear_db_before_clear =
> +   driQueryOptionb(config->options, 
> "radeonsi_clear_db_before_clear");
> sscreen->has_msaa_sample_loc_bug = (sscreen->b.family >= 
> CHIP_POLARIS10 &&
> sscreen->b.family <= 
> CHIP_POLARIS12) ||
>sscreen->b.family == CHIP_VEGA10 ||
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
> b/src/gallium/drivers/radeonsi/si_pipe.h
> index c162a0fcd6..8138d4234a 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.h
> +++ b/src/gallium/drivers/radeonsi/si_pipe.h
> @@ -98,7 +98,7 @@ struct si_screen {
> boolhas_out_of_order_rast;
> boolassume_no_z_fights;
> boolcommutative_blend_add;
> -   boolclear_db_meta_before_clear;
> +   boolclear_db_before_clear;
> boolhas_msaa_sample_loc_bug;
> booldpbb_allowed;
> booldfsm_allowed;
> diff --git a/src/util/drirc b/src/util/drirc
> index 39ac3c858c..2d1f53ccbc 100644
>