diff options
Diffstat (limited to 'src/i830_batchbuffer.h')
-rw-r--r-- | src/i830_batchbuffer.h | 125 |
1 files changed, 62 insertions, 63 deletions
diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h index 02834381..a00a4364 100644 --- a/src/i830_batchbuffer.h +++ b/src/i830_batchbuffer.h @@ -37,63 +37,59 @@ void intel_batch_teardown(ScrnInfoPtr pScrn); void intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed); void intel_batch_wait_last(ScrnInfoPtr pScrn); -static inline int -intel_batch_space(I830Ptr pI830) +static inline int intel_batch_space(I830Ptr pI830) { - return (pI830->batch_bo->size - BATCH_RESERVED) - (pI830->batch_used); + return (pI830->batch_bo->size - BATCH_RESERVED) - (pI830->batch_used); } static inline void intel_batch_require_space(ScrnInfoPtr pScrn, I830Ptr pI830, GLuint sz) { - assert(sz < pI830->batch_bo->size - 8); - if (intel_batch_space(pI830) < sz) - intel_batch_flush(pScrn, FALSE); + assert(sz < pI830->batch_bo->size - 8); + if (intel_batch_space(pI830) < sz) + intel_batch_flush(pScrn, FALSE); } -static inline void -intel_batch_start_atomic(ScrnInfoPtr pScrn, unsigned int sz) +static inline void intel_batch_start_atomic(ScrnInfoPtr pScrn, unsigned int sz) { - I830Ptr pI830 = I830PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); - assert(!pI830->in_batch_atomic); - intel_batch_require_space(pScrn, pI830, sz * 4); + assert(!pI830->in_batch_atomic); + intel_batch_require_space(pScrn, pI830, sz * 4); - pI830->in_batch_atomic = TRUE; - pI830->batch_atomic_limit = pI830->batch_used + sz * 4; + pI830->in_batch_atomic = TRUE; + pI830->batch_atomic_limit = pI830->batch_used + sz * 4; } -static inline void -intel_batch_end_atomic(ScrnInfoPtr pScrn) +static inline void intel_batch_end_atomic(ScrnInfoPtr pScrn) { - I830Ptr pI830 = I830PTR(pScrn); + I830Ptr pI830 = I830PTR(pScrn); - assert(pI830->in_batch_atomic); - assert(pI830->batch_used <= pI830->batch_atomic_limit); - pI830->in_batch_atomic = FALSE; + assert(pI830->in_batch_atomic); + assert(pI830->batch_used <= pI830->batch_atomic_limit); + pI830->in_batch_atomic = FALSE; } -static inline void -intel_batch_emit_dword(I830Ptr pI830, uint32_t dword) +static inline void intel_batch_emit_dword(I830Ptr pI830, uint32_t dword) { - assert(pI830->batch_ptr != NULL); - assert(intel_batch_space(pI830) >= 4); - *(uint32_t *)(pI830->batch_ptr + pI830->batch_used) = dword; - pI830->batch_used += 4; + assert(pI830->batch_ptr != NULL); + assert(intel_batch_space(pI830) >= 4); + *(uint32_t *) (pI830->batch_ptr + pI830->batch_used) = dword; + pI830->batch_used += 4; } static inline void -intel_batch_emit_reloc (I830Ptr pI830, - dri_bo *bo, - uint32_t read_domains, - uint32_t write_domains, - uint32_t delta) +intel_batch_emit_reloc(I830Ptr pI830, + dri_bo * bo, + uint32_t read_domains, + uint32_t write_domains, uint32_t delta) { - assert(intel_batch_space(pI830) >= 4); - *(uint32_t *)(pI830->batch_ptr + pI830->batch_used) = bo->offset + delta; - dri_bo_emit_reloc(pI830->batch_bo, read_domains, write_domains, delta, - pI830->batch_used, bo); - pI830->batch_used += 4; + assert(intel_batch_space(pI830) >= 4); + *(uint32_t *) (pI830->batch_ptr + pI830->batch_used) = + bo->offset + delta; + dri_bo_emit_reloc(pI830->batch_bo, read_domains, write_domains, delta, + pI830->batch_used, bo); + pI830->batch_used += 4; } static inline void @@ -101,10 +97,10 @@ intel_batch_emit_reloc_pixmap(I830Ptr pI830, PixmapPtr pPixmap, uint32_t read_domains, uint32_t write_domain, uint32_t delta) { - dri_bo *bo = i830_get_pixmap_bo(pPixmap); - assert(pI830->batch_ptr != NULL); - assert(intel_batch_space(pI830) >= 4); - intel_batch_emit_reloc(pI830, bo, read_domains, write_domain, delta); + dri_bo *bo = i830_get_pixmap_bo(pPixmap); + assert(pI830->batch_ptr != NULL); + assert(intel_batch_space(pI830) >= 4); + intel_batch_emit_reloc(pI830, bo, read_domains, write_domain, delta); } #define OUT_BATCH(dword) intel_batch_emit_dword(pI830, dword) @@ -128,33 +124,36 @@ union intfloat { #define BEGIN_BATCH(n) \ do { \ - if (pI830->batch_emitting != 0) \ - FatalError("%s: BEGIN_BATCH called without closing " \ - "ADVANCE_BATCH\n", __FUNCTION__); \ - intel_batch_require_space(pScrn, pI830, (n) * 4); \ - pI830->batch_emitting = (n) * 4; \ - pI830->batch_emit_start = pI830->batch_used; \ + if (pI830->batch_emitting != 0) \ + FatalError("%s: BEGIN_BATCH called without closing " \ + "ADVANCE_BATCH\n", __FUNCTION__); \ + intel_batch_require_space(pScrn, pI830, (n) * 4); \ + pI830->batch_emitting = (n) * 4; \ + pI830->batch_emit_start = pI830->batch_used; \ } while (0) #define ADVANCE_BATCH() do { \ - if (pI830->batch_emitting == 0) \ - FatalError("%s: ADVANCE_BATCH called with no matching " \ - "BEGIN_BATCH\n", __FUNCTION__); \ - if (pI830->batch_used > pI830->batch_emit_start + pI830->batch_emitting) \ - FatalError("%s: ADVANCE_BATCH: exceeded allocation %d/%d\n ", \ - __FUNCTION__, \ - pI830->batch_used - pI830->batch_emit_start, \ - pI830->batch_emitting); \ - if (pI830->batch_used < pI830->batch_emit_start + pI830->batch_emitting) \ - FatalError("%s: ADVANCE_BATCH: under-used allocation %d/%d\n ", \ - __FUNCTION__, \ - pI830->batch_used - pI830->batch_emit_start, \ - pI830->batch_emitting); \ - if ((pI830->batch_emitting > 8) && (I810_DEBUG & DEBUG_ALWAYS_SYNC)) { \ - /* Note: not actually syncing, just flushing each batch. */ \ - intel_batch_flush(pScrn, FALSE); \ - } \ - pI830->batch_emitting = 0; \ + if (pI830->batch_emitting == 0) \ + FatalError("%s: ADVANCE_BATCH called with no matching " \ + "BEGIN_BATCH\n", __FUNCTION__); \ + if (pI830->batch_used > \ + pI830->batch_emit_start + pI830->batch_emitting) \ + FatalError("%s: ADVANCE_BATCH: exceeded allocation %d/%d\n ", \ + __FUNCTION__, \ + pI830->batch_used - pI830->batch_emit_start, \ + pI830->batch_emitting); \ + if (pI830->batch_used < pI830->batch_emit_start + \ + pI830->batch_emitting) \ + FatalError("%s: ADVANCE_BATCH: under-used allocation %d/%d\n ", \ + __FUNCTION__, \ + pI830->batch_used - pI830->batch_emit_start, \ + pI830->batch_emitting); \ + if ((pI830->batch_emitting > 8) && \ + (I810_DEBUG & DEBUG_ALWAYS_SYNC)) { \ + /* Note: not actually syncing, just flushing each batch. */ \ + intel_batch_flush(pScrn, FALSE); \ + } \ + pI830->batch_emitting = 0; \ } while (0) #endif /* _INTEL_BATCHBUFFER_H */ |