[Mesa-dev] [PATCH] r600g: fix crash in set_framebuffer_state

Marek Olšák maraeo at gmail.com
Fri Oct 11 00:48:30 CEST 2013


It would be safer to check ps_shader in update_db_shader_control
instead. This is not the only place where update_db_shader_control is
called.

Marek

On Thu, Oct 10, 2013 at 7:17 PM, Grigori Goronzy <greg at chown.ath.cx> wrote:
> We should be able to safely set the framebuffer state without a
> fragment shader bound. bind_ps_state will take care of updating the
> necessary state bits later.
> ---
>  src/gallium/drivers/r600/evergreen_state.c | 4 +++-
>  src/gallium/drivers/r600/r600_state.c      | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
> index 83cb024..22de003 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -1822,7 +1822,9 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx,
>                 rctx->db_misc_state.atom.dirty = true;
>         }
>
> -       evergreen_update_db_shader_control(rctx);
> +       if (rctx->ps_shader) {
> +               evergreen_update_db_shader_control(rctx);
> +       }
>
>         /* Calculate the CS size. */
>         rctx->framebuffer.atom.num_dw = 4; /* SCISSOR */
> diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
> index b01ab9c..ee08de9 100644
> --- a/src/gallium/drivers/r600/r600_state.c
> +++ b/src/gallium/drivers/r600/r600_state.c
> @@ -1662,7 +1662,9 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
>                 rctx->alphatest_state.atom.dirty = true;
>         }
>
> -       r600_update_db_shader_control(rctx);
> +       if (rctx->ps_shader) {
> +               r600_update_db_shader_control(rctx);
> +       }
>
>         /* Calculate the CS size. */
>         rctx->framebuffer.atom.num_dw =
> --
> 1.8.1.2
>
> _______________________________________________
> 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