From 9dec164f8c867bc69f3bf1295faf67d35d44989e Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Wed, 26 Oct 2022 17:52:59 -0700 Subject: weston: Fix build with libmali/mali400 libmali provides GLESv1 and v2, but not v3 which Weston is using. Implement workarounds for v3 usage Signed-off-by: Mark Hatle --- .../0002-libmali-does-not-support-gles3.patch | 77 ++++++++++++++++++++++ .../recipes-graphics/wayland/weston_%.bbappend | 2 + 2 files changed, 79 insertions(+) create mode 100644 meta-xilinx-core/recipes-graphics/wayland/files/0002-libmali-does-not-support-gles3.patch diff --git a/meta-xilinx-core/recipes-graphics/wayland/files/0002-libmali-does-not-support-gles3.patch b/meta-xilinx-core/recipes-graphics/wayland/files/0002-libmali-does-not-support-gles3.patch new file mode 100644 index 00000000..d4dadc7c --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/wayland/files/0002-libmali-does-not-support-gles3.patch @@ -0,0 +1,77 @@ +libmali does not support libgles3 + +Build in compatible ifdefs where necessary to workaround slight differences +between GLES2 (mali) and GLES3 (mesa) that Weston is expecting. + +Signed-off-by: Mark Hatle + +diff -urN a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c +--- a/libweston/renderer-gl/gl-renderer.c 2022-07-26 03:22:25.000000000 -0700 ++++ b/libweston/renderer-gl/gl-renderer.c 2022-10-26 16:25:13.497247422 -0700 +@@ -29,7 +29,7 @@ + + #include + #include +-#include ++/*#include */ + + #include + #include +@@ -1822,7 +1822,13 @@ + return GL_RED_EXT; + case GL_RG8_EXT: + return GL_RG_EXT; ++#ifndef GL_RGBA16F ++#define GL_RGBA16F GL_RGBA16F_EXT ++#endif + case GL_RGBA16F: ++#ifndef GL_RGB10_A2 ++#define GL_RGB10_A2 GL_RGB10_A2_EXT ++#endif + case GL_RGB10_A2: + return GL_RGBA; + default: +@@ -2023,6 +2029,9 @@ + gs->shader_variant = SHADER_VARIANT_RGBA; + pitch = wl_shm_buffer_get_stride(shm_buffer) / 8; + gl_format[0] = GL_RGBA16F; ++#ifndef GL_HALF_FLOAT ++#define GL_HALF_FLOAT GL_HALF_FLOAT_OES ++#endif + gl_pixel_type = GL_HALF_FLOAT; + es->is_opaque = false; + break; +diff -urN a/libweston/renderer-gl/gl-shader-config-color-transformation.c b/libweston/renderer-gl/gl-shader-config-color-transformation.c +--- a/libweston/renderer-gl/gl-shader-config-color-transformation.c 2022-07-26 03:22:25.000000000 -0700 ++++ b/libweston/renderer-gl/gl-shader-config-color-transformation.c 2022-07-26 03:22:25.000000000 -0700 +@@ -25,7 +25,8 @@ + + #include "config.h" + +-#include ++#include ++/*#include */ + #include + + #include +@@ -138,6 +139,9 @@ + glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0); + glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0); ++#ifndef GL_R32F ++#define GL_R32F GL_R32F_EXT ++#endif + glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, lut_len, nr_rows, 0, + GL_RED_EXT, GL_FLOAT, lut); + +diff -ur a/shared/weston-egl-ext.h b/shared/weston-egl-ext.h +--- a/shared/weston-egl-ext.h 2022-07-26 03:22:25.000000000 -0700 ++++ b/shared/weston-egl-ext.h 2022-10-26 17:11:28.501107772 -0700 +@@ -150,6 +150,7 @@ + #define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0) + #define EGL_BAD_DEVICE_EXT 0x322B + #define EGL_DEVICE_EXT 0x322C ++#define EGLAttrib EGLAttribKHR + typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); + typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); + typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); diff --git a/meta-xilinx-core/recipes-graphics/wayland/weston_%.bbappend b/meta-xilinx-core/recipes-graphics/wayland/weston_%.bbappend index 85176995..f8d7f6ab 100644 --- a/meta-xilinx-core/recipes-graphics/wayland/weston_%.bbappend +++ b/meta-xilinx-core/recipes-graphics/wayland/weston_%.bbappend @@ -7,6 +7,8 @@ SOC_FAMILY_ARCH ??= "${TUNE_PKGARCH}" PACKAGE_ARCH:zynqmp = "${SOC_FAMILY_ARCH}" +SRC_URI:append:mali400 = " file://0002-libmali-does-not-support-gles3.patch" + # OpenGL comes from libmali on ev/eg, when egl is enabled DEPENDS:append:mali400 = "${@bb.utils.contains('PACKAGECONFIG', 'egl', ' libmali-xlnx', '', d)}" -- cgit v1.2.3-54-g00ecf