Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [i-g-t PATCH v3 2/2] tests/lib: make sure the GPU is idle at test start and exit
Date: Tue, 28 May 2013 18:33:20 +0200	[thread overview]
Message-ID: <20130528163320.GD15743@phenom.ffwll.local> (raw)
In-Reply-To: <1369751732-19173-1-git-send-email-imre.deak@intel.com>

On Tue, May 28, 2013 at 05:35:32PM +0300, Imre Deak wrote:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64270
> 
> v2:
> - Make sure also that the GPU is idle at start and error exit of any
>   test using drm_open_any(). (Daniel)
> v3:
> - actually call gem_quiescent_gpu() at exit
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Both merged to igt, thanks.
-Daniel

> ---
>  lib/drmtest.c | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 2d37fb6..d17dbb0 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -228,7 +228,7 @@ int drm_get_card(int master)
>  }
>  
>  /** Open the first DRM device we can find, searching up to 16 device nodes */
> -int drm_open_any(void)
> +static int __drm_open_any(void)
>  {
>  	char *name;
>  	int ret, fd;
> @@ -248,6 +248,31 @@ int drm_open_any(void)
>  	return fd;
>  }
>  
> +static void quiescent_gpu_at_exit(int sig)
> +{
> +	int fd;
> +
> +	fd = __drm_open_any();
> +	if (fd >= 0) {
> +		gem_quiescent_gpu(fd);
> +		close(fd);
> +	}
> +}
> +
> +int drm_open_any(void)
> +{
> +	static int open_count;
> +	int fd = __drm_open_any();
> +
> +	if (fd < 0 || __sync_fetch_and_add(&open_count, 1))
> +		return fd;
> +
> +	gem_quiescent_gpu(fd);
> +	drmtest_install_exit_handler(quiescent_gpu_at_exit);
> +
> +	return fd;
> +}
> +
>  /**
>   * Open the first DRM device we can find where we end up being the master.
>   */
> -- 
> 1.8.1.2
> 
> _______________________________________________
> 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-05-28 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-27 15:42 [i-g-t PATCH] tests/gem_wait_render_timeout: make sure the GPU is idle before exiting Imre Deak
2013-05-28  9:31 ` Daniel Vetter
2013-05-28 14:22 ` [i-g-t PATCH v2 1/2] lib: make sure all rings are idle in gpu_quiescent_gpu() Imre Deak
2013-05-28 14:22 ` [i-g-t PATCH v2 2/2] tests/lib: make sure the GPU is idle at test start and exit Imre Deak
2013-05-28 14:35   ` [i-g-t PATCH v3 " Imre Deak
2013-05-28 16:33     ` Daniel Vetter [this message]

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=20130528163320.GD15743@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox