[Mesa-dev] [PATCH] winsys/amdgpu: reduce max_alloc_size based on GTT limits

Marek Olšák maraeo at gmail.com
Mon Feb 20 15:10:30 UTC 2017


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Sun, Feb 19, 2017 at 8:25 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Allocating huge buffers in VRAM is not a problem, but when those buffers
> start being migrated, the kernel runs into errors because it cannot split
> those buffer up for moving through GTT.
>
> This should fix intermittent failures of
> GL45-CTS.texture_buffer.texture_buffer_max_size
>
> Cc: mesa-stable at lists.freedesktop.org
> ---
>  src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> index c3dfda5..1fe7060 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> @@ -331,8 +331,10 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd)
>     ws->info.gart_size = gtt.heap_size;
>     ws->info.vram_size = vram.heap_size;
>     ws->info.vram_vis_size = vram_vis.heap_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;
> +   /* The kernel can split large buffers in VRAM but not in GTT, so large
> +    * allocations can fail or cause buffer movement failures in the kernel.
> +    */
> +   ws->info.max_alloc_size = MIN2(ws->info.vram_size * 0.9, ws->info.gart_size * 0.7);
>     /* 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;
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list