summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvfx
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-04-12 09:36:28 +0200
committerLuca Barbieri <[email protected]>2010-04-12 12:13:15 +0200
commit507dc546c3da415036521fcf91e76af88c2cbf69 (patch)
treee8a1753eaff0cff20ea135ae75e9ff327766c351 /src/gallium/drivers/nvfx
parentf0b8677d57f32ea66c997dfc8c3bf06987c6ebcd (diff)
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).
Diffstat (limited to 'src/gallium/drivers/nvfx')
-rw-r--r--src/gallium/drivers/nvfx/nvfx_vbo.c25
1 files changed, 20 insertions, 5 deletions
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);