All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] tests/gem_fenced_exec_thrash: Test with > max fences
Date: Thu, 11 Apr 2013 20:22:23 +0200	[thread overview]
Message-ID: <20130411182223.GQ27612@phenom.ffwll.local> (raw)
In-Reply-To: <1365702220-20155-1-git-send-email-ville.syrjala@linux.intel.com>

On Thu, Apr 11, 2013 at 08:43:40PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> 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älä <ville.syrjala@linux.intel.com>

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_thrash.c
> index ca88c53..c8a2c58 100644
> --- a/tests/gem_fenced_exec_thrash.c
> +++ b/tests/gem_fenced_exec_thrash.c
> @@ -38,6 +38,7 @@
>  #include <i915_drm.h>
>  
>  #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, uint32_t handle)
> @@ -106,23 +105,19 @@ static void fill_reloc(struct drm_i915_gem_relocation_entry *reloc, uint32_t han
>  	reloc->write_domain = 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 = drm_open_any();
> -	int i, n, num_fences;
> +	int i, n;
>  	int loop = 1000;
>  
>  	memset(execbuf, 0, sizeof(execbuf));
>  	memset(exec, 0, sizeof(exec));
>  	memset(reloc, 0, sizeof(reloc));
>  
> -	num_fences = get_num_fences(fd) & ~1;
> -	assert(num_fences <= MAX_FENCES);
>  	for (n = 0; n < 2*num_fences; n++) {
>  		uint32_t handle = tiled_bo_create(fd);
>  		exec[1][2*num_fences - n-1].handle = exec[0][n].handle = handle;
> @@ -148,13 +143,30 @@ main(int argc, char **argv)
>  		ret = drmIoctl(fd,
>  			       DRM_IOCTL_I915_GEM_EXECBUFFER2,
>  			       &execbuf[0]);
> -		assert(ret == 0);
> +		assert(expected_errno ?
> +		       ret < 0 && errno == expected_errno :
> +		       ret == 0);
>  
>  		ret = drmIoctl(fd,
>  			       DRM_IOCTL_I915_GEM_EXECBUFFER2,
>  			       &execbuf[1]);
> -		assert(ret == 0);
> +		assert(expected_errno ?
> +		       ret < 0 && errno == expected_errno :
> +		       ret == 0);
>  	} while (--loop);
> +}
> +
> +int
> +main(int argc, char **argv)
> +{
> +	int fd = drm_open_any();
> +	int num_fences = get_num_fences(fd);
> +	uint32_t devid = intel_get_drm_devid(fd);
> +
> +	assert(num_fences <= MAX_FENCES);
> +
> +	run_test(fd, num_fences - 2, 0);
> +	run_test(fd, num_fences + 1, intel_gen(devid) >= 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

  reply	other threads:[~2013-04-11 18:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09 12:25 [PATCH i-g-t 0/3] Fence register stuff ville.syrjala
2013-04-09 12:25 ` [PATCH i-g-t 1/3] tests/gem_fenced_exec_thrash: Increase MAX_FENCES to 32 ville.syrjala
2013-04-09 13:05   ` Chris Wilson
2013-04-11 17:43     ` [PATCH] tests/gem_fenced_exec_thrash: Test with > max fences ville.syrjala
2013-04-11 18:22       ` Daniel Vetter [this message]
2013-04-09 12:25 ` [PATCH i-g-t 2/3] tests: Use gem_available_fences() ville.syrjala
2013-04-09 12:25 ` [PATCH i-g-t 3/3] tests/gem_tiling_max_stride: Add a test for max fence stride ville.syrjala
2013-04-09 13:06   ` Chris Wilson
2013-04-09 13:41     ` [PATCH i-g-t v2] " ville.syrjala
2013-04-09 13:51       ` Chris Wilson
2013-04-09 14:45         ` [PATCH i-g-t v4] " ville.syrjala
2013-04-09 18:06           ` Chris Wilson
2013-04-09 18:21             ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130411182223.GQ27612@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.