summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/nv30/nv30_dma.h
blob: 6eff6b42903f464b047202d91ce0171e8a235be3 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef __NV30_DMA_H__
#define __NV30_DMA_H__

#include "pipe/nouveau/nouveau_winsys.h"

#define OUT_RING(data) do {                                                    \
	(*nv30->nvws->channel->pushbuf->cur++) = (data);                       \
} while(0)

#define OUT_RINGp(src,size) do {                                               \
	memcpy(nv30->nvws->channel->pushbuf->cur, (src), (size) * 4);          \
	nv30->nvws->channel->pushbuf->cur += (size);                           \
} while(0)

#define OUT_RINGf(data) do {                                                   \
	union { float v; uint32_t u; } c;                                      \
	c.v = (data);                                                          \
	OUT_RING(c.u);                                                         \
} while(0)

#define BEGIN_RING(obj,mthd,size) do {                                         \
	if (nv30->nvws->channel->pushbuf->remaining < ((size) + 1))            \
		nv30->nvws->push_flush(nv30->nvws->channel, ((size) + 1));     \
	OUT_RING((nv30->obj->subc << 13) | ((size) << 18) | (mthd));           \
	nv30->nvws->channel->pushbuf->remaining -= ((size) + 1);               \
} while(0)

#define BEGIN_RING_NI(obj,mthd,size) do {                                      \
	BEGIN_RING(obj, (mthd) | 0x40000000, (size));                          \
} while(0)

#define FIRE_RING() do {                                                       \
	nv30->nvws->push_flush(nv30->nvws->channel, 0);                        \
} while(0)

#define OUT_RELOC(bo,data,flags,vor,tor) do {                                  \
	nv30->nvws->push_reloc(nv30->nvws->channel,                            \
			       nv30->nvws->channel->pushbuf->cur,              \
			       (struct nouveau_bo *)(bo),                      \
			       (data), (flags), (vor), (tor));                 \
	OUT_RING(0);                                                           \
} while(0)

/* Raw data + flags depending on FB/TT buffer */
#define OUT_RELOCd(bo,data,flags,vor,tor) do {                                 \
	OUT_RELOC((bo), (data), (flags) | NOUVEAU_BO_OR, (vor), (tor));        \
} while(0)

/* FB/TT object handle */
#define OUT_RELOCo(bo,flags) do {                                              \
	OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR,                            \
		  nv30->nvws->channel->vram->handle,                           \
		  nv30->nvws->channel->gart->handle);                          \
} while(0)

/* Low 32-bits of offset */
#define OUT_RELOCl(bo,delta,flags) do {                                        \
	OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_LOW, 0, 0);              \
} while(0)

/* High 32-bits of offset */
#define OUT_RELOCh(bo,delta,flags) do {                                        \
	OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_HIGH, 0, 0);             \
} while(0)

#endif