winsys/amdgpu: count buffer size only once
authorMarek Olšák <marek.olsak@amd.com>
Thu, 28 Apr 2016 15:30:16 +0000 (17:30 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 2 May 2016 20:49:25 +0000 (22:49 +0200)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c

index 1536829b36316660510ef09cec89bb6bfdf76a47..03e45a95920c891c12032de96b58ab09c7c9e90d 100644 (file)
@@ -525,10 +525,10 @@ static unsigned amdgpu_cs_add_buffer(struct radeon_winsys_cs *rcs,
    unsigned index = amdgpu_add_buffer(cs, bo, usage, bo->initial_domain,
                                      priority, &added_domains);
 
-   if (added_domains & RADEON_DOMAIN_GTT)
-      cs->used_gart += bo->base.size;
    if (added_domains & RADEON_DOMAIN_VRAM)
       cs->used_vram += bo->base.size;
+   else if (added_domains & RADEON_DOMAIN_GTT)
+      cs->used_gart += bo->base.size;
 
    return index;
 }