nouveau: avoid running out of relocs
PATCH 1/1 nouveau: avoid running out of relocs
--- src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
src/gallium/drivers/nouveau/nouveau_stateobj.h +8 -4
@@ -113,8 +113,10 @@ so_emit(struct nouveau_channel *chan, struct nouveau_stateobj *so)unsigned nr, i; nr = so->cur - so->push; -if (pb->remaining < nr) -nouveau_pushbuf_flush (chan, nr); +/* This will flush if we need space. +* We don't actually need the marker. +*/ +nouveau_pushbuf_marker_emit (chan, nr, so->cur_reloc); pb->remaining -= nr;memcpy (pb->cur, so->push, nr *4 );
@@ -138,8 +140,10 @@ so_emit_reloc_markers(struct nouveau_channel *chan, struct nouveau_stateobj *so)return ; i = so->cur_reloc <<1 ; -if (pb->remaining < i) -nouveau_pushbuf_flush (chan, i); +/* This will flush if we need space. +* We don't actually need the marker. +*/ +nouveau_pushbuf_marker_emit (chan, i, i); pb->remaining -= i;for (i =0 ; i < so->cur_reloc; i++) {
Signature · 1 line
1.6.5.3
A message that is not in the archive (sent off-list or not yet received): 1259963980-6698-1-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
NACK. You'll want to do this once, at the start of nv50_state_emit(), if we run out *during* state_emit() something's gone very wrong, and we'd need to fallback to software as the DDX does.
Having the flush occur mid-frame will cause other issues.
Ben.
Quoted 35 lines · Maarten Maathuis
Signed-off-by Maarten Maathuis <[email protected]>--- src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)src/gallium/drivers/nouveau/nouveau_stateobj.h +8
-4@@ -113,8 +113,10 @@ so_emit(struct nouveau_channel *chan, struct nouveau_stateobj *so)unsigned nr, i; nr = so->cur - so->push; -if (pb->remaining < nr) -nouveau_pushbuf_flush (chan, nr); +/* This will flush if we need space. +* We don't actually need the marker. +*/ +nouveau_pushbuf_marker_emit (chan, nr, so->cur_reloc); pb->remaining -= nr;memcpy (pb->cur, so->push, nr *4 );@@ -138,8 +140,10 @@ so_emit_reloc_markers(struct nouveau_channel *chan, struct nouveau_stateobj *so)return ; i = so->cur_reloc <<1 ; -if (pb->remaining < i) -nouveau_pushbuf_flush (chan, i); +/* This will flush if we need space. +* We don't actually need the marker. +*/ +nouveau_pushbuf_marker_emit (chan, i, i); pb->remaining -= i;for (i =0 ; i < so->cur_reloc; i++) {
So the so_emit flush that was there was busted to begin with?
Quoted 47 lines · Ben Skeggs
NACK. You'll want to do this once, at the start of
nv50_state_emit(), if we run out *during*state_emit()something's gone very wrong, and we'd need to fallback to software as the DDX does.Having the flush occur mid-frame will cause other issues.
Ben.
Quoted 35 lines · Maarten Maathuis
Signed-off-by Maarten Maathuis <[email protected]>---
src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++----1 files changed, 8 insertions(+), 4 deletions(-)src/gallium/drivers/nouveau/nouveau_stateobj.h +8
-4@@ -113,8 +113,10 @@ so_emit(struct nouveau_channel *chan, struct nouveau_stateobj *so) unsigned nr, i; nr = so->cur - so->push; - if (pb->remaining < nr) - nouveau_pushbuf_flush(chan, nr); + /* This will flush if we need space. + * We don't actually need the marker. + */ + nouveau_pushbuf_marker_emit(chan, nr, so->cur_reloc); pb->remaining -= nr; memcpy(pb->cur, so->push, nr * 4);@@ -138,8 +140,10 @@ so_emit_reloc_markers(struct nouveau_channel *chan, struct nouveau_stateobj *so) return; i = so->cur_reloc << 1; - if (pb->remaining < i) - nouveau_pushbuf_flush(chan, i); + /* This will flush if we need space. + * We don't actually need the marker. + */ + nouveau_pushbuf_marker_emit(chan, i, i); pb->remaining -= i; for (i = 0; i < so->cur_reloc; i++) {
A message that is not in the archive (sent off-list or not yet received): 6d4bc9fc0912041535j44a0792bvb13395d683537466-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 1 line · Maarten Maathuis
So the
so_emitflush that was there was busted to begin with?
Yes indeed. It's probably a remnant of the old days :) We need to do what the DDX does, and use MARK_RING() (which'll also check available pushbuf space) in the places it's safe to flush.
Quoted 49 lines · Ben Skeggs
Quoted 47 lines
NACK. You'll want to do this once, at the start of
nv50_state_emit(), if we run out *during*state_emit()something's gone very wrong, and we'd need to fallback to software as the DDX does.Having the flush occur mid-frame will cause other issues.
Ben.
Quoted 35 lines · Maarten Maathuis
Signed-off-by Maarten Maathuis <[email protected]>--- src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)src/gallium/drivers/nouveau/nouveau_stateobj.h +8
-4@@ -113,8 +113,10 @@ so_emit(struct nouveau_channel *chan, struct nouveau_stateobj *so)unsigned nr, i; nr = so->cur - so->push; -if (pb->remaining < nr) -nouveau_pushbuf_flush (chan, nr); +/* This will flush if we need space. +* We don't actually need the marker. +*/ +nouveau_pushbuf_marker_emit (chan, nr, so->cur_reloc); pb->remaining -= nr;memcpy (pb->cur, so->push, nr *4 );@@ -138,8 +140,10 @@ so_emit_reloc_markers(struct nouveau_channel *chan, struct nouveau_stateobj *so)return ; i = so->cur_reloc <<1 ; -if (pb->remaining < i) -nouveau_pushbuf_flush (chan, i); +/* This will flush if we need space. +* We don't actually need the marker. +*/ +nouveau_pushbuf_marker_emit (chan, i, i); pb->remaining -= i;for (i =0 ; i < so->cur_reloc; i++) {
Quoted 6 lines · Ben Skeggs
NACK. You'll want to do this once, at the start of
nv50_state_emit(), if we run out *during*state_emit()something's gone very wrong, and we'd need to fallback to software as the DDX does.Having the flush occur mid-frame will cause other issues.
It shouldn't, at least for nv50. If a mid-frame flush happens nv50_state_flush_notify() will re-emit anything that's needed to go on with the state emission, so Maarten's proposal looks fine to me as long as he or someone else fixes the nv[34]0 pipe drivers to use flush notifiers. :)
Software fallbacks could still be handled this way: if a BO cannot be relocated you just rewind the pushbuf up to the last marker and then you kick it off to clean up any references to the buffers software rendering is going to be performed on.
Quoted 37 lines
Ben.
Quoted 34 lines · Maarten Maathuis
Signed-off-by Maarten Maathuis <[email protected]>--- src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)src/gallium/drivers/nouveau/nouveau_stateobj.h +8
-4@@ -113,8 +113,10 @@ so_emit(struct nouveau_channel *chan, struct nouveau_stateobj *so)unsigned nr, i; nr = so->cur - so->push; -if (pb->remaining < nr) -nouveau_pushbuf_flush (chan, nr); +/* This will flush if we need space. +* We don't actually need the marker. +*/ +nouveau_pushbuf_marker_emit (chan, nr, so->cur_reloc); pb->remaining -= nr;memcpy (pb->cur, so->push, nr *4 );@@ -138,8 +140,10 @@ so_emit_reloc_markers(struct nouveau_channel *chan, struct nouveau_stateobj *so)return ; i = so->cur_reloc <<1 ; -if (pb->remaining < i) -nouveau_pushbuf_flush (chan, i); +/* This will flush if we need space. +* We don't actually need the marker. +*/ +nouveau_pushbuf_marker_emit (chan, i, i); pb->remaining -= i;
Quoted 7 lines
src/gallium/drivers/nouveau/nouveau_stateobj.h so_emit_reloc_markers(struct nouveau_channel *chan, struct nouveau_stateobj *so) · line 149
Quoted 1 line
src/gallium/drivers/nouveau/nouveau_stateobj.h +0
-0for (i =0 ; i < so->cur_reloc; i++) {_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau