From 1d05cec205100f13b2fda18fdd27c6f0eebf6422 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 14 Jul 2017 13:26:24 +0200 Subject: [PATCH] etnaviv: reset indexed rendering information when not rendering indexed A dangling bo object would result in memory corruption while loading a level in ioquake3_opengl2. Fixes: 330d0607ed60 (gallium: remove pipe_index_buffer and set_index_buffer) Suggested-by: Lucas Stach Signed-off-by: Wladimir J. van der Laan Reviewed-by: Lucas Stach --- src/gallium/drivers/etnaviv/etnaviv_context.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c index e7590954c74..2ca09ce3219 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_context.c +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c @@ -192,13 +192,18 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.offset = index_offset; ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.flags = ETNA_RELOC_READ; ctx->index_buffer.FE_INDEX_STREAM_CONTROL = translate_index_size(info->index_size); - ctx->dirty |= ETNA_DIRTY_INDEX_BUFFER; if (!ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.bo) { BUG("Unsupported or no index buffer"); return; } + } else { + ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.bo = 0; + ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.offset = 0; + ctx->index_buffer.FE_INDEX_STREAM_BASE_ADDR.flags = 0; + ctx->index_buffer.FE_INDEX_STREAM_CONTROL = 0; } + ctx->dirty |= ETNA_DIRTY_INDEX_BUFFER; struct etna_shader_key key = {}; struct etna_surface *cbuf = etna_surface(pfb->cbufs[0]); -- 2.30.2