radeonsi/gfx9: update primitive binning code for EQAA
authorMarek Olšák <marek.olsak@amd.com>
Fri, 1 Jun 2018 03:47:17 +0000 (23:47 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 14 Jun 2018 02:00:37 +0000 (22:00 -0400)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/gallium/drivers/radeonsi/si_state_binning.c

index 665c11fe61fac6a9a1ed0f3c1a04bd5c44454a62..3928d045df0e1d8c4aaa15a0b17b6f5e8160e2ed 100644 (file)
@@ -66,7 +66,7 @@ static struct uvec2 si_find_bin_size(struct si_screen *sscreen,
 static struct uvec2 si_get_color_bin_size(struct si_context *sctx,
                                          unsigned cb_target_enabled_4bit)
 {
-       unsigned nr_samples = sctx->framebuffer.nr_samples;
+       unsigned num_fragments = sctx->framebuffer.nr_color_samples;
        unsigned sum = 0;
 
        /* Compute the sum of all Bpp. */
@@ -80,9 +80,9 @@ static struct uvec2 si_get_color_bin_size(struct si_context *sctx,
        }
 
        /* Multiply the sum by some function of the number of samples. */
-       if (nr_samples >= 2) {
+       if (num_fragments >= 2) {
                if (si_get_ps_iter_samples(sctx) >= 2)
-                       sum *= nr_samples;
+                       sum *= num_fragments;
                else
                        sum *= 2;
        }
@@ -205,7 +205,7 @@ static struct uvec2 si_get_depth_bin_size(struct si_context *sctx)
        unsigned stencil_coeff = rtex->surface.has_stencil &&
                                 dsa->stencil_enabled ? 1 : 0;
        unsigned sum = 4 * (depth_coeff + stencil_coeff) *
-                      sctx->framebuffer.nr_samples;
+                      rtex->buffer.b.b.nr_samples;
 
        static const si_bin_size_subtable table[] = {
                {
@@ -393,8 +393,13 @@ void si_emit_dpbb_state(struct si_context *sctx)
        /* Enable DFSM if it's preferred. */
        unsigned punchout_mode = V_028060_FORCE_OFF;
        bool disable_start_of_prim = true;
+       bool zs_eqaa_dfsm_bug = sctx->chip_class == GFX9 &&
+                               sctx->framebuffer.state.zsbuf &&
+                               sctx->framebuffer.nr_samples !=
+                               MAX2(1, sctx->framebuffer.state.zsbuf->texture->nr_samples);
 
        if (sscreen->dfsm_allowed &&
+           !zs_eqaa_dfsm_bug &&
            cb_target_enabled_4bit &&
            !G_02880C_KILL_ENABLE(db_shader_control) &&
            /* These two also imply that DFSM is disabled when PS writes to memory. */