summaryrefslogtreecommitdiff
path: root/src/nv50_accel.h
blob: f5ccd9229e67d232a6d9407aae314142083a99a6 (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
50
51
52
#ifndef __NV50_ACCEL_H__
#define __NV50_ACCEL_H__

/* "Tesla scratch buffer" offsets */
#define PVP_OFFSET 0x00000000 /* Vertex program */
#define PFP_OFFSET 0x00001000 /* Fragment program */
#define TIC_OFFSET 0x00002000 /* Texture Image Control */
#define TSC_OFFSET 0x00003000 /* Texture Sampler Control */

/* Fragment programs */
#define PFP_S     0x0000 /* (src) */
#define PFP_C     0x0100 /* (src IN mask) */
#define PFP_CCA   0x0200 /* (src IN mask) component-alpha */
#define PFP_CCASA 0x0300 /* (src IN mask) component-alpha src-alpha */
#define PFP_S_A8  0x0400 /* (src) a8 rt */
#define PFP_C_A8  0x0500 /* (src IN mask) a8 rt - same for CA and CA_SA */
#define PFP_NV12  0x0600 /* NV12 YUV->RGB */

/* Constant buffer assignments */
#define CB_TSC 0
#define CB_TIC 1

static __inline__ void
VTX1s(NVPtr pNv, float sx, float sy, unsigned dx, unsigned dy)
{
	struct nouveau_channel *chan = pNv->chan;
	struct nouveau_grobj *tesla = pNv->Nv3D;

	BEGIN_RING(chan, tesla, NV50TCL_VTX_ATTR_2F_X(8), 2);
	OUT_RINGf (chan, sx);
	OUT_RINGf (chan, sy);
	BEGIN_RING(chan, tesla, NV50TCL_VTX_ATTR_2I(0), 1);
 	OUT_RING  (chan, (dy << 16) | dx);
}

static __inline__ void
VTX2s(NVPtr pNv, float s1x, float s1y, float s2x, float s2y,
		 unsigned dx, unsigned dy)
{
	struct nouveau_channel *chan = pNv->chan;
	struct nouveau_grobj *tesla = pNv->Nv3D;

	BEGIN_RING(chan, tesla, NV50TCL_VTX_ATTR_2F_X(8), 4);
	OUT_RINGf (chan, s1x);
	OUT_RINGf (chan, s1y);
	OUT_RINGf (chan, s2x);
	OUT_RINGf (chan, s2y);
	BEGIN_RING(chan, tesla, NV50TCL_VTX_ATTR_2I(0), 1);
 	OUT_RING  (chan, (dy << 16) | dx);
}

#endif