freedreno/a6xx: skip unnecessary MRT blend state
authorRob Clark <robdclark@chromium.org>
Tue, 21 Apr 2020 16:05:55 +0000 (09:05 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 30 Apr 2020 20:03:17 +0000 (20:03 +0000)
To lower CP overhead.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4813>

src/gallium/drivers/freedreno/a6xx/fd6_blend.c

index 279f9ea551252f94c5fa7e616618d68263d68722..16e2bfaf1b815cb7f2a42c769abef3bd603bd289 100644 (file)
@@ -78,7 +78,7 @@ __fd6_setup_blend_variant(struct fd6_blend_stateobj *blend, unsigned sample_mask
                        ((A6XX_MAX_RENDER_TARGETS * 4) + 6) * 4);
        so->stateobj = ring;
 
-       for (unsigned i = 0; i < A6XX_MAX_RENDER_TARGETS; i++) {
+       for (unsigned i = 0; i <= cso->max_rt; i++) {
                const struct pipe_rt_blend_state *rt;
 
                if (cso->independent_blend_enable)
@@ -162,8 +162,8 @@ fd6_blend_state_create(struct pipe_context *pctx,
        so->ctx = fd_context(pctx);
        so->lrz_write = true;  /* unless blend enabled for any MRT */
 
-       unsigned nr = cso->independent_blend_enable ? A6XX_MAX_RENDER_TARGETS : 1;
-       for (unsigned i = 0; i < nr; i++) {
+       unsigned nr = cso->independent_blend_enable ? cso->max_rt : 0;
+       for (unsigned i = 0; i <= nr; i++) {
                const struct pipe_rt_blend_state *rt = &cso->rt[i];
 
                if (rt->blend_enable) {