radeon: take a bo reference when adding to validate list
authorDave Airlie <airlied@redhat.com>
Thu, 16 Apr 2009 03:06:08 +0000 (13:06 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 16 Apr 2009 03:06:08 +0000 (13:06 +1000)
src/mesa/drivers/dri/radeon/radeon_common.c

index 756c09fff3ba12fe7b9abfc4ecb6e18883f3df92..2449795ea940efd5cdd4937d43fac08bf4c5b822 100644 (file)
@@ -928,6 +928,7 @@ void radeon_validate_reset_bos(radeonContextPtr radeon)
        int i;
 
        for (i = 0; i < radeon->state.validated_bo_count; i++) {
+               radeon_bo_unref(radeon->state.bos[i].bo);
                radeon->state.bos[i].bo = NULL;
                radeon->state.bos[i].read_domains = 0;
                radeon->state.bos[i].write_domain = 0;
@@ -938,6 +939,7 @@ void radeon_validate_reset_bos(radeonContextPtr radeon)
 
 void radeon_validate_bo(radeonContextPtr radeon, struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain)
 {
+       radeon_bo_ref(bo);
        radeon->state.bos[radeon->state.validated_bo_count].bo = bo;
        radeon->state.bos[radeon->state.validated_bo_count].read_domains = read_domains;
        radeon->state.bos[radeon->state.validated_bo_count].write_domain = write_domain;