diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2011-01-21 17:30:28 -0500 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2011-01-21 17:30:28 -0500 |
commit | fadee0409a8e13b78bbccb83dd70f590fee23d57 (patch) | |
tree | ed112884fc3b212718ecb544cbde5b1d90d086ef /src | |
parent | af7d81625a8cf873e6efc881489b3eda9861bd03 (diff) |
vbo: balance radeon_vbo_get() and radeon_vbo_put()
bo_ref() and bo_map() in radeon_vbo_get()
bo_unmap() and bo_unref() in radeon_vbo_put()
rather than doing the bo_map() separately in
radeon_vbo_space().
Diffstat (limited to 'src')
-rw-r--r-- | src/radeon_vbo.c | 8 | ||||
-rw-r--r-- | src/radeon_vbo.h | 16 |
2 files changed, 10 insertions, 14 deletions
diff --git a/src/radeon_vbo.c b/src/radeon_vbo.c index c0a668f6..a72224f6 100644 --- a/src/radeon_vbo.c +++ b/src/radeon_vbo.c @@ -56,8 +56,15 @@ void radeon_vbo_put(ScrnInfoPtr pScrn, struct radeon_vbo_object *vbo) void radeon_vbo_get(ScrnInfoPtr pScrn, struct radeon_vbo_object *vbo) { + int ret; vbo->vb_bo = radeon_vbo_get_bo(pScrn); + if (vbo->vb_bo) { + radeon_bo_ref(vbo->vb_bo); + ret = radeon_bo_map(vbo->vb_bo, 1); + if (ret) + FatalError("Failed to map vb %d\n", ret); + } vbo->vb_total = VBO_SIZE; vbo->vb_offset = 0; @@ -195,7 +202,6 @@ again_alloc: } bo = first_elem(&accel_state->bo_reserved)->bo; - radeon_bo_ref(bo); return bo; } diff --git a/src/radeon_vbo.h b/src/radeon_vbo.h index f64930e2..583f2626 100644 --- a/src/radeon_vbo.h +++ b/src/radeon_vbo.h @@ -35,19 +35,9 @@ radeon_vbo_space(ScrnInfoPtr pScrn, vbo->vb_op_vert_size = vert_size; #if defined(XF86DRM_MODE) - if (info->cs) { - int ret; - struct radeon_bo *bo = vbo->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 + vbo->vb_offset); - } else + if (info->cs) + vb = (pointer)((char *)vbo->vb_bo->ptr + vbo->vb_offset); + else #endif vb = (pointer)((char *)vbo->vb_ptr + vbo->vb_offset); return vb; |