Maarten Maathuis
2009-Dec-04 21:59 UTC
[Nouveau] [PATCH] nouveau: avoid running out of relocs
Signed-off-by: Maarten Maathuis <madman2003 at gmail.com> --- 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
Maarten Maathuis
2009-Dec-04 22:23 UTC
[Nouveau] [PATCH] nouveau: avoid running out of relocs
Signed-off-by: Maarten Maathuis <madman2003 at gmail.com> --- 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
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 at gmail.com> > --- > 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++) {
Maarten Maathuis
2009-Dec-04 23:35 UTC
[Nouveau] [PATCH] nouveau: avoid running out of relocs
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 at gmail.com> 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 at gmail.com> >> --- >> ?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++) { > > >
Possibly Parallel Threads
- [PATCH] nouveau: avoid running out of relocs (attempt 4)
- [PATCH] nouveau: avoid running out of relocs (attempt 5)
- [PATCH] nouveau: avoid running out of relocs (attempt 3)
- [PATCH 1/2] nv50: don't emit reloc markers after a referenced vtxbuf is mapped
- [PATCH 1/3] nv50: remove vtxbuf stateobject after a referenced vtxbuf is mapped