[Intel-gfx] [PATCH igt v4 06/13] igt/gem_exec_parse: init global parser_version in fixture

Robert Bragg robert at sixbynine.org
Mon Nov 14 20:51:15 UTC 2016


This adds a static global int parser_version that can be referenced by
all subtests without needing multiple GETPARAM requests.

Signed-off-by: Robert Bragg <robert at sixbynine.org>
---
 tests/gem_exec_parse.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tests/gem_exec_parse.c b/tests/gem_exec_parse.c
index ebcd092..9e57ff5 100644
--- a/tests/gem_exec_parse.c
+++ b/tests/gem_exec_parse.c
@@ -51,6 +51,7 @@
 #define   PIPE_CONTROL_QW_WRITE	(1<<14)
 #define   PIPE_CONTROL_LRI_POST_OP (1<<23)
 
+static int parser_version;
 
 static int command_parser_version(int fd)
 {
@@ -341,7 +342,7 @@ static void hsw_load_register_reg(void)
 	fd = drm_open_driver(DRIVER_INTEL);
 
 	igt_require(IS_HASWELL(intel_get_drm_devid(fd)));
-	igt_require(command_parser_version(fd) >= 7);
+	igt_require(parser_version >= 7);
 
 	handle = gem_create(fd, 4096);
 
@@ -381,16 +382,10 @@ igt_main
 	int fd;
 
 	igt_fixture {
-		int parser_version = 0;
-                drm_i915_getparam_t gp;
-		int rc;
-
 		fd = drm_open_driver(DRIVER_INTEL);
 
-		gp.param = I915_PARAM_CMD_PARSER_VERSION;
-		gp.value = &parser_version;
-		rc = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
-		igt_require(!rc && parser_version > 0);
+		parser_version = command_parser_version(fd);
+		igt_require(parser_version != -1);
 
 		igt_require(gem_uses_ppgtt(fd));
 
-- 
2.10.1



More information about the Intel-gfx mailing list