diff options
author | Christoph Bumiller <[email protected]> | 2012-04-06 15:41:55 +0200 |
---|---|---|
committer | Ben Skeggs <[email protected]> | 2012-04-14 02:56:33 +1000 |
commit | 6d1cdec3ba151168bfc3aef222fba6265dfb41fb (patch) | |
tree | c8c013eaa14e1b7463b6b3f39221524d901370f6 /src/gallium/drivers/nvc0/nvc0_surface.c | |
parent | 3c7872f35f4ae439082d413ab31333cf99be7e91 (diff) |
nouveau: switch to libdrm_nouveau-2.0
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_surface.c')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_surface.c | 400 |
1 files changed, 198 insertions, 202 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c index 46b5da551db..cb5091ae376 100644 --- a/src/gallium/drivers/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nvc0/nvc0_surface.c @@ -73,14 +73,13 @@ nvc0_2d_format(enum pipe_format format) } static int -nvc0_2d_texture_set(struct nouveau_channel *chan, int dst, +nvc0_2d_texture_set(struct nouveau_pushbuf *push, boolean dst, struct nv50_miptree *mt, unsigned level, unsigned layer) { struct nouveau_bo *bo = mt->base.bo; uint32_t width, height, depth; uint32_t format; uint32_t mthd = dst ? NVC0_2D_DST_FORMAT : NVC0_2D_SRC_FORMAT; - uint32_t flags = mt->base.domain | (dst ? NOUVEAU_BO_WR : NOUVEAU_BO_RD); uint32_t offset = mt->level[level].offset; format = nvc0_2d_format(mt->base.base.format); @@ -106,44 +105,44 @@ nvc0_2d_texture_set(struct nouveau_channel *chan, int dst, layer = 0; } - if (!(bo->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK)) { - BEGIN_RING(chan, RING_2D_(mthd), 2); - OUT_RING (chan, format); - OUT_RING (chan, 1); - BEGIN_RING(chan, RING_2D_(mthd + 0x14), 5); - OUT_RING (chan, mt->level[level].pitch); - OUT_RING (chan, width); - OUT_RING (chan, height); - OUT_RELOCh(chan, bo, offset, flags); - OUT_RELOCl(chan, bo, offset, flags); + if (nouveau_bo_memtype(bo)) { + BEGIN_NVC0(push, SUBC_2D(mthd), 2); + PUSH_DATA (push, format); + PUSH_DATA (push, 1); + BEGIN_NVC0(push, SUBC_2D(mthd + 0x14), 5); + PUSH_DATA (push, mt->level[level].pitch); + PUSH_DATA (push, width); + PUSH_DATA (push, height); + PUSH_DATAh(push, bo->offset + offset); + PUSH_DATA (push, bo->offset + offset); } else { - BEGIN_RING(chan, RING_2D_(mthd), 5); - OUT_RING (chan, format); - OUT_RING (chan, 0); - OUT_RING (chan, mt->level[level].tile_mode); - OUT_RING (chan, depth); - OUT_RING (chan, layer); - BEGIN_RING(chan, RING_2D_(mthd + 0x18), 4); - OUT_RING (chan, width); - OUT_RING (chan, height); - OUT_RELOCh(chan, bo, offset, flags); - OUT_RELOCl(chan, bo, offset, flags); + BEGIN_NVC0(push, SUBC_2D(mthd), 5); + PUSH_DATA (push, format); + PUSH_DATA (push, 0); + PUSH_DATA (push, mt->level[level].tile_mode); + PUSH_DATA (push, depth); + PUSH_DATA (push, layer); + BEGIN_NVC0(push, SUBC_2D(mthd + 0x18), 4); + PUSH_DATA (push, width); + PUSH_DATA (push, height); + PUSH_DATAh(push, bo->offset + offset); + PUSH_DATA (push, bo->offset + offset); } #if 0 if (dst) { - BEGIN_RING(chan, RING_2D_(NVC0_2D_CLIP_X), 4); - OUT_RING (chan, 0); - OUT_RING (chan, 0); - OUT_RING (chan, width); - OUT_RING (chan, height); + BEGIN_NVC0(push, SUBC_2D(NVC0_2D_CLIP_X), 4); + PUSH_DATA (push, 0); + PUSH_DATA (push, 0); + PUSH_DATA (push, width); + PUSH_DATA (push, height); } #endif return 0; } static int -nvc0_2d_texture_do_copy(struct nouveau_channel *chan, +nvc0_2d_texture_do_copy(struct nouveau_pushbuf *push, struct nv50_miptree *dst, unsigned dst_level, unsigned dx, unsigned dy, unsigned dz, struct nv50_miptree *src, unsigned src_level, @@ -158,15 +157,15 @@ nvc0_2d_texture_do_copy(struct nouveau_channel *chan, int ret; uint32_t ctrl = 0x00; - ret = MARK_RING(chan, 2 * 16 + 32, 4); + ret = PUSH_SPACE(push, 2 * 16 + 32); if (ret) return ret; - ret = nvc0_2d_texture_set(chan, 1, dst, dst_level, dz); + ret = nvc0_2d_texture_set(push, TRUE, dst, dst_level, dz); if (ret) return ret; - ret = nvc0_2d_texture_set(chan, 0, src, src_level, sz); + ret = nvc0_2d_texture_set(push, FALSE, src, src_level, sz); if (ret) return ret; @@ -175,23 +174,23 @@ nvc0_2d_texture_do_copy(struct nouveau_channel *chan, ctrl = 0x11; /* 0/1 = CENTER/CORNER, 00/10 = POINT/BILINEAR */ - BEGIN_RING(chan, RING_2D(BLIT_CONTROL), 1); - OUT_RING (chan, ctrl); - BEGIN_RING(chan, RING_2D(BLIT_DST_X), 4); - OUT_RING (chan, dx << dst->ms_x); - OUT_RING (chan, dy << dst->ms_y); - OUT_RING (chan, w << dst->ms_x); - OUT_RING (chan, h << dst->ms_y); - BEGIN_RING(chan, RING_2D(BLIT_DU_DX_FRACT), 4); - OUT_RING (chan, duvdxy[2 + ((int)src->ms_x - (int)dst->ms_x)] & 0xf0000000); - OUT_RING (chan, duvdxy[2 + ((int)src->ms_x - (int)dst->ms_x)] & 0x0000000f); - OUT_RING (chan, duvdxy[2 + ((int)src->ms_y - (int)dst->ms_y)] & 0xf0000000); - OUT_RING (chan, duvdxy[2 + ((int)src->ms_y - (int)dst->ms_y)] & 0x0000000f); - BEGIN_RING(chan, RING_2D(BLIT_SRC_X_FRACT), 4); - OUT_RING (chan, 0); - OUT_RING (chan, sx << src->ms_x); - OUT_RING (chan, 0); - OUT_RING (chan, sy << src->ms_x); + BEGIN_NVC0(push, NVC0_2D(BLIT_CONTROL), 1); + PUSH_DATA (push, ctrl); + BEGIN_NVC0(push, NVC0_2D(BLIT_DST_X), 4); + PUSH_DATA (push, dx << dst->ms_x); + PUSH_DATA (push, dy << dst->ms_y); + PUSH_DATA (push, w << dst->ms_x); + PUSH_DATA (push, h << dst->ms_y); + BEGIN_NVC0(push, NVC0_2D(BLIT_DU_DX_FRACT), 4); + PUSH_DATA (push, duvdxy[2 + ((int)src->ms_x - (int)dst->ms_x)] & 0xf0000000); + PUSH_DATA (push, duvdxy[2 + ((int)src->ms_x - (int)dst->ms_x)] & 0x0000000f); + PUSH_DATA (push, duvdxy[2 + ((int)src->ms_y - (int)dst->ms_y)] & 0xf0000000); + PUSH_DATA (push, duvdxy[2 + ((int)src->ms_y - (int)dst->ms_y)] & 0x0000000f); + BEGIN_NVC0(push, NVC0_2D(BLIT_SRC_X_FRACT), 4); + PUSH_DATA (push, 0); + PUSH_DATA (push, sx << src->ms_x); + PUSH_DATA (push, 0); + PUSH_DATA (push, sy << src->ms_x); return 0; } @@ -203,7 +202,7 @@ nvc0_resource_copy_region(struct pipe_context *pipe, struct pipe_resource *src, unsigned src_level, const struct pipe_box *src_box) { - struct nvc0_screen *screen = nvc0_context(pipe)->screen; + struct nvc0_context *nvc0 = nvc0_context(pipe); int ret; boolean m2mf; unsigned dst_layer = dstz, src_layer = src_box->z; @@ -234,7 +233,7 @@ nvc0_resource_copy_region(struct pipe_context *pipe, src_box->x, src_box->y, src_box->z); for (i = 0; i < src_box->depth; ++i) { - nvc0_m2mf_transfer_rect(&screen->base.base, &drect, &srect, nx, ny); + nvc0_m2mf_transfer_rect(nvc0, &drect, &srect, nx, ny); if (nv50_miptree(dst)->layout_3d) drect.z++; @@ -252,16 +251,22 @@ nvc0_resource_copy_region(struct pipe_context *pipe, assert(nvc0_2d_format_faithful(src->format)); assert(nvc0_2d_format_faithful(dst->format)); + BCTX_REFN(nvc0->bufctx, 2D, nv04_resource(src), RD); + BCTX_REFN(nvc0->bufctx, 2D, nv04_resource(dst), WR); + nouveau_pushbuf_bufctx(nvc0->base.pushbuf, nvc0->bufctx); + nouveau_pushbuf_validate(nvc0->base.pushbuf); + for (; dst_layer < dstz + src_box->depth; ++dst_layer, ++src_layer) { - ret = nvc0_2d_texture_do_copy(screen->base.channel, + ret = nvc0_2d_texture_do_copy(nvc0->base.pushbuf, nv50_miptree(dst), dst_level, dstx, dsty, dst_layer, nv50_miptree(src), src_level, src_box->x, src_box->y, src_layer, src_box->width, src_box->height); if (ret) - return; + break; } + nouveau_bufctx_reset(nvc0->bufctx, 0); } static void @@ -271,69 +276,65 @@ nvc0_clear_render_target(struct pipe_context *pipe, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { - struct nvc0_context *nv50 = nvc0_context(pipe); - struct nvc0_screen *screen = nv50->screen; - struct nouveau_channel *chan = screen->base.channel; + struct nvc0_context *nvc0 = nvc0_context(pipe); + struct nouveau_pushbuf *push = nvc0->base.pushbuf; struct nv50_surface *sf = nv50_surface(dst); struct nv04_resource *res = nv04_resource(sf->base.texture); unsigned z; - BEGIN_RING(chan, RING_3D(CLEAR_COLOR(0)), 4); - OUT_RINGf (chan, color->f[0]); - OUT_RINGf (chan, color->f[1]); - OUT_RINGf (chan, color->f[2]); - OUT_RINGf (chan, color->f[3]); - - if (MARK_RING(chan, 18, 2)) - return; - - BEGIN_RING(chan, RING_3D(SCREEN_SCISSOR_HORIZ), 2); - OUT_RING (chan, ( width << 16) | dstx); - OUT_RING (chan, (height << 16) | dsty); - - BEGIN_RING(chan, RING_3D(RT_CONTROL), 1); - OUT_RING (chan, 1); - BEGIN_RING(chan, RING_3D(RT_ADDRESS_HIGH(0)), 9); - OUT_RESRCh(chan, res, sf->offset, NOUVEAU_BO_WR); - OUT_RESRCl(chan, res, sf->offset, NOUVEAU_BO_WR); - if (likely(nouveau_bo_tile_layout(res->bo))) { + BEGIN_NVC0(push, NVC0_3D(CLEAR_COLOR(0)), 4); + PUSH_DATAf(push, color->f[0]); + PUSH_DATAf(push, color->f[1]); + PUSH_DATAf(push, color->f[2]); + PUSH_DATAf(push, color->f[3]); + + BEGIN_NVC0(push, NVC0_3D(SCREEN_SCISSOR_HORIZ), 2); + PUSH_DATA (push, ( width << 16) | dstx); + PUSH_DATA (push, (height << 16) | dsty); + + BEGIN_NVC0(push, NVC0_3D(RT_CONTROL), 1); + PUSH_DATA (push, 1); + BEGIN_NVC0(push, NVC0_3D(RT_ADDRESS_HIGH(0)), 9); + PUSH_DATAh(push, res->address + sf->offset); + PUSH_DATA (push, res->address + sf->offset); + if (likely(nouveau_bo_memtype(res->bo))) { struct nv50_miptree *mt = nv50_miptree(dst->texture); - OUT_RING(chan, sf->width); - OUT_RING(chan, sf->height); - OUT_RING(chan, nvc0_format_table[dst->format].rt); - OUT_RING(chan, (mt->layout_3d << 16) | + PUSH_DATA(push, sf->width); + PUSH_DATA(push, sf->height); + PUSH_DATA(push, nvc0_format_table[dst->format].rt); + PUSH_DATA(push, (mt->layout_3d << 16) | mt->level[sf->base.u.tex.level].tile_mode); - OUT_RING(chan, dst->u.tex.first_layer + sf->depth); - OUT_RING(chan, mt->layer_stride >> 2); - OUT_RING(chan, dst->u.tex.first_layer); + PUSH_DATA(push, dst->u.tex.first_layer + sf->depth); + PUSH_DATA(push, mt->layer_stride >> 2); + PUSH_DATA(push, dst->u.tex.first_layer); } else { if (res->base.target == PIPE_BUFFER) { - OUT_RING(chan, 262144); - OUT_RING(chan, 1); + PUSH_DATA(push, 262144); + PUSH_DATA(push, 1); } else { - OUT_RING(chan, nv50_miptree(&res->base)->level[0].pitch); - OUT_RING(chan, sf->height); + PUSH_DATA(push, nv50_miptree(&res->base)->level[0].pitch); + PUSH_DATA(push, sf->height); } - OUT_RING(chan, nvc0_format_table[sf->base.format].rt); - OUT_RING(chan, 1 << 12); - OUT_RING(chan, 1); - OUT_RING(chan, 0); - OUT_RING(chan, 0); + PUSH_DATA(push, nvc0_format_table[sf->base.format].rt); + PUSH_DATA(push, 1 << 12); + PUSH_DATA(push, 1); + PUSH_DATA(push, 0); + PUSH_DATA(push, 0); - IMMED_RING(chan, RING_3D(ZETA_ENABLE), 0); + IMMED_NVC0(push, NVC0_3D(ZETA_ENABLE), 0); /* tiled textures don't have to be fenced, they're not mapped directly */ nvc0_resource_fence(res, NOUVEAU_BO_WR); } for (z = 0; z < sf->depth; ++z) { - BEGIN_RING(chan, RING_3D(CLEAR_BUFFERS), 1); - OUT_RING (chan, 0x3c | + BEGIN_NVC0(push, NVC0_3D(CLEAR_BUFFERS), 1); + PUSH_DATA (push, 0x3c | (z << NVC0_3D_CLEAR_BUFFERS_LAYER__SHIFT)); } - nv50->dirty |= NVC0_NEW_FRAMEBUFFER; + nvc0->dirty |= NVC0_NEW_FRAMEBUFFER; } static void @@ -345,57 +346,52 @@ nvc0_clear_depth_stencil(struct pipe_context *pipe, unsigned dstx, unsigned dsty, unsigned width, unsigned height) { - struct nvc0_context *nv50 = nvc0_context(pipe); - struct nvc0_screen *screen = nv50->screen; - struct nouveau_channel *chan = screen->base.channel; + struct nvc0_context *nvc0 = nvc0_context(pipe); + struct nouveau_pushbuf *push = nvc0->base.pushbuf; struct nv50_miptree *mt = nv50_miptree(dst->texture); struct nv50_surface *sf = nv50_surface(dst); - struct nouveau_bo *bo = mt->base.bo; uint32_t mode = 0; int unk = mt->base.base.target == PIPE_TEXTURE_2D; unsigned z; if (clear_flags & PIPE_CLEAR_DEPTH) { - BEGIN_RING(chan, RING_3D(CLEAR_DEPTH), 1); - OUT_RINGf (chan, depth); + BEGIN_NVC0(push, NVC0_3D(CLEAR_DEPTH), 1); + PUSH_DATAf(push, depth); mode |= NVC0_3D_CLEAR_BUFFERS_Z; } if (clear_flags & PIPE_CLEAR_STENCIL) { - BEGIN_RING(chan, RING_3D(CLEAR_STENCIL), 1); - OUT_RING (chan, stencil & 0xff); + BEGIN_NVC0(push, NVC0_3D(CLEAR_STENCIL), 1); + PUSH_DATA (push, stencil & 0xff); mode |= NVC0_3D_CLEAR_BUFFERS_S; } - if (MARK_RING(chan, 20, 2)) - return; - - BEGIN_RING(chan, RING_3D(SCREEN_SCISSOR_HORIZ), 2); - OUT_RING (chan, ( width << 16) | dstx); - OUT_RING (chan, (height << 16) | dsty); - - BEGIN_RING(chan, RING_3D(ZETA_ADDRESS_HIGH), 5); - OUT_RELOCh(chan, bo, sf->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - OUT_RELOCl(chan, bo, sf->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - OUT_RING (chan, nvc0_format_table[dst->format].rt); - OUT_RING (chan, mt->level[sf->base.u.tex.level].tile_mode); - OUT_RING (chan, mt->layer_stride >> 2); - BEGIN_RING(chan, RING_3D(ZETA_ENABLE), 1); - OUT_RING (chan, 1); - BEGIN_RING(chan, RING_3D(ZETA_HORIZ), 3); - OUT_RING (chan, sf->width); - OUT_RING (chan, sf->height); - OUT_RING (chan, (unk << 16) | (dst->u.tex.first_layer + sf->depth)); - BEGIN_RING(chan, RING_3D(ZETA_BASE_LAYER), 1); - OUT_RING (chan, dst->u.tex.first_layer); + BEGIN_NVC0(push, NVC0_3D(SCREEN_SCISSOR_HORIZ), 2); + PUSH_DATA (push, ( width << 16) | dstx); + PUSH_DATA (push, (height << 16) | dsty); + + BEGIN_NVC0(push, NVC0_3D(ZETA_ADDRESS_HIGH), 5); + PUSH_DATAh(push, mt->base.address + sf->offset); + PUSH_DATA (push, mt->base.address + sf->offset); + PUSH_DATA (push, nvc0_format_table[dst->format].rt); + PUSH_DATA (push, mt->level[sf->base.u.tex.level].tile_mode); + PUSH_DATA (push, mt->layer_stride >> 2); + BEGIN_NVC0(push, NVC0_3D(ZETA_ENABLE), 1); + PUSH_DATA (push, 1); + BEGIN_NVC0(push, NVC0_3D(ZETA_HORIZ), 3); + PUSH_DATA (push, sf->width); + PUSH_DATA (push, sf->height); + PUSH_DATA (push, (unk << 16) | (dst->u.tex.first_layer + sf->depth)); + BEGIN_NVC0(push, NVC0_3D(ZETA_BASE_LAYER), 1); + PUSH_DATA (push, dst->u.tex.first_layer); for (z = 0; z < sf->depth; ++z) { - BEGIN_RING(chan, RING_3D(CLEAR_BUFFERS), 1); - OUT_RING (chan, mode | + BEGIN_NVC0(push, NVC0_3D(CLEAR_BUFFERS), 1); + PUSH_DATA (push, mode | (z << NVC0_3D_CLEAR_BUFFERS_LAYER__SHIFT)); } - nv50->dirty |= NVC0_NEW_FRAMEBUFFER; + nvc0->dirty |= NVC0_NEW_FRAMEBUFFER; } void @@ -404,7 +400,7 @@ nvc0_clear(struct pipe_context *pipe, unsigned buffers, double depth, unsigned stencil) { struct nvc0_context *nvc0 = nvc0_context(pipe); - struct nouveau_channel *chan = nvc0->screen->base.channel; + struct nouveau_pushbuf *push = nvc0->base.pushbuf; struct pipe_framebuffer_state *fb = &nvc0->framebuffer; unsigned i; uint32_t mode = 0; @@ -414,34 +410,34 @@ nvc0_clear(struct pipe_context *pipe, unsigned buffers, return; if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) { - BEGIN_RING(chan, RING_3D(CLEAR_COLOR(0)), 4); - OUT_RINGf (chan, color->f[0]); - OUT_RINGf (chan, color->f[1]); - OUT_RINGf (chan, color->f[2]); - OUT_RINGf (chan, color->f[3]); + BEGIN_NVC0(push, NVC0_3D(CLEAR_COLOR(0)), 4); + PUSH_DATAf(push, color->f[0]); + PUSH_DATAf(push, color->f[1]); + PUSH_DATAf(push, color->f[2]); + PUSH_DATAf(push, color->f[3]); mode = NVC0_3D_CLEAR_BUFFERS_R | NVC0_3D_CLEAR_BUFFERS_G | NVC0_3D_CLEAR_BUFFERS_B | NVC0_3D_CLEAR_BUFFERS_A; } if (buffers & PIPE_CLEAR_DEPTH) { - BEGIN_RING(chan, RING_3D(CLEAR_DEPTH), 1); - OUT_RING (chan, fui(depth)); + BEGIN_NVC0(push, NVC0_3D(CLEAR_DEPTH), 1); + PUSH_DATA (push, fui(depth)); mode |= NVC0_3D_CLEAR_BUFFERS_Z; } if (buffers & PIPE_CLEAR_STENCIL) { - BEGIN_RING(chan, RING_3D(CLEAR_STENCIL), 1); - OUT_RING (chan, stencil & 0xff); + BEGIN_NVC0(push, NVC0_3D(CLEAR_STENCIL), 1); + PUSH_DATA (push, stencil & 0xff); mode |= NVC0_3D_CLEAR_BUFFERS_S; } - BEGIN_RING(chan, RING_3D(CLEAR_BUFFERS), 1); - OUT_RING (chan, mode); + BEGIN_NVC0(push, NVC0_3D(CLEAR_BUFFERS), 1); + PUSH_DATA (push, mode); for (i = 1; i < fb->nr_cbufs; i++) { - BEGIN_RING(chan, RING_3D(CLEAR_BUFFERS), 1); - OUT_RING (chan, (i << 6) | 0x3c); + BEGIN_NVC0(push, NVC0_3D(CLEAR_BUFFERS), 1); + PUSH_DATA (push, (i << 6) | 0x3c); } } @@ -709,42 +705,42 @@ nvc0_blit_set_src(struct nvc0_context *nvc0, static void nvc0_blitctx_prepare_state(struct nvc0_blitctx *blit) { - struct nouveau_channel *chan = blit->screen->base.channel; + struct nouveau_pushbuf *push = blit->screen->base.pushbuf; /* TODO: maybe make this a MACRO (if we need more logic) ? */ /* blend state */ - BEGIN_RING(chan, RING_3D(COLOR_MASK(0)), 1); - OUT_RING (chan, blit->color_mask); - BEGIN_RING(chan, RING_3D(BLEND_ENABLE(0)), 1); - OUT_RING (chan, 0); - IMMED_RING(chan, RING_3D(LOGIC_OP_ENABLE), 0); + BEGIN_NVC0(push, NVC0_3D(COLOR_MASK(0)), 1); + PUSH_DATA (push, blit->color_mask); + BEGIN_NVC0(push, NVC0_3D(BLEND_ENABLE(0)), 1); + PUSH_DATA (push, 0); + IMMED_NVC0(push, NVC0_3D(LOGIC_OP_ENABLE), 0); /* rasterizer state */ - BEGIN_RING(chan, RING_3D(FRAG_COLOR_CLAMP_EN), 1); - OUT_RING (chan, 0); - IMMED_RING(chan, RING_3D(MULTISAMPLE_ENABLE), 0); - BEGIN_RING(chan, RING_3D(MSAA_MASK(0)), 4); - OUT_RING (chan, 0xffff); - OUT_RING (chan, 0xffff); - OUT_RING (chan, 0xffff); - OUT_RING (chan, 0xffff); - BEGIN_RING(chan, RING_3D(POLYGON_MODE_FRONT), 1); - OUT_RING (chan, NVC0_3D_POLYGON_MODE_FRONT_FILL); - BEGIN_RING(chan, RING_3D(POLYGON_MODE_BACK), 1); - OUT_RING (chan, NVC0_3D_POLYGON_MODE_BACK_FILL); - IMMED_RING(chan, RING_3D(POLYGON_SMOOTH_ENABLE), 0); - IMMED_RING(chan, RING_3D(POLYGON_OFFSET_FILL_ENABLE), 0); - IMMED_RING(chan, RING_3D(POLYGON_STIPPLE_ENABLE), 0); - IMMED_RING(chan, RING_3D(CULL_FACE_ENABLE), 0); + BEGIN_NVC0(push, NVC0_3D(FRAG_COLOR_CLAMP_EN), 1); + PUSH_DATA (push, 0); + IMMED_NVC0(push, NVC0_3D(MULTISAMPLE_ENABLE), 0); + BEGIN_NVC0(push, NVC0_3D(MSAA_MASK(0)), 4); + PUSH_DATA (push, 0xffff); + PUSH_DATA (push, 0xffff); + PUSH_DATA (push, 0xffff); + PUSH_DATA (push, 0xffff); + BEGIN_NVC0(push, NVC0_3D(POLYGON_MODE_FRONT), 1); + PUSH_DATA (push, NVC0_3D_POLYGON_MODE_FRONT_FILL); + BEGIN_NVC0(push, NVC0_3D(POLYGON_MODE_BACK), 1); + PUSH_DATA (push, NVC0_3D_POLYGON_MODE_BACK_FILL); + IMMED_NVC0(push, NVC0_3D(POLYGON_SMOOTH_ENABLE), 0); + IMMED_NVC0(push, NVC0_3D(POLYGON_OFFSET_FILL_ENABLE), 0); + IMMED_NVC0(push, NVC0_3D(POLYGON_STIPPLE_ENABLE), 0); + IMMED_NVC0(push, NVC0_3D(CULL_FACE_ENABLE), 0); /* zsa state */ - IMMED_RING(chan, RING_3D(DEPTH_TEST_ENABLE), 0); - IMMED_RING(chan, RING_3D(STENCIL_ENABLE), 0); - IMMED_RING(chan, RING_3D(ALPHA_TEST_ENABLE), 0); + IMMED_NVC0(push, NVC0_3D(DEPTH_TEST_ENABLE), 0); + IMMED_NVC0(push, NVC0_3D(STENCIL_ENABLE), 0); + IMMED_NVC0(push, NVC0_3D(ALPHA_TEST_ENABLE), 0); /* disable transform feedback */ - IMMED_RING(chan, RING_3D(TFB_ENABLE), 0); + IMMED_NVC0(push, NVC0_3D(TFB_ENABLE), 0); } static void @@ -835,7 +831,7 @@ nvc0_resource_resolve(struct pipe_context *pipe, struct nvc0_context *nvc0 = nvc0_context(pipe); struct nvc0_screen *screen = nvc0->screen; struct nvc0_blitctx *blit = screen->blitctx; - struct nouveau_channel *chan = screen->base.channel; + struct nouveau_pushbuf *push = screen->base.pushbuf; struct pipe_resource *src = info->src.res; struct pipe_resource *dst = info->dst.res; float x0, x1, y0, y1; @@ -878,11 +874,11 @@ nvc0_resource_resolve(struct pipe_context *pipe, y0 *= (float)(1 << nv50_miptree(src)->ms_y); y1 *= (float)(1 << nv50_miptree(src)->ms_y); - BEGIN_RING(chan, RING_3D(SP_START_ID(5)), 1); - OUT_RING (chan, + BEGIN_NVC0(push, NVC0_3D(SP_START_ID(5)), 1); + PUSH_DATA (push, blit->fp.code_base + blit->fp_offset); - IMMED_RING(chan, RING_3D(VIEWPORT_TRANSFORM_EN), 0); + IMMED_NVC0(push, NVC0_3D(VIEWPORT_TRANSFORM_EN), 0); /* Draw a large triangle in screen coordinates covering the whole * render target, with scissors defining the destination region. @@ -890,43 +886,43 @@ nvc0_resource_resolve(struct pipe_context *pipe, * arranged in a way to yield the desired offset and scale. */ - BEGIN_RING(chan, RING_3D(SCISSOR_HORIZ(0)), 2); - OUT_RING (chan, (info->dst.x1 << 16) | info->dst.x0); - OUT_RING (chan, (info->dst.y1 << 16) | info->dst.y0); + BEGIN_NVC0(push, NVC0_3D(SCISSOR_HORIZ(0)), 2); + PUSH_DATA (push, (info->dst.x1 << 16) | info->dst.x0); + PUSH_DATA (push, (info->dst.y1 << 16) | info->dst.y0); - IMMED_RING(chan, RING_3D(VERTEX_BEGIN_GL), + IMMED_NVC0(push, NVC0_3D(VERTEX_BEGIN_GL), NVC0_3D_VERTEX_BEGIN_GL_PRIMITIVE_TRIANGLES); - BEGIN_RING(chan, RING_3D(VTX_ATTR_DEFINE), 3); - OUT_RING (chan, 0x74201); - OUT_RINGf (chan, x0); - OUT_RINGf (chan, y0); - BEGIN_RING(chan, RING_3D(VTX_ATTR_DEFINE), 3); - OUT_RING (chan, 0x74200); - OUT_RINGf (chan, 0.0f); - OUT_RINGf (chan, 0.0f); - BEGIN_RING(chan, RING_3D(VTX_ATTR_DEFINE), 3); - OUT_RING (chan, 0x74201); - OUT_RINGf (chan, x1); - OUT_RINGf (chan, y0); - BEGIN_RING(chan, RING_3D(VTX_ATTR_DEFINE), 3); - OUT_RING (chan, 0x74200); - OUT_RINGf (chan, 16384 << nv50_miptree(dst)->ms_x); - OUT_RINGf (chan, 0.0f); - BEGIN_RING(chan, RING_3D(VTX_ATTR_DEFINE), 3); - OUT_RING (chan, 0x74201); - OUT_RINGf (chan, x0); - OUT_RINGf (chan, y1); - BEGIN_RING(chan, RING_3D(VTX_ATTR_DEFINE), 3); - OUT_RING (chan, 0x74200); - OUT_RINGf (chan, 0.0f); - OUT_RINGf (chan, 16384 << nv50_miptree(dst)->ms_y); - - IMMED_RING(chan, RING_3D(VERTEX_END_GL), 0); + BEGIN_NVC0(push, NVC0_3D(VTX_ATTR_DEFINE), 3); + PUSH_DATA (push, 0x74201); + PUSH_DATAf(push, x0); + PUSH_DATAf(push, y0); + BEGIN_NVC0(push, NVC0_3D(VTX_ATTR_DEFINE), 3); + PUSH_DATA (push, 0x74200); + PUSH_DATAf(push, 0.0f); + PUSH_DATAf(push, 0.0f); + BEGIN_NVC0(push, NVC0_3D(VTX_ATTR_DEFINE), 3); + PUSH_DATA (push, 0x74201); + PUSH_DATAf(push, x1); + PUSH_DATAf(push, y0); + BEGIN_NVC0(push, NVC0_3D(VTX_ATTR_DEFINE), 3); + PUSH_DATA (push, 0x74200); + PUSH_DATAf(push, 16384 << nv50_miptree(dst)->ms_x); + PUSH_DATAf(push, 0.0f); + BEGIN_NVC0(push, NVC0_3D(VTX_ATTR_DEFINE), 3); + PUSH_DATA (push, 0x74201); + PUSH_DATAf(push, x0); + PUSH_DATAf(push, y1); + BEGIN_NVC0(push, NVC0_3D(VTX_ATTR_DEFINE), 3); + PUSH_DATA (push, 0x74200); + PUSH_DATAf(push, 0.0f); + PUSH_DATAf(push, 16384 << nv50_miptree(dst)->ms_y); + + IMMED_NVC0(push, NVC0_3D(VERTEX_END_GL), 0); /* re-enable normally constant state */ - IMMED_RING(chan, RING_3D(VIEWPORT_TRANSFORM_EN), 1); + IMMED_NVC0(push, NVC0_3D(VIEWPORT_TRANSFORM_EN), 1); nvc0_blitctx_post_blit(nvc0, blit); } |