[Mesa-dev] [PATCH] r600g: check gpr count limit

Alex Deucher alexdeucher at gmail.com
Mon Apr 9 14:55:03 PDT 2012


On Mon, Apr 9, 2012 at 4:44 PM, Vadim Girlin <vadimgirlin at gmail.com> wrote:
> This should help to prevent gpu lockups.
> See https://bugs.freedesktop.org/show_bug.cgi?id=48472
>
> Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

Should probably also add a note that this should be applied to the
stable branches as well.

> ---
>  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 1adf344..4932dcc 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;
> --
> 1.7.7.6
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list