summaryrefslogtreecommitdiff
path: root/src/radeon_vbo.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-11-30 15:32:12 +1000
committerDave Airlie <airlied@redhat.com>2009-12-01 13:40:45 +1000
commit88a50a30df11a06263209340a42251851f8e2334 (patch)
tree7a8ee4323f5f9ed91ff96e73986343315e0232e0 /src/radeon_vbo.h
parentb2597deea3a3953ff50d54ff37e3c043eac409f4 (diff)
r600: fix multi-operation in single batch support.
This ports the mesa DMA buffer handling with the 3 lists, Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/radeon_vbo.h')
-rw-r--r--src/radeon_vbo.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/radeon_vbo.h b/src/radeon_vbo.h
new file mode 100644
index 00000000..a8c70b30
--- /dev/null
+++ b/src/radeon_vbo.h
@@ -0,0 +1,62 @@
+
+#ifndef RADEON_VBO_H
+#define RADEON_VBO_H
+
+extern void r600_vb_no_space(ScrnInfoPtr pScrn, int vert_size);
+extern void radeon_vbo_init_lists(ScrnInfoPtr pScrn);
+extern void radeon_vbo_free_lists(ScrnInfoPtr pScrn);
+extern void radeon_vbo_flush_bos(ScrnInfoPtr pScrn);
+extern void radeon_vbo_get(ScrnInfoPtr pScrn);
+extern void radeon_vbo_put(ScrnInfoPtr pScrn);
+
+static inline void radeon_vbo_check(ScrnInfoPtr pScrn, int vert_size)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ struct radeon_accel_state *accel_state = info->accel_state;
+
+ if ((accel_state->vb_offset + (3 * vert_size)) > accel_state->vb_total) {
+ r600_vb_no_space(pScrn, vert_size);
+ }
+}
+
+static inline void *
+radeon_vbo_space(ScrnInfoPtr pScrn, int vert_size)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ struct radeon_accel_state *accel_state = info->accel_state;
+ void *vb;
+
+ /* we've ran out of space in the vertex buffer - need to get a
+ new one */
+ if ((accel_state->vb_offset + (3 * vert_size)) > accel_state->vb_total) {
+ r600_vb_no_space(pScrn, vert_size);
+ }
+ accel_state->vb_op_vert_size = vert_size;
+#if defined(XF86DRM_MODE)
+ if (info->cs) {
+ int ret;
+ struct radeon_bo *bo = accel_state->vb_bo;
+
+ if (!bo->ptr) {
+ ret = radeon_bo_map(bo, 1);
+ if (ret) {
+ FatalError("Failed to map vb %d\n", ret);
+ return NULL;
+ }
+ }
+ vb = (pointer)((char *)bo->ptr + accel_state->vb_offset);
+ } else
+#endif
+ vb = (pointer)((char *)accel_state->vb_ptr + accel_state->vb_offset);
+ return vb;
+}
+
+static inline void radeon_vbo_commit(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ struct radeon_accel_state *accel_state = info->accel_state;
+
+ accel_state->vb_offset += 3 * accel_state->vb_op_vert_size;
+}
+
+#endif