From e42b2f768509b6984c7186805c6a8afdaebf3a06 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 12 Mar 2010 02:47:44 -0800 Subject: r300g: Properly clamp index limits. Make the kernel even less likely to barf on us. --- src/gallium/drivers/r300/r300_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/drivers/r300/r300_render.c') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 9c001ae186d..ef1b7510e18 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -280,7 +280,7 @@ static void r300_emit_draw_elements(struct r300_context *r300, DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, min %u max %u\n", count, minIndex, maxIndex); - maxIndex = MIN2(maxIndex, r300->vertex_buffer_max_index); + maxIndex = MIN3(maxIndex, r300->vertex_buffer_max_index, (1 << 24) - 1); if (alt_num_verts) { BEGIN_CS(15); -- cgit v1.2.3 From 2764a5191ffcaf93a77beff464ac8eca15163fcc Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 12 Mar 2010 18:13:18 -0800 Subject: r300g: Forcibly sanitize max index. Not perfect, but the kernel should shut up now. --- src/gallium/drivers/r300/r300_render.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gallium/drivers/r300/r300_render.c') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index ef1b7510e18..ccf39876a59 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -274,14 +274,14 @@ static void r300_emit_draw_elements(struct r300_context *r300, #endif CS_LOCALS(r300); - assert((start * indexSize) % 4 == 0); + assert((start * indexSize) % 4 == 0); assert(count < (1 << 24)); + maxIndex = MIN3(maxIndex, r300->vertex_buffer_max_index, count - minIndex); + DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, min %u max %u\n", count, minIndex, maxIndex); - maxIndex = MIN3(maxIndex, r300->vertex_buffer_max_index, (1 << 24) - 1); - if (alt_num_verts) { BEGIN_CS(15); OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count); -- cgit v1.2.3