diff mbox

igt/gem_ctx_exec: Add lrc lite restore subtest

Message ID 1429026178-26960-1-git-send-email-michel.thierry@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michel Thierry April 14, 2015, 3:42 p.m. UTC
Exercise lite-restore (re-submit a context that is currently running),
by queueing several small batchbuffers.

This test helps to validate WaIdleLiteRestore.

Signed-off-by: Michel Thierry <michel.thierry@intel.com>
---
 tests/gem_ctx_exec.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

Comments

Daniel Vetter April 14, 2015, 5:12 p.m. UTC | #1
On Tue, Apr 14, 2015 at 04:42:58PM +0100, Michel Thierry wrote:
> Exercise lite-restore (re-submit a context that is currently running),
> by queueing several small batchbuffers.
> 
> This test helps to validate WaIdleLiteRestore.
> 
> Signed-off-by: Michel Thierry <michel.thierry@intel.com>

Applied, thanks.
-Daniel
> ---
>  tests/gem_ctx_exec.c | 30 +++++++++++++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c
> index 43b38a2..3df939c 100644
> --- a/tests/gem_ctx_exec.c
> +++ b/tests/gem_ctx_exec.c
> @@ -155,7 +155,7 @@ static void big_exec(int fd, uint32_t handle, int ring)
>  
>  uint32_t handle;
>  uint32_t batch[2] = {0, MI_BATCH_BUFFER_END};
> -uint32_t ctx_id;
> +uint32_t ctx_id, ctx_id2;
>  int fd;
>  
>  igt_main
> @@ -215,4 +215,32 @@ igt_main
>  
>  		gem_context_destroy(fd, ctx_id);
>  	}
> +
> +	igt_subtest("lrc-lite-restore") {
> +		int i, j;
> +
> +		/*
> +		 * Need 2 contexts to be able to replicate a lite restore,
> +		 * i.e. a running context is resubmitted.
> +		 */
> +		ctx_id = gem_context_create(fd);
> +		ctx_id2 = gem_context_create(fd);
> +
> +		/*
> +		 * Queue several small batchbuffers to be sure we'll send execlists
> +		 * with 2 valid context, and likely cause a lite restore when ctxB
> +		 * is resubmitted at the top of the new execlist.
> +		 */
> +		for (i = 0; i < 20; i++) {
> +			for (j = 0; j < 200; j++) {
> +				igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
> +				igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id2) == 0);
> +			}
> +
> +			gem_sync(fd, handle);
> +		}
> +
> +		gem_context_destroy(fd, ctx_id);
> +		gem_context_destroy(fd, ctx_id2);
> +	}
>  }
> -- 
> 2.3.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c
index 43b38a2..3df939c 100644
--- a/tests/gem_ctx_exec.c
+++ b/tests/gem_ctx_exec.c
@@ -155,7 +155,7 @@  static void big_exec(int fd, uint32_t handle, int ring)
 
 uint32_t handle;
 uint32_t batch[2] = {0, MI_BATCH_BUFFER_END};
-uint32_t ctx_id;
+uint32_t ctx_id, ctx_id2;
 int fd;
 
 igt_main
@@ -215,4 +215,32 @@  igt_main
 
 		gem_context_destroy(fd, ctx_id);
 	}
+
+	igt_subtest("lrc-lite-restore") {
+		int i, j;
+
+		/*
+		 * Need 2 contexts to be able to replicate a lite restore,
+		 * i.e. a running context is resubmitted.
+		 */
+		ctx_id = gem_context_create(fd);
+		ctx_id2 = gem_context_create(fd);
+
+		/*
+		 * Queue several small batchbuffers to be sure we'll send execlists
+		 * with 2 valid context, and likely cause a lite restore when ctxB
+		 * is resubmitted at the top of the new execlist.
+		 */
+		for (i = 0; i < 20; i++) {
+			for (j = 0; j < 200; j++) {
+				igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+				igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id2) == 0);
+			}
+
+			gem_sync(fd, handle);
+		}
+
+		gem_context_destroy(fd, ctx_id);
+		gem_context_destroy(fd, ctx_id2);
+	}
 }