* [PATCH] nouveau: avoid running out of relocs
@ 2009-12-04 21:59 Maarten Maathuis
[not found] ` <1259963980-6698-1-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Maarten Maathuis @ 2009-12-04 21:59 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Signed-off-by: Maarten Maathuis <madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h
index b595405..28f483f 100644
--- a/src/gallium/drivers/nouveau/nouveau_stateobj.h
+++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h
@@ -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++) {
--
1.6.5.3
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <1259963980-6698-1-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] nouveau: avoid running out of relocs [not found] ` <1259963980-6698-1-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2009-12-04 23:32 ` Ben Skeggs 2009-12-04 23:35 ` Maarten Maathuis 2009-12-05 16:07 ` Francisco Jerez 0 siblings, 2 replies; 6+ messages in thread From: Ben Skeggs @ 2009-12-04 23:32 UTC (permalink / raw) To: Maarten Maathuis; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW 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. On Fri, 2009-12-04 at 22:59 +0100, Maarten Maathuis wrote: > Signed-off-by: Maarten Maathuis <madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > --- > src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++---- > 1 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h > index b595405..28f483f 100644 > --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h > +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h > @@ -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++) { ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nouveau: avoid running out of relocs 2009-12-04 23:32 ` Ben Skeggs @ 2009-12-04 23:35 ` Maarten Maathuis [not found] ` <6d4bc9fc0912041535j44a0792bvb13395d683537466-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2009-12-05 16:07 ` Francisco Jerez 1 sibling, 1 reply; 6+ messages in thread From: Maarten Maathuis @ 2009-12-04 23:35 UTC (permalink / raw) To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW So the so_emit flush that was there was busted to begin with? On Sat, Dec 5, 2009 at 12:32 AM, Ben Skeggs <skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > 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. > > On Fri, 2009-12-04 at 22:59 +0100, Maarten Maathuis wrote: >> Signed-off-by: Maarten Maathuis <madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> --- >> src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++---- >> 1 files changed, 8 insertions(+), 4 deletions(-) >> >> diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h >> index b595405..28f483f 100644 >> --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h >> +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h >> @@ -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++) { > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <6d4bc9fc0912041535j44a0792bvb13395d683537466-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] nouveau: avoid running out of relocs [not found] ` <6d4bc9fc0912041535j44a0792bvb13395d683537466-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2009-12-04 23:50 ` Ben Skeggs 0 siblings, 0 replies; 6+ messages in thread From: Ben Skeggs @ 2009-12-04 23:50 UTC (permalink / raw) To: Maarten Maathuis; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW On Sat, 2009-12-05 at 00:35 +0100, Maarten Maathuis wrote: > So the so_emit flush 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. > > On Sat, Dec 5, 2009 at 12:32 AM, Ben Skeggs <skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > 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. > > > > On Fri, 2009-12-04 at 22:59 +0100, Maarten Maathuis wrote: > >> Signed-off-by: Maarten Maathuis <madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >> --- > >> src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++---- > >> 1 files changed, 8 insertions(+), 4 deletions(-) > >> > >> diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h > >> index b595405..28f483f 100644 > >> --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h > >> +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h > >> @@ -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++) { > > > > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nouveau: avoid running out of relocs 2009-12-04 23:32 ` Ben Skeggs 2009-12-04 23:35 ` Maarten Maathuis @ 2009-12-05 16:07 ` Francisco Jerez 1 sibling, 0 replies; 6+ messages in thread From: Francisco Jerez @ 2009-12-05 16:07 UTC (permalink / raw) To: skeggsb-Re5JQEeQqe8AvxtiuMwx3w; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW [-- Attachment #1.1.1: Type: text/plain, Size: 2542 bytes --] Ben Skeggs <skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > 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. > Ben. > > On Fri, 2009-12-04 at 22:59 +0100, Maarten Maathuis wrote: >> Signed-off-by: Maarten Maathuis <madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> --- >> src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++---- >> 1 files changed, 8 insertions(+), 4 deletions(-) >> >> diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h >> index b595405..28f483f 100644 >> --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h >> +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h >> @@ -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++) { > > > _______________________________________________ > Nouveau mailing list > Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org > http://lists.freedesktop.org/mailman/listinfo/nouveau [-- Attachment #1.2: Type: application/pgp-signature, Size: 196 bytes --] [-- Attachment #2: Type: text/plain, Size: 181 bytes --] _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] nouveau: avoid running out of relocs @ 2009-12-04 22:23 Maarten Maathuis 0 siblings, 0 replies; 6+ messages in thread From: Maarten Maathuis @ 2009-12-04 22:23 UTC (permalink / raw) To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Signed-off-by: Maarten Maathuis <madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- src/gallium/drivers/nouveau/nouveau_stateobj.h | 12 ++++++++---- src/gallium/drivers/nv50/nv50_query.c | 2 +- src/gallium/drivers/nv50/nv50_surface.c | 2 ++ src/gallium/drivers/nv50/nv50_transfer.c | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h index b595405..28f483f 100644 --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h @@ -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++) { diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c index 5305c93..744afd0 100644 --- a/src/gallium/drivers/nv50/nv50_query.c +++ b/src/gallium/drivers/nv50/nv50_query.c @@ -93,7 +93,7 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq) struct nouveau_grobj *tesla = nv50->screen->tesla; struct nv50_query *q = nv50_query(pq); - WAIT_RING (chan, 5); + MARK_RING(chan, 5, 2); /* flush on lack on space or relocs */ BEGIN_RING(chan, tesla, NV50TCL_QUERY_ADDRESS_HIGH, 4); OUT_RELOCh(chan, q->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); OUT_RELOCl(chan, q->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 6bf6f77..5d5e6dd 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -62,6 +62,7 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst) return 1; if (!bo->tile_flags) { + MARK_RING(chan, 9, 2); /* flush on lack on space or relocs */ BEGIN_RING(chan, eng2d, mthd, 2); OUT_RING (chan, format); OUT_RING (chan, 1); @@ -72,6 +73,7 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst) OUT_RELOCh(chan, bo, ps->offset, flags); OUT_RELOCl(chan, bo, ps->offset, flags); } else { + MARK_RING(chan, 11, 2); /* flush on lack on space or relocs */ BEGIN_RING(chan, eng2d, mthd, 5); OUT_RING (chan, format); OUT_RING (chan, 0); diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 4705f96..4686e3d 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -81,7 +81,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, while (height) { int line_count = height > 2047 ? 2047 : height; - WAIT_RING (chan, 15); + MARK_RING (chan, 15, 4); /* flush on lack on space or relocs */ BEGIN_RING(chan, m2mf, NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN_HIGH, 2); OUT_RELOCh(chan, src_bo, src_offset, src_reloc); @@ -282,7 +282,7 @@ nv50_upload_sifc(struct nv50_context *nv50, reloc |= NOUVEAU_BO_WR; - WAIT_RING (chan, 32); + MARK_RING (chan, 32, 2); /* flush on lack on space or relocs */ if (bo->tile_flags) { BEGIN_RING(chan, eng2d, NV50_2D_DST_FORMAT, 5); -- 1.6.5.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-12-05 16:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-04 21:59 [PATCH] nouveau: avoid running out of relocs Maarten Maathuis
[not found] ` <1259963980-6698-1-git-send-email-madman2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-12-04 23:32 ` Ben Skeggs
2009-12-04 23:35 ` Maarten Maathuis
[not found] ` <6d4bc9fc0912041535j44a0792bvb13395d683537466-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-04 23:50 ` Ben Skeggs
2009-12-05 16:07 ` Francisco Jerez
-- strict thread matches above, loose matches on Subject: below --
2009-12-04 22:23 Maarten Maathuis
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.