OSDN Git Service

radeonsi: use level mask for early out in si_blit_decompress_color
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 22 Apr 2016 20:27:33 +0000 (15:27 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 27 Apr 2016 16:16:40 +0000 (11:16 -0500)
Mostly for consistency with the other decompress functions, but note that
in the non-DCC decompress case, the function can now early-out in slightly
more (albeit probably rare) cases.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_blit.c

index 09f3207..32f953d 100644 (file)
@@ -309,17 +309,19 @@ static void si_blit_decompress_color(struct pipe_context *ctx,
                bool need_dcc_decompress)
 {
        struct si_context *sctx = (struct si_context *)ctx;
-       unsigned layer, level, checked_last_layer, max_layer;
+       unsigned layer, checked_last_layer, max_layer;
+       unsigned level_mask =
+               u_bit_consecutive(first_level, last_level - first_level + 1);
 
-       if (!rtex->dirty_level_mask && !need_dcc_decompress)
+       if (!need_dcc_decompress)
+               level_mask &= rtex->dirty_level_mask;
+       if (!level_mask)
                return;
 
-       for (level = first_level; level <= last_level; level++) {
+       while (level_mask) {
+               unsigned level = u_bit_scan(&level_mask);
                void* custom_blend;
 
-               if (!(rtex->dirty_level_mask & (1 << level)) && !need_dcc_decompress)
-                       continue;
-
                if (rtex->dcc_offset && need_dcc_decompress) {
                        custom_blend = sctx->custom_blend_dcc_decompress;
                } else if (rtex->fmask.size) {