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);
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);
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);
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);
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);