summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-09-10 18:27:53 +0200
committerEmil Velikov <[email protected]>2015-10-07 14:36:30 +0100
commit33ed153214c67e9a00db90c1f37e1d7756916fed (patch)
treea62479ce590c5ad32cf2e2e97913bc511fb2bb40 /src/gallium/drivers/radeonsi
parent3cd7493f11f7b8269601d2b5045a59c7b9d89fd3 (diff)
radeonsi: skip drawing if the tess factor ring allocation fails
Cc: 11.0 <[email protected]> Acked-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> (cherry picked from commit 22d3ccf5a814bfc768e373d0c983a356f4e4efe3) [Emil Velikov: Track tf_state over tf_ring. NULL check/FREE tf_state.] Signed-off-by: Emil Velikov <[email protected]> Conflicts: src/gallium/drivers/radeonsi/si_state_shaders.c
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/si_state.h2
-rw-r--r--src/gallium/drivers/radeonsi/si_state_draw.c4
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c17
3 files changed, 18 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index 8fa65dc780c..6d9ac5ff5ae 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -274,7 +274,7 @@ si_create_sampler_view_custom(struct pipe_context *ctx,
unsigned force_level);
/* si_state_shader.c */
-void si_update_shaders(struct si_context *sctx);
+bool si_update_shaders(struct si_context *sctx);
void si_init_shader_functions(struct si_context *sctx);
/* si_state_draw.c */
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index d54ed689cbf..e0394cf00e9 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -760,8 +760,8 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
else
sctx->current_rast_prim = info->mode;
- si_update_shaders(sctx);
- if (!si_upload_shader_descriptors(sctx))
+ if (!si_update_shaders(sctx) ||
+ !si_upload_shader_descriptors(sctx))
return;
if (info->indexed) {
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index ae8df5db62d..f21d1ef78f4 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1238,11 +1238,20 @@ static void si_init_tess_factor_ring(struct si_context *sctx)
assert(!sctx->tf_state);
sctx->tf_state = CALLOC_STRUCT(si_pm4_state);
+ if (!sctx->tf_state)
+ return;
+
sctx->tf_ring = pipe_buffer_create(sctx->b.b.screen, PIPE_BIND_CUSTOM,
PIPE_USAGE_DEFAULT,
32768 * sctx->screen->b.info.max_se);
+ if (!sctx->tf_ring) {
+ FREE(sctx->tf_state);
+ return;
+ }
+
sctx->b.clear_buffer(&sctx->b.b, sctx->tf_ring, 0,
sctx->tf_ring->width0, fui(0), false);
+
assert(((sctx->tf_ring->width0 / 4) & C_030938_SIZE) == 0);
if (sctx->b.chip_class >= CIK) {
@@ -1346,15 +1355,18 @@ static void si_update_so(struct si_context *sctx, struct si_shader_selector *sha
sctx->b.streamout.stride_in_dw = shader->so.stride;
}
-void si_update_shaders(struct si_context *sctx)
+bool si_update_shaders(struct si_context *sctx)
{
struct pipe_context *ctx = (struct pipe_context*)sctx;
struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
/* Update stages before GS. */
if (sctx->tes_shader) {
- if (!sctx->tf_state)
+ if (!sctx->tf_state) {
si_init_tess_factor_ring(sctx);
+ if (!sctx->tf_state)
+ return false;
+ }
/* VS as LS */
si_shader_select(ctx, sctx->vs_shader);
@@ -1453,6 +1465,7 @@ void si_update_shaders(struct si_context *sctx)
if (sctx->b.chip_class == SI)
si_mark_atom_dirty(sctx, &sctx->db_render_state);
}
+ return true;
}
void si_init_shader_functions(struct si_context *sctx)