diff options
author | Vadim Girlin <[email protected]> | 2012-04-10 00:44:52 +0400 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2012-04-09 18:05:57 -0400 |
commit | 783e4da72aa203a645737dec81b001341951a942 (patch) | |
tree | 32b139fc74f3cc97b29d126adae38c94c5cfd7e8 /src/gallium/drivers/r600 | |
parent | 4b06280ea34ce0e2ef9ec36df792c28c3828eabd (diff) |
r600g: check gpr count limit
This should help to prevent gpu lockups.
See https://bugs.freedesktop.org/show_bug.cgi?id=48472
NOTE: This is a candidate for the stable branches.
Signed-off-by: Vadim Girlin <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/r600_shader.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 1adf34420c1..4932dcc6e5b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1266,6 +1266,14 @@ static int r600_shader_from_tgsi(struct r600_context * rctx, struct r600_pipe_sh if (ctx.bc->chip_class == CAYMAN) cm_bytecode_add_cf_end(ctx.bc); + /* check GPR limit - we have 124 = 128 - 4 + * (4 are reserved as alu clause temporary registers) */ + if (ctx.bc->ngpr > 124) { + R600_ERR("GPR limit exceeded - shader requires %d registers\n", ctx.bc->ngpr); + r = -ENOMEM; + goto out_err; + } + free(ctx.literals); tgsi_parse_free(&ctx.parse); return 0; |