summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-08-25 11:19:24 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-08-26 09:36:52 +0100
commite6887a5752774c18cf527477fdd3e57e4893ff3b (patch)
treebb2b7fd03509130ca7744b0fd53d5628615e323c /src/gallium/auxiliary
parent026e7731e549e0777c010348460fd48b3d75a843 (diff)
draw: attempt atomic submit of large drawelements calls
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.h4
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_emit.c9
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c7
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c11
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache.c21
-rw-r--r--src/gallium/auxiliary/draw/draw_vbuf.h3
6 files changed, 29 insertions, 26 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h
index 3d2a9c78b7..c02f229110 100644
--- a/src/gallium/auxiliary/draw/draw_pt.h
+++ b/src/gallium/auxiliary/draw/draw_pt.h
@@ -98,9 +98,9 @@ struct draw_pt_middle_end {
unsigned count);
/* Transform all vertices in a linear range and then draw them with
- * the supplied element list.
+ * the supplied element list. May fail and return FALSE.
*/
- void (*run_linear_elts)( struct draw_pt_middle_end *,
+ boolean (*run_linear_elts)( struct draw_pt_middle_end *,
unsigned fetch_start,
unsigned fetch_count,
const ushort *draw_elts,
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
index 0684c93d10..5a4db6cfe5 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
@@ -324,7 +324,7 @@ static void fetch_emit_run_linear( struct draw_pt_middle_end *middle,
}
-static void fetch_emit_run_linear_elts( struct draw_pt_middle_end *middle,
+static boolean fetch_emit_run_linear_elts( struct draw_pt_middle_end *middle,
unsigned start,
unsigned count,
const ushort *draw_elts,
@@ -341,10 +341,8 @@ static void fetch_emit_run_linear_elts( struct draw_pt_middle_end *middle,
hw_verts = draw->render->allocate_vertices( draw->render,
(ushort)feme->translate->key.output_stride,
(ushort)count );
- if (!hw_verts) {
- assert(0);
- return;
- }
+ if (!hw_verts)
+ return FALSE;
/* Single routine to fetch vertices and emit HW verts.
*/
@@ -367,6 +365,7 @@ static void fetch_emit_run_linear_elts( struct draw_pt_middle_end *middle,
feme->translate->key.output_stride,
count );
+ return TRUE;
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
index 87094f3092..73fc70c1bc 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -332,7 +332,7 @@ fse_run(struct draw_pt_middle_end *middle,
-static void fse_run_linear_elts( struct draw_pt_middle_end *middle,
+static boolean fse_run_linear_elts( struct draw_pt_middle_end *middle,
unsigned start,
unsigned count,
const ushort *draw_elts,
@@ -351,8 +351,7 @@ static void fse_run_linear_elts( struct draw_pt_middle_end *middle,
(ushort)count );
if (!hw_verts) {
- assert(0);
- return;
+ return FALSE;
}
/* Single routine to fetch vertices, run shader and emit HW verts.
@@ -374,6 +373,8 @@ static void fse_run_linear_elts( struct draw_pt_middle_end *middle,
hw_verts,
fse->key.output_stride,
count );
+
+ return TRUE;
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
index f617aac9f7..ec3b41c320 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
@@ -262,7 +262,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
-static void fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle,
+static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle,
unsigned start,
unsigned count,
const ushort *draw_elts,
@@ -277,12 +277,8 @@ static void fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle,
struct vertex_header *pipeline_verts =
(struct vertex_header *)MALLOC(fpme->vertex_size * alloc_count);
- if (!pipeline_verts) {
- /* Not much we can do here - just skip the rendering.
- */
- assert(0);
- return;
- }
+ if (!pipeline_verts)
+ return FALSE;
/* Fetch into our vertex buffer
*/
@@ -336,6 +332,7 @@ static void fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle,
}
FREE(pipeline_verts);
+ return TRUE;
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c
index b8b5de729d..e8467b2ae3 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache.c
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c
@@ -306,6 +306,7 @@ static void vcache_check_run( struct draw_pt_front_end *frontend,
unsigned fetch_count = max_index + 1 - min_index;
const ushort *transformed_elts;
ushort *storage = NULL;
+ boolean ok;
if (0) debug_printf("fetch_count %d fetch_max %d draw_count %d\n", fetch_count,
@@ -313,7 +314,6 @@ static void vcache_check_run( struct draw_pt_front_end *frontend,
draw_count);
if (max_index == 0xffffffff ||
- fetch_count >= vcache->fetch_max ||
fetch_count > draw_count) {
if (0) debug_printf("fail\n");
goto fail;
@@ -395,14 +395,19 @@ static void vcache_check_run( struct draw_pt_front_end *frontend,
transformed_elts = storage;
}
- vcache->middle->run_linear_elts( vcache->middle,
- min_index, /* start */
- fetch_count,
- transformed_elts,
- draw_count );
-
+ ok = vcache->middle->run_linear_elts( vcache->middle,
+ min_index, /* start */
+ fetch_count,
+ transformed_elts,
+ draw_count );
+
FREE(storage);
- return;
+
+ if (ok)
+ return;
+
+ debug_printf("failed to execute atomic draw elts for %d/%d, splitting up\n",
+ fetch_count, draw_count);
fail:
vcache_run( frontend, get_elt, elts, draw_count );
diff --git a/src/gallium/auxiliary/draw/draw_vbuf.h b/src/gallium/auxiliary/draw/draw_vbuf.h
index 62247ccd9f..b0aa2df309 100644
--- a/src/gallium/auxiliary/draw/draw_vbuf.h
+++ b/src/gallium/auxiliary/draw/draw_vbuf.h
@@ -79,7 +79,8 @@ struct vbuf_render {
boolean (*set_primitive)( struct vbuf_render *, unsigned prim );
/**
- * DrawElements, note indices are ushort:
+ * DrawElements, note indices are ushort. The driver must complete
+ * this call, if necessary splitting the index list itself.
*/
void (*draw)( struct vbuf_render *,
const ushort *indices,