[Intel-gfx] [PATCH igt] igt/gem_tiled_fence_blits: Allocate bo array

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Jan 17 12:33:16 UTC 2018


On 17/01/2018 11:49, Chris Wilson wrote:
> As we allow more buffers to be allocated to fill larger apertures, we
> may exceed the static allocation of 4096 buffers.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104669
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>   tests/gem_tiled_fence_blits.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/gem_tiled_fence_blits.c b/tests/gem_tiled_fence_blits.c
> index 51f672fd9..693e96cec 100644
> --- a/tests/gem_tiled_fence_blits.c
> +++ b/tests/gem_tiled_fence_blits.c
> @@ -98,16 +98,20 @@ check_bo(int fd, drm_intel_bo *bo, uint32_t start_val)
>   	}
>   }
>   
> -static void run_test (int fd, int count)
> +static void run_test(int fd, int count)
>   {
> -	drm_intel_bo *bo[4096];
> -	uint32_t bo_start_val[4096];
> +	drm_intel_bo **bo;
> +	uint32_t *bo_start_val;
>   	uint32_t start = 0;
>   	int i;
>   
>   	count |= 1;
>   	igt_info("Using %d 1MiB buffers\n", count);
>   
> +	bo = malloc(count * sizeof(*bo));
> +	bo_start_val = malloc(count * sizeof(*bo_start_val));

I was recently reminded of calloc but it is still OK.

> +	igt_assert(bo && bo_start_val);
> +
>   	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
>   	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
>   	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
> @@ -158,6 +162,9 @@ static void run_test (int fd, int count)
>   
>   	intel_batchbuffer_free(batch);
>   	drm_intel_bufmgr_destroy(bufmgr);
> +
> +	free(bo_start_val);
> +	free(bo);
>   }
>   
>   #define MAX_32b ((1ull << 32) - 4096)
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Regards,

Tvrtko


More information about the Intel-gfx mailing list