From 29bffb843fdb1da44ffa36920be5743bb46fe0c9 Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Tue, 13 Dec 2022 11:54:20 -0800 Subject: mesa-demos: Move mesa-demos from meta-petalinux Move mesa-demos work from meta-petalinux, fix libmali integration and remove the testapps workaround. Signed-off-by: Mark Hatle --- ...info-Align-EXT_platform_device-extension-.patch | 44 ++++++++++++++ ...info-Use-EGL_PLATFORM_DEVICE_EXT-only-if-.patch | 41 +++++++++++++ .../mesa/mesa-demos/libmali-egl-workaround.patch | 67 ++++++++++++++++++++++ .../recipes-graphics/mesa/mesa-demos_%.bbappend | 16 +++++- 4 files changed, 165 insertions(+), 3 deletions(-) create mode 100644 meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0001-src-egl-eglinfo-Align-EXT_platform_device-extension-.patch create mode 100644 meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0002-src-egl-eglinfo-Use-EGL_PLATFORM_DEVICE_EXT-only-if-.patch create mode 100644 meta-xilinx-core/recipes-graphics/mesa/mesa-demos/libmali-egl-workaround.patch (limited to 'meta-xilinx-core/recipes-graphics') diff --git a/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0001-src-egl-eglinfo-Align-EXT_platform_device-extension-.patch b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0001-src-egl-eglinfo-Align-EXT_platform_device-extension-.patch new file mode 100644 index 00000000..fc2108e1 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0001-src-egl-eglinfo-Align-EXT_platform_device-extension-.patch @@ -0,0 +1,44 @@ +From 9470d00850e8b622d963d4d9c61ad1e59972310a Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan +Date: Tue, 28 Jan 2020 16:10:54 -0800 +Subject: [PATCH 1/2] src: egl: eglinfo: Align EXT_platform_device extension + macros with khronos + +Although the macro definitions are consistent, using the macros name +defined under khronos makes it backward compatible with older eglext.h + +Signed-off-by: Madhurkiran Harikrishnan +upstream-status: Inappropriate [Xilinx specific] +Signed-off-by: Mark Hatle +--- + src/egl/opengl/eglinfo.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c +index 72fe45a..e8a0225 100644 +--- a/src/egl/opengl/eglinfo.c ++++ b/src/egl/opengl/eglinfo.c +@@ -305,17 +305,17 @@ main(int argc, char *argv[]) + NULL), "Android platform"); + if (strstr(clientext, "EGL_MESA_platform_gbm") || + strstr(clientext, "EGL_KHR_platform_gbm")) +- ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_GBM_MESA, ++ ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_GBM_KHR, + EGL_DEFAULT_DISPLAY, + NULL), "GBM platform"); + if (strstr(clientext, "EGL_EXT_platform_wayland") || + strstr(clientext, "EGL_KHR_platform_wayland")) +- ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, ++ ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, + EGL_DEFAULT_DISPLAY, + NULL), "Wayland platform"); + if (strstr(clientext, "EGL_EXT_platform_x11") || + strstr(clientext, "EGL_KHR_platform_x11")) +- ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_X11_EXT, ++ ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_X11_KHR, + EGL_DEFAULT_DISPLAY, + NULL), "X11 platform"); + if (strstr(clientext, "EGL_MESA_platform_surfaceless")) +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0002-src-egl-eglinfo-Use-EGL_PLATFORM_DEVICE_EXT-only-if-.patch b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0002-src-egl-eglinfo-Use-EGL_PLATFORM_DEVICE_EXT-only-if-.patch new file mode 100644 index 00000000..4453b63e --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/0002-src-egl-eglinfo-Use-EGL_PLATFORM_DEVICE_EXT-only-if-.patch @@ -0,0 +1,41 @@ +From 040b0b79a8e73a3348ab2e95f817636a7d479f18 Mon Sep 17 00:00:00 2001 +From: Madhurkiran Harikrishnan +Date: Tue, 28 Jan 2020 16:17:46 -0800 +Subject: [PATCH 2/2] src: egl: eglinfo: Use EGL_PLATFORM_DEVICE_EXT only if + the EGL provider supports it + +Compiling against the other EGL provider like mali fails, as they dont +support this macro as one of thier supported platforms + +Signed-off-by: Madhurkiran Harikrishnan +upstream-status: Inappropritate [Xilinx specific] +Signed-off-by: Mark Hatle +--- + src/egl/opengl/eglinfo.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c +index e8a0225..bc0e869 100644 +--- a/src/egl/opengl/eglinfo.c ++++ b/src/egl/opengl/eglinfo.c +@@ -243,6 +243,7 @@ doOneDisplay(EGLDisplay d, const char *name) + static int + doOneDevice(EGLDeviceEXT d, int i) + { ++#ifdef EGL_PLATFORM_DEVICE_EXT + PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay = + (PFNEGLGETPLATFORMDISPLAYEXTPROC) + eglGetProcAddress("eglGetPlatformDisplayEXT"); +@@ -253,6 +254,9 @@ doOneDevice(EGLDeviceEXT d, int i) + + return doOneDisplay(getPlatformDisplay(EGL_PLATFORM_DEVICE_EXT, d, NULL), + "Platform Device"); ++#else ++ return 0; ++#endif + } + + +-- +2.17.1 + diff --git a/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/libmali-egl-workaround.patch b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/libmali-egl-workaround.patch new file mode 100644 index 00000000..19248bb3 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos/libmali-egl-workaround.patch @@ -0,0 +1,67 @@ +Index: mesa-demos-8.5.0/src/egl/opengl/eglinfo.c +=================================================================== +--- mesa-demos-8.5.0.orig/src/egl/opengl/eglinfo.c ++++ mesa-demos-8.5.0/src/egl/opengl/eglinfo.c +@@ -195,6 +195,7 @@ PrintDisplayExtensions(EGLDisplay d) + } + + ++#ifdef EGL_EXT_device_base + static const char * + PrintDeviceExtensions(EGLDeviceEXT d) + { +@@ -211,7 +212,7 @@ PrintDeviceExtensions(EGLDeviceEXT d) + + return PrintExtensions(extensions); + } +- ++#endif + + static int + doOneDisplay(EGLDisplay d, const char *name) +@@ -240,6 +241,7 @@ doOneDisplay(EGLDisplay d, const char *n + } + + ++#ifdef EGL_EXT_device_base + static int + doOneDevice(EGLDeviceEXT d, int i) + { +@@ -258,8 +260,9 @@ doOneDevice(EGLDeviceEXT d, int i) + return 0; + #endif + } ++#endif + +- ++#ifdef EGL_EXT_device_base + static int + doDevices(const char *name) + { +@@ -288,7 +291,7 @@ doDevices(const char *name) + + return ret; + } +- ++#endif + + int + main(int argc, char *argv[]) +@@ -322,13 +325,17 @@ main(int argc, char *argv[]) + ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_X11_KHR, + EGL_DEFAULT_DISPLAY, + NULL), "X11 platform"); ++#ifdef EGL_PLATFORM_SURFACELESS_MESA + if (strstr(clientext, "EGL_MESA_platform_surfaceless")) + ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA, + EGL_DEFAULT_DISPLAY, + NULL), "Surfaceless platform"); ++#endif ++#ifdef EGL_EXT_device_base + if (strstr(clientext, "EGL_EXT_device_enumeration") && + strstr(clientext, "EGL_EXT_platform_device")) + ret += doDevices("Device platform"); ++#endif + } + else { + ret = doOneDisplay(eglGetDisplay(EGL_DEFAULT_DISPLAY), "Default display"); diff --git a/meta-xilinx-core/recipes-graphics/mesa/mesa-demos_%.bbappend b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos_%.bbappend index d430b63e..b7714a39 100644 --- a/meta-xilinx-core/recipes-graphics/mesa/mesa-demos_%.bbappend +++ b/meta-xilinx-core/recipes-graphics/mesa/mesa-demos_%.bbappend @@ -1,4 +1,14 @@ -# OpenGL comes from libmali on ev/eg, when egl is enabled -DEPENDS:append:mali400 = "${@bb.utils.contains('PACKAGECONFIG', 'egl', ' libmali-xlnx', '', d)}" +FILESEXTRAPATHS:prepend := "${THISDIR}/mesa-demos:" -PACKAGE_ARCH:mali400 = "${@bb.utils.contains('PACKAGECONFIG', 'egl', '${MACHINE_ARCH}', '${TUNE_PKGARCH}', d)}" +SRC_URI += " \ + file://0001-src-egl-eglinfo-Align-EXT_platform_device-extension-.patch \ + file://0002-src-egl-eglinfo-Use-EGL_PLATFORM_DEVICE_EXT-only-if-.patch \ + file://libmali-egl-workaround.patch \ +" + +DEPENDS += "wayland-protocols" + +# Links to libmali-xlnx, so it becomes MACHINE_ARCH specific +DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" +MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" +PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" -- cgit v1.2.3-54-g00ecf