1#ifndef _INTEL_BATCHBUFFER_H
2#define _INTEL_BATCHBUFFER_H
3
4/* #define VERBOSE 0 */
5#ifndef VERBOSE
6extern int VERBOSE;
7#endif
8
9#define BATCH_LOCALS    unsigned char *batch_ptr;
10
11#define BEGIN_BATCH(n)                                                  \
12    do {                                                                \
13	assert(xvmc_driver->batch.space >= (n) *4);			\
14        batch_ptr = xvmc_driver->batch.ptr;                             \
15    } while (0)
16
17#define OUT_BATCH(n)                                                    \
18    do {                                                                \
19        *(unsigned int *)batch_ptr = (n);                               \
20        batch_ptr += 4;                                                 \
21    } while (0)
22
23#define OUT_RELOC(bo,read_domains,write_domains,delta)  \
24    do { \
25        *(unsigned int *)batch_ptr = (delta) + bo->offset; \
26        intel_batch_emit_reloc(bo, read_domains, write_domains, delta, batch_ptr); \
27        batch_ptr += 4;                                                 \
28    } while (0)
29
30#define OUT_BATCH_SHORT(n)                                              \
31    do {                                                                \
32        *(short *)batch_ptr = (n);                                      \
33        batch_ptr += 2;                                                 \
34    } while (0)
35
36#define OUT_BATCH_CHAR(n)                                               \
37	do {                                                                \
38		*(char *)batch_ptr = (n);                                       \
39		batch_ptr ++;                                                   \
40	} while (0)
41#define ADVANCE_BATCH()                                                  \
42    do {                                                                 \
43        xvmc_driver->batch.space -= (batch_ptr - xvmc_driver->batch.ptr);\
44        xvmc_driver->batch.ptr = batch_ptr;                              \
45    } while(0)
46
47extern void intelFlushBatch(void);
48extern void intelBatchbufferData(const void *, unsigned, unsigned);
49extern Bool intelInitBatchBuffer(void);
50extern void intelFiniBatchBuffer(void);
51extern void intelCmdIoctl(char *, unsigned);
52extern void intel_batch_emit_reloc(dri_bo * bo, uint32_t read_domain,
53				   uint32_t write_domain, uint32_t delta,
54				   unsigned char *);
55#endif /* _INTEL_BATCHBUFFER_H */
56