summaryrefslogtreecommitdiff
path: root/src/xvmc/intel_batchbuffer.h
blob: d4d8037a2c1ab36f833480299bf6e4eabfc6a546 (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
#ifndef _INTEL_BATCHBUFFER_H
#define _INTEL_BATCHBUFFER_H

/* #define VERBOSE 0 */
#ifndef VERBOSE
extern int VERBOSE;
#endif

#define BATCH_LOCALS    unsigned char *batch_ptr;

#define BEGIN_BATCH(n)                                                  \
    do {                                                                \
        if (xvmc_driver->batch.space < (n)*4)                           \
            intelFlushBatch(TRUE);                            		\
        batch_ptr = xvmc_driver->batch.ptr;                             \
    } while (0)

#define OUT_BATCH(n)                                                    \
    do {                                                                \
        *(unsigned int *)batch_ptr = (n);                               \
        batch_ptr += 4;                                                 \
    } while (0)

#define OUT_BATCH_SHORT(n)                                              \
    do {                                                                \
        *(short *)batch_ptr = (n);                                      \
        batch_ptr += 2;                                                 \
    } while (0)

#define OUT_BATCH_CHAR(n)                                               \
	do {                                                                \
		*(char *)batch_ptr = (n);                                       \
		batch_ptr ++;                                                   \
	} while (0)
#define ADVANCE_BATCH()                                                  \
    do {                                                                 \
        xvmc_driver->batch.space -= (batch_ptr - xvmc_driver->batch.ptr);\
        xvmc_driver->batch.ptr = batch_ptr;                              \
        assert(xvmc_driver->batch.space >= 0);                           \
    } while(0)

extern void intelFlushBatch(Bool);
extern void intelBatchbufferData(const void *, unsigned, unsigned);
extern Bool intelInitBatchBuffer(void);
extern void intelFiniBatchBuffer(void);
extern void intelCmdIoctl(char *, unsigned);
#endif /* _INTEL_BATCHBUFFER_H */