summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/nouveau
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2010-03-04 21:32:07 +0100
committerFrancisco Jerez <currojerez@riseup.net>2010-03-04 23:07:11 +0100
commit80316cbefaa28454ab9d6da44ac93805608c3685 (patch)
treef3efa4ee4afff985e65612c8c22a3363378bb2ae /src/mesa/drivers/dri/nouveau
parent43c347c63ee10db95bd912fc39b1127fa35305a4 (diff)
dri/nouveau: Try to keep client buffers smaller than the scratch VBO length.
Diffstat (limited to 'src/mesa/drivers/dri/nouveau')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 8a2caff63e..69a9b96f0c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -243,6 +243,23 @@ vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays)
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_POS);
}
+static unsigned
+get_max_client_stride(GLcontext *ctx)
+{
+ struct nouveau_render_state *render = to_render_state(ctx);
+ int i, s = 0;
+
+ for (i = 0; i < render->attr_count; i++) {
+ int attr = render->map[i];
+ struct nouveau_array_state *a = &render->attrs[attr];
+
+ if (attr >= 0 && !a->bo)
+ s = MAX2(a->stride, s);
+ }
+
+ return s;
+}
+
static void
TAG(vbo_render_prims)(GLcontext *ctx, const struct gl_client_array **arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
@@ -257,9 +274,18 @@ vbo_maybe_split(GLcontext *ctx, const struct gl_client_array **arrays,
GLuint min_index, GLuint max_index)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct nouveau_render_state *render = to_render_state(ctx);
unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * nctx->bo.count,
vert_avail = get_max_vertices(ctx, NULL, pushbuf_avail),
idx_avail = get_max_vertices(ctx, ib, pushbuf_avail);
+ int stride;
+
+ /* Try to keep client buffers smaller than the scratch BOs. */
+ if (!ib && render->mode == VBO &&
+ (stride = get_max_client_stride(ctx)))
+ vert_avail = MIN2(vert_avail,
+ RENDER_SCRATCH_SIZE / stride);
+
if ((ib && ib->count > idx_avail) ||
(!ib && max_index - min_index > vert_avail)) {