piglit: add patches for unbuildable surfaceless Mesa test

[Backported from master.]

Some EGL implementations do not actually ship all Khronos-
extensions. As it turns out, the Mali 450 driver does not
include any of the following symbols, used by the
egl_mesa_platform_surfaceless.c spec test:
* eglGetPlatformDisplay
* eglCreatePlatformPixmapSurface
* eglCreatePlatformWindowSurface

The Right Thing To Do was to obtain the implementation of
these functions (via eglGetProcAddress), as is provided
by their EXT counterparts. These are guaranteed to exist
since they are required by EGL_EXT_platform_base.

(From OE-Core rev: 903a051d47e550553aa9d6d9c38c43737f376cfe)

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Daniel Díaz 2017-06-07 09:51:21 -05:00 committed by Richard Purdie
parent 262af7bf2d
commit c63903443b
4 changed files with 171 additions and 0 deletions

View File

@ -0,0 +1,54 @@
From a6608f218b5023cef36b3de5ec3c5f00b0211d1c Mon Sep 17 00:00:00 2001
From: Daniel Diaz <daniel.diaz@linaro.org>
Date: Wed, 17 May 2017 18:00:15 -0500
Subject: [PATCH 2/4] util/egl: Honour Surfaceless MESA in get_default_display
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The EGL_MESA_platform_surfaceless extension was introduced not too long
ago. Add support for it our helper.
Upstream-Status: Accepted, since git 7b74602.
Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
---
tests/util/piglit-util-egl.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tests/util/piglit-util-egl.c b/tests/util/piglit-util-egl.c
index 106c735..389fe12 100644
--- a/tests/util/piglit-util-egl.c
+++ b/tests/util/piglit-util-egl.c
@@ -85,6 +85,7 @@ piglit_egl_get_default_display(EGLenum platform)
static bool has_x11 = false;
static bool has_wayland = false;
static bool has_gbm = false;
+ static bool has_surfaceless_mesa = false;
static EGLDisplay (*peglGetPlatformDisplayEXT)(EGLenum platform, void *native_display, const EGLint *attrib_list);
@@ -99,6 +100,7 @@ piglit_egl_get_default_display(EGLenum platform)
has_x11 = piglit_is_egl_extension_supported(EGL_NO_DISPLAY, "EGL_EXT_platform_x11");
has_wayland = piglit_is_egl_extension_supported(EGL_NO_DISPLAY, "EGL_EXT_platform_wayland");
has_gbm = piglit_is_egl_extension_supported(EGL_NO_DISPLAY, "EGL_EXT_platform_gbm");
+ has_surfaceless_mesa = piglit_is_egl_extension_supported(EGL_NO_DISPLAY, "EGL_MESA_platform_surfaceless");
peglGetPlatformDisplayEXT = (void*) eglGetProcAddress("eglGetPlatformDisplayEXT");
}
@@ -123,6 +125,11 @@ piglit_egl_get_default_display(EGLenum platform)
return EGL_NO_DISPLAY;
}
break;
+ case EGL_PLATFORM_SURFACELESS_MESA:
+ if (!has_surfaceless_mesa) {
+ return EGL_NO_DISPLAY;
+ }
+ break;
default:
fprintf(stderr, "%s: unrecognized platform %#x\n", __func__, platform);
return EGL_NO_DISPLAY;
--
1.9.1

View File

@ -0,0 +1,36 @@
From c0dc430b8f5deeacdb11cd188195e16f512af233 Mon Sep 17 00:00:00 2001
From: Daniel Diaz <daniel.diaz@linaro.org>
Date: Wed, 17 May 2017 18:00:16 -0500
Subject: [PATCH 3/4] egl_mesa_platform_surfaceless: Don't use
eglGetPlatformDisplay directly
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The entry point is not guaranteed to exist, so use the
piglit_egl_get_default_display() helper which does the correct thing.
Upstream-Status: Accepted, since git 7b74602.
Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
---
.../spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c b/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c
index 3bbd6aa..81a3919 100644
--- a/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c
+++ b/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c
@@ -31,7 +31,7 @@ test_setup(EGLDisplay *dpy)
piglit_require_egl_extension(EGL_NO_DISPLAY, "EGL_MESA_platform_surfaceless");
- *dpy = eglGetPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA, NULL, NULL);
+ *dpy = piglit_egl_get_default_display(EGL_PLATFORM_SURFACELESS_MESA);
if (*dpy == EGL_NO_DISPLAY) {
printf("failed to get EGLDisplay\n");
piglit_report_result(PIGLIT_SKIP);
--
1.9.1

View File

@ -0,0 +1,78 @@
From 57de1ff6758ec5ea4a52637f233e3e3150086255 Mon Sep 17 00:00:00 2001
From: Daniel Diaz <daniel.diaz@linaro.org>
Date: Wed, 17 May 2017 18:00:17 -0500
Subject: [PATCH 4/4] egl_mesa_platform_surfaceless: Use EXT functions for
surfaces
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
These EXT symbols are guaranteed to exist since they require
EGL_EXT_platform_base.
Upstream-Status: Accepted, since git 7b74602.
Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
---
.../egl_mesa_platform_surfaceless.c | 23 ++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c b/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c
index 81a3919..264ed71 100644
--- a/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c
+++ b/tests/egl/spec/egl_mesa_platform_surfaceless/egl_mesa_platform_surfaceless.c
@@ -24,6 +24,24 @@
#include "piglit-util.h"
#include "piglit-util-egl.h"
+/* Extension function pointers.
+ *
+ * Use prefix 'pegl' (piglit egl) instead of 'egl' to avoid collisions with
+ * prototypes in eglext.h. */
+EGLSurface (*peglCreatePlatformPixmapSurfaceEXT)(EGLDisplay display, EGLConfig config,
+ NativePixmapType native_pixmap, const EGLint *attrib_list);
+EGLSurface (*peglCreatePlatformWindowSurfaceEXT)(EGLDisplay display, EGLConfig config,
+ NativeWindowType native_window, const EGLint *attrib_list);
+
+static void
+init_egl_extension_funcs(void)
+{
+ peglCreatePlatformPixmapSurfaceEXT = (void*)
+ eglGetProcAddress("eglCreatePlatformPixmapSurfaceEXT");
+ peglCreatePlatformWindowSurfaceEXT = (void*)
+ eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
+}
+
static void
test_setup(EGLDisplay *dpy)
{
@@ -72,7 +90,7 @@ test_create_window(void *test_data)
test_setup(&dpy);
- surf = eglCreatePlatformWindowSurface(dpy, EGL_NO_CONFIG_KHR,
+ surf = peglCreatePlatformWindowSurfaceEXT(dpy, EGL_NO_CONFIG_KHR,
/*native_window*/ NULL,
/*attrib_list*/ NULL);
if (surf) {
@@ -103,7 +121,7 @@ test_create_pixmap(void *test_data)
test_setup(&dpy);
- surf = eglCreatePlatformPixmapSurface(dpy, EGL_NO_CONFIG_KHR,
+ surf = peglCreatePlatformPixmapSurfaceEXT(dpy, EGL_NO_CONFIG_KHR,
/*native_window*/ NULL,
/*attrib_list*/ NULL);
if (surf) {
@@ -205,6 +223,7 @@ main(int argc, char **argv)
piglit_report_result(PIGLIT_FAIL);
}
+ init_egl_extension_funcs();
result = piglit_run_selected_subtests(subtests, selected_names,
num_selected, result);
piglit_report_result(result);
--
1.9.1

View File

@ -6,6 +6,9 @@ SRC_URI = "git://anongit.freedesktop.org/piglit \
file://0001-cmake-install-bash-completions-in-the-right-place.patch \
file://0001-tests-Use-FE_UPWARD-only-if-its-defined-in-fenv.h.patch \
file://0001-CMake-define-GBM_BO_MAP-only-when-symbol-is-found.patch \
file://0002-util-egl-Honour-Surfaceless-MESA-in-get_default_disp.patch \
file://0003-egl_mesa_platform_surfaceless-Don-t-use-eglGetPlatfo.patch \
file://0004-egl_mesa_platform_surfaceless-Use-EXT-functions-for-.patch \
"
# From 2017-02-06