Merge branch 'upstream-gallium-0.1' into darktama-gallium-0.1
[mesa.git] / src / mesa / drivers / dri / nouveau_winsys / nouveau_local.h
1 #ifndef __NOUVEAU_LOCAL_H__
2 #define __NOUVEAU_LOCAL_H__
3
4 #include <stdio.h>
5
6 /* Debug output */
7 #define NOUVEAU_MSG(fmt, args...) do { \
8 fprintf(stdout, "nouveau: "fmt, ##args); \
9 fflush(stdout); \
10 } while(0)
11
12 #define NOUVEAU_ERR(fmt, args...) do { \
13 fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args); \
14 fflush(stderr); \
15 } while(0)
16
17 #define NOUVEAU_TIME_MSEC() 0
18
19 /* User FIFO control */
20 //#define NOUVEAU_DMA_TRACE
21 //#define NOUVEAU_DMA_DEBUG
22 //#define NOUVEAU_DMA_DUMP_POSTRELOC_PUSHBUF
23 #define NOUVEAU_DMA_SUBCHAN_LRU
24 #define NOUVEAU_DMA_BARRIER
25 #define NOUVEAU_DMA_TIMEOUT 2000
26
27 /* Push buffer access macros */
28 #define BEGIN_RING(obj,mthd,size) do { \
29 nv->pushbuf = nouveau_pipe_dma_beginp(nv->obj, (mthd), (size)); \
30 } while(0)
31
32 #define OUT_RING(data) do { \
33 (*nv->pushbuf++) = (data); \
34 } while(0)
35
36 #define OUT_RINGp(src,size) do { \
37 memcpy(nv->pushbuf, (src), (size)<<2); \
38 nv->pushbuf += (size); \
39 } while(0)
40
41 #define OUT_RINGf(data) do { \
42 union { float v; uint32_t u; } c; \
43 c.v = (data); \
44 OUT_RING(c.u); \
45 } while(0)
46
47 #define FIRE_RING() do { \
48 nouveau_pipe_dma_kickoff(nv->channel); \
49 } while(0)
50
51 #define OUT_RELOC(bo,data,flags,vor,tor) do { \
52 nouveau_pushbuf_emit_reloc(nv->channel, nv->pushbuf, (void*)(bo), \
53 (data), (flags), (vor), (tor)); \
54 OUT_RING(0); \
55 } while(0)
56
57 /* Raw data + flags depending on FB/TT buffer */
58 #define OUT_RELOCd(bo,data,flags,vor,tor) do { \
59 OUT_RELOC((bo), (data), (flags) | NOUVEAU_BO_OR, (vor), (tor)); \
60 } while(0)
61
62 /* FB/TT object handle */
63 #define OUT_RELOCo(bo,flags) do { \
64 OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR, \
65 nv->channel->vram->handle, nv->channel->gart->handle); \
66 } while(0)
67
68 /* Low 32-bits of offset */
69 #define OUT_RELOCl(bo,delta,flags) do { \
70 OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_LOW, 0, 0); \
71 } while(0)
72
73 /* High 32-bits of offset */
74 #define OUT_RELOCh(bo,delta,flags) do { \
75 OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_HIGH, 0, 0); \
76 } while(0)
77
78 #endif