[Intel-gfx] [PATCH igt] tests/kms_*: Use correct DRM context version

Daniel Stone daniels at collabora.com
Fri Apr 7 13:15:26 UTC 2017


DRM_EVENT_CONTEXT_VERSION is the latest context version supported by
whatever version of libdrm is present. igt was blindly asserting it
supported whatever version that may be, even if it actually didn't.

With libdrm 2.4.78, setting a higher context version than 2 will attempt
to call the page_flip_handler2 vfunc if it was non-NULL, which being a
random chunk of stack memory, it might well have been.

Set the version as 2, which should be bumped only with the appropriate
version checks.

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 tests/kms_atomic_transition.c    | 2 +-
 tests/kms_flip.c                 | 2 +-
 tests/kms_flip_tiling.c          | 2 +-
 tests/kms_frontbuffer_tracking.c | 2 +-
 tests/kms_mmio_vs_cs_flip.c      | 2 +-
 tests/kms_rotation_crc.c         | 2 +-
 tests/kms_universal_plane.c      | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 70bff203..80592259 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -146,7 +146,7 @@ static void ev_page_flip(int fd, unsigned seq, unsigned tv_sec, unsigned tv_usec
 }
 
 static drmEventContext drm_events = {
-	.version = DRM_EVENT_CONTEXT_VERSION,
+	.version = 2,
 	.page_flip_handler = ev_page_flip
 };
 
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 41406dfe..a2af8305 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1072,7 +1072,7 @@ static unsigned int wait_for_events(struct test_output *o)
 	igt_assert(event_mask);
 
 	memset(&evctx, 0, sizeof evctx);
-	evctx.version = DRM_EVENT_CONTEXT_VERSION;
+	evctx.version = 2;
 	evctx.vblank_handler = vblank_handler;
 	evctx.page_flip_handler = page_flip_handler;
 
diff --git a/tests/kms_flip_tiling.c b/tests/kms_flip_tiling.c
index 143be198..5aae29a8 100644
--- a/tests/kms_flip_tiling.c
+++ b/tests/kms_flip_tiling.c
@@ -64,7 +64,7 @@ static void pipe_crc_free(void)
 
 static void wait_for_pageflip(int fd)
 {
-	drmEventContext evctx = { .version = DRM_EVENT_CONTEXT_VERSION };
+	drmEventContext evctx = { .version = 2 };
 	struct timeval timeout = { .tv_sec = 0, .tv_usec = 50000 };
 	fd_set fds;
 	int ret;
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 5f372d9f..e75ea549 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -2278,7 +2278,7 @@ static void wait_flip_event(void)
 	drmEventContext evctx;
 	struct pollfd pfd;
 
-	evctx.version = DRM_EVENT_CONTEXT_VERSION;
+	evctx.version = 2;
 	evctx.vblank_handler = NULL;
 	evctx.page_flip_handler = flip_handler;
 
diff --git a/tests/kms_mmio_vs_cs_flip.c b/tests/kms_mmio_vs_cs_flip.c
index 96a9dec3..fa947d9c 100644
--- a/tests/kms_mmio_vs_cs_flip.c
+++ b/tests/kms_mmio_vs_cs_flip.c
@@ -109,7 +109,7 @@ static void wait_for_flip(data_t *data, uint32_t flip_handle)
 		.tv_usec = 0,
 	};
 	drmEventContext evctx = {
-		.version = DRM_EVENT_CONTEXT_VERSION,
+		.version = 2,
 		.page_flip_handler = page_flip_handler,
 	};
 	fd_set fds;
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 43478849..8306cf26 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -233,7 +233,7 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 
 static void wait_for_pageflip(int fd)
 {
-	drmEventContext evctx = { .version = DRM_EVENT_CONTEXT_VERSION };
+	drmEventContext evctx = { .version = 2 };
 	struct timeval timeout = { .tv_sec = 0, .tv_usec = 50000 };
 	fd_set fds;
 	int ret;
diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index 39fa1f1d..5459a9a3 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -470,7 +470,7 @@ pageflip_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 	pageflip_test_t test = { .data = data };
 	igt_plane_t *primary;
 	struct timeval timeout = { .tv_sec = 0, .tv_usec = 500 };
-	drmEventContext evctx = { .version = DRM_EVENT_CONTEXT_VERSION };
+	drmEventContext evctx = { .version = 2 };
 
 	fd_set fds;
 	int ret = 0;
-- 
2.12.2



More information about the Intel-gfx mailing list