freedreno: use util_dynarray_clear instead of util_dynarray_resize(_, 0)
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 3 May 2019 16:11:27 +0000 (18:11 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 12 Jun 2019 22:30:25 +0000 (18:30 -0400)
This is more expressive and simplifies a subsequent change.

v2:
- fix one more call-site after rebase

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/freedreno/a2xx/fd2_gmem.c
src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
src/gallium/drivers/freedreno/a4xx/fd4_gmem.c
src/gallium/drivers/freedreno/a5xx/fd5_gmem.c
src/gallium/drivers/freedreno/a6xx/fd6_gmem.c

index 0c7ea844fa47ac69b0e4a6f4ad7641edaf22332e..0edc5e940c11dc163748c4b59e5638ee9c02d8bb 100644 (file)
@@ -404,7 +404,7 @@ patch_draws(struct fd_batch *batch, enum pc_di_vis_cull_mode vismode)
                        struct fd_cs_patch *patch = fd_patch_element(&batch->draw_patches, i);
                        *patch->cs = patch->val | DRAW(0, 0, 0, vismode, 0);
                }
-               util_dynarray_resize(&batch->draw_patches, 0);
+               util_dynarray_clear(&batch->draw_patches);
                return;
        }
 
@@ -472,8 +472,8 @@ fd2_emit_sysmem_prep(struct fd_batch *batch)
                        A2XX_PA_SC_WINDOW_OFFSET_Y(0));
 
        patch_draws(batch, IGNORE_VISIBILITY);
-       util_dynarray_resize(&batch->draw_patches, 0);
-       util_dynarray_resize(&batch->shader_patches, 0);
+       util_dynarray_clear(&batch->draw_patches);
+       util_dynarray_clear(&batch->shader_patches);
 }
 
 /* before first tile */
@@ -551,7 +551,7 @@ fd2_emit_tile_init(struct fd_batch *batch)
                patch->cs[5] = A2XX_RB_DEPTH_INFO_DEPTH_BASE(depth_base) |
                        A2XX_RB_DEPTH_INFO_DEPTH_FORMAT(1);
        }
-       util_dynarray_resize(&batch->gmem_patches, 0);
+       util_dynarray_clear(&batch->gmem_patches);
 
        /* set to zero, for some reason hardware doesn't like certain values */
        OUT_PKT3(ring, CP_SET_CONSTANT, 2);
@@ -656,8 +656,8 @@ fd2_emit_tile_init(struct fd_batch *batch)
                patch_draws(batch, IGNORE_VISIBILITY);
        }
 
-       util_dynarray_resize(&batch->draw_patches, 0);
-       util_dynarray_resize(&batch->shader_patches, 0);
+       util_dynarray_clear(&batch->draw_patches);
+       util_dynarray_clear(&batch->shader_patches);
 }
 
 /* before mem2gmem */
index 5c3079e2dcb0894ae31aa6d8f7fc1f502ed6a960..b27cb8d00e8d812c9bb16119d4a0144e5523a0c8 100644 (file)
@@ -711,7 +711,7 @@ patch_draws(struct fd_batch *batch, enum pc_di_vis_cull_mode vismode)
                struct fd_cs_patch *patch = fd_patch_element(&batch->draw_patches, i);
                *patch->cs = patch->val | DRAW(0, 0, 0, vismode, 0);
        }
-       util_dynarray_resize(&batch->draw_patches, 0);
+       util_dynarray_clear(&batch->draw_patches);
 }
 
 static void
@@ -722,7 +722,7 @@ patch_rbrc(struct fd_batch *batch, uint32_t val)
                struct fd_cs_patch *patch = fd_patch_element(&batch->rbrc_patches, i);
                *patch->cs = patch->val | val;
        }
-       util_dynarray_resize(&batch->rbrc_patches, 0);
+       util_dynarray_clear(&batch->rbrc_patches);
 }
 
 /* for rendering directly to system memory: */
index 5d5e3870d83ec847ea6be17218018c579782dc14..ac2d1e2a0abf531ed54f05725bc96cb5aaec5ade 100644 (file)
@@ -517,7 +517,7 @@ patch_draws(struct fd_batch *batch, enum pc_di_vis_cull_mode vismode)
                struct fd_cs_patch *patch = fd_patch_element(&batch->draw_patches, i);
                *patch->cs = patch->val | DRAW4(0, 0, 0, vismode);
        }
-       util_dynarray_resize(&batch->draw_patches, 0);
+       util_dynarray_clear(&batch->draw_patches);
 }
 
 /* for rendering directly to system memory: */
index d72d36dde3e47a4126554c636c47c9f433b3fb7e..c95acd66aef4072b8e5aef5d627b1fe183a61a82 100644 (file)
@@ -255,7 +255,7 @@ patch_draws(struct fd_batch *batch, enum pc_di_vis_cull_mode vismode)
                struct fd_cs_patch *patch = fd_patch_element(&batch->draw_patches, i);
                *patch->cs = patch->val | DRAW4(0, 0, 0, vismode);
        }
-       util_dynarray_resize(&batch->draw_patches, 0);
+       util_dynarray_clear(&batch->draw_patches);
 }
 
 static void
index 1afb1d74fa3a9a6f1f160a7f4db1db9337416e92..77eda58c3f18d3bc37301fe6375ae87f1fbc00ca 100644 (file)
@@ -280,7 +280,7 @@ patch_fb_read(struct fd_batch *batch)
                struct fd_cs_patch *patch = fd_patch_element(&batch->fb_read_patches, i);
                *patch->cs = patch->val | A6XX_TEX_CONST_2_PITCH(gmem->bin_w * gmem->cbuf_cpp[0]);
        }
-       util_dynarray_resize(&batch->fb_read_patches, 0);
+       util_dynarray_clear(&batch->fb_read_patches);
 }
 
 static void
@@ -291,7 +291,7 @@ patch_draws(struct fd_batch *batch, enum pc_di_vis_cull_mode vismode)
                struct fd_cs_patch *patch = fd_patch_element(&batch->draw_patches, i);
                *patch->cs = patch->val | DRAW4(0, 0, 0, vismode);
        }
-       util_dynarray_resize(&batch->draw_patches, 0);
+       util_dynarray_clear(&batch->draw_patches);
 }
 
 static void