diff options
author | Dave Airlie <airlied@linux.ie> | 2009-01-22 21:12:54 +1000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2009-01-22 21:12:54 +1000 |
commit | 11995807f1d83e29e4517c6ae5449cd702f33835 (patch) | |
tree | e7e0ccec53c11138531dc44a49e23ef4d14eb3a4 /src/mesa | |
parent | 014c52eb6bc2fc0edb69d1ef063eb6c9735b3833 (diff) |
radeon: fix counting for cfree handles in an inline
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_bo_legacy.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c index 32b452d636..c4026be971 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c +++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c @@ -93,6 +93,13 @@ static void bo_legacy_tobj_destroy(void *data, driTextureObject *t) bo_legacy->validated = 0; } +static void inline clean_handles(struct bo_manager_legacy *bom) +{ + while (bom->cfree_handles > 0 && + !bom->free_handles[bom->cfree_handles - 1]) + bom->cfree_handles--; + +} static int legacy_new_handle(struct bo_manager_legacy *bom, uint32_t *handle) { uint32_t tmp; @@ -103,12 +110,7 @@ static int legacy_new_handle(struct bo_manager_legacy *bom, uint32_t *handle) } if (bom->cfree_handles > 0) { tmp = bom->free_handles[--bom->cfree_handles]; - while (!bom->free_handles[bom->cfree_handles - 1]) { - bom->cfree_handles--; - if (bom->cfree_handles <= 0) { - bom->cfree_handles = 0; - } - } + clean_handles(bom); } else { bom->cfree_handles = 0; tmp = bom->nhandle++; @@ -135,12 +137,7 @@ static int legacy_free_handle(struct bo_manager_legacy *bom, uint32_t handle) bom->free_handles[i] = 0; } } - while (!bom->free_handles[bom->cfree_handles - 1]) { - bom->cfree_handles--; - if (bom->cfree_handles <= 0) { - bom->cfree_handles = 0; - } - } + clean_handles(bom); return 0; } if (bom->cfree_handles < bom->nfree_handles) { |