コード例 #1
0
static Bool
NVAccelInitImagePattern(ScrnInfoPtr pScrn)
{
	NVPtr pNv = NVPTR(pScrn);
	struct nouveau_channel *chan = pNv->chan;

	if (!pNv->NvImagePattern) {
		if (nouveau_grobj_alloc(chan, NvImagePattern,
					NV04_PATTERN_CLASS,
					&pNv->NvImagePattern))
			return FALSE;
	}

	BEGIN_NV04(chan, NV01_SUBC(MISC, OBJECT), 1);
	OUT_RING  (chan, pNv->NvImagePattern->handle);
	BEGIN_NV04(chan, NV01_PATT(DMA_NOTIFY), 1);
	OUT_RING  (chan, chan->nullobj->handle);
	BEGIN_NV04(chan, NV01_PATT(MONOCHROME_FORMAT), 3);
#if X_BYTE_ORDER == X_BIG_ENDIAN
	OUT_RING  (chan, NV01_PATTERN_MONOCHROME_FORMAT_LE);
#else
	OUT_RING  (chan, NV01_PATTERN_MONOCHROME_FORMAT_CGA6);
#endif
	OUT_RING  (chan, NV01_PATTERN_MONOCHROME_SHAPE_8X8);
	OUT_RING  (chan, NV04_PATTERN_PATTERN_SELECT_MONO);

	return TRUE;
}
コード例 #2
0
ファイル: nv04_surface.c プロジェクト: karolherbst/mesa
void
nv04_surface_fill(struct gl_context *ctx,
                  struct nouveau_surface *dst,
                  unsigned mask, unsigned value,
                  int dx, int dy, int w, int h)
{
    struct nouveau_pushbuf_refn refs[] = {
        { dst->bo, NOUVEAU_BO_WR | NOUVEAU_BO_VRAM | NOUVEAU_BO_GART },
    };
    struct nouveau_pushbuf *push = context_push(ctx);
    struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
    struct nv04_fifo *fifo = hw->chan->data;

    if (nouveau_pushbuf_space(push, 64, 4, 0) ||
            nouveau_pushbuf_refn (push, refs, 1))
        return;

    BEGIN_NV04(push, NV04_SF2D(DMA_IMAGE_SOURCE), 2);
    PUSH_RELOC(push, dst->bo, 0, NOUVEAU_BO_OR, fifo->vram, fifo->gart);
    PUSH_RELOC(push, dst->bo, 0, NOUVEAU_BO_OR, fifo->vram, fifo->gart);
    BEGIN_NV04(push, NV04_SF2D(FORMAT), 4);
    PUSH_DATA (push, surf2d_format(dst->format));
    PUSH_DATA (push, (dst->pitch << 16) | dst->pitch);
    PUSH_RELOC(push, dst->bo, dst->offset, NOUVEAU_BO_LOW, 0, 0);
    PUSH_RELOC(push, dst->bo, dst->offset, NOUVEAU_BO_LOW, 0, 0);

    BEGIN_NV04(push, NV01_PATT(COLOR_FORMAT), 1);
    PUSH_DATA (push, rect_format(dst->format));
    BEGIN_NV04(push, NV01_PATT(MONOCHROME_COLOR1), 1);
    PUSH_DATA (push, mask | ~0ll << (8 * dst->cpp));

    BEGIN_NV04(push, NV04_GDI(COLOR_FORMAT), 1);
    PUSH_DATA (push, rect_format(dst->format));
    BEGIN_NV04(push, NV04_GDI(COLOR1_A), 1);
    PUSH_DATA (push, value);
    BEGIN_NV04(push, NV04_GDI(UNCLIPPED_RECTANGLE_POINT(0)), 2);
    PUSH_DATA (push, (dx << 16) | dy);
    PUSH_DATA (push, ( w << 16) |  h);
}