[Piglit] [PATCH 4/5] egl-util: introduce egl_util_create_native_pixmap helper

Emil Velikov emil.l.velikov at gmail.com
Mon Dec 11 20:15:22 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

Allows us to consolidate native platform specifics in once place.
Will be reused in later commit(s).

Cc: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 tests/egl/egl-util.c | 12 +++++++++---
 tests/egl/egl-util.h |  3 +++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c
index 92a799185..fa6d482ed 100644
--- a/tests/egl/egl-util.c
+++ b/tests/egl/egl-util.c
@@ -84,15 +84,21 @@ egl_init_test(struct egl_test *test)
 	test->stop_on_failure = true;
 }
 
+EGLNativePixmapType
+egl_util_create_native_pixmap(struct egl_state *state, int width, int height)
+{
+	return XCreatePixmap(state->dpy, state->win,
+			     width, height, state->depth);
+}
+
 EGLSurface
 egl_util_create_pixmap(struct egl_state *state,
 		       int width, int height, const EGLint *attribs)
 {
-	Pixmap pixmap;
+	EGLNativePixmapType pixmap;
 	EGLSurface surf;
 
-	pixmap = XCreatePixmap(state->dpy, state->win,
-			       width, height, state->depth);
+	pixmap = egl_util_create_native_pixmap(state, width, height);
 
 	surf = eglCreatePixmapSurface(state->egl_dpy, state->cfg,
 				      pixmap, attribs);
diff --git a/tests/egl/egl-util.h b/tests/egl/egl-util.h
index 614e58648..428e144b4 100644
--- a/tests/egl/egl-util.h
+++ b/tests/egl/egl-util.h
@@ -64,6 +64,9 @@ static const EGLint egl_default_window_height = 300;
 void
 egl_init_test(struct egl_test *test);
 
+EGLNativePixmapType
+egl_util_create_native_pixmap(struct egl_state *state, int width, int height);
+
 EGLSurface
 egl_util_create_pixmap(struct egl_state *state,
 		       int width, int height, const EGLint *attribs);
-- 
2.15.0



More information about the Piglit mailing list