radeonsi: fix crashing performance counters (division by zero)
authorMarek Olšák <marek.olsak@amd.com>
Sat, 26 Jan 2019 01:39:40 +0000 (20:39 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 4 Feb 2019 23:46:25 +0000 (18:46 -0500)
Fixes: e2b9329f17 "radeonsi: move remaining perfcounter code into si_perfcounter.c"
src/gallium/drivers/radeonsi/si_perfcounter.c

index 2da14f8868fcfe132823f3ff8530ab2238b3b851..d55394f2cba751cb04739e070540f40edc0876db 100644 (file)
@@ -1333,7 +1333,7 @@ void si_init_perfcounters(struct si_screen *screen)
        for (i = 0; i < num_blocks; ++i) {
                struct si_pc_block *block = &pc->blocks[i];
                block->b = &blocks[i];
-               block->num_instances = block->b->instances;
+               block->num_instances = MAX2(1, block->b->instances);
 
                if (!strcmp(block->b->b->name, "CB") ||
                    !strcmp(block->b->b->name, "DB"))