From: Luca Barbieri Date: Mon, 12 Apr 2010 07:36:28 +0000 (+0200) Subject: nvfx: avoid flushes in primitives X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=507dc546c3da415036521fcf91e76af88c2cbf69;p=mesa.git nvfx: avoid flushes in primitives Currently we miscalculate the space needed to push vertices, causing flushes where they should not happen. Use a much more conservative estimate to fix it. It will be done better in the future (e.g. using the nv50 primitive splitter). --- diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c index b9566f9ee27..73f00adff04 100644 --- a/src/gallium/drivers/nvfx/nvfx_vbo.c +++ b/src/gallium/drivers/nvfx/nvfx_vbo.c @@ -195,7 +195,10 @@ nvfx_draw_arrays(struct pipe_context *pipe, nvfx_state_emit(nvfx); - vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256, + unsigned avail = AVAIL_RING(chan); + avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ + + vc = nouveau_vbuf_split(avail, 6, 256, mode, start, count, &restart); if (!vc) { FIRE_RING(chan); @@ -249,7 +252,10 @@ nvfx_draw_elements_u08(struct nvfx_context *nvfx, void *ib, nvfx_state_emit(nvfx); - vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2, + unsigned avail = AVAIL_RING(chan); + avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ + + vc = nouveau_vbuf_split(avail, 6, 2, mode, start, count, &restart); if (vc == 0) { FIRE_RING(chan); @@ -300,7 +306,10 @@ nvfx_draw_elements_u16(struct nvfx_context *nvfx, void *ib, nvfx_state_emit(nvfx); - vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2, + unsigned avail = AVAIL_RING(chan); + avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ + + vc = nouveau_vbuf_split(avail, 6, 2, mode, start, count, &restart); if (vc == 0) { FIRE_RING(chan); @@ -351,7 +360,10 @@ nvfx_draw_elements_u32(struct nvfx_context *nvfx, void *ib, nvfx_state_emit(nvfx); - vc = nouveau_vbuf_split(AVAIL_RING(chan), 5, 1, + unsigned avail = AVAIL_RING(chan); + avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ + + vc = nouveau_vbuf_split(avail, 5, 1, mode, start, count, &restart); if (vc == 0) { FIRE_RING(chan); @@ -427,7 +439,10 @@ nvfx_draw_elements_vbo(struct pipe_context *pipe, nvfx_state_emit(nvfx); - vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256, + unsigned avail = AVAIL_RING(chan); + avail -= 16 + (avail >> 10); /* for the BEGIN_RING_NIs, conservatively assuming one every 1024, plus 16 for safety */ + + vc = nouveau_vbuf_split(avail, 6, 256, mode, start, count, &restart); if (!vc) { FIRE_RING(chan);