winsys/radeon: Always report at least 1 compute unit

All uses of this require that the value be at least one, so it's
easier to report at least one than having to wrap all uses
in MAX2(max_compute_units, 1).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Tom Stellard 2014-12-05 23:59:10 +00:00
parent 67dcbcd92c
commit 0e1c085f17
2 changed files with 3 additions and 1 deletions

View file

@ -607,7 +607,7 @@ static int r600_get_compute_param(struct pipe_screen *screen,
case PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS: case PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS:
if (ret) { if (ret) {
uint32_t *max_compute_units = ret; uint32_t *max_compute_units = ret;
*max_compute_units = MAX2(rscreen->info.max_compute_units, 1); *max_compute_units = rscreen->info.max_compute_units;
} }
return sizeof(uint32_t); return sizeof(uint32_t);

View file

@ -387,6 +387,8 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
radeon_get_drm_value(ws->fd, RADEON_INFO_MAX_PIPES, NULL, radeon_get_drm_value(ws->fd, RADEON_INFO_MAX_PIPES, NULL,
&ws->info.r600_max_pipes); &ws->info.r600_max_pipes);
/* All GPUs have at least one compute unit */
ws->info.max_compute_units = 1;
radeon_get_drm_value(ws->fd, RADEON_INFO_ACTIVE_CU_COUNT, NULL, radeon_get_drm_value(ws->fd, RADEON_INFO_ACTIVE_CU_COUNT, NULL,
&ws->info.max_compute_units); &ws->info.max_compute_units);