Add a subtest that reuses the same EGLDisplay used in the main thread. This is just another case we can test and see if there's a difference in the preemption behavior. --- tests/egl/egl-context-preemption.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/tests/egl/egl-context-preemption.c b/tests/egl/egl-context-preemption.c index e9180d4ee..3781f2fcf 100644 --- a/tests/egl/egl-context-preemption.c +++ b/tests/egl/egl-context-preemption.c @@ -51,6 +51,7 @@ struct test_data { int nruns; EGLDisplay dpy; EGLContext ctx; + const struct test_profile *p; }; struct test_profile { @@ -58,6 +59,7 @@ struct test_profile { size_t bufsize; GLenum draw_mode; GLuint (*shader_setup)(void); + bool same_display; }; static bool small = false; @@ -300,8 +302,9 @@ setup_thread_context(struct test_data *d) bool ok = false; EGLContext ctx2 = EGL_NO_CONTEXT; - EGLDisplay dpy; - if (init_other_display(&dpy) == PIGLIT_SKIP) { + EGLDisplay dpy = d->dpy; + if (!d->p->same_display && + init_other_display(&dpy) == PIGLIT_SKIP) { piglit_loge("failed to get display\n"); result = PIGLIT_FAIL; return result; @@ -351,7 +354,9 @@ setup_thread_context(struct test_data *d) cleanup: if (ctx2 != EGL_NO_CONTEXT) eglDestroyContext(dpy, ctx2); - eglTerminate(dpy); + + if (!d->p->same_display) + eglTerminate(dpy); return result; } @@ -438,7 +443,8 @@ thread2_create_high_priority_context(void *data) if (d->ctx != EGL_NO_CONTEXT) eglDestroyContext(d->dpy, d->ctx); - eglTerminate(d->dpy); + if (!d->p->same_display) + eglTerminate(d->dpy); return result; } @@ -479,6 +485,7 @@ test_preemption(void *data) struct test_data d = { .main_finished = false, .nruns = 0, + .p = profile, }; d.dpy = eglGetCurrentDisplay(); @@ -626,6 +633,14 @@ static struct test_profile trifan = { .shader_setup = setup_shaders, }; +static struct test_profile triangles_same_display = { + .vertices = triangle_vertices, + .bufsize = sizeof(triangle_vertices), + .draw_mode = GL_TRIANGLES, + .shader_setup = setup_shaders, + .same_display = true, +}; + static const struct piglit_subtest subtests[] = { { "triangles", @@ -639,6 +654,12 @@ static const struct piglit_subtest subtests[] = { test_preemption, &trifan, }, + { + "triangles_same_display", + "same_display", + test_preemption, + &triangles_same_display, + }, {0}, }; -- 2.19.1 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit