From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH] tests/gem_fenced_exec_thrash: Test with > max fences Date: Thu, 11 Apr 2013 20:22:23 +0200 Message-ID: <20130411182223.GQ27612@phenom.ffwll.local> References: <20130409130500.GM3792@cantiga.alporthouse.com> <1365702220-20155-1-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ea0-f172.google.com (mail-ea0-f172.google.com [209.85.215.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D4A2E6689 for ; Thu, 11 Apr 2013 11:19:23 -0700 (PDT) Received: by mail-ea0-f172.google.com with SMTP id z7so908714eaf.31 for ; Thu, 11 Apr 2013 11:19:22 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1365702220-20155-1-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: ville.syrjala@linux.intel.com Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, Apr 11, 2013 at 08:43:40PM +0300, ville.syrjala@linux.intel.com wro= te: > From: Ville Syrj=E4l=E4 > = > Make sure the kernel returns EDEADLK when the number of fences is > exceeded for gen2-3. For gen4+ the test makes sure the kernel ignores > the EXEC_OBJECT_NEEDS_FENCE flag. > = > Note that I changed the code not to round the num_fences to an even > number. Not sure why that was there, and if there's a reason for it, > we need to add it back. > = > Signed-off-by: Ville Syrj=E4l=E4 Looks nice, merged. -Daniel > --- > tests/gem_fenced_exec_thrash.c | 38 +++++++++++++++++++++++++-----------= -- > 1 file changed, 25 insertions(+), 13 deletions(-) > = > diff --git a/tests/gem_fenced_exec_thrash.c b/tests/gem_fenced_exec_thras= h.c > index ca88c53..c8a2c58 100644 > --- a/tests/gem_fenced_exec_thrash.c > +++ b/tests/gem_fenced_exec_thrash.c > @@ -38,6 +38,7 @@ > #include > = > #include "drmtest.h" > +#include "intel_gpu_tools.h" > = > #define WIDTH 1024 > #define HEIGHT 1024 > @@ -47,8 +48,6 @@ > = > #define MAX_FENCES 32 > = > -#define MI_BATCH_BUFFER_END (0xA<<23) > - > /* > * Testcase: execbuf fence accounting > * > @@ -95,7 +94,7 @@ static int get_num_fences(int fd) > printf ("total %d fences\n", val); > assert(val > 4); > = > - return val - 2; > + return val; > } > = > static void fill_reloc(struct drm_i915_gem_relocation_entry *reloc, uint= 32_t handle) > @@ -106,23 +105,19 @@ static void fill_reloc(struct drm_i915_gem_relocati= on_entry *reloc, uint32_t han > reloc->write_domain =3D 0; > } > = > -int > -main(int argc, char **argv) > +static void run_test(int fd, int num_fences, int expected_errno) > { > struct drm_i915_gem_execbuffer2 execbuf[2]; > - struct drm_i915_gem_exec_object2 exec[2][2*MAX_FENCES+1]; > - struct drm_i915_gem_relocation_entry reloc[2*MAX_FENCES]; > + struct drm_i915_gem_exec_object2 exec[2][2*MAX_FENCES+3]; > + struct drm_i915_gem_relocation_entry reloc[2*MAX_FENCES+2]; > = > - int fd =3D drm_open_any(); > - int i, n, num_fences; > + int i, n; > int loop =3D 1000; > = > memset(execbuf, 0, sizeof(execbuf)); > memset(exec, 0, sizeof(exec)); > memset(reloc, 0, sizeof(reloc)); > = > - num_fences =3D get_num_fences(fd) & ~1; > - assert(num_fences <=3D MAX_FENCES); > for (n =3D 0; n < 2*num_fences; n++) { > uint32_t handle =3D tiled_bo_create(fd); > exec[1][2*num_fences - n-1].handle =3D exec[0][n].handle =3D handle; > @@ -148,13 +143,30 @@ main(int argc, char **argv) > ret =3D drmIoctl(fd, > DRM_IOCTL_I915_GEM_EXECBUFFER2, > &execbuf[0]); > - assert(ret =3D=3D 0); > + assert(expected_errno ? > + ret < 0 && errno =3D=3D expected_errno : > + ret =3D=3D 0); > = > ret =3D drmIoctl(fd, > DRM_IOCTL_I915_GEM_EXECBUFFER2, > &execbuf[1]); > - assert(ret =3D=3D 0); > + assert(expected_errno ? > + ret < 0 && errno =3D=3D expected_errno : > + ret =3D=3D 0); > } while (--loop); > +} > + > +int > +main(int argc, char **argv) > +{ > + int fd =3D drm_open_any(); > + int num_fences =3D get_num_fences(fd); > + uint32_t devid =3D intel_get_drm_devid(fd); > + > + assert(num_fences <=3D MAX_FENCES); > + > + run_test(fd, num_fences - 2, 0); > + run_test(fd, num_fences + 1, intel_gen(devid) >=3D 4 ? 0 : EDEADLK); > = > close(fd); > = > -- = > 1.8.1.5 > = > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch