}
static void
-setup_lma_buffer(GLcontext *ctx)
+setup_hierz_buffer(struct gl_context *ctx)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
- struct nouveau_bo_context *bctx = context_bctx(ctx, LMA_DEPTH);
+ struct nouveau_bo_context *bctx = context_bctx(ctx, HIERZ);
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
unsigned pitch = align(fb->Width, 128),
height = align(fb->Height, 2),
size = pitch * height;
- if (!nfb->lma_bo || nfb->lma_bo->size != size) {
- nouveau_bo_ref(NULL, &nfb->lma_bo);
- nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, size,
- &nfb->lma_bo);
+ if (!nfb->hierz.bo || nfb->hierz.bo->size != size) {
+ nouveau_bo_ref(NULL, &nfb->hierz.bo);
+ nouveau_bo_new_tile(context_dev(ctx), NOUVEAU_BO_VRAM, 0, size,
+ 0, NOUVEAU_BO_TILE_ZETA, &nfb->hierz.bo);
}
nouveau_bo_markl(bctx, celsius, NV17TCL_LMA_DEPTH_BUFFER_OFFSET,
- nfb->lma_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+ nfb->hierz.bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
WAIT_RING(chan, 9);
BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_WINDOW_X, 4);
}
void
-nv10_emit_framebuffer(GLcontext *ctx, int emit)
+nv10_emit_framebuffer(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
nouveau_bo_markl(bctx, celsius, NV10TCL_ZETA_OFFSET,
s->bo, 0, bo_flags);
- if (context_chipset(ctx) >= 0x17)
- setup_lma_buffer(ctx);
+ if (context_chipset(ctx) >= 0x17) {
+ setup_hierz_buffer(ctx);
+ context_dirty(ctx, ZCLEAR);
+ }
}
BEGIN_RING(chan, celsius, NV10TCL_RT_FORMAT, 2);
}
void
-nv10_emit_render_mode(GLcontext *ctx, int emit)
+nv10_emit_render_mode(struct gl_context *ctx, int emit)
{
}
void
-nv10_emit_scissor(GLcontext *ctx, int emit)
+nv10_emit_scissor(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_viewport(GLcontext *ctx, int emit)
+nv10_emit_viewport(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
+ struct gl_viewport_attrib *vp = &ctx->Viewport;
struct gl_framebuffer *fb = ctx->DrawBuffer;
float a[4] = {};
- int i;
get_viewport_translate(ctx, a);
a[0] -= 2048;
a[1] -= 2048;
+ if (nv10_use_viewport_zclear(ctx))
+ a[2] = nv10_transform_depth(ctx, (vp->Far + vp->Near) / 2);
BEGIN_RING(chan, celsius, NV10TCL_VIEWPORT_TRANSLATE_X, 4);
- for (i = 0; i < 4; i++)
- OUT_RINGf(chan, a[i]);
+ OUT_RINGp(chan, a, 4);
BEGIN_RING(chan, celsius, NV10TCL_VIEWPORT_CLIP_HORIZ(0), 1);
OUT_RING(chan, (fb->Width - 1) << 16 | 0x08000800);
context_dirty(ctx, PROJECTION);
}
+
+void
+nv10_emit_zclear(struct gl_context *ctx, int emit)
+{
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct nouveau_channel *chan = context_chan(ctx);
+ struct nouveau_grobj *celsius = context_eng3d(ctx);
+ struct nouveau_framebuffer *nfb =
+ to_nouveau_framebuffer(ctx->DrawBuffer);
+
+ if (nfb->hierz.bo) {
+ BEGIN_RING(chan, celsius, NV17TCL_ZCLEAR_ENABLE, 2);
+ OUT_RING(chan, nctx->hierz.clear_blocked ? 0 : 1);
+ OUT_RING(chan, nfb->hierz.clear_value |
+ (nctx->hierz.clear_seq & 0xff));
+ } else {
+ BEGIN_RING(chan, celsius, NV10TCL_DEPTH_RANGE_NEAR, 2);
+ OUT_RINGf(chan, nv10_transform_depth(ctx, 0));
+ OUT_RINGf(chan, nv10_transform_depth(ctx, 1));
+ context_dirty(ctx, VIEWPORT);
+ }
+}