diff options
author | Dave Airlie <airlied@redhat.com> | 2009-11-27 10:16:00 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-11-27 14:10:23 +1000 |
commit | a8dbf7c23481501987971a9c0b6cb0760f86127f (patch) | |
tree | 8762e9e19e6aeea5b05872c06201a3f7d8bcf03d /src/r600_state.h | |
parent | 971e463b2cfdc1ba1c78a24fb439d33dd9155dfc (diff) |
r600/accel: cleanup and merge a lot of the accel functions
All of the drawing ops were the exact same modulo the vtx size,
this along with the vertex buffer wrapping code could all be consolidated
into a smaller set of functions.
This also adds 2 VBO which we switch between, and merges a #define to
enable the multiple operations in one CS under KMS mode.
Multi-operation still isn't working though.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/r600_state.h')
-rw-r--r-- | src/r600_state.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/r600_state.h b/src/r600_state.h index b2d2433a..6cd47dcc 100644 --- a/src/r600_state.h +++ b/src/r600_state.h @@ -326,8 +326,7 @@ void r600_vb_discard(ScrnInfoPtr pScrn); int r600_cp_start(ScrnInfoPtr pScrn); -void -r600_finish_op(ScrnInfoPtr pScrn); +void r600_finish_op(ScrnInfoPtr pScrn, int vtx_size); extern Bool RADEONPrepareAccess_CS(PixmapPtr pPix, int index); extern void RADEONFinishAccess_CS(PixmapPtr pPix, int index); @@ -336,4 +335,25 @@ extern void RADEONEXADestroyPixmap(ScreenPtr pScreen, void *driverPriv); extern struct radeon_bo *radeon_get_pixmap_bo(PixmapPtr pPix); extern Bool RADEONEXAPixmapIsOffscreen(PixmapPtr pPix); + +static inline float * +r600_vb_space(ScrnInfoPtr pScrn, int vert_size) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + struct radeon_accel_state *accel_state = info->accel_state; + float *vb; + + if ((accel_state->vb_offset + (3 * vert_size)) > accel_state->vb_total) { + r600_finish_op(pScrn, vert_size); + if (info->cs) + radeon_cs_flush_indirect(pScrn); + r600_cp_start(pScrn); + } + vb = (pointer)((char *)accel_state->vb_ptr + accel_state->vb_offset); + return vb; +} + +#define r600_vb_update(accel_state, vert_size) do { (accel_state)->vb_offset += (3 * (vert_size)); } while(0) + + #endif |