From dc8c12331e567ace9e05fce3198c1c121ec2927d Mon Sep 17 00:00:00 2001
From: Wenlin Kang <wenlin.kang@windriver.com>
Date: Thu, 8 Sep 2016 12:18:13 +0800
Subject: [PATCH] qtmultimedia: fix a conflicting declaration

Use lgl2.h instead of gl2.h and gl2ext.h,
fix a "conflicting declaration" error.

Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
---
 src/plugins/videonode/imx6/lgl2.h             | 46 +++++++++++++++++++
 .../imx6/qsgvivantevideomaterial.cpp          |  5 +-
 .../videonode/imx6/qsgvivantevideonode.cpp    |  5 +-
 3 files changed, 52 insertions(+), 4 deletions(-)
 create mode 100644 src/plugins/videonode/imx6/lgl2.h

diff --git a/src/plugins/videonode/imx6/lgl2.h b/src/plugins/videonode/imx6/lgl2.h
new file mode 100644
index 00000000..24236976
--- /dev/null
+++ b/src/plugins/videonode/imx6/lgl2.h
@@ -0,0 +1,46 @@
+#ifndef __L_GL2_H__
+#define __L_GL2_H__
+
+// this file comes from <GLES2/gl2.h> and <GLES2/gl2ext.h>,
+// it's a light gl2.h.
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIENTRY
+ *-------------------------------------------------------------------------
+ * This follows the return type of the function  and precedes the function
+ * name in the function prototype.
+ */
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+     /* Win32 but not WinCE */
+#   define KHRONOS_APIENTRY __stdcall
+#else
+#   define KHRONOS_APIENTRY
+#endif
+
+#ifndef GL_APIENTRY
+#   define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#ifndef GL_APIENTRYP
+#   define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+typedef void GLvoid;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef int GLsizei;
+
+#define GL_VIV_YV12                                             0x8FC0
+#define GL_VIV_NV12                                             0x8FC1
+#define GL_VIV_YUY2                                             0x8FC2
+#define GL_VIV_UYVY                                             0x8FC3
+#define GL_VIV_NV21                                             0x8FC4
+#define GL_VIV_I420                                             0x8FC5
+
+typedef void (GL_APIENTRYP PFNGLTEXDIRECTVIVMAPPROC) (GLenum Target, GLsizei Width, GLsizei Height, GLenum Format, GLvoid ** Logical, const GLuint * Physical);
+typedef void (GL_APIENTRYP PFNGLTEXDIRECTMAPVIVPROC) (GLenum Target, GLsizei Width, GLsizei Height, GLenum Format, GLvoid ** Logical, const GLuint * Physical);
+typedef void (GL_APIENTRYP PFNGLTEXDIRECTVIVPROC) (GLenum Target, GLsizei Width, GLsizei Height, GLenum Format, GLvoid ** Pixels);
+typedef void (GL_APIENTRYP PFNGLTEXDIRECTINVALIDATEVIVPROC) (GLenum Target);
+typedef void (GL_APIENTRYP PFNGLTEXDIRECTTILEDMAPVIVPROC) (GLenum Target, GLsizei Width, GLsizei Height, GLenum Format, GLvoid ** Logical, const GLuint * Physical);
+
+#endif
diff --git a/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp b/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp
index e1468fe3..a77a9d6a 100644
--- a/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp
+++ b/src/plugins/videonode/imx6/qsgvivantevideomaterial.cpp
@@ -37,8 +37,9 @@
 **
 ****************************************************************************/
 
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
+// use lgl2.h instead of <GLES2/gl2.h> and <GLES2/gl2ext.h>,
+// fixes a conflicting declaration issue.
+#include "lgl2.h"
 
 #include "qsgvivantevideomaterial.h"
 #include "qsgvivantevideomaterialshader.h"
diff --git a/src/plugins/videonode/imx6/qsgvivantevideonode.cpp b/src/plugins/videonode/imx6/qsgvivantevideonode.cpp
index c8d83b4b..5b1b8f24 100644
--- a/src/plugins/videonode/imx6/qsgvivantevideonode.cpp
+++ b/src/plugins/videonode/imx6/qsgvivantevideonode.cpp
@@ -37,8 +37,9 @@
 **
 ****************************************************************************/
 
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
+// use lgl2.h instead of <GLES2/gl2.h> and <GLES2/gl2ext.h>,
+// fixes a conflicting declaration issue.
+#include "lgl2.h"
 
 #include "qsgvivantevideonode.h"
 #include "qsgvivantevideomaterialshader.h"
