diff options
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_context.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_context.h | 16 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_screen.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_screen.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_state.c | 26 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_stateobj.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_transfer.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_winsys.h | 79 |
8 files changed, 29 insertions, 118 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c index a05408a6780..d41ee297d43 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nvc0/nvc0_context.c @@ -153,6 +153,7 @@ nvc0_bufctx_reset(struct nvc0_context *nvc0, int ctx) void nvc0_bufctx_emit_relocs(struct nvc0_context *nvc0) { + struct nouveau_channel *chan = nvc0->screen->base.channel; struct resident *rsd; struct util_dynarray *array; unsigned ctx, i; @@ -163,11 +164,11 @@ nvc0_bufctx_emit_relocs(struct nvc0_context *nvc0) for (i = 0; i < array->size / sizeof(struct resident); ++i) { rsd = util_dynarray_element(array, struct resident, i); - nvc0_make_bo_resident(nvc0, rsd->bo, rsd->flags); + nouveau_bo_validate(chan, rsd->bo, rsd->flags); } } - nvc0_make_bo_resident(nvc0, nvc0->screen->text, NOUVEAU_BO_RD); - nvc0_make_bo_resident(nvc0, nvc0->screen->uniforms, NOUVEAU_BO_RD); - nvc0_make_bo_resident(nvc0, nvc0->screen->txc, NOUVEAU_BO_RD); + nouveau_bo_validate(chan, nvc0->screen->text, NOUVEAU_BO_RD); + nouveau_bo_validate(chan, nvc0->screen->uniforms, NOUVEAU_BO_RD); + nouveau_bo_validate(chan, nvc0->screen->txc, NOUVEAU_BO_RD); } diff --git a/src/gallium/drivers/nvc0/nvc0_context.h b/src/gallium/drivers/nvc0/nvc0_context.h index df8a6da075b..962a2c0cf2c 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.h +++ b/src/gallium/drivers/nvc0/nvc0_context.h @@ -143,22 +143,6 @@ nvc0_surface(struct pipe_surface *ps) return (struct nvc0_surface *)ps; } -static INLINE void -nvc0_make_bo_resident(struct nvc0_context *nvc0, struct nouveau_bo *bo, - unsigned flags) -{ - nouveau_reloc_emit(nvc0->screen->base.channel, - NULL, 0, NULL, bo, 0, 0, flags, 0, 0); -} - -static INLINE void -nvc0_make_buffer_resident(struct nvc0_context *nvc0, - struct nvc0_resource *res, unsigned flags) -{ - nvc0_resource_validate(res, flags); - nvc0_make_bo_resident(nvc0, res->bo, flags); -} - /* nvc0_context.c */ struct pipe_context *nvc0_create(struct pipe_screen *, void *); diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index 7936ef37d17..de2ddb2fff8 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -451,7 +451,6 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 17, 1 << 20, &screen->text); if (ret) goto fail; - /* nouveau_bo_pin(dev, screen->text); */ nouveau_resource_init(&screen->text_heap, 0, 1 << 20); @@ -498,7 +497,6 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) &screen->mp_stack_bo); if (ret) goto fail; - /* nouveau_bo_pin(dev, screen->mp_stack_bo); */ BEGIN_RING(chan, RING_3D_(0x17bc), 3); OUT_RELOCh(chan, screen->mp_stack_bo, 0, NOUVEAU_BO_GART | NOUVEAU_BO_RDWR); @@ -508,7 +506,6 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 17, 1 << 17, &screen->txc); if (ret) goto fail; - /* nouveau_bo_pin(dev, screen->txc); */ BEGIN_RING(chan, RING_3D(TIC_ADDRESS_HIGH), 3); OUT_RELOCh(chan, screen->txc, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); @@ -622,9 +619,10 @@ nvc0_screen_make_buffers_resident(struct nvc0_screen *screen) const unsigned flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD; - nouveau_reloc_emit(chan, NULL, 0, NULL, screen->text, 0, 0, flags, 0, 0); - nouveau_reloc_emit(chan, NULL, 0, NULL, screen->txc, 0, 0, flags, 0, 0); - nouveau_reloc_emit(chan, NULL, 0, NULL, screen->tls, 0, 0, flags, 0, 0); + nouveau_bo_validate(chan, screen->text, flags); + nouveau_bo_validate(chan, screen->txc, flags); + nouveau_bo_validate(chan, screen->tls, flags); + nouveau_bo_validate(chan, screen->mp_stack_bo, flags); } int diff --git a/src/gallium/drivers/nvc0/nvc0_screen.h b/src/gallium/drivers/nvc0/nvc0_screen.h index 8aa77da2bf1..5b1b623356d 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.h +++ b/src/gallium/drivers/nvc0/nvc0_screen.h @@ -112,8 +112,7 @@ nvc0_resource_validate(struct nvc0_resource *res, uint32_t flags) if (flags & NOUVEAU_BO_WR) nvc0_fence_reference(&res->fence_wr, screen->fence.current); - nouveau_reloc_emit(screen->base.channel, - NULL, 0, NULL, res->bo, 0, 0, NOUVEAU_BO_RDWR, 0, 0); + nouveau_bo_validate(screen->base.channel, res->bo, flags); } diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index a462b543ad0..62abaa75774 100644 --- a/src/gallium/drivers/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nvc0/nvc0_state.c @@ -95,7 +95,7 @@ nvc0_blend_state_create(struct pipe_context *pipe, so->pipe = *cso; - SB_OUT_3D(so, BLEND_INDEPENDENT, cso->independent_blend_enable); + SB_IMMED_3D(so, BLEND_INDEPENDENT, cso->independent_blend_enable); if (!cso->independent_blend_enable) { SB_BEGIN_3D(so, BLEND_ENABLES, 1); @@ -143,7 +143,7 @@ nvc0_blend_state_create(struct pipe_context *pipe, SB_DATA (so, 1); SB_DATA (so, nvgl_logicop_func(cso->logicop_func)); } else { - SB_OUT_3D (so, LOGIC_OP_ENABLE, 0); + SB_IMMED_3D(so, LOGIC_OP_ENABLE, 0); } assert(so->size < (sizeof(so->state) / sizeof(so->state[0]))); @@ -177,18 +177,18 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe, so->pipe = *cso; #ifndef NVC0_SCISSORS_CLIPPING - SB_OUT_3D (so, SCISSOR_ENABLE(0), cso->scissor); + SB_IMMED_3D(so, SCISSOR_ENABLE(0), cso->scissor); #endif SB_BEGIN_3D(so, SHADE_MODEL, 1); SB_DATA (so, cso->flatshade ? NVC0_3D_SHADE_MODEL_FLAT : NVC0_3D_SHADE_MODEL_SMOOTH); - SB_OUT_3D (so, PROVOKING_VERTEX_LAST, !cso->flatshade_first); - SB_OUT_3D (so, VERTEX_TWO_SIDE_ENABLE, cso->light_twoside); + SB_IMMED_3D(so, PROVOKING_VERTEX_LAST, !cso->flatshade_first); + SB_IMMED_3D(so, VERTEX_TWO_SIDE_ENABLE, cso->light_twoside); SB_BEGIN_3D(so, LINE_WIDTH, 1); SB_DATA (so, fui(cso->line_width)); - SB_OUT_3D (so, LINE_SMOOTH_ENABLE, cso->line_smooth); + SB_IMMED_3D(so, LINE_SMOOTH_ENABLE, cso->line_smooth); SB_BEGIN_3D(so, LINE_STIPPLE_ENABLE, 1); if (cso->line_stipple_enable) { @@ -201,18 +201,18 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe, SB_DATA (so, 0); } - SB_OUT_3D(so, VP_POINT_SIZE_EN, cso->point_size_per_vertex); + SB_IMMED_3D(so, VP_POINT_SIZE_EN, cso->point_size_per_vertex); if (!cso->point_size_per_vertex) { SB_BEGIN_3D(so, POINT_SIZE, 1); SB_DATA (so, fui(cso->point_size)); } - SB_OUT_3D(so, POINT_SPRITE_ENABLE, cso->point_quad_rasterization); + SB_IMMED_3D(so, POINT_SPRITE_ENABLE, cso->point_quad_rasterization); SB_BEGIN_3D(so, POLYGON_MODE_FRONT, 1); SB_DATA (so, nvgl_polygon_mode(cso->fill_front)); SB_BEGIN_3D(so, POLYGON_MODE_BACK, 1); SB_DATA (so, nvgl_polygon_mode(cso->fill_back)); - SB_OUT_3D (so, POLYGON_SMOOTH_ENABLE, cso->poly_smooth); + SB_IMMED_3D(so, POLYGON_SMOOTH_ENABLE, cso->poly_smooth); SB_BEGIN_3D(so, CULL_FACE_ENABLE, 3); SB_DATA (so, cso->cull_face != PIPE_FACE_NONE); @@ -231,7 +231,7 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe, break; } - SB_OUT_3D (so, POLYGON_STIPPLE_ENABLE, cso->poly_stipple_enable); + SB_IMMED_3D(so, POLYGON_STIPPLE_ENABLE, cso->poly_stipple_enable); SB_BEGIN_3D(so, POLYGON_OFFSET_POINT_ENABLE, 3); SB_DATA (so, cso->offset_point); SB_DATA (so, cso->offset_line); @@ -271,7 +271,7 @@ nvc0_zsa_state_create(struct pipe_context *pipe, so->pipe = *cso; - SB_OUT_3D (so, DEPTH_WRITE_ENABLE, cso->depth.writemask); + SB_IMMED_3D(so, DEPTH_WRITE_ENABLE, cso->depth.writemask); SB_BEGIN_3D(so, DEPTH_TEST_ENABLE, 1); if (cso->depth.enabled) { SB_DATA (so, 1); @@ -292,7 +292,7 @@ nvc0_zsa_state_create(struct pipe_context *pipe, SB_DATA (so, cso->stencil[0].writemask); SB_DATA (so, cso->stencil[0].valuemask); } else { - SB_OUT_3D (so, STENCIL_FRONT_ENABLE, 0); + SB_IMMED_3D(so, STENCIL_FRONT_ENABLE, 0); } if (cso->stencil[1].enabled) { @@ -306,7 +306,7 @@ nvc0_zsa_state_create(struct pipe_context *pipe, SB_DATA (so, cso->stencil[1].writemask); SB_DATA (so, cso->stencil[1].valuemask); } else { - SB_OUT_3D (so, STENCIL_TWO_SIDE_ENABLE, 0); + SB_IMMED_3D(so, STENCIL_TWO_SIDE_ENABLE, 0); } SB_BEGIN_3D(so, ALPHA_TEST_ENABLE, 1); diff --git a/src/gallium/drivers/nvc0/nvc0_stateobj.h b/src/gallium/drivers/nvc0/nvc0_stateobj.h index 67674d4093f..e7cd94800de 100644 --- a/src/gallium/drivers/nvc0/nvc0_stateobj.h +++ b/src/gallium/drivers/nvc0/nvc0_stateobj.h @@ -10,7 +10,7 @@ (so)->state[(so)->size++] = \ (0x2 << 28) | ((s) << 16) | (NVC0_SUBCH_3D << 13) | ((NVC0_3D_##m) >> 2) -#define SB_OUT_3D(so, m, d) \ +#define SB_IMMED_3D(so, m, d) \ (so)->state[(so)->size++] = \ (0x8 << 28) | ((d) << 16) | (NVC0_SUBCH_3D << 13) | ((NVC0_3D_##m) >> 2) diff --git a/src/gallium/drivers/nvc0/nvc0_transfer.c b/src/gallium/drivers/nvc0/nvc0_transfer.c index 67f6321cac6..138d157652b 100644 --- a/src/gallium/drivers/nvc0/nvc0_transfer.c +++ b/src/gallium/drivers/nvc0/nvc0_transfer.c @@ -127,7 +127,7 @@ nvc0_m2mf_push_linear(struct nvc0_context *nvc0, if (nr < 9) { FIRE_RING(chan); - nvc0_make_bo_resident(nvc0, dst, NOUVEAU_BO_WR); + nouveau_bo_validate(chan, dst, NOUVEAU_BO_WR); continue; } nr = MIN2(count, nr - 1); diff --git a/src/gallium/drivers/nvc0/nvc0_winsys.h b/src/gallium/drivers/nvc0/nvc0_winsys.h index 85f8ed4da49..af7711031f1 100644 --- a/src/gallium/drivers/nvc0/nvc0_winsys.h +++ b/src/gallium/drivers/nvc0/nvc0_winsys.h @@ -11,6 +11,7 @@ #include "nouveau/nouveau_grobj.h" #include "nouveau/nouveau_device.h" #include "nouveau/nouveau_resource.h" +#include "nouveau/nouveau_pushbuf.h" #include "nouveau/nouveau_reloc.h" #include "nvc0_resource.h" /* OUT_RESRC */ @@ -44,16 +45,10 @@ nouveau_bo_tile_layout(struct nouveau_bo *bo) } static INLINE void -WAIT_RING(struct nouveau_channel *chan, unsigned size) +nouveau_bo_validate(struct nouveau_channel *chan, + struct nouveau_bo *bo, unsigned flags) { - if (chan->cur + size > chan->end) - nouveau_pushbuf_flush(chan, size); -} - -static INLINE void -OUT_RING(struct nouveau_channel *chan, uint32_t data) -{ - *(chan->cur++) = (data); + nouveau_reloc_emit(chan, NULL, 0, NULL, bo, 0, 0, flags, 0, 0); } /* incremental methods */ @@ -88,66 +83,6 @@ IMMED_RING(struct nouveau_channel *chan, uint32_t mthd, unsigned data) OUT_RING (chan, (0x8 << 28) | (data << 16) | mthd); } -int -nouveau_pushbuf_marker_emit(struct nouveau_channel *chan, - unsigned wait_dwords, unsigned wait_relocs); -int -nouveau_pushbuf_emit_reloc(struct nouveau_channel *, void *ptr, - struct nouveau_bo *, uint32_t data, uint32_t data2, - uint32_t flags, uint32_t vor, uint32_t tor); -int -nouveau_pushbuf_submit(struct nouveau_channel *chan, struct nouveau_bo *bo, - unsigned offset, unsigned length); - -static INLINE int -MARK_RING(struct nouveau_channel *chan, unsigned dwords, unsigned relocs) -{ - return nouveau_pushbuf_marker_emit(chan, dwords, relocs); -} - -static INLINE void -OUT_RINGf(struct nouveau_channel *chan, float data) -{ - union { uint32_t i; float f; } u; - u.f = data; - OUT_RING(chan, u.i); -} - -static INLINE unsigned -AVAIL_RING(struct nouveau_channel *chan) -{ - return chan->end - chan->cur; -} - -static INLINE void -OUT_RINGp(struct nouveau_channel *chan, const void *data, unsigned size) -{ - memcpy(chan->cur, data, size * 4); - chan->cur += size; -} - -static INLINE int -OUT_RELOC(struct nouveau_channel *chan, struct nouveau_bo *bo, - unsigned data, unsigned flags, unsigned vor, unsigned tor) -{ - return nouveau_pushbuf_emit_reloc(chan, chan->cur++, bo, - data, 0, flags, vor, tor); -} - -static INLINE int -OUT_RELOCl(struct nouveau_channel *chan, struct nouveau_bo *bo, - unsigned delta, unsigned flags) -{ - return OUT_RELOC(chan, bo, delta, flags | NOUVEAU_BO_LOW, 0, 0); -} - -static INLINE int -OUT_RELOCh(struct nouveau_channel *chan, struct nouveau_bo *bo, - unsigned delta, unsigned flags) -{ - return OUT_RELOC(chan, bo, delta, flags | NOUVEAU_BO_HIGH, 0, 0); -} - static INLINE int OUT_RESRCh(struct nouveau_channel *chan, struct nvc0_resource *res, unsigned delta, unsigned flags) @@ -163,12 +98,6 @@ OUT_RESRCl(struct nouveau_channel *chan, struct nvc0_resource *res, } static INLINE void -FIRE_RING(struct nouveau_channel *chan) -{ - nouveau_pushbuf_flush(chan, 0); -} - -static INLINE void BIND_RING(struct nouveau_channel *chan, struct nouveau_grobj *gr, unsigned s) { struct nouveau_subchannel *subc = &gr->channel->subc[s]; |