winsys/amdgpu: compute num_good_compute_units correctly
authorMarek Olšák <marek.olsak@amd.com>
Tue, 19 Jan 2016 16:43:11 +0000 (17:43 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 22 Jan 2016 14:02:40 +0000 (15:02 +0100)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c

index 9835024036b022725063c76d59710d55c075a84e..69df363b6d64fae46cbc6c741d8ba12c309829ef 100644 (file)
@@ -266,17 +266,12 @@ static boolean do_winsys_init(struct amdgpu_winsys *ws)
    ws->info.r600_virtual_address = TRUE;
    ws->info.r600_has_dma = dma.available_rings != 0;
 
-   /* Guess what the maximum compute unit number is by looking at the mask
-    * of enabled CUs.
-    */
+   /* Get the number of good compute units. */
+   ws->info.num_good_compute_units = 0;
    for (i = 0; i < ws->info.max_se; i++)
-      for (j = 0; j < ws->info.max_sh_per_se; j++) {
-         unsigned max = util_last_bit(ws->amdinfo.cu_bitmap[i][j]);
-
-         if (ws->info.num_good_compute_units < max)
-            ws->info.num_good_compute_units = max;
-      }
-   ws->info.num_good_compute_units *= ws->info.max_se * ws->info.max_sh_per_se;
+      for (j = 0; j < ws->info.max_sh_per_se; j++)
+         ws->info.num_good_compute_units +=
+            util_bitcount(ws->amdinfo.cu_bitmap[i][j]);
 
    memcpy(ws->info.si_tile_mode_array, ws->amdinfo.gb_tile_mode,
           sizeof(ws->amdinfo.gb_tile_mode));