summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2014-10-27 05:40:45 -0700
committerPatrick Ohly <patrick.ohly@intel.com>2014-11-24 10:59:17 +0100
commit4448285b4912ac52a8a0431b6f050baad4738d79 (patch)
tree641b3845220e5f94ea748a7a6ac32c444eb9063f
parentbd3b81b15e78f67c6b4b2ac81c25ca737572cbcc (diff)
downloadmeta-tizen-4448285b4912ac52a8a0431b6f050baad4738d79.tar.gz
meta-tizen-4448285b4912ac52a8a0431b6f050baad4738d79.tar.bz2
meta-tizen-4448285b4912ac52a8a0431b6f050baad4738d79.zip
emulator-yagl: optionally replace Mesa
When enabled in local.conf as quoted below, Mesa is used neither for building nor installed into images. Instead emulator-yagl gets used. Depends on meta data which does not hard-code a dependency on Mesa. PREFERRED_PROVIDER_virtual/libgl = "emulator-yagl" PREFERRED_PROVIDER_virtual/libgles1 = "emulator-yagl" PREFERRED_PROVIDER_virtual/libgles2 = "emulator-yagl" PREFERRED_PROVIDER_virtual/egl = "emulator-yagl"
-rw-r--r--recipes-tizen/emulator-yagl/emulator-yagl-extraconf.inc57
-rw-r--r--recipes-tizen/emulator-yagl/emulator-yagl.inc146
-rw-r--r--recipes-tizen/emulator-yagl/emulator-yagl_git.bb10
-rw-r--r--recipes-tizen/emulator-yagl/files/0001-avoid-dependency-on-mesa.patch537
-rw-r--r--recipes-tizen/emulator-yagl/files/0001-make-egltext.h-more-compatible-with-Mesa.patch27
5 files changed, 777 insertions, 0 deletions
diff --git a/recipes-tizen/emulator-yagl/emulator-yagl-extraconf.inc b/recipes-tizen/emulator-yagl/emulator-yagl-extraconf.inc
new file mode 100644
index 00000000..604642a2
--- /dev/null
+++ b/recipes-tizen/emulator-yagl/emulator-yagl-extraconf.inc
@@ -0,0 +1,57 @@
+# A build dependency because of wayland-scanner.
+# emulator-yagl expects tools and include files inside CMAKE_FIND_ROOT_PATH,
+# so we just depend on the target's wayland.
+# DEPENDS += "wayland"
+
+# inherit tizen_cmake
+
+# Work around broken ${CMAKE_FIND_ROOT_PATH}${WAYLAND_CLIENT_PREFIX}/bin/wayland-scanner:
+# instead of using a hard-coded path, expect it in PATH (which is set by bitbake).
+# Using ${CMAKE_FIND_ROOT_PATH} like that is broken because it is a list of values,
+# not just a single one.
+
+do_compile_prepend() {
+ cd ${S}
+ sed -e 's;[^ ]*/wayland-scanner;wayland-scanner;' CMake/WPCodegenTarget.cmake >CMake/WPCodegenTarget.cmake.tmp
+ mv CMake/WPCodegenTarget.cmake.tmp CMake/WPCodegenTarget.cmake
+
+ # TODO: turn this into a patch.
+ sed -e 's;ifdef MESA_EGL_NO_X11_HEADERS;if 1;' include/EGL/eglplatform.h >include/EGL/eglplatform.h.tmp
+ mv include/EGL/eglplatform.h.tmp include/EGL/eglplatform.h
+
+ # TODO: turn this into a patch
+ mkdir -p packaging
+ cat >packaging/95-tizen-emulator.rules <<EOF
+KERNEL=="glmem", MODE="0666", SMACK="*"
+KERNEL=="yagl", MODE="0666", SMACK="*"
+KERNEL=="vdpram*", MODE="0644", SYMLINK+="dpram/%n"
+
+# Moved from /etc/rc.d/rc3.d/S30brightness
+SUBSYSTEM=="lcd", ATTR{lcd_power}=="?*", RUN+="/bin/chown :system_bklight 0664 %S/%p/lcd_power"
+EOF
+}
+
+PROVIDES = "virtual/libgl virtual/libgles1 virtual/libgles2 virtual/egl virtual/mesa"
+
+# Replace mesa's gbm.
+SRC_URI += "file://0001-avoid-dependency-on-mesa.patch \
+ file://0001-make-egltext.h-more-compatible-with-Mesa.patch \
+"
+emulator-yagl-dev_files += "/usr/include/gbm.h \
+ /usr/lib/pkgconfig/gbm.pc \
+"
+
+# Fix file patterns so that .so is in -dev.
+emulator-yagl-dev_files += "/usr/lib/*.so"
+emulator-yagl_files_remove = "/usr/lib/*.so*"
+emulator-yagl_files += "/usr/lib/*.so.*"
+
+# No longer correct, emulator-yagl replaces mesa completely now.
+DEPENDS_remove = "mesa"
+
+# Disable X11, it's on unconditionally in the .spec file.
+DEPENDS_remove = "libx11 xf86driproto libxcb libxext libxfixes"
+RDEPENDS_${PN}-dev_remove = "libx11"
+EXTRA_OECMAKE += "-DPLATFORM_X11=0"
+
+RPROVIDES_emulator-yagl += "libgles2 libegl"
diff --git a/recipes-tizen/emulator-yagl/emulator-yagl.inc b/recipes-tizen/emulator-yagl/emulator-yagl.inc
new file mode 100644
index 00000000..586b6453
--- /dev/null
+++ b/recipes-tizen/emulator-yagl/emulator-yagl.inc
@@ -0,0 +1,146 @@
+DESCRIPTION = "YaGL - OpenGLES acceleration module for emulator"
+HOMEPAGE = "http://nohomepage.org"
+SECTION = "System/Base"
+LICENSE = "MIT"
+
+SRC_URI = ""
+
+S = "${WORKDIR}/git"
+
+inherit autotools-brokensep
+
+BBCLASSEXTEND = ""
+PROVIDES = ""
+
+#PROVIDES by emulator-yagl
+
+
+#PROVIDES by emulator-yagl-dev
+PROVIDES += "emulator-yagl-dev"
+
+
+RDEPENDS = ""
+#RDEPENDS of emulator-yagl-dev (${PN}-dev)
+RDEPENDS_${PN}-dev += "emulator-yagl"
+RDEPENDS_${PN}-dev += "libx11"
+
+
+DEPENDS = ""
+#DEPENDS of emulator-yagl
+DEPENDS += "xf86driproto"
+inherit tizen_cmake
+DEPENDS += "libx11"
+inherit pkgconfig
+DEPENDS += "udev"
+DEPENDS += "wayland"
+DEPENDS += "libdrm"
+DEPENDS += "libxcb"
+DEPENDS += "mesa"
+DEPENDS += "libxext"
+DEPENDS += "libxfixes"
+
+do_prep() {
+ cd ${S}
+ chmod -Rf a+rX,u+w,g-w,o-w ${S}
+ #setup -q
+
+
+}
+do_patch_append() {
+ bb.build.exec_func('do_prep', d)
+}
+
+do_configure() {
+}
+
+do_compile() {
+ cd ${S}
+ LANG=C
+ export LANG
+ unset DISPLAY
+ LD_AS_NEEDED=1; export LD_AS_NEEDED ;
+
+ cp ${S}/packaging/emulator-yagl.manifest .
+
+ cmake \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
+ -DCMAKE_INSTALL_LIBDIR:PATH=${prefix}/lib \
+ -DINCLUDE_INSTALL_DIR:PATH=${prefix}/include \
+ -DLIB_INSTALL_DIR:PATH=${prefix}/lib \
+ -DSYSCONF_INSTALL_DIR:PATH=${sysconfdir} \
+ -DSHARE_INSTALL_PREFIX:PATH=${prefix}/share \
+ -DCMAKE_SKIP_RPATH:BOOL=ON \
+ -DBUILD_SHARED_LIBS:BOOL=ON \
+ -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
+ ${EXTRA_OECMAKE} -DCMAKE_INSTALL_PREFIX=${D}/usr -DPLATFORM_GBM=1 -DPLATFORM_WAYLAND=1
+ make
+
+
+
+}
+
+do_install() {
+ export RPM_BUILD_ROOT=${D}
+ cd ${S}
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf ${D}
+ mkdir -p ${D}
+
+ make install
+ ln -s libEGL.so.1.0 ${D}/usr/lib/libEGL.so.1.0.0
+ ln -s libGLESv2.so.2.0 ${D}/usr/lib/libGLESv2.so.2.0.0
+ ln -s libGLESv2.so.2.0.0 ${D}/usr/lib/libGL.so.1.2.0
+
+ mkdir -p ${D}/usr/lib/udev/rules.d
+ cp packaging/95-tizen-emulator.rules ${D}/usr/lib/udev/rules.d
+
+ mkdir -p ${D}/usr/include
+ cp -r include/EGL ${D}/usr/include/
+ cp -r include/GL ${D}/usr/include/
+ cp -r include/GLES ${D}/usr/include/
+ cp -r include/GLES2 ${D}/usr/include/
+ cp -r include/KHR ${D}/usr/include/
+
+
+}
+
+pkg_postinst_${PN}() {
+ #!/bin/sh -e
+
+ [ "x$D" == "x" ] && ldconfig
+}
+
+pkg_postrm_${PN}() {
+ #!/bin/sh -e
+
+ [ "x$D" == "x" ] && ldconfig
+}
+
+PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-locale"
+PACKAGES += " emulator-yagl "
+PACKAGES += " emulator-yagl-dev "
+
+emulator-yagl_files = ""
+emulator-yagl_files += "/usr/lib/udev/rules.d/95-tizen-emulator.rules"
+emulator-yagl_files += "/usr/lib/*.so*"
+MANIFESTFILES_${PN} = "emulator-yagl.manifest"
+
+emulator-yagl-dev_files = ""
+emulator-yagl-dev_files += "/usr/include/EGL"
+emulator-yagl-dev_files += "/usr/include/GL"
+emulator-yagl-dev_files += "/usr/include/GLES"
+emulator-yagl-dev_files += "/usr/include/GLES2"
+emulator-yagl-dev_files += "/usr/include/KHR"
+MANIFESTFILES_${PN}-dev = "emulator-yagl.manifest"
+
+FILES_${PN} = "${emulator-yagl_files}"
+FILES_${PN}-dev = "${emulator-yagl-dev_files}"
+
+PKG_emulator-yagl= "emulator-yagl"
+PKG_emulator-yagl-dev= "emulator-yagl-dev"
+
+require emulator-yagl-extraconf.inc
+
diff --git a/recipes-tizen/emulator-yagl/emulator-yagl_git.bb b/recipes-tizen/emulator-yagl/emulator-yagl_git.bb
new file mode 100644
index 00000000..8d02da81
--- /dev/null
+++ b/recipes-tizen/emulator-yagl/emulator-yagl_git.bb
@@ -0,0 +1,10 @@
+require emulator-yagl.inc
+
+PRIORITY = "10"
+
+LIC_FILES_CHKSUM ??= "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+
+SRC_URI += "git://review.tizen.org/platform/adaptation/emulator/emulator-yagl;tag=1de389884a211e241f3aa9b5bd0188cb91f5c0e1;nobranch=1"
+
+BBCLASSEXTEND += " native "
+
diff --git a/recipes-tizen/emulator-yagl/files/0001-avoid-dependency-on-mesa.patch b/recipes-tizen/emulator-yagl/files/0001-avoid-dependency-on-mesa.patch
new file mode 100644
index 00000000..8951eccf
--- /dev/null
+++ b/recipes-tizen/emulator-yagl/files/0001-avoid-dependency-on-mesa.patch
@@ -0,0 +1,537 @@
+From bce733e48c164329a8b32747f4290f5c4024f1ef Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Thu, 23 Oct 2014 09:16:15 -0700
+Subject: [PATCH] avoid dependency on mesa
+
+Mesa had to be installed when compiling emulator-yagl because of the gbm.h header
+file. In addition, code using libgbm had to be compiled against Mesa because
+emulator-yagl did not provide the header file and gbm.pc.
+
+When compiling with Yocto, this approach fails because both Mesa and emulator-yagl
+get installed at the same time, causing a conflict for the files that emulator-yagl
+wants to replace. It works in OBS because the emulator-yagl files get installed only
+without mesa.
+
+To solve this problem, this patch copies gbm.h from Mesa 10.1.3 and creates its
+own .pc files, mimicking the version of Mesa. That way Mesa is no longer needed at all.
+---
+ CMakeLists.txt | 5 -
+ EGL/CMakeLists.txt | 7 +
+ EGL/egl.pc.in | 12 ++
+ GLESv1_CM/CMakeLists.txt | 7 +
+ GLESv1_CM/glesv1_cm.pc.in | 12 ++
+ GLESv2/CMakeLists.txt | 7 +
+ GLESv2/glesv2.pc.in | 12 ++
+ gbm/CMakeLists.txt | 11 ++
+ gbm/gbm.pc.in | 12 ++
+ include/gbm.h | 292 ++++++++++++++++++++++++++++++++++++++++++
+ include/yagl_gbm.h | 2 +-
+ wayland-egl/CMakeLists.txt | 7 +
+ wayland-egl/wayland-egl.pc.in | 12 ++
+ 13 files changed, 392 insertions(+), 6 deletions(-)
+ create mode 100644 EGL/egl.pc.in
+ create mode 100644 GLESv1_CM/glesv1_cm.pc.in
+ create mode 100644 GLESv2/glesv2.pc.in
+ create mode 100644 gbm/gbm.pc.in
+ create mode 100644 include/gbm.h
+ create mode 100644 wayland-egl/wayland-egl.pc.in
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 10d6476..08f5ae7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -89,11 +89,6 @@ if (PLATFORM_X11)
+ endif ()
+
+ if (PLATFORM_GBM)
+- pkg_check_modules(GBM REQUIRED gbm)
+-
+- add_definitions(${GBM_CFLAGS})
+- include_directories(${GBM_INCLUDE_DIRS})
+-
+ pkg_check_modules(LIBUDEV REQUIRED libudev)
+
+ add_definitions(${LIBUDEV_CFLAGS})
+diff --git a/EGL/CMakeLists.txt b/EGL/CMakeLists.txt
+index 2aea772..a4239cf 100644
+--- a/EGL/CMakeLists.txt
++++ b/EGL/CMakeLists.txt
+@@ -100,3 +100,10 @@ install(
+ TARGETS EGL
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+ )
++
++CONFIGURE_FILE(egl.pc.in egl.pc @ONLY)
++INSTALL(FILES
++ ${CMAKE_BINARY_DIR}/EGL/egl.pc
++ DESTINATION
++ ${INSTALL_LIB_DIR}/pkgconfig
++ )
+diff --git a/EGL/egl.pc.in b/EGL/egl.pc.in
+new file mode 100644
+index 0000000..6fb5ecc
+--- /dev/null
++++ b/EGL/egl.pc.in
+@@ -0,0 +1,12 @@
++prefix=@CMAKE_INSTALL_PREFIX@
++exec_prefix=${prefix}
++libdir=@LIB_INSTALL_DIR@
++includedir=${prefix}/include
++
++Name: libEGL
++Description: emulator-yagl EGL library
++# Determined by the version of Mesa which we emulate.
++Version: 10.1.3
++Requires:
++Libs: -L${libdir} -lEGL
++Cflags: -I${includedir}
+diff --git a/GLESv1_CM/CMakeLists.txt b/GLESv1_CM/CMakeLists.txt
+index 4c3bc70..6042351 100644
+--- a/GLESv1_CM/CMakeLists.txt
++++ b/GLESv1_CM/CMakeLists.txt
+@@ -18,3 +18,10 @@ install(
+ TARGETS GLESv1_CM
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+ )
++
++CONFIGURE_FILE(glesv1_cm.pc.in glesv1_cm.pc @ONLY)
++INSTALL(FILES
++ ${CMAKE_BINARY_DIR}/GLESv1_CM/glesv1_cm.pc
++ DESTINATION
++ ${INSTALL_LIB_DIR}/pkgconfig
++ )
+diff --git a/GLESv1_CM/glesv1_cm.pc.in b/GLESv1_CM/glesv1_cm.pc.in
+new file mode 100644
+index 0000000..5c7badc
+--- /dev/null
++++ b/GLESv1_CM/glesv1_cm.pc.in
+@@ -0,0 +1,12 @@
++prefix=@CMAKE_INSTALL_PREFIX@
++exec_prefix=${prefix}
++libdir=@LIB_INSTALL_DIR@
++includedir=${prefix}/include
++
++Name: libglesv1_cm
++Description: emulator-yagl OpenGL ES 1.0 CM library
++# Determined by the version of Mesa which we emulate.
++Version: 10.1.3
++Requires:
++Libs: -L${libdir} -lGLESv1_CM
++Cflags: -I${includedir}
+diff --git a/GLESv2/CMakeLists.txt b/GLESv2/CMakeLists.txt
+index 835b1bd..c45936a 100644
+--- a/GLESv2/CMakeLists.txt
++++ b/GLESv2/CMakeLists.txt
+@@ -39,3 +39,10 @@ install(
+ TARGETS GLESv2
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+ )
++
++CONFIGURE_FILE(glesv2.pc.in glesv2.pc @ONLY)
++INSTALL(FILES
++ ${CMAKE_BINARY_DIR}/GLESv2/glesv2.pc
++ DESTINATION
++ ${INSTALL_LIB_DIR}/pkgconfig
++ )
+diff --git a/GLESv2/glesv2.pc.in b/GLESv2/glesv2.pc.in
+new file mode 100644
+index 0000000..70fa1d8
+--- /dev/null
++++ b/GLESv2/glesv2.pc.in
+@@ -0,0 +1,12 @@
++prefix=@CMAKE_INSTALL_PREFIX@
++exec_prefix=${prefix}
++libdir=@LIB_INSTALL_DIR@
++includedir=${prefix}/include
++
++Name: libGLESv2
++Description: emulator-yagl OpenGL ES 2.0 library
++# Determined by the version of Mesa which we emulate.
++Version: 10.1.3
++Requires:
++Libs: -L${libdir} -lGLESv2
++Cflags: -I${includedir}
+diff --git a/gbm/CMakeLists.txt b/gbm/CMakeLists.txt
+index 90c6390..eb6ccd8 100644
+--- a/gbm/CMakeLists.txt
++++ b/gbm/CMakeLists.txt
+@@ -25,3 +25,14 @@ install(
+ TARGETS gbm-yagl
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+ )
++
++CONFIGURE_FILE(gbm.pc.in gbm.pc @ONLY)
++INSTALL(FILES
++ ${CMAKE_BINARY_DIR}/gbm/gbm.pc
++ DESTINATION
++ ${INSTALL_LIB_DIR}/pkgconfig
++ )
++INSTALL(FILES
++ ${CMAKE_BINARY_DIR}/include/gbm.h
++ DESTINATION ${CMAKE_INSTALL_PREFIX}/include
++ )
+diff --git a/gbm/gbm.pc.in b/gbm/gbm.pc.in
+new file mode 100644
+index 0000000..6f376ff
+--- /dev/null
++++ b/gbm/gbm.pc.in
+@@ -0,0 +1,12 @@
++prefix=@CMAKE_INSTALL_PREFIX@
++exec_prefix=${prefix}
++libdir=@LIB_INSTALL_DIR@
++includedir=${prefix}/include
++
++Name: libgbm
++Description: emulator-yagl generic buffer management
++# Determined by the version of Mesa from which we take gbm.h.
++Version: 10.1.3
++Requires:
++Libs: -L${libdir} -lgbm
++Cflags: -I${includedir}
+diff --git a/include/gbm.h b/include/gbm.h
+new file mode 100644
+index 0000000..9d2a030
+--- /dev/null
++++ b/include/gbm.h
+@@ -0,0 +1,292 @@
++/*
++ * Copyright © 2011 Intel Corporation
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a
++ * copy of this software and associated documentation files (the "Software"),
++ * to deal in the Software without restriction, including without limitation
++ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ * and/or sell copies of the Software, and to permit persons to whom the
++ * Software is furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice (including the next
++ * paragraph) shall be included in all copies or substantial portions of the
++ * Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
++ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
++ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
++ * DEALINGS IN THE SOFTWARE.
++ *
++ * Authors:
++ * Benjamin Franzke <benjaminfranzke@googlemail.com>
++ */
++
++#ifndef _GBM_H_
++#define _GBM_H_
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++
++#define __GBM__ 1
++
++#include <stdint.h>
++
++/**
++ * \file gbm.h
++ * \brief Generic Buffer Manager
++ */
++
++struct gbm_device;
++struct gbm_bo;
++struct gbm_surface;
++
++/**
++ * \mainpage The Generic Buffer Manager
++ *
++ * This module provides an abstraction that the caller can use to request a
++ * buffer from the underlying memory management system for the platform.
++ *
++ * This allows the creation of portable code whilst still allowing access to
++ * the underlying memory manager.
++ */
++
++/**
++ * Abstraction representing the handle to a buffer allocated by the
++ * manager
++ */
++union gbm_bo_handle {
++ void *ptr;
++ int32_t s32;
++ uint32_t u32;
++ int64_t s64;
++ uint64_t u64;
++};
++
++/** Format of the allocated buffer */
++enum gbm_bo_format {
++ /** RGB with 8 bits per channel in a 32 bit value */
++ GBM_BO_FORMAT_XRGB8888,
++ /** ARGB with 8 bits per channel in a 32 bit value */
++ GBM_BO_FORMAT_ARGB8888
++};
++
++#define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
++ ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
++
++#define GBM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */
++
++/* color index */
++#define GBM_FORMAT_C8 __gbm_fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
++
++/* 8 bpp RGB */
++#define GBM_FORMAT_RGB332 __gbm_fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */
++#define GBM_FORMAT_BGR233 __gbm_fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */
++
++/* 16 bpp RGB */
++#define GBM_FORMAT_XRGB4444 __gbm_fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */
++#define GBM_FORMAT_XBGR4444 __gbm_fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */
++#define GBM_FORMAT_RGBX4444 __gbm_fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */
++#define GBM_FORMAT_BGRX4444 __gbm_fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */
++
++#define GBM_FORMAT_ARGB4444 __gbm_fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */
++#define GBM_FORMAT_ABGR4444 __gbm_fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */
++#define GBM_FORMAT_RGBA4444 __gbm_fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */
++#define GBM_FORMAT_BGRA4444 __gbm_fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */
++
++#define GBM_FORMAT_XRGB1555 __gbm_fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */
++#define GBM_FORMAT_XBGR1555 __gbm_fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */
++#define GBM_FORMAT_RGBX5551 __gbm_fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */
++#define GBM_FORMAT_BGRX5551 __gbm_fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */
++
++#define GBM_FORMAT_ARGB1555 __gbm_fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */
++#define GBM_FORMAT_ABGR1555 __gbm_fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */
++#define GBM_FORMAT_RGBA5551 __gbm_fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */
++#define GBM_FORMAT_BGRA5551 __gbm_fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */
++
++#define GBM_FORMAT_RGB565 __gbm_fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */
++#define GBM_FORMAT_BGR565 __gbm_fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */
++
++/* 24 bpp RGB */
++#define GBM_FORMAT_RGB888 __gbm_fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */
++#define GBM_FORMAT_BGR888 __gbm_fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */
++
++/* 32 bpp RGB */
++#define GBM_FORMAT_XRGB8888 __gbm_fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */
++#define GBM_FORMAT_XBGR8888 __gbm_fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */
++#define GBM_FORMAT_RGBX8888 __gbm_fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
++#define GBM_FORMAT_BGRX8888 __gbm_fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */
++
++#define GBM_FORMAT_ARGB8888 __gbm_fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */
++#define GBM_FORMAT_ABGR8888 __gbm_fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */
++#define GBM_FORMAT_RGBA8888 __gbm_fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
++#define GBM_FORMAT_BGRA8888 __gbm_fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
++
++#define GBM_FORMAT_XRGB2101010 __gbm_fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */
++#define GBM_FORMAT_XBGR2101010 __gbm_fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */
++#define GBM_FORMAT_RGBX1010102 __gbm_fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */
++#define GBM_FORMAT_BGRX1010102 __gbm_fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */
++
++#define GBM_FORMAT_ARGB2101010 __gbm_fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */
++#define GBM_FORMAT_ABGR2101010 __gbm_fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */
++#define GBM_FORMAT_RGBA1010102 __gbm_fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
++#define GBM_FORMAT_BGRA1010102 __gbm_fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
++
++/* packed YCbCr */
++#define GBM_FORMAT_YUYV __gbm_fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
++#define GBM_FORMAT_YVYU __gbm_fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
++#define GBM_FORMAT_UYVY __gbm_fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
++#define GBM_FORMAT_VYUY __gbm_fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
++
++#define GBM_FORMAT_AYUV __gbm_fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
++
++/*
++ * 2 plane YCbCr
++ * index 0 = Y plane, [7:0] Y
++ * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
++ * or
++ * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
++ */
++#define GBM_FORMAT_NV12 __gbm_fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
++#define GBM_FORMAT_NV21 __gbm_fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
++#define GBM_FORMAT_NV16 __gbm_fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */
++#define GBM_FORMAT_NV61 __gbm_fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */
++
++/*
++ * 3 plane YCbCr
++ * index 0: Y plane, [7:0] Y
++ * index 1: Cb plane, [7:0] Cb
++ * index 2: Cr plane, [7:0] Cr
++ * or
++ * index 1: Cr plane, [7:0] Cr
++ * index 2: Cb plane, [7:0] Cb
++ */
++#define GBM_FORMAT_YUV410 __gbm_fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */
++#define GBM_FORMAT_YVU410 __gbm_fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */
++#define GBM_FORMAT_YUV411 __gbm_fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */
++#define GBM_FORMAT_YVU411 __gbm_fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */
++#define GBM_FORMAT_YUV420 __gbm_fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
++#define GBM_FORMAT_YVU420 __gbm_fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */
++#define GBM_FORMAT_YUV422 __gbm_fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */
++#define GBM_FORMAT_YVU422 __gbm_fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */
++#define GBM_FORMAT_YUV444 __gbm_fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
++#define GBM_FORMAT_YVU444 __gbm_fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
++
++
++/**
++ * Flags to indicate the intended use for the buffer - these are passed into
++ * gbm_bo_create(). The caller must set the union of all the flags that are
++ * appropriate
++ *
++ * \sa Use gbm_device_is_format_supported() to check if the combination of format
++ * and use flags are supported
++ */
++enum gbm_bo_flags {
++ /**
++ * Buffer is going to be presented to the screen using an API such as KMS
++ */
++ GBM_BO_USE_SCANOUT = (1 << 0),
++ /**
++ * Buffer is going to be used as cursor - the dimensions for the buffer
++ * must be 64x64 if this flag is passed.
++ */
++ GBM_BO_USE_CURSOR_64X64 = (1 << 1),
++ /**
++ * Buffer is to be used for rendering - for example it is going to be used
++ * as the storage for a color buffer
++ */
++ GBM_BO_USE_RENDERING = (1 << 2),
++ /**
++ * Buffer can be used for gbm_bo_write. This is guaranteed to work
++ * with GBM_BO_USE_CURSOR_64X64. but may not work for other
++ * combinations.
++ */
++ GBM_BO_USE_WRITE = (1 << 3),
++};
++
++int
++gbm_device_get_fd(struct gbm_device *gbm);
++
++const char *
++gbm_device_get_backend_name(struct gbm_device *gbm);
++
++int
++gbm_device_is_format_supported(struct gbm_device *gbm,
++ uint32_t format, uint32_t usage);
++
++void
++gbm_device_destroy(struct gbm_device *gbm);
++
++struct gbm_device *
++gbm_create_device(int fd);
++
++struct gbm_bo *
++gbm_bo_create(struct gbm_device *gbm,
++ uint32_t width, uint32_t height,
++ uint32_t format, uint32_t flags);
++
++#define GBM_BO_IMPORT_WL_BUFFER 0x5501
++#define GBM_BO_IMPORT_EGL_IMAGE 0x5502
++
++struct gbm_bo *
++gbm_bo_import(struct gbm_device *gbm, uint32_t type,
++ void *buffer, uint32_t usage);
++
++uint32_t
++gbm_bo_get_width(struct gbm_bo *bo);
++
++uint32_t
++gbm_bo_get_height(struct gbm_bo *bo);
++
++uint32_t
++gbm_bo_get_stride(struct gbm_bo *bo);
++
++uint32_t
++gbm_bo_get_format(struct gbm_bo *bo);
++
++struct gbm_device *
++gbm_bo_get_device(struct gbm_bo *bo);
++
++union gbm_bo_handle
++gbm_bo_get_handle(struct gbm_bo *bo);
++
++int
++gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
++
++void
++gbm_bo_set_user_data(struct gbm_bo *bo, void *data,
++ void (*destroy_user_data)(struct gbm_bo *, void *));
++
++void *
++gbm_bo_get_user_data(struct gbm_bo *bo);
++
++void
++gbm_bo_destroy(struct gbm_bo *bo);
++
++struct gbm_surface *
++gbm_surface_create(struct gbm_device *gbm,
++ uint32_t width, uint32_t height,
++ uint32_t format, uint32_t flags);
++
++struct gbm_bo *
++gbm_surface_lock_front_buffer(struct gbm_surface *surface);
++
++void
++gbm_surface_release_buffer(struct gbm_surface *surface, struct gbm_bo *bo);
++
++int
++gbm_surface_has_free_buffers(struct gbm_surface *surface);
++
++void
++gbm_surface_destroy(struct gbm_surface *surface);
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
+diff --git a/include/yagl_gbm.h b/include/yagl_gbm.h
+index 6825b52..4055d30 100644
+--- a/include/yagl_gbm.h
++++ b/include/yagl_gbm.h
+@@ -3,7 +3,7 @@
+
+ #include "yagl_export.h"
+ #include "yagl_types.h"
+-#include <gbm.h>
++#include "gbm.h"
+
+ struct vigs_drm_device;
+ struct vigs_drm_surface;
+diff --git a/wayland-egl/CMakeLists.txt b/wayland-egl/CMakeLists.txt
+index fe7ae74..3641683 100644
+--- a/wayland-egl/CMakeLists.txt
++++ b/wayland-egl/CMakeLists.txt
+@@ -12,3 +12,10 @@ install(
+ TARGETS wayland-egl-yagl
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+ )
++
++CONFIGURE_FILE(wayland-egl.pc.in wayland-egl.pc @ONLY)
++INSTALL(FILES
++ ${CMAKE_BINARY_DIR}/wayland-egl/wayland-egl.pc
++ DESTINATION
++ ${INSTALL_LIB_DIR}/pkgconfig
++ )
+diff --git a/wayland-egl/wayland-egl.pc.in b/wayland-egl/wayland-egl.pc.in
+new file mode 100644
+index 0000000..669879d
+--- /dev/null
++++ b/wayland-egl/wayland-egl.pc.in
+@@ -0,0 +1,12 @@
++prefix=@CMAKE_INSTALL_PREFIX@
++exec_prefix=${prefix}
++libdir=@LIB_INSTALL_DIR@
++includedir=${prefix}/include
++
++Name: libwayland-egl
++Description: emulator-yagl wayland EGL library
++# Determined by the version of Mesa which we emulate.
++Version: 10.1.3
++Requires:
++Libs: -L${libdir} -lwayland-egl
++Cflags: -I${includedir}
+--
+1.8.4.5
+
diff --git a/recipes-tizen/emulator-yagl/files/0001-make-egltext.h-more-compatible-with-Mesa.patch b/recipes-tizen/emulator-yagl/files/0001-make-egltext.h-more-compatible-with-Mesa.patch
new file mode 100644
index 00000000..aae84d92
--- /dev/null
+++ b/recipes-tizen/emulator-yagl/files/0001-make-egltext.h-more-compatible-with-Mesa.patch
@@ -0,0 +1,27 @@
+From f4d838179389513168a1ebe124b04ebfe9576cb9 Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Fri, 24 Oct 2014 04:55:44 -0700
+Subject: [PATCH] make egltext.h more compatible with Mesa
+
+Weston expects to get the definition of PFNEGLQUERYWAYLANDBUFFERWL
+(defined in eglmesaext.h) when including eglext.h. Support that
+the same way as Mesa does, by including that second file.
+---
+ include/EGL/eglext.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
+index a392b31..07ea7fd 100644
+--- a/include/EGL/eglext.h
++++ b/include/EGL/eglext.h
+@@ -625,4 +625,7 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
+ }
+ #endif
+
++/* emulate Mesa behavior and provide definitions of Mesa extensions via eglext.h */
++#include <EGL/eglmesaext.h>
++
+ #endif
+--
+1.8.4.5
+