summaryrefslogtreecommitdiff
path: root/imageblit.c
blob: 020d3abbae2eb858bebfd87e4a30460a819222b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdio.h>

#include "screen.h"
#include "object.h"
#include "fifo.h"
#include "nouveau_class.h"

void imageblit_init(void)
{
	printf("-- ImageBlit, init\n");

	SetSubchannel(NvSubImageBlit, NvImageBlit);

	BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_DMA_NOTIFY, 1);
	OUT_RING(NvSyncNotify);

	BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_SURFACE, 1);
	OUT_RING(NvCtxSurf2D);
	BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_CLIP_RECTANGLE, 1);
	OUT_RING(NvClipRect);
	BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_PATTERN, 1);
	OUT_RING(NvImagePattern);
	BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_ROP, 1);
	OUT_RING(NvRasterOp);
	/*BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_OPERATION, 1);
	OUT_RING(NV04_IMAGE_BLIT_OPERATION_SRCCOPY);*/

	FIRE_RING();
}

void imageblit_copy(int sx,int sy, int dx,int dy, int w,int h)
{
	printf("-- ImageBlit, copy\n");

	SetSubchannel(NvSubImageBlit, NvImageBlit);

	BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_SURFACE, 1);
	OUT_RING  (NvCtxSurf2D);

	BEGIN_RING(NvSubImageBlit, NV04_IMAGE_BLIT_OPERATION, 1);
	OUT_RING  (NV04_IMAGE_BLIT_OPERATION_SRCCOPY);

	BEGIN_RING(NvSubImageBlit, NV01_IMAGE_BLIT_POINT_IN, 3);
	OUT_RING  ((sy<<16)|sx);
	OUT_RING  ((dy<<16)|dx);
	OUT_RING  ((h<<16)|w);

	FIRE_RING();
}