Mesa (10.4): radeonsi: fix a crash if a stencil ref state is set before a DSA state
Emil Velikov
evelikov at kemper.freedesktop.org
Wed Feb 18 22:22:17 UTC 2015
Module: Mesa
Branch: 10.4
Commit: 67ac6a39516ad073b098855305ea5c9e9bf508e1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=67ac6a39516ad073b098855305ea5c9e9bf508e1
Author: Marek Olšák <marek.olsak at amd.com>
Date: Sun Feb 15 18:12:06 2015 +0100
radeonsi: fix a crash if a stencil ref state is set before a DSA state
+ minor indentation fixes
Discovered by Axel Davy.
This can't be reproduced with any app, because all state trackers set a DSA
state first.
Cc: 10.5 10.4 10.3 <mesa-stable at lists.freedesktop.org>
Reviewed-by: Axel Davy <axel.davy at ens.fr>
(cherry picked from commit 2ead74888a70481aa40b5b6ede42279e1917e66c)
---
src/gallium/drivers/radeonsi/si_state.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index edd179e..ac669fc 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -697,12 +697,16 @@ static void si_delete_rs_state(struct pipe_context *ctx, void *state)
*/
static void si_update_dsa_stencil_ref(struct si_context *sctx)
{
- struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
+ struct si_pm4_state *pm4;
struct pipe_stencil_ref *ref = &sctx->stencil_ref;
- struct si_state_dsa *dsa = sctx->queued.named.dsa;
+ struct si_state_dsa *dsa = sctx->queued.named.dsa;
- if (pm4 == NULL)
- return;
+ if (!dsa)
+ return;
+
+ pm4 = CALLOC_STRUCT(si_pm4_state);
+ if (pm4 == NULL)
+ return;
si_pm4_set_reg(pm4, R_028430_DB_STENCILREFMASK,
S_028430_STENCILTESTVAL(ref->ref_value[0]) |
More information about the mesa-commit
mailing list