gallium/radeon/winsyses: set reasonable max_alloc_size
authorMarek Olšák <marek.olsak@amd.com>
Tue, 4 Oct 2016 21:29:27 +0000 (23:29 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 5 Oct 2016 19:03:54 +0000 (21:03 +0200)
which is returned for GL_MAX_TEXTURE_BUFFER_SIZE.
It doesn't have any other use at the moment.
Bigger allocations are not rejected.

This fixes GL45-CTS.texture_buffer.texture_buffer_max_size on Bonaire.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c

index c28e1ca373c025e946a5d4aa284f07890e59d79c..98d72bd9f2c8fa4e545211c1a177e04a30ad8946 100644 (file)
@@ -318,8 +318,8 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd)
    /* Set hardware information. */
    ws->info.gart_size = gtt.heap_size;
    ws->info.vram_size = vram.heap_size;
-   /* TODO: the kernel reports vram/gart.max_allocation == 251 MB (bug?) */
-   ws->info.max_alloc_size = MAX2(ws->info.vram_size, ws->info.gart_size);
+   /* The kernel can split large buffers, so we can do large allocations. */
+   ws->info.max_alloc_size = MAX2(ws->info.vram_size, ws->info.gart_size) * 0.9;
    /* convert the shader clock from KHz to MHz */
    ws->info.max_shader_clock = ws->amdinfo.max_engine_clk / 1000;
    ws->info.max_se = ws->amdinfo.num_shader_engines;
index c7ceee250b8cf58c6d571a757bbffd0b877711b9..70f061ccc36441b573c1895aa988e1b341c78482 100644 (file)
@@ -373,7 +373,9 @@ static bool do_winsys_init(struct radeon_drm_winsys *ws)
     ws->info.gart_size = gem_info.gart_size;
     ws->info.vram_size = gem_info.vram_size;
 
-    ws->info.max_alloc_size = MAX2(ws->info.vram_size, ws->info.gart_size);
+    /* Radeon allocates all buffers as contigous, which makes large allocations
+     * unlikely to succeed. */
+    ws->info.max_alloc_size = MAX2(ws->info.vram_size, ws->info.gart_size) * 0.7;
     if (ws->info.drm_minor < 40)
         ws->info.max_alloc_size = MIN2(ws->info.max_alloc_size, 256*1024*1024);