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

Chris Wilson chris at chris-wilson.co.uk
Wed Jan 17 12:38:20 UTC 2018


Quoting Tvrtko Ursulin (2018-01-17 12:33:16)
> 
> 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.

I thought both arrays were set to initial non-zero values in the
following loop.

I started with calloc, realized the memset was overkill and we don't
have malloc_array.
-Chris


More information about the Intel-gfx mailing list