radeon/compute: Implement PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS
authorBruno Jiménez <brunojimen@gmail.com>
Fri, 13 Jun 2014 09:23:14 +0000 (11:23 +0200)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 13 Jun 2014 14:59:30 +0000 (10:59 -0400)
v2:
    Add RADEON_INFO_ACTIVE_CU_COUNT as a define, as suggested by
    Tom Stellard

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
src/gallium/winsys/radeon/drm/radeon_winsys.h

index 4c6cf0e60c1ad7c691cbd958a874df8d74355cbe..4b9d31c4da3b588805e33395493a0a21a3088ddd 100644 (file)
@@ -520,6 +520,13 @@ static int r600_get_compute_param(struct pipe_screen *screen,
                }
                return sizeof(uint32_t);
 
+       case PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS:
+               if (ret) {
+                       uint32_t *max_compute_units = ret;
+                       *max_compute_units = rscreen->info.max_compute_units;
+               }
+               return sizeof(uint32_t);
+
        default:
                fprintf(stderr, "unknown PIPE_COMPUTE_CAP %d\n", param);
                return 0;
index e54e79e38f8f274ec4eece38dda4de67c4c4260c..576fea5f3822823c5b9847ae789963948204bd73 100644 (file)
 #include <sys/stat.h>
 #include <unistd.h>
 
+#ifndef RADEON_INFO_ACTIVE_CU_COUNT
+#define RADEON_INFO_ACTIVE_CU_COUNT 0x20
+#endif
+
 static struct util_hash_table *fd_tab = NULL;
 pipe_static_mutex(fd_tab_mutex);
 
@@ -382,6 +386,9 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
     radeon_get_drm_value(ws->fd, RADEON_INFO_MAX_PIPES, NULL,
                          &ws->info.r600_max_pipes);
 
+    radeon_get_drm_value(ws->fd, RADEON_INFO_ACTIVE_CU_COUNT, NULL,
+                         &ws->info.max_compute_units);
+
     if (radeon_get_drm_value(ws->fd, RADEON_INFO_SI_TILE_MODE_ARRAY, NULL,
                              ws->info.si_tile_mode_array)) {
         ws->info.si_tile_mode_array_valid = TRUE;
index 2d13550c9ccedb310a3525dd32a5210441b9a976..6df1987aee0d184d5ff3ba60b29b540c6bcbf3b0 100644 (file)
@@ -198,6 +198,7 @@ struct radeon_info {
     uint32_t                    gart_size;
     uint32_t                    vram_size;
     uint32_t                    max_sclk;
+    uint32_t                    max_compute_units;
 
     uint32_t                    drm_major; /* version */
     uint32_t                    drm_minor;