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