winsys/amdgpu: loosen up requirements for how much memory IBs can use
authorMarek Olšák <marek.olsak@amd.com>
Thu, 28 Apr 2016 14:33:54 +0000 (16:33 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 2 May 2016 20:49:25 +0000 (22:49 +0200)
ported from winsys/radeon.

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 8f50f3587510a5741d27ca5bc98eb57e95837b16..1536829b36316660510ef09cec89bb6bfdf76a47 100644 (file)
@@ -549,11 +549,17 @@ static boolean amdgpu_cs_validate(struct radeon_winsys_cs *rcs)
 static boolean amdgpu_cs_memory_below_limit(struct radeon_winsys_cs *rcs, uint64_t vram, uint64_t gtt)
 {
    struct amdgpu_cs *cs = amdgpu_cs(rcs);
-   boolean status =
-         (cs->used_gart + gtt) < cs->ctx->ws->info.gart_size * 0.7 &&
-         (cs->used_vram + vram) < cs->ctx->ws->info.vram_size * 0.7;
+   struct amdgpu_winsys *ws = cs->ctx->ws;
+
+   vram += cs->used_vram;
+   gtt += cs->used_gart;
+
+   /* Anything that goes above the VRAM size should go to GTT. */
+   if (vram > ws->info.vram_size)
+       gtt += vram - ws->info.vram_size;
 
-   return status;
+   /* Now we just need to check if we have enough GTT. */
+   return gtt < ws->info.gart_size * 0.7;
 }
 
 static unsigned amdgpu_cs_get_buffer_list(struct radeon_winsys_cs *rcs,