Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From 3e0d5577444b32579bdf5b69d720a322322ff7bc Mon Sep 17 00:00:00 2001 |
| 2 | From: Milian Wolff <milian.wolff@kdab.com> |
| 3 | Date: Tue, 26 Nov 2019 15:08:20 +0100 |
| 4 | Subject: [PATCH] qmlgl: ensure Qt defines GLsync to fix compile on some platforms |
| 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | By explictly including QtGui/qopengl.h we force the code path that |
| 10 | defines GLsync in the Qt-specific way. Without that, some platforms |
| 11 | failed to compile the qmlgl plugin, since neither Qt nor gstreamer |
| 12 | defined GLsync then, leading to e.g.: |
| 13 | |
| 14 | ``` |
| 15 | make[4]: Entering directory '/.../gst-plugins-good-1.16.1/ext/qt' |
| 16 | CXX libgstqmlgl_la-qtitem.lo |
| 17 | In file included from gstqtgl.h:32, |
| 18 | from qtitem.h:27, |
| 19 | from qtitem.cc:28: |
| 20 | /.../usr/include/gstreamer-1.0/ |
| 21 | gst/gl/gstglfuncs.h:93:17: error: expected identifier before ‘*’ token |
| 22 | ret (GSTGLAPI *name) args; |
| 23 | ^ |
| 24 | /.../usr/include/gstreamer-1.0/ |
| 25 | gst/gl/glprototypes/sync.h:27:1: note: in expansion of macro |
| 26 | ‘GST_GL_EXT_FUNCTION’ |
| 27 | GST_GL_EXT_FUNCTION (GLsync, FenceSync, |
| 28 | ^~~~~~~~~~~~~~~~~~~ |
| 29 | ``` |
| 30 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 31 | Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/commit/3e0d5577444b32579bdf5b69d720a322322ff7bc] |
| 32 | --- |
| 33 | ext/qt/gstqtgl.h | 18 +++++++++++------- |
| 34 | 1 file changed, 11 insertions(+), 7 deletions(-) |
| 35 | |
| 36 | --- a/ext/qt/gstqtgl.h |
| 37 | +++ b/ext/qt/gstqtgl.h |
| 38 | @@ -22,14 +22,7 @@ |
| 39 | #include <QtGui/qtgui-config.h> |
| 40 | #endif |
| 41 | |
| 42 | -/* qt uses the same trick as us to typedef GLsync on GLES2 but to a different |
| 43 | - * type which confuses the preprocessor. Instead of trying to reconcile the |
| 44 | - * two, we instead use the GLsync definition from Qt from above, and ensure |
| 45 | - * that we don't typedef GLsync in gstglfuncs.h */ |
| 46 | #include <gst/gl/gstglconfig.h> |
| 47 | -#undef GST_GL_HAVE_GLSYNC |
| 48 | -#define GST_GL_HAVE_GLSYNC 1 |
| 49 | -#include <gst/gl/gstglfuncs.h> |
| 50 | |
| 51 | /* The glext.h guard was renamed in 2018, but some software which |
| 52 | * includes their own copy of the GL headers (such as qt) might have |
| 53 | @@ -46,6 +39,17 @@ |
| 54 | #endif |
| 55 | #endif |
| 56 | |
| 57 | +/* pulls in GLsync, see below */ |
| 58 | +#include <QtGui/qopengl.h> |
| 59 | + |
| 60 | +/* qt uses the same trick as us to typedef GLsync on GLES2 but to a different |
| 61 | + * type which confuses the preprocessor. Instead of trying to reconcile the |
| 62 | + * two, we instead use the GLsync definition from Qt from above, and ensure |
| 63 | + * that we don't typedef GLsync in gstglfuncs.h */ |
| 64 | +#undef GST_GL_HAVE_GLSYNC |
| 65 | +#define GST_GL_HAVE_GLSYNC 1 |
| 66 | +#include <gst/gl/gstglfuncs.h> |
| 67 | + |
| 68 | #if defined(QT_OPENGL_ES_2) |
| 69 | #include <QtGui/QOpenGLContext> |
| 70 | #include <QtGui/QOpenGLFunctions> |