r600g,radeonsi: don't add streamout.num_dw_for_end twice
authorMarek Olšák <marek.olsak@amd.com>
Sun, 9 Mar 2014 21:10:27 +0000 (22:10 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 11 Mar 2014 17:51:20 +0000 (18:51 +0100)
It's already added in need_cs_space.

Also don't calculate anything if there are no buffers.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeon/r600_streamout.c

index a556e3ae0e056e286453a9ea18dccd0ab3ac1d9e..d9b1d1c8e5e225eaf1240aa191c0fa2d03a1e21b 100644 (file)
@@ -79,6 +79,9 @@ void r600_streamout_buffers_dirty(struct r600_common_context *rctx)
        unsigned num_bufs_appended = util_bitcount(rctx->streamout.enabled_mask &
                                                   rctx->streamout.append_bitmask);
 
+       if (!num_bufs)
+               return;
+
        rctx->streamout.num_dw_for_end =
                12 + /* flush_vgt_streamout */
                num_bufs * 8 + /* STRMOUT_BUFFER_UPDATE */
@@ -99,8 +102,7 @@ void r600_streamout_buffers_dirty(struct r600_common_context *rctx)
        begin->num_dw +=
                num_bufs_appended * 8 + /* STRMOUT_BUFFER_UPDATE */
                (num_bufs - num_bufs_appended) * 6 + /* STRMOUT_BUFFER_UPDATE */
-               (rctx->family > CHIP_R600 && rctx->family < CHIP_RS780 ? 2 : 0) + /* SURFACE_BASE_UPDATE */
-               rctx->streamout.num_dw_for_end;
+               (rctx->family > CHIP_R600 && rctx->family < CHIP_RS780 ? 2 : 0); /* SURFACE_BASE_UPDATE */
 
        begin->dirty = true;
 }