static void nv04_hwctx_init(struct gl_context *ctx) { struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; struct nouveau_pushbuf *push = context_push(ctx); struct nv04_fifo *fifo = hw->chan->data; BEGIN_NV04(push, NV01_SUBC(SURF, OBJECT), 1); PUSH_DATA (push, hw->surf3d->handle); BEGIN_NV04(push, NV04_SF3D(DMA_NOTIFY), 3); PUSH_DATA (push, hw->ntfy->handle); PUSH_DATA (push, fifo->vram); PUSH_DATA (push, fifo->vram); BEGIN_NV04(push, NV01_SUBC(3D, OBJECT), 1); PUSH_DATA (push, hw->eng3d->handle); BEGIN_NV04(push, NV04_TTRI(DMA_NOTIFY), 4); PUSH_DATA (push, hw->ntfy->handle); PUSH_DATA (push, fifo->vram); PUSH_DATA (push, fifo->gart); PUSH_DATA (push, hw->surf3d->handle); BEGIN_NV04(push, NV01_SUBC(3D, OBJECT), 1); PUSH_DATA (push, hw->eng3dm->handle); BEGIN_NV04(push, NV04_MTRI(DMA_NOTIFY), 4); PUSH_DATA (push, hw->ntfy->handle); PUSH_DATA (push, fifo->vram); PUSH_DATA (push, fifo->gart); PUSH_DATA (push, hw->surf3d->handle); PUSH_KICK (push); }
void nv04_emit_scissor(struct gl_context *ctx, int emit) { struct nouveau_pushbuf *push = context_push(ctx); int x, y, w, h; get_scissors(ctx->DrawBuffer, &x, &y, &w, &h); BEGIN_NV04(push, NV04_SF3D(CLIP_HORIZONTAL), 2); PUSH_DATA (push, w << 16 | x); PUSH_DATA (push, h << 16 | y); }
void nv04_emit_framebuffer(struct gl_context *ctx, int emit) { struct nouveau_pushbuf *push = context_push(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; struct nouveau_surface *s; uint32_t rt_format = NV04_CONTEXT_SURFACES_3D_FORMAT_TYPE_PITCH; uint32_t rt_pitch = 0, zeta_pitch = 0; unsigned bo_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR; if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) return; PUSH_RESET(push, BUFCTX_FB); /* Render target */ if (fb->_ColorDrawBuffers[0]) { s = &to_nouveau_renderbuffer( fb->_ColorDrawBuffers[0])->surface; rt_format |= get_rt_format(s->format); zeta_pitch = rt_pitch = s->pitch; BEGIN_NV04(push, NV04_SF3D(OFFSET_COLOR), 1); PUSH_MTHDl(push, NV04_SF3D(OFFSET_COLOR), BUFCTX_FB, s->bo, 0, bo_flags); } /* depth/stencil */ if (fb->Attachment[BUFFER_DEPTH].Renderbuffer) { s = &to_nouveau_renderbuffer( fb->Attachment[BUFFER_DEPTH].Renderbuffer)->surface; zeta_pitch = s->pitch; BEGIN_NV04(push, NV04_SF3D(OFFSET_ZETA), 1); PUSH_MTHDl(push, NV04_SF3D(OFFSET_ZETA), BUFCTX_FB, s->bo, 0, bo_flags); } BEGIN_NV04(push, NV04_SF3D(FORMAT), 1); PUSH_DATA (push, rt_format); BEGIN_NV04(push, NV04_SF3D(PITCH), 1); PUSH_DATA (push, zeta_pitch << 16 | rt_pitch); /* Recompute the scissor state. */ context_dirty(ctx, SCISSOR); context_dirty(ctx, CONTROL); }