[Mesa-stable] [Mesa-dev] [PATCH 1/2] i965/gs: Properly skip GS binding table upload when no GS active.

Chris Forbes chrisf at ijw.co.nz
Mon Nov 25 11:24:21 PST 2013


Ouch.

Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>

On Tue, Nov 26, 2013 at 5:23 AM, Paul Berry <stereotype441 at gmail.com> wrote:
> Previously, in brw_gs_upload_binding_table(), we checked whether
> brw->gs.prog_data was NULL in order to determine whether a geometry
> shader was active.  This didn't work: brw->gs.prog_data starts off as
> NULL, but it is set to non-NULL when a geometry shader program is
> built, and then never set to NULL again.  As a result, if we called
> brw_gs_upload_binding_table() while there was no geometry shader
> active, but a geometry shader had previously been active, it would
> refer to a stale (and possibly freed) prog_data structure.
>
> This patch fixes the problem by modifying
> brw_gs_upload_binding_table() to use the proper technique to determine
> whether a geometry shader is active: by checking whether
> brw->geometry_program is NULL.
>
> I suspect this may address the crash reported in comment 2 of bug
> 71870.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
>
> Cc: mesa-stable at lists.freedesktop.org
> ---
>  src/mesa/drivers/dri/i965/brw_binding_tables.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c b/src/mesa/drivers/dri/i965/brw_binding_tables.c
> index 0a322dc..b39bd10 100644
> --- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
> +++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
> @@ -128,7 +128,7 @@ static void
>  brw_gs_upload_binding_table(struct brw_context *brw)
>  {
>     /* If there's no GS, skip changing anything. */
> -   if (!brw->gs.prog_data)
> +   if (brw->geometry_program == NULL)
>        return;
>
>     brw_upload_binding_table(brw, BRW_NEW_GS_BINDING_TABLE, &brw->gs.base);
> --
> 1.8.4.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list