All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0
@ 2017-11-15 21:02 Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 01/14] libdrm: Extend ARM support to mx7 Tom Hochstein
                   ` (14 more replies)
  0 siblings, 15 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

This patchset contains the graphics changes for the i.MX GA release
L4.9.11-1.0.0, plus an update to work with an i.MX fork of
Weston 2.0. GPU drivers are updated to version 6.2.2.p0, with
changes documented in the individual commit.

v2
- systemd-gpuconfig: Retracted patch
- imx-gpu-viv: Added systemd init, including Fabio's input on systemd-gpuconfig
- core-image-weston: Retracted patch
- libepoxy: Fixed build breaks, per Otavio's request
- weston: Add 2.0 base recipe since master has moved to 3.0

Tom Hochstein (14):
  libdrm: Extend ARM support to mx7
  eglinfo-fb: Use generic header
  imx-gpu-apitrace: Move apitrace out of imx-gpu-viv v6
  imx-gpu-g2d: Move imx-gpu-g2d out of imx-gpu-viv v6
  imx-gpu-viv: Upgrade to 6.2.2.p0
  imx-gpu-viv: Add systemd init
  mesa: Remove parts provided by imx-gpu-viv v6
  piglit: Remove redundant dependency
  xserver-xf86-config: Add Xorg configuration for i.MX 6SLL and 7ULP
  xf86-video-imxfb-vivante: Upgrade to 6.2.2.p0
  gtk+3: Use egl pkgconfig for build setup
  weston: Switch to 2.0 with i.MX fork
  weston-init: Fix weston 2.0 startup for pam, systemd case
  libepoxy: Fix build break for EGL_CAST dependency

 conf/machine/include/imx-base.inc                  |    8 +-
 .../drm/libdrm/mx7/drm-update-arm.patch            |   35 +
 ...place-vendor-specific-header-with-generic.patch |   28 +
 recipes-graphics/eglinfo/eglinfo-fb_%.bbappend     |    6 +
 recipes-graphics/gtk+/gtk+3_%.bbappend             |    7 +-
 .../0001-add-docs-HOWTO.markdown.patch             |   61 +
 ...cs-Freescale_apitrace_user_guide.markdown.patch |   91 ++
 ...0003-add-docs-Freescale_apitrace.markdown.patch |  133 ++
 .../0004-add-docs-apitrace_test.markdown.patch     |  144 ++
 .../0005-add-apitrace_dalvik.sh.patch              |   75 +
 .../0006-add-test_android.sh.patch                 |   72 +
 .../imx-gpu-apitrace/0007-add-test_yocto.sh.patch  |  131 ++
 .../0008-docs-mention-apitrace_dalvik.sh.patch     |   28 +
 .../0009-add-retrace-glws_nonx.cpp.patch           |  515 +++++++
 .../0010-cmake-use-glws_nonx-for-Vivante.patch     |   62 +
 .../0011-cli_trace-export-ENABLE_API_TRACE-1.patch |   37 +
 .../0012-use-dlsym-to-get-function-pointers.patch  |   31 +
 ...ver-does-not-support-GL_RGB-in-openGL-dri.patch |   36 +
 ...-hangs-when-retracing-OGLESParticles-on-m.patch |   28 +
 ...5-egl-define-egl-native-types-for-non-x11.patch |   36 +
 ...-don-t-recreate-the-EGL-surface-on-resize.patch |   32 +
 .../imx-gpu-apitrace/0017-add-Image-getMD5.patch   |   69 +
 ...ace-use-Image-getMD5-for-image-comparison.patch |  175 +++
 ...race-don-t-use-dlsym-on-aliased-functions.patch |   91 ++
 .../0020-egl-glx-trace-add-ApiTraceEnabled.patch   |   79 +
 .../0021-LocalWriter-make-a-writer-ignorable.patch |  101 ++
 ...-retrace-tutorial3-is-different-with-trac.patch |   82 +
 .../0023-add-support-for-Vivante-extensions.patch  |  444 ++++++
 ...70-ccc-cannot-trace-mesa-demos-vertexrate.patch |   34 +
 ...025-MGS-1271-ccc-disable-X-debug-function.patch |   30 +
 ...-MGS-1721-ccc-fix-broken-build-on-AArch64.patch |   43 +
 ...c-blank-screen-when-retracing-es20-sdk-ap.patch |   58 +
 ...c-add-the-TOT-commit-SHA1-inside-the-bina.patch |   55 +
 ...-avoid-memcpy-in-glTexDirectInvalidateVIV.patch |  283 ++++
 ...-retrace-support-eglCreatePixmapSurface-o.patch |   98 ++
 ...acktrace-define-HAVE_STDINT_H-in-config.h.patch |   36 +
 .../0032-changed-disable-X11-mechanism.patch       |   18 +
 ...c-Miss-usr-bin-eglretrace-file-in-FB-and-.patch |   70 +
 .../0034-MGS-make-multiarch-optional.patch         |   22 +
 ...en-don-t-override-symbols-in-Vivante-libs.patch |  101 ++
 .../imx-gpu-apitrace/imx-gpu-apitrace_7.1.0.bb     |   57 +
 .../imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb            |   36 +
 recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc       |  242 +--
 recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig |   19 +
 .../imx-gpu-viv/imx-gpu-viv/gpuconfig.service      |    8 +
 .../imx-gpu-viv/imx-gpu-viv_5.0.11.p8.6-hfp.bb     |    7 -
 .../imx-gpu-viv/imx-gpu-viv_6.2.2.p0-aarch32.bb    |   12 +
 .../Add-fallback-definition-for-EGL-CAST.patch     |   31 +
 recipes-graphics/libepoxy/libepoxy_%.bbappend      |    3 +
 recipes-graphics/mesa/mesa_%.bbappend              |   20 +-
 recipes-graphics/piglit/piglit_git.bbappend        |    1 -
 recipes-graphics/wayland/weston-init.bbappend      |   23 +
 recipes-graphics/wayland/weston-init/weston.config |    2 +
 .../wayland/weston-init/weston.service             |   37 +
 ...-configuration-option-for-no-input-device.patch |  112 --
 ...2-ccc-Add-GPU-VIV-support-for-weston-1.11.patch |  135 --
 ...1-configure.ac-Fix-wayland-protocols-path.patch |    2 +-
 .../wayland/weston/0001-make-error-portable.patch  |   12 +-
 .../0001-shared-include-stdint.h-for-int32_t.patch |   23 -
 ...ch-Provide-a-default-version-that-doesn-t.patch |   52 +-
 ...1-ccc-Enable-g2d-renderer-for-weston-1.11.patch | 1605 --------------------
 ...ld-Add-clone-mode-support-for-multi-displ.patch |  104 --
 ...68-xwld-System-can-not-boot-up-to-desktop.patch |   44 -
 ...ld-G2D-compositor-build-failed-in-slevk-b.patch |  146 --
 .../weston/0006-Link-compositor-to-egl.patch       |   12 -
 ...d-Fix-crash-when-run-with-no-input-device.patch |   47 -
 recipes-graphics/wayland/weston_1.11.1.bb          |  113 --
 recipes-graphics/wayland/weston_1.11.1.bbappend    |   46 -
 recipes-graphics/wayland/weston_2.0.0.bb           |  113 ++
 recipes-graphics/wayland/weston_2.0.0.bbappend     |   37 +
 .../xorg-driver/xf86-video-imxfb-vivante.inc       |    8 +-
 .../xf86-video-imxfb-vivante_5.0.11.p8.6.bb        |   10 -
 .../xf86-video-imxfb-vivante_6.2.2.p0.bb           |    9 +
 .../xserver-xf86-config/mx6sll/xorg.conf           |   12 +
 .../xserver-xf86-config/mx7ulp/xorg.conf           |   15 +
 .../kernel-module-imx-gpu-viv_5.0.11.p8.6.bb       |   19 -
 .../kernel-module-imx-gpu-viv_6.2.2.p0.bb          |   16 +
 77 files changed, 4092 insertions(+), 2583 deletions(-)
 create mode 100644 recipes-graphics/drm/libdrm/mx7/drm-update-arm.patch
 create mode 100644 recipes-graphics/eglinfo/eglinfo-fb/0001-Replace-vendor-specific-header-with-generic.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0001-add-docs-HOWTO.markdown.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0002-add-docs-Freescale_apitrace_user_guide.markdown.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0003-add-docs-Freescale_apitrace.markdown.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0004-add-docs-apitrace_test.markdown.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0005-add-apitrace_dalvik.sh.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0006-add-test_android.sh.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0007-add-test_yocto.sh.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0008-docs-mention-apitrace_dalvik.sh.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0009-add-retrace-glws_nonx.cpp.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0010-cmake-use-glws_nonx-for-Vivante.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0011-cli_trace-export-ENABLE_API_TRACE-1.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0012-use-dlsym-to-get-function-pointers.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0013-Vivante-driver-does-not-support-GL_RGB-in-openGL-dri.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0014-MGS-469-GPU-hangs-when-retracing-OGLESParticles-on-m.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0015-egl-define-egl-native-types-for-non-x11.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0016-don-t-recreate-the-EGL-surface-on-resize.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0017-add-Image-getMD5.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0018-retrace-use-Image-getMD5-for-image-comparison.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0019-egltrace-don-t-use-dlsym-on-aliased-functions.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0020-egl-glx-trace-add-ApiTraceEnabled.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0021-LocalWriter-make-a-writer-ignorable.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0022-MGS-309-ccc-retrace-tutorial3-is-different-with-trac.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0023-add-support-for-Vivante-extensions.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0024-MGS-470-ccc-cannot-trace-mesa-demos-vertexrate.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0025-MGS-1271-ccc-disable-X-debug-function.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0026-MGS-1721-ccc-fix-broken-build-on-AArch64.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0027-MGS-1859-ccc-blank-screen-when-retracing-es20-sdk-ap.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0028-MGS-2254-ccc-add-the-TOT-commit-SHA1-inside-the-bina.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0029-MGS-815-ccc-avoid-memcpy-in-glTexDirectInvalidateVIV.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0030-MGS-814-ccc-retrace-support-eglCreatePixmapSurface-o.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0031-libbacktrace-define-HAVE_STDINT_H-in-config.h.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0032-changed-disable-X11-mechanism.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0033-MGS-2963-ccc-Miss-usr-bin-eglretrace-file-in-FB-and-.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0034-MGS-make-multiarch-optional.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0035-dlopen-don-t-override-symbols-in-Vivante-libs.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace_7.1.0.bb
 create mode 100644 recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb
 create mode 100644 recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig
 create mode 100644 recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig.service
 delete mode 100644 recipes-graphics/imx-gpu-viv/imx-gpu-viv_5.0.11.p8.6-hfp.bb
 create mode 100644 recipes-graphics/imx-gpu-viv/imx-gpu-viv_6.2.2.p0-aarch32.bb
 create mode 100644 recipes-graphics/libepoxy/libepoxy/Add-fallback-definition-for-EGL-CAST.patch
 create mode 100644 recipes-graphics/libepoxy/libepoxy_%.bbappend
 delete mode 100644 recipes-graphics/piglit/piglit_git.bbappend
 create mode 100644 recipes-graphics/wayland/weston-init.bbappend
 create mode 100644 recipes-graphics/wayland/weston-init/weston.config
 create mode 100644 recipes-graphics/wayland/weston-init/weston.service
 delete mode 100644 recipes-graphics/wayland/weston/0001-Add-configuration-option-for-no-input-device.patch
 delete mode 100644 recipes-graphics/wayland/weston/0001-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-1.11.patch
 delete mode 100644 recipes-graphics/wayland/weston/0001-shared-include-stdint.h-for-int32_t.patch
 delete mode 100644 recipes-graphics/wayland/weston/0002-MGS-2521-ccc-Enable-g2d-renderer-for-weston-1.11.patch
 delete mode 100644 recipes-graphics/wayland/weston/0003-MGS-1783-xwld-Add-clone-mode-support-for-multi-displ.patch
 delete mode 100644 recipes-graphics/wayland/weston/0004-MGS-1668-xwld-System-can-not-boot-up-to-desktop.patch
 delete mode 100644 recipes-graphics/wayland/weston/0005-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch
 delete mode 100644 recipes-graphics/wayland/weston/0006-Link-compositor-to-egl.patch
 delete mode 100644 recipes-graphics/wayland/weston/0007-xwayland-Fix-crash-when-run-with-no-input-device.patch
 delete mode 100644 recipes-graphics/wayland/weston_1.11.1.bb
 delete mode 100644 recipes-graphics/wayland/weston_1.11.1.bbappend
 create mode 100644 recipes-graphics/wayland/weston_2.0.0.bb
 create mode 100644 recipes-graphics/wayland/weston_2.0.0.bbappend
 delete mode 100644 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_5.0.11.p8.6.bb
 create mode 100644 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_6.2.2.p0.bb
 create mode 100755 recipes-graphics/xorg-xserver/xserver-xf86-config/mx6sll/xorg.conf
 create mode 100755 recipes-graphics/xorg-xserver/xserver-xf86-config/mx7ulp/xorg.conf
 delete mode 100644 recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_5.0.11.p8.6.bb
 create mode 100644 recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0.bb

-- 
1.9.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v2 01/14] libdrm: Extend ARM support to mx7
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 02/14] eglinfo-fb: Use generic header Tom Hochstein
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

Apply the same xf86drm.h change made for mx6 to mx7.
The recipe is already extended by using imxgpu2d as filter.

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 .../drm/libdrm/mx7/drm-update-arm.patch            | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 recipes-graphics/drm/libdrm/mx7/drm-update-arm.patch

diff --git a/recipes-graphics/drm/libdrm/mx7/drm-update-arm.patch b/recipes-graphics/drm/libdrm/mx7/drm-update-arm.patch
new file mode 100644
index 0000000..1160cd1
--- /dev/null
+++ b/recipes-graphics/drm/libdrm/mx7/drm-update-arm.patch
@@ -0,0 +1,35 @@
+Add ARM support into xf86arm.h.  This provides support for Xorg interface.
+Without this the vivante samples will hang during close requiring a reboot
+
+Upstream-Status: Pending
+
+Signed-off-by: Lauren Post <lauren.post@freescale.com>
+Signed-off-by: Evan Kotara <evan.kotara@freescale.com>
+
+diff --git a/xf86drm.h b/xf86drm.h
+--- a/xf86drm.h
++++ b/xf86drm.h
+@@ -461,6 +461,23 @@ do {	register unsigned int __old __asm("
+ 		: "cr0", "memory");			\
+ 	} while (0)
+ 
++#elif defined(__arm__)
++       #undef DRM_DEV_MODE
++       #define DRM_DEV_MODE     (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
++
++       #define DRM_CAS(lock,old,new,__ret)             \
++       do {                                            \
++               __asm__ __volatile__ (                  \
++                       "1: ldrex %0, [%1]\n"           \
++                       "   teq %0, %2\n"               \
++                       "   ite eq\n"                   \
++                       "   strexeq %0, %3, [%1]\n"     \
++                       "   movne   %0, #1\n"           \
++               : "=&r" (__ret)                         \
++               : "r" (lock), "r" (old), "r" (new)      \
++               : "cc","memory");                       \
++       } while (0)
++
+ #endif /* architecture */
+ #endif /* __GNUC__ >= 2 */
+ 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 02/14] eglinfo-fb: Use generic header
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 01/14] libdrm: Extend ARM support to mx7 Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 03/14] imx-gpu-apitrace: Move apitrace out of imx-gpu-viv v6 Tom Hochstein
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

Use eglplatform.h rather than vendor-specific eglvivante.h.

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 ...place-vendor-specific-header-with-generic.patch | 28 ++++++++++++++++++++++
 recipes-graphics/eglinfo/eglinfo-fb_%.bbappend     |  6 +++++
 2 files changed, 34 insertions(+)
 create mode 100644 recipes-graphics/eglinfo/eglinfo-fb/0001-Replace-vendor-specific-header-with-generic.patch

diff --git a/recipes-graphics/eglinfo/eglinfo-fb/0001-Replace-vendor-specific-header-with-generic.patch b/recipes-graphics/eglinfo/eglinfo-fb/0001-Replace-vendor-specific-header-with-generic.patch
new file mode 100644
index 0000000..7c315c8
--- /dev/null
+++ b/recipes-graphics/eglinfo/eglinfo-fb/0001-Replace-vendor-specific-header-with-generic.patch
@@ -0,0 +1,28 @@
+From fdb3add3dfd53c539c3c79e4fbf9eedb1dc1e440 Mon Sep 17 00:00:00 2001
+From: Prabhu Sundararaj <prabhu.sundararaj@nxp.com>
+Date: Fri, 26 Feb 2016 11:29:54 -0600
+Subject: [PATCH] Use generic eglplatform.h rather than vendor specifc
+ (eglvivante.h) EGL headers.
+
+Upstream-Status: Pending
+
+---
+ wscript | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/wscript b/wscript
+index 195e247..d08bc29 100644
+--- a/wscript
++++ b/wscript
+@@ -219,7 +219,7 @@ def check_vivante_egl(conf, egl_extra_defines):
+ 		extra_defines += egl_extra_defines
+ 	extra_cxxflags = map(lambda x: conf.env['DEFINES_ST'] % x, extra_defines)
+ 	conf.env['CXXFLAGS'] += extra_cxxflags
+-	conf.check_cxx(mandatory = 1, header_name = 'EGL/eglvivante.h', uselib_store = 'EGL')
++	conf.check_cxx(mandatory = 1, header_name = 'EGL/eglplatform.h', uselib_store = 'EGL')
+ 	conf.check_cxx(mandatory = 1, header_name = 'EGL/egl.h', uselib_store = 'EGL')
+ 	conf.env['CXXFLAGS_EGL'] += extra_cxxflags
+ 	conf.env['CXXFLAGS'] = old_cxxflags
+-- 
+2.7.0
+
diff --git a/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend b/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend
index 7aa0e50..f130d23 100644
--- a/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend
+++ b/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend
@@ -1,2 +1,8 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI_append_imxgpu3d = " \
+    file://0001-Replace-vendor-specific-header-with-generic.patch \
+"
+
 # Set i.MX specific dependencies and device type
 EGLINFO_DEVICE_imxgpu3d = "imx6"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 03/14] imx-gpu-apitrace: Move apitrace out of imx-gpu-viv v6
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 01/14] libdrm: Extend ARM support to mx7 Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 02/14] eglinfo-fb: Use generic header Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-16 15:52   ` Otavio Salvador
  2017-11-15 21:02 ` [PATCH v2 04/14] imx-gpu-g2d: Move imx-gpu-g2d " Tom Hochstein
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 .../0001-add-docs-HOWTO.markdown.patch             |  61 +++
 ...cs-Freescale_apitrace_user_guide.markdown.patch |  91 ++++
 ...0003-add-docs-Freescale_apitrace.markdown.patch | 133 ++++++
 .../0004-add-docs-apitrace_test.markdown.patch     | 144 ++++++
 .../0005-add-apitrace_dalvik.sh.patch              |  75 +++
 .../0006-add-test_android.sh.patch                 |  72 +++
 .../imx-gpu-apitrace/0007-add-test_yocto.sh.patch  | 131 ++++++
 .../0008-docs-mention-apitrace_dalvik.sh.patch     |  28 ++
 .../0009-add-retrace-glws_nonx.cpp.patch           | 515 +++++++++++++++++++++
 .../0010-cmake-use-glws_nonx-for-Vivante.patch     |  62 +++
 .../0011-cli_trace-export-ENABLE_API_TRACE-1.patch |  37 ++
 .../0012-use-dlsym-to-get-function-pointers.patch  |  31 ++
 ...ver-does-not-support-GL_RGB-in-openGL-dri.patch |  36 ++
 ...-hangs-when-retracing-OGLESParticles-on-m.patch |  28 ++
 ...5-egl-define-egl-native-types-for-non-x11.patch |  36 ++
 ...-don-t-recreate-the-EGL-surface-on-resize.patch |  32 ++
 .../imx-gpu-apitrace/0017-add-Image-getMD5.patch   |  69 +++
 ...ace-use-Image-getMD5-for-image-comparison.patch | 175 +++++++
 ...race-don-t-use-dlsym-on-aliased-functions.patch |  91 ++++
 .../0020-egl-glx-trace-add-ApiTraceEnabled.patch   |  79 ++++
 .../0021-LocalWriter-make-a-writer-ignorable.patch | 101 ++++
 ...-retrace-tutorial3-is-different-with-trac.patch |  82 ++++
 .../0023-add-support-for-Vivante-extensions.patch  | 444 ++++++++++++++++++
 ...70-ccc-cannot-trace-mesa-demos-vertexrate.patch |  34 ++
 ...025-MGS-1271-ccc-disable-X-debug-function.patch |  30 ++
 ...-MGS-1721-ccc-fix-broken-build-on-AArch64.patch |  43 ++
 ...c-blank-screen-when-retracing-es20-sdk-ap.patch |  58 +++
 ...c-add-the-TOT-commit-SHA1-inside-the-bina.patch |  55 +++
 ...-avoid-memcpy-in-glTexDirectInvalidateVIV.patch | 283 +++++++++++
 ...-retrace-support-eglCreatePixmapSurface-o.patch |  98 ++++
 ...acktrace-define-HAVE_STDINT_H-in-config.h.patch |  36 ++
 .../0032-changed-disable-X11-mechanism.patch       |  18 +
 ...c-Miss-usr-bin-eglretrace-file-in-FB-and-.patch |  70 +++
 .../0034-MGS-make-multiarch-optional.patch         |  22 +
 ...en-don-t-override-symbols-in-Vivante-libs.patch | 101 ++++
 .../imx-gpu-apitrace/imx-gpu-apitrace_7.1.0.bb     |  57 +++
 36 files changed, 3458 insertions(+)
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0001-add-docs-HOWTO.markdown.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0002-add-docs-Freescale_apitrace_user_guide.markdown.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0003-add-docs-Freescale_apitrace.markdown.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0004-add-docs-apitrace_test.markdown.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0005-add-apitrace_dalvik.sh.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0006-add-test_android.sh.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0007-add-test_yocto.sh.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0008-docs-mention-apitrace_dalvik.sh.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0009-add-retrace-glws_nonx.cpp.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0010-cmake-use-glws_nonx-for-Vivante.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0011-cli_trace-export-ENABLE_API_TRACE-1.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0012-use-dlsym-to-get-function-pointers.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0013-Vivante-driver-does-not-support-GL_RGB-in-openGL-dri.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0014-MGS-469-GPU-hangs-when-retracing-OGLESParticles-on-m.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0015-egl-define-egl-native-types-for-non-x11.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0016-don-t-recreate-the-EGL-surface-on-resize.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0017-add-Image-getMD5.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0018-retrace-use-Image-getMD5-for-image-comparison.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0019-egltrace-don-t-use-dlsym-on-aliased-functions.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0020-egl-glx-trace-add-ApiTraceEnabled.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0021-LocalWriter-make-a-writer-ignorable.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0022-MGS-309-ccc-retrace-tutorial3-is-different-with-trac.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0023-add-support-for-Vivante-extensions.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0024-MGS-470-ccc-cannot-trace-mesa-demos-vertexrate.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0025-MGS-1271-ccc-disable-X-debug-function.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0026-MGS-1721-ccc-fix-broken-build-on-AArch64.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0027-MGS-1859-ccc-blank-screen-when-retracing-es20-sdk-ap.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0028-MGS-2254-ccc-add-the-TOT-commit-SHA1-inside-the-bina.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0029-MGS-815-ccc-avoid-memcpy-in-glTexDirectInvalidateVIV.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0030-MGS-814-ccc-retrace-support-eglCreatePixmapSurface-o.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0031-libbacktrace-define-HAVE_STDINT_H-in-config.h.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0032-changed-disable-X11-mechanism.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0033-MGS-2963-ccc-Miss-usr-bin-eglretrace-file-in-FB-and-.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0034-MGS-make-multiarch-optional.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0035-dlopen-don-t-override-symbols-in-Vivante-libs.patch
 create mode 100644 recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace_7.1.0.bb

diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0001-add-docs-HOWTO.markdown.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0001-add-docs-HOWTO.markdown.patch
new file mode 100644
index 0000000..219fd7a
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0001-add-docs-HOWTO.markdown.patch
@@ -0,0 +1,61 @@
+From a3598a20937c9fd8ad85a8797186db5aeb4b0095 Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Thu, 19 Jan 2017 09:38:20 +0200
+Subject: [PATCH 01/31] add docs/HOWTO.markdown
+
+---
+ docs/HOWTO.markdown | 42 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 42 insertions(+)
+ create mode 100644 docs/HOWTO.markdown
+
+diff --git a/docs/HOWTO.markdown b/docs/HOWTO.markdown
+new file mode 100644
+index 0000000..fed8fc2
+--- /dev/null
++++ b/docs/HOWTO.markdown
+@@ -0,0 +1,42 @@
++# Build for i.MX6 #
++## Yocto ##
++
++    export CROSSTOOLCHAIN=...
++    export CMAKE_SYSROOT=...
++    cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/arm-gnueabi.toolchain.cmake -f CMakeLists.txt -DCMAKE_INSTALL_PREFIX:PATH=<path>
++    make && make install
++
++
++## Android ##
++
++    cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/android.toolchain.cmake -f CMakeLists.txt -DCMAKE_INSTALL_PREFIX:PATH=<path> -DANDROID_NATIVE_API_LEVEL=android-19 -DANDROID_NDK=<ndk tool>
++
++KitKat uses sdk level 19; Lollipop uses 21:
++    make && make install
++
++
++# Build for x86 #
++
++    cmake -f CMakeLists.txt -DCMAKE_INSTALL_PREFIX:PATH=<path>
++    make && make install
++
++# Tips #
++## Switch cross build and native build ##
++
++    make clean
++    find . -name CMakeFiles -exec rm -rf "{}" \;
++    find . -name CMakeCache.txt -exec rm "{}" \;
++
++
++## To enable qapitrace ##
++
++You must install qt4 development packages:
++
++    sudo apt-get install qt4-default qt4-qmake qt4-dev-tools libqt4-dev libqt4-opengl-dev automoc
++
++
++## Fix empty AR in link.txt created by cmake ##
++
++For cross build, macro CMAKE_AR may not work. Use following command to replace the empty AR command with correct value:
++
++    find . -name "link.txt" -exec grep -l -e "\"\" cr" "{}" \; | xargs sed -i 's#\"\"#'$CROSSTOOLCHAIN'-ar#'
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0002-add-docs-Freescale_apitrace_user_guide.markdown.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0002-add-docs-Freescale_apitrace_user_guide.markdown.patch
new file mode 100644
index 0000000..a70b59a
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0002-add-docs-Freescale_apitrace_user_guide.markdown.patch
@@ -0,0 +1,91 @@
+From 7f37ca44b70f3bbaa3210bf63c11d4f8bb74b42a Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Thu, 6 Apr 2017 09:37:26 +0300
+Subject: [PATCH 02/31] add docs/Freescale_apitrace_user_guide.markdown
+
+---
+ docs/Freescale_apitrace_user_guide.markdown | 72 +++++++++++++++++++++++++++++
+ 1 file changed, 72 insertions(+)
+ create mode 100644 docs/Freescale_apitrace_user_guide.markdown
+
+diff --git a/docs/Freescale_apitrace_user_guide.markdown b/docs/Freescale_apitrace_user_guide.markdown
+new file mode 100644
+index 0000000..cec66ce
+--- /dev/null
++++ b/docs/Freescale_apitrace_user_guide.markdown
+@@ -0,0 +1,72 @@
++# Freescale apitrace release note
++
++## Overview
++
++Freescale apitrace is a set of tools enhanced from open source project apitrace.
++Freescale version adds support to Freescale i.MX6 chipsets which use Vivante GPU IP.
++
++
++## Purpose
++
++This tool is to provide the gpu application and driver developers a way to look
++inside the application with source code. It also provides a way to port an
++application to another platform with source requirement. Comparing with
++Vivante’s similar tool vTracer/vPlayer, Freescale apitrace provides some new
++features:
++
++```
++Feature                     Vivante Apitrace   Comment
++---------------------------+-------+-------+-------------------------------------.
++Easy to use                | N     | Y     | Vivante’s tools have Too many       |
++                           |       |       | settings to remember, and user must |
++                           |       |       | make sure tool version matches gpu  |
++                           |       |       | driver version. There’s a strong    |
++                           |       |       | dependency between tool and gpu     |
++                           |       |       | driver.                             |
++---------------------------+-------+-------+-------------------------------------+
++License                    | N     | Y     | vPlayer/vTracer: closed source      |
++control                    |       |       | Apitrace: BSD                       |
++-------+-+-----------------+-------+-------+-------------------------------------+
++Trace  |O| Linux           | Y     | Y     |                                     |
++       |S| Android         | Y     | Y     |                                     |
++       |-+-----------------+-------+-------+-------------------------------------+
++       |A| OpenGL          | N     | Y     |                                     |
++       |P| GLES1           | Y     | Y     |                                     |
++       |I| GLES2           | Y     | Y     |                                     |
++       | | GLES3           | Y     | Y     | With my patch to support ES 3.0     |
++       | | OpenVG          | ???   | ???   |                                     |
++-------+-+-----------------+-------+-------+-------------------------------------+
++Replay |O| Linux           | Y     | Y     |                                     |
++       |S| Android         | Y     | ???   |                                     |
++       | | Windows         | Y     | Y     |                                     |
++       |-+-----------------+-------+-------+-------------------------------------+
++       |Frame dump         | Y     | Y     |                                     |
++       |Frame range&repeat | Y     | Y     |                                     |
++       |Insert error check | Y     | Y     |                                     |
++       |Insert glFinish    | Y     | N     |                                     |
++       |Dump per-call state| N     | Y     |                                     |
++-------+-------------------+-------+-------+-------------------------------------+
++Post   | View framebuffer  | N     | Y     |                                     |
++process| View textures     | N     | Y     |                                     |
++       | Editing           | N     | Y     |                                     |
++       | Performance Mon   | N     | Y     |                                     |
++       | Encode to video   | N     | Y     |                                     |
++-------+-------------------+-------+-------+-------------------------------------'
++```
++
++## Release History
++```
++Version  Date
++.-------+---------.
++| 0.1   | 2014/12 |
++'-------+---------'
++```
++
++
++## Known Issues
++
++```
++MGS-310 APITRACE: Will print "/usr/lib/libstdc++.so.6: _ZNSo5writeEPKci+0x4f" using udisk to store trace files
++MGS-309 APITRACE: retrace "tutorial3" is different with trace it
++MGS-308 APITRACE: Should support to create children dir
++```
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0003-add-docs-Freescale_apitrace.markdown.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0003-add-docs-Freescale_apitrace.markdown.patch
new file mode 100644
index 0000000..4b456b7
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0003-add-docs-Freescale_apitrace.markdown.patch
@@ -0,0 +1,133 @@
+From 34dfb168829133af38577509017d7505ce53122f Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Wed, 5 Apr 2017 16:17:47 +0300
+Subject: [PATCH 03/31] add docs/Freescale_apitrace.markdown
+
+---
+ docs/Freescale_apitrace.markdown | 113 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 113 insertions(+)
+ create mode 100644 docs/Freescale_apitrace.markdown
+
+diff --git a/docs/Freescale_apitrace.markdown b/docs/Freescale_apitrace.markdown
+new file mode 100644
+index 0000000..fda3a2b
+--- /dev/null
++++ b/docs/Freescale_apitrace.markdown
+@@ -0,0 +1,113 @@
++# Freescale Apitrace
++
++## How apitrace works
++
++
++### trace
++
++Make use of LD_PRELOAD (for Linux) to preload wrapper library.
++Every OpenGL(ES) API call will be redirected to wrapper library.
++In the wrapper, current thread ID, API name, and associated data
++are recorded into a file.  The wrapper also overrides C
++function “dlopen” (for Linux) to monitor OpenGL libraries loading.
++
++
++### replay
++
++Also called _retrace_, it reads in trace file and run OpenGL(ES)
++APIs on host one by one. Each OpenGL(ES) API call will be processed by
++a callback function. In that callback, extra job can be inserted.
++
++
++### qapitrace
++
++A tool to analysis trace file, with GUI display.
++
++
++## Advantage of apitrace
++
++* More features provided by apitrace than vTracer/vPlayer as listed
++before. Some features are important (inspect gpu state at any call,
++edit API call, etc.) but missing from vTracer.
++
++* It is open source, so we can freely enhance the tool according to our
++requirement.
++
++* It is possible to add OpenVG API support. It will be
++a big advantage if OpenVG is supported.
++
++* ADIT requires *replay* to be run on their layer management system.
++vPlayer fails to provide such support.
++But apitrace has a good framework and is convenient for ADIT
++to hook in the window creation function (just create a derived class
++from class EglDrawable)
++
++* Extend the tool to use it as conformance or
++regression test tool Currently there’re lots of gpu applications. Test
++team has to watch the screen to judge whether rendering is ok or not. No
++objective tool to verify correctness of gpu rendering.  With this tool,
++we can develop a tool to compare frame by frame between a reference
++board and a debug board. This kind of tool can benefit test team (and
++customers) to deal with the heavier and heavier test tasks.
++
++* Quality is better Vivante’s tools often meet this or that problem. This open
++source tool is originated from Intel Corporation and other companies.
++
++
++## Difference with original apitrace
++
++Original apitrace won’t run
++with Vivante’s gpu software stack. Must use Freescale version
++instead. Freescale also enhanced apitrace to support OpenGL
++ES 3.0.
++
++
++## Differences between apitrace and vProfiler/vPlayer Vivante
++
++Provides vTracer and vPlayer to help debug OpenGL ES 1.1/2.0/3.0 API
++call. There’s another tool, apitrace, can be used to replace vTracer
++and vPlayer.Freescale apitrace.docx
++
++
++Here’s a table comparing main features provided by Vivante tools
++and apitrace:
++
++```
++Feature                     Vivante Apitrace   Comment
++---------------------------+-------+-------+-------------------------------------.
++Easy to use                | N     | Y     | Vivante’s tools have Too many       |
++                           |       |       | settings to remember, and user must |
++                           |       |       | make sure tool version matches gpu  |
++                           |       |       | driver version. There’s a strong    |
++                           |       |       | dependency between tool and gpu     |
++                           |       |       | driver.                             |
++---------------------------+-------+-------+-------------------------------------+
++License                    | N     | Y     | vPlayer/vTracer: closed source      |
++control                    |       |       | Apitrace: BSD                       |
++-------+-+-----------------+-------+-------+-------------------------------------+
++Trace  |O| Linux           | Y     | Y     |                                     |
++       |S| Android         | Y     | Y     |                                     |
++       |-+-----------------+-------+-------+-------------------------------------+
++       |A| OpenGL          | N     | Y     |                                     |
++       |P| GLES1           | Y     | Y     |                                     |
++       |I| GLES2           | Y     | Y     |                                     |
++       | | GLES3           | Y     | Y     | With my patch to support ES 3.0     |
++       | | OpenVG          | ???   | ???   |                                     |
++-------+-+-----------------+-------+-------+-------------------------------------+
++Replay |O| Linux           | Y     | Y     |                                     |
++       |S| Android         | Y     | ???   |                                     |
++       | | Windows         | Y     | Y     |                                     |
++       |-+-----------------+-------+-------+-------------------------------------+
++       |Frame dump         | Y     | Y     |                                     |
++       |Frame range&repeat | Y     | Y     |                                     |
++       |Insert error check | Y     | Y     |                                     |
++       |Insert glFinish    | Y     | N     |                                     |
++       |Dump per-call state| N     | Y     |                                     |
++-------+-------------------+-------+-------+-------------------------------------+
++Post   | View framebuffer  | N     | Y     |                                     |
++process| View textures     | N     | Y     |                                     |
++       | Editing           | N     | Y     |                                     |
++       | Performance Mon   | N     | Y     |                                     |
++       | Encode to video   | N     | Y     |                                     |
++-------+-------------------+-------+-------+-------------------------------------+
++```
+\ No newline at end of file
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0004-add-docs-apitrace_test.markdown.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0004-add-docs-apitrace_test.markdown.patch
new file mode 100644
index 0000000..2cfefc8
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0004-add-docs-apitrace_test.markdown.patch
@@ -0,0 +1,144 @@
+From f78922b19fec8c8cd40bdf42b18c09fed0a7f597 Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Thu, 6 Apr 2017 10:10:40 +0300
+Subject: [PATCH 04/31] add docs/apitrace_test.markdown
+
+---
+ docs/apitrace_test.markdown | 125 ++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 125 insertions(+)
+ create mode 100644 docs/apitrace_test.markdown
+
+diff --git a/docs/apitrace_test.markdown b/docs/apitrace_test.markdown
+new file mode 100644
+index 0000000..b93d317
+--- /dev/null
++++ b/docs/apitrace_test.markdown
+@@ -0,0 +1,125 @@
++Gpu driver: 5.0.11p4 and later
++
++Package: gpu-south-tools-release
++
++
++## Install tools
++
++### Yocto
++
++Installed by default. If not, use following command to install:
++
++```
++cp gpu-south-tools-release/0.1/apitrace/linux/yocto/bin/* /usr/bin
++cp -r gpu-south-tools-release/0.1/apitrace/linux/yocto/lib/apitrace /usr/lib
++cp -r gpu-south-tools-release/0.1/apitrace/linux/yocto/share/doc/apitrace/ /usr/share/doc/
++```
++
++And copy gpu-south-tools-release/0.1/apitrace/linux/yocto/test to some place for auto test.
++
++### Android
++
++In COM terminal, which has root privilege, mount the release package to android
++system:
++
++```
++mkdir /data/share; busybox mount -t nfs -o nolock 10.192.241.131:/home/zhenyong/share /data/share
++cp -r gpu-south-tools-release/0.1/apitrace/android/apitrace /data/
++```
++
++### PC-linux-x64
++
++```
++cp gpu-south-tools-release/0.1/apitrace/linux/x64/bin/* /usr/bin
++cp -r gpu-south-tools-release/0.1/apitrace/linux/x64/lib/apitrace /usr/lib
++cp -r gpu-south-tools-release/0.1/apitrace/linux/x64/share/doc/apitrace/ /usr/share/doc/
++```
++
++
++## Test content
++
++For x11/fb/dfb/wayland, both apitrace and retrace need test.
++For android, only apitrace is test. The dumped trace file need replay on
++i.mx6q-x11 device. Dumped files are stored under /sdcard/.
++For x64-linux, only qapitrace is to test.
++
++
++## Test instructions
++
++### Yocto
++
++Run:
++```
++gpu-south-tools-release/0.1/apitrace/test_yocto.sh
++```
++
++### Android
++
++auto	sh /data/apitrace/test/test_android.sh
++manual	sh /data/apitrace/bin/apitrace_dalvik.sh com.android.settings start
++	<operation with com.android.settings>
++	sh /data/apitrace/bin/apitrace_dalvik.sh com.android.settings stop
++
++Download trace files:
++```
++adb shell busybox find /sdcard/ -name "*.trace" | tr -d '\015' | while read FILE; do adb pull $FILE ./; done
++```
++
++Replay on yocto:
++```
++eglretrace *.trace
++```
++
++Caution: trace file requires a lot of disk space, so reserve at least 1 GB.
++
++
++## Test result
++
++No crash, no failure, and retrace is correct, and dumped trace file can be
++ opened by qapitrace on x64-linux.
++
++
++## Test cases
++
++```
+++---------------+-----------------------+
++|               | angeles               |
++| OpenGL ES 1.1 | tritex                |
++|               | textures              |
++|               | OGLESCoverflow        |
++|               | tutorial1             |
++|               | tutorial2             |
++|               | tutorial3             |
++|               | tutorial4             |
++|               | tutorial5             |
++|               | tutorial6             |
++|               | tutorial7             |
+++---------------+-----------------------+
++|               | es2gears              |
++| OpenGL ES 2.0 | OGLES2Coverflow       |
++|               | OGLES2Fog             |
++|               | OGLES2Texturing       |
++|               | scene_FBO             |
++|               | glimagesink           |
++|               | glmark2-es2           |
++|               | tutorial1_es20        |
++|               | tutorial2_es20        |
++|               | tutorial3_es20        |
++|               | tutorial4_es20        |
++|               | tutorial5_es20        |
++|               | tutorial6_es20        |
++|               | tutorial7_es20        |
++|               | com.android.gallery3d |
+++---------------+-----------------------+
++|               | OGLES3PhantomMask     |
++| OpenGL ES 3.0 | OGLES3DeferredShading |
++|               | OGLES3RenderToTexture |
+++---------------+-----------------------+
++|               | glxgears              |
++| OpenGL        | glmark2               |
++|               | glxs                  |
+++---------------+-----------------------+
++| OpenVG        | tiger                 |
++|               | vgmark_10             |
+++---------------+-----------------------+
++```
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0005-add-apitrace_dalvik.sh.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0005-add-apitrace_dalvik.sh.patch
new file mode 100644
index 0000000..1b0e8aa
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0005-add-apitrace_dalvik.sh.patch
@@ -0,0 +1,75 @@
+From 80c17e1d0c28e1a78abbc57c484ce09133a66000 Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Thu, 19 Jan 2017 09:24:35 +0200
+Subject: [PATCH 05/31] add apitrace_dalvik.sh
+
+---
+ apitrace_dalvik.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 56 insertions(+)
+ create mode 100644 apitrace_dalvik.sh
+
+diff --git a/apitrace_dalvik.sh b/apitrace_dalvik.sh
+new file mode 100644
+index 0000000..107d0fc
+--- /dev/null
++++ b/apitrace_dalvik.sh
+@@ -0,0 +1,56 @@
++#! /system/bin/sh
++
++# Copyright (c) 2014, Freescale Semiconductor Inc.
++# All rights reserved.
++#
++# You should get a copy of license in this software package named EULA.txt.
++# Please read EULA.txt carefully first.
++
++
++
++
++# This script is used on Android to instrument non-native Android applications.
++# For native Android applications, you can use "apitrace" as on Linux.
++#
++# Install this package under /data.
++# The .trace files will be stored under /sdcard/.
++
++# If install this package to other place, please update INSTALL in this file
++
++if [ $# != 2 ] || [ "$2" != "start" -a "$2" != "stop" ]; then
++	echo "$0 <component> <start|stop>"
++	log -t apitrace "$0 <component> <start|stop>"
++	exit 1
++fi
++
++PROCNAME=$1
++INSTALL=/data/apitrace
++
++if [ "$2" == "start" ]; then
++	if [ -e $INSTALL/lib/apitrace/wrappers/egltrace.so ]; then
++		# TODO: check normal user can access this path or not
++		setprop wrap.$PROCNAME LD_PRELOAD=$INSTALL/lib/apitrace/wrappers/egltrace.so
++	else
++		# default
++		setprop wrap.$PROCNAME LD_PRELOAD=/system/lib/egltrace.so
++	fi
++
++	setprop debug.apitrace.procname $PROCNAME
++
++	log -t apitrace "Stop $PROCNAME/.main_dummy"
++	am start -S $PROCNAME/.main_dummy
++	sleep 5
++
++	log -t apitrace "Start $PROCNAME"
++	am start $PROCNAME
++fi
++
++if [ "$2" == "stop" ]; then
++	log -t apitrace "Stop $PROCNAME tracing"
++	log -t apitrace "Stop $PROCNAME/.main_dummy"
++	am start -S $PROCNAME/.main_dummy
++	setprop wrap.$PROCNAME ""
++	setprop debug.apitrace.procname ""
++fi
++
++exit 0
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0006-add-test_android.sh.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0006-add-test_android.sh.patch
new file mode 100644
index 0000000..6af1943
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0006-add-test_android.sh.patch
@@ -0,0 +1,72 @@
+From a2ac34d5b0dca60fa98555801f3e021f5f21c464 Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Thu, 19 Jan 2017 09:39:20 +0200
+Subject: [PATCH 06/31] add test_android.sh
+
+---
+ test_android.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 53 insertions(+)
+ create mode 100644 test_android.sh
+
+diff --git a/test_android.sh b/test_android.sh
+new file mode 100644
+index 0000000..b6cfb9f
+--- /dev/null
++++ b/test_android.sh
+@@ -0,0 +1,53 @@
++#!/system/bin/sh
++
++INSTALL=/data/apitrace
++TRACEFILE_PATH=/sdcard/
++MAXDURATION="10" # duration for every case. depending on available disk space
++
++EGL11_CASES="angeles test-opengl-tritex test-opengl-textures"
++
++kill_app()
++{
++    APP=$1
++    # Need truncate app name, otherwise pkill will fail on yocto
++    busybox pkill -x "${APP:0:15}"
++}
++
++run_eglcases()
++{
++    for tcase in $1
++    do
++        CURPATH="$(realpath .)"
++        echo "--------------------------------------------------------"
++	echo "Start apitrace"
++        echo "--------------------------------------------------------"
++        # start test
++	apitrace trace -v --output=$TRACEFILE_PATH/$tcase.trace --api=egl $tcase &
++        sleep $MAXDURATION
++        # end test
++	kill_app $tcase
++        cd $CURPATH # go back to original path
++    done
++}
++
++run_cases()
++{
++    export PATH=$PATH:$INSTALL/bin:$INSTALL/test
++
++    echo "Put trace file to $TRACEFILE_PATH"
++
++    mkdir -p $TRACEFILE_PATH
++    rm $TRACEFILE_PATH/*.trace
++
++    run_eglcases "$EGL11_CASES"
++}
++
++date
++
++run_cases
++
++echo "--------------------------------------------------------"
++echo "Test finished"
++date
++echo "--------------------------------------------------------"
++exit 0
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0007-add-test_yocto.sh.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0007-add-test_yocto.sh.patch
new file mode 100644
index 0000000..b3272e9
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0007-add-test_yocto.sh.patch
@@ -0,0 +1,131 @@
+From c2f2546ad9f4139c278630d8ddacd462de8aec8e Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Thu, 19 Jan 2017 09:40:19 +0200
+Subject: [PATCH 07/31] add test_yocto.sh
+
+---
+ test_yocto.sh | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 112 insertions(+)
+ create mode 100644 test_yocto.sh
+
+diff --git a/test_yocto.sh b/test_yocto.sh
+new file mode 100644
+index 0000000..805ccaf
+--- /dev/null
++++ b/test_yocto.sh
+@@ -0,0 +1,112 @@
++#! /bin/bash
++
++# tool to auto-test apitrace/retrace on linux-yocto
++# this tool support x11/fb/dfb/wayland backends
++
++if [ $# != 2 ]; then
++    echo "Usage: $0 <backend> <tracefile path>"
++    echo "    backend: can be one of fb/dfb/wayland/x11"
++    echo "    tracefile path: where to put trace file"
++    exit -1
++fi
++
++BACKEND=$1
++TRACEFILE_PATH="$(realpath $2)"
++MAXDURATION="10s" # duration for every case. depending on available disk space
++
++EGL11_CASES="angeles tritex OGLESCoverflow tutorial1 tutorial2 tutorial3 tutorial4 tutorial5 tutorial6 tutorial7"
++EGL20_CASES="es2gears OGLES2Coverflow OGLES2Fog OGLES2Texturing scene_FBO glmark2-es2 tutorial1_es20 tutorial2_es20 tutorial3_es20 tutorial4_es20 tutorial5_es20 tutorial6_es20 tutorial7_es20"
++EGL30_CASES="OGLES3PhantomMask OGLES3DeferredShading OGLES3RenderToTexture"
++#GLX_CASES="glxgears glmark2 glxs"
++GLX_CASES="glxgears glxs"
++
++kill_app()
++{
++    APP=$1
++    # Need truncate app name, otherwise pkill will fail on yocto
++    pkill -x "${APP:0:15}"
++}
++
++run_eglcases()
++{
++    for tcase in $1
++    do
++        CURPATH="$(realpath .)"
++        echo "--------------------------------------------------------"
++	echo "Start apitrace"
++        echo "--------------------------------------------------------"
++        # for tutorial cases, need go to that directory to run
++	if [ "${tcase:0:8}" == "tutorial" ]; then
++            cd /opt/viv_samples/vdk
++	fi
++        # start test
++	apitrace trace --output=$TRACEFILE_PATH/$tcase.trace --api=egl $tcase &
++        sleep $MAXDURATION
++        # end test
++	kill_app $tcase
++        cd $CURPATH # go back to original path
++
++	echo "--------------------------------------------------------"
++	echo "Start retrace"
++        echo "--------------------------------------------------------"
++	sleep 1s
++        eglretrace $TRACEFILE_PATH/$tcase.trace
++    done
++}
++
++run_glxcases()
++{
++    for tcase in $1
++    do
++        CURPATH="$(realpath .)"
++	echo "--------------------------------------------------------"
++	echo "Start apitrace"
++        echo "--------------------------------------------------------"
++
++	if [ "$tcase" == "glxs" ]; then
++            cd /share/X11Tests/yocto1.6rel/bin/GLXS
++	    tcase="./$tcase"
++	fi
++
++        # start test
++	apitrace trace --output=$TRACEFILE_PATH/$tcase.trace --api=gl $tcase &
++        sleep $MAXDURATION
++        # end test
++	kill_app $tcase
++        cd $CURPATH # go back to original path
++
++	echo "--------------------------------------------------------"
++	echo "Start retrace"
++        echo "--------------------------------------------------------"
++	sleep 1s
++        glretrace $TRACEFILE_PATH/$tcase.trace
++    done
++}
++
++run_cases()
++{
++    export PATH=$PATH:/share/X11Tests/yocto1.6rel/bin:/opt/viv_samples/vdk
++    export PATH=$PATH:/share/X11Tests/yocto1.6rel/bin/PowerVR3.1/Advanced/:/share/X11Tests/yocto1.6rel/bin/PowerVR3.1/Intermediate/:/share/X11Tests/yocto1.6rel/bin/PowerVR3.1/Beginner/
++    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/share/X11Tests/yocto1.6rel/lib
++    if [ "$BACKEND" == "x11" ]; then
++    export DISPLAY=:0
++    fi
++    mkdir -p $TRACEFILE_PATH
++    rm $TRACEFILE_PATH/*.trace
++
++    run_eglcases "$EGL11_CASES"
++    run_eglcases "$EGL20_CASES"
++    run_eglcases "$EGL30_CASES"
++    if [ "$BACKEND" == "x11" ]; then
++    run_glxcases "$GLX_CASES"
++    fi
++}
++
++date
++
++run_cases
++
++echo "--------------------------------------------------------"
++echo "Test finished"
++date
++echo "--------------------------------------------------------"
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0008-docs-mention-apitrace_dalvik.sh.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0008-docs-mention-apitrace_dalvik.sh.patch
new file mode 100644
index 0000000..7df7466
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0008-docs-mention-apitrace_dalvik.sh.patch
@@ -0,0 +1,28 @@
+From 9cac54ef85833b55095a8115ecbf059b6d4e23c3 Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Wed, 29 Mar 2017 14:36:19 +0300
+Subject: [PATCH 08/31] docs: mention apitrace_dalvik.sh
+
+---
+ docs/Dalvik.markdown | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/docs/Dalvik.markdown b/docs/Dalvik.markdown
+index 6fddf38..0224e7e 100644
+--- a/docs/Dalvik.markdown
++++ b/docs/Dalvik.markdown
+@@ -42,6 +42,11 @@ are saved into '/data/data/$PROCNAME' directory by default:
+     adb shell rm /data/data/$PROCNAME/$PROCNAME.trace
+ 
+ 
++## Helper script ##
++
++    sh /sdcard/apitrace/bin/apitrace_dalvik.sh com.android.settings
++
++
+ ## Tracing on Android pre-4.0 ##
+ 
+ `LD_PRELOAD` is supported since Android 2.3 "Gingerbread" and newer, but
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0009-add-retrace-glws_nonx.cpp.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0009-add-retrace-glws_nonx.cpp.patch
new file mode 100644
index 0000000..a50192f
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0009-add-retrace-glws_nonx.cpp.patch
@@ -0,0 +1,515 @@
+From c44f18c4ae1098a5ff2afb98eb3f1c2d1b0fe7e5 Mon Sep 17 00:00:00 2001
+From: Gan Yuchou <yuchou.gan@nxp.com>
+Date: Mon, 23 Jan 2017 12:27:25 +0200
+Subject: [PATCH 09/31] add retrace/glws_nonx.cpp
+
+Signed-off-by: Gan Yuchou <yuchou.gan@nxp.com>
+---
+ retrace/glws_nonx.cpp | 495 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 495 insertions(+)
+ create mode 100644 retrace/glws_nonx.cpp
+
+diff --git a/retrace/glws_nonx.cpp b/retrace/glws_nonx.cpp
+new file mode 100644
+index 0000000..fa8db97
+--- /dev/null
++++ b/retrace/glws_nonx.cpp
+@@ -0,0 +1,495 @@
++// This file is to support: FB/DFB/Wayland retrace
++
++#include <assert.h>
++#include <stdlib.h>
++
++#include <iostream>
++
++#include <dlfcn.h>
++
++#include "glproc.hpp"
++#include "glws.hpp"
++
++#include <EGL/eglext.h>
++#include "gc_vdk.h"
++
++namespace glws {
++
++static vdkEGL vdk_egl;
++static char const *eglExtensions = NULL;
++static bool has_EGL_KHR_create_context = false;
++static bool check_dfb();
++
++static EGLenum
++translateAPI(glprofile::Profile profile)
++{
++    switch (profile.api) {
++    case glprofile::API_GL:
++        return EGL_OPENGL_API;
++    case glprofile::API_GLES:
++        return EGL_OPENGL_ES_API;
++    default:
++        assert(0);
++        return EGL_NONE;
++    }
++}
++
++
++/* Must be called before
++ *
++ * - eglCreateContext
++ * - eglGetCurrentContext
++ * - eglGetCurrentDisplay
++ * - eglGetCurrentSurface
++ * - eglMakeCurrent (when its ctx parameter is EGL_NO_CONTEXT ),
++ * - eglWaitClient
++ * - eglWaitNative
++ */
++static void
++bindAPI(EGLenum api)
++{
++    if (eglBindAPI(api) != EGL_TRUE) {
++        std::cerr << "error: eglBindAPI failed\n";
++        exit(1);
++    }
++}
++
++class NonxVisual : public Visual
++{
++public:
++    EGLConfig config;
++
++    NonxVisual(Profile prof, EGLConfig cfg) :
++        Visual(prof),
++        config(cfg)
++    {}
++
++    virtual ~NonxVisual() {
++    }
++};
++
++class NonxDrawable : public Drawable
++{
++public:
++    EGLNativePixmapType native_pixmap;
++    EGLenum api;
++
++    NonxDrawable(const Visual *vis, int w, int h, bool pbuffer) :
++        Drawable (vis, w, h, pbuffer),
++        api(EGL_OPENGL_ES_API)
++    {
++        native_pixmap = (EGLNativePixmapType)0;
++        createVDKDrawable(w, h);
++    }
++
++    virtual ~NonxDrawable()
++    {
++        destroyVDKDrawable();
++    }
++
++    void
++    createVDKDrawable(int w, int h, bool pixmap = false) {
++        if(check_dfb()) {
++            int width, height, stride, bpp;
++            unsigned long phy;
++            vdkGetDisplayInfo(vdk_egl.display, &width, &height, &phy, &stride, &bpp);
++            Drawable::resize(width, height);
++            w = width;
++            h = height;
++        }
++        vdk_egl.window = vdkCreateWindow(vdk_egl.display, 0, 0, w, h);
++
++        EGLConfig config = static_cast<const NonxVisual *>(visual)->config;
++
++        if(pixmap)
++        {
++            native_pixmap = vdkCreatePixmap(vdk_egl.display, w, h, 32);
++            vdk_egl.eglSurface = eglCreatePixmapSurface(vdk_egl.eglDisplay, config, native_pixmap, NULL);
++            if(vdk_egl.eglSurface == EGL_NO_SURFACE) {
++               std::cerr << "error: failed to create pixmap surface:" << eglGetError() << "\n";
++               exit(1);
++            }
++            std::cerr<<"@@@@create eglPixmapSurface:" << vdk_egl.eglSurface << "\n";
++        }
++
++        else {
++            eglWaitNative(EGL_CORE_NATIVE_ENGINE);
++            vdk_egl.eglSurface = eglCreateWindowSurface(vdk_egl.eglDisplay, config, (EGLNativeWindowType)vdk_egl.window, NULL);
++            if(vdk_egl.eglSurface == EGL_NO_SURFACE) {
++                std::cerr << "error: failed to create window surface\n";
++                exit(1);
++            }
++        }
++
++        vdkSetWindowTitle(vdk_egl.window, "retrace");
++        vdkShowWindow(vdk_egl.window);
++
++        std::cerr << "window size " << w << " x " << h << "\n";
++    }
++
++    void
++    destroyVDKDrawable(void) {
++        if(vdk_egl.eglSurface != EGL_NO_SURFACE) {
++            eglDestroySurface(vdk_egl.eglDisplay, vdk_egl.eglSurface);
++            eglWaitClient();
++            vdk_egl.eglSurface = EGL_NO_SURFACE;
++        }
++        if(native_pixmap != NULL) {
++            vdkDestroyPixmap(native_pixmap);
++            native_pixmap = NULL;
++        }
++        if(vdk_egl.window != NULL) {
++            /* Hide the window. */
++            vdkHideWindow(vdk_egl.window);
++            /* Destroy the window. */
++            vdkDestroyWindow(vdk_egl.window);
++            vdk_egl.window = NULL;
++            eglWaitNative(EGL_CORE_NATIVE_ENGINE);
++        }
++    }
++
++    void
++    resize(int w, int h) {
++        if (w == width && h == height) {
++            return;
++        }
++
++        eglWaitClient();
++        /* Hide the window. */
++        vdkHideWindow(vdk_egl.window);
++        /* Destroy the window. */
++        vdkDestroyWindow(vdk_egl.window);
++        vdk_egl.window = NULL;
++        eglWaitNative(EGL_CORE_NATIVE_ENGINE);
++
++        vdk_egl.window = vdkCreateWindow(vdk_egl.display, 0, 0, w, h);
++        EGLContext currentContext = eglGetCurrentContext();
++        EGLConfig config = static_cast<const NonxVisual *>(visual)->config;
++        EGLSurface oldSurface = vdk_egl.eglSurface;
++        vdk_egl.eglSurface = eglCreateWindowSurface(vdk_egl.eglDisplay, config, (EGLNativeWindowType)vdk_egl.window, NULL);
++        eglMakeCurrent(vdk_egl.eglDisplay, vdk_egl.eglSurface, vdk_egl.eglSurface, currentContext);
++        eglDestroySurface(vdk_egl.eglDisplay, oldSurface);
++
++        vdkSetWindowTitle(vdk_egl.window, "retrace");
++        vdkShowWindow(vdk_egl.window);
++
++        std::cerr << "window resize " << w << " x " << h << "\n";
++        Drawable::resize(w, h);
++    }
++
++    void
++    show(void) {
++        if (visible) {
++            return;
++        }
++
++        eglWaitClient();
++
++        vdkShowWindow(vdk_egl.window);
++
++        eglWaitNative(EGL_CORE_NATIVE_ENGINE);
++
++        Drawable::show();
++    }
++
++    void
++    swapBuffers(void) {
++        bindAPI(api);
++        vdkSwapEGL(&vdk_egl);
++    }
++};
++
++class NonxContext : public Context
++{
++public:
++    EGLContext context;
++
++    NonxContext(const Visual *vis, EGLContext ctx) :
++        Context(vis),
++        context(ctx)
++    {}
++
++    virtual ~NonxContext() {
++        eglDestroyContext(vdk_egl.eglDisplay, context);
++    }
++};
++
++/**
++ * Load the symbols from the specified shared object into global namespace, so
++ * that they can be later found by dlsym(RTLD_NEXT, ...);
++ */
++static void
++load(const char *filename)
++{
++    if (!dlopen(filename, RTLD_GLOBAL | RTLD_LAZY)) {
++        std::cerr << "error: unable to open " << filename << "\n";
++        exit(1);
++    }
++}
++
++static bool
++check_dfb() {
++    static int status = -1;
++    if(status != -1)
++        return (status == 1);
++
++    void *h = dlopen("libdirectfb_gal.so", RTLD_GLOBAL | RTLD_LAZY);
++    if (h == NULL) {
++        status = 0;
++        return false;
++    }
++
++    std::cerr << "It is DirectFB\n";
++
++    dlclose(h);
++    status = 1;
++    return true;
++}
++
++void
++init(void) {
++    load("libEGL.so.1");
++
++    vdk_egl.vdk = vdkInitialize();
++    if(vdk_egl.vdk == 0) {
++        std::cerr << "error: failed to init vdk\n";
++        exit(1);
++    }
++    // vdk display as native display
++    vdk_egl.display = vdkGetDisplay(vdk_egl.vdk);
++    std::cerr << "native display: " << vdk_egl.display << "\n";
++
++    vdk_egl.eglDisplay = eglGetDisplay(vdk_egl.display);
++    if (vdk_egl.eglDisplay == EGL_NO_DISPLAY) {
++        std::cerr << "error: unable to get EGL display\n";
++        exit(1);
++    }
++
++    EGLint major, minor;
++    if (!eglInitialize(vdk_egl.eglDisplay, &major, &minor)) {
++        std::cerr << "error: unable to initialize EGL display\n";
++        exit(1);
++    }
++
++    eglExtensions = eglQueryString(vdk_egl.eglDisplay, EGL_EXTENSIONS);
++    has_EGL_KHR_create_context = checkExtension("EGL_KHR_create_context", eglExtensions);
++
++}
++
++void
++cleanup(void) {
++    if (vdk_egl.eglDisplay != EGL_NO_DISPLAY) {
++        eglTerminate(vdk_egl.eglDisplay);
++    }
++    vdkDestroyDisplay(vdk_egl.display);
++    vdkExit(vdk_egl.vdk);
++}
++
++Visual *
++createVisual(bool doubleBuffer, unsigned samples, Profile profile) {
++    EGLint api_bits;
++    if (profile.api == glprofile::API_GL) {
++        api_bits = EGL_OPENGL_BIT;
++        if (profile.core && !has_EGL_KHR_create_context) {
++            return NULL;
++        }
++    } else if (profile.api == glprofile::API_GLES) {
++        switch (profile.major) {
++        case 1:
++            api_bits = EGL_OPENGL_ES_BIT;
++            break;
++        case 3:
++            if (has_EGL_KHR_create_context) {
++                api_bits = EGL_OPENGL_ES3_BIT;
++                break;
++            }
++            /* fall-through */
++        case 2:
++            api_bits = EGL_OPENGL_ES2_BIT;
++            break;
++        default:
++            return NULL;
++        }
++    } else {
++        assert(0);
++        return NULL;
++    }
++
++    Attributes<EGLint> attribs;
++    attribs.add(EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
++    attribs.add(EGL_RED_SIZE, 1);
++    attribs.add(EGL_GREEN_SIZE, 1);
++    attribs.add(EGL_BLUE_SIZE, 1);
++    attribs.add(EGL_ALPHA_SIZE, 1);
++    attribs.add(EGL_DEPTH_SIZE, 1);
++    attribs.add(EGL_STENCIL_SIZE, 1);
++    attribs.add(EGL_RENDERABLE_TYPE, api_bits);
++    attribs.end(EGL_NONE);
++
++    EGLint num_configs = 0;
++    if (!eglGetConfigs(vdk_egl.eglDisplay, NULL, 0, &num_configs) ||
++        num_configs <= 0) {
++        return NULL;
++    }
++
++    std::vector<EGLConfig> configs(num_configs);
++    if (!eglChooseConfig(vdk_egl.eglDisplay, attribs, &configs[0], num_configs,  &num_configs) ||
++        num_configs <= 0) {
++        return NULL;
++    }
++
++    // We can't tell what other APIs the trace will use afterwards, therefore
++    // try to pick a config which supports the widest set of APIs.
++    int bestScore = -1;
++    EGLConfig config = configs[0];
++    for (EGLint i = 0; i < num_configs; ++i) {
++        EGLint renderable_type = EGL_NONE;
++        eglGetConfigAttrib(vdk_egl.eglDisplay, configs[i], EGL_RENDERABLE_TYPE, &renderable_type);
++        int score = 0;
++        assert(renderable_type & api_bits);
++        renderable_type &= ~api_bits;
++        if (renderable_type & EGL_OPENGL_ES2_BIT) {
++            score += 1 << 4;
++        }
++        if (renderable_type & EGL_OPENGL_ES3_BIT) {
++            score += 1 << 3;
++        }
++        if (renderable_type & EGL_OPENGL_ES_BIT) {
++            score += 1 << 2;
++        }
++        if (renderable_type & EGL_OPENGL_BIT) {
++            score += 1 << 1;
++        }
++        if (score > bestScore) {
++            config = configs[i];
++            bestScore = score;
++        }
++    }
++    assert(bestScore >= 0);
++
++    EGLint visual_id;
++    if (!eglGetConfigAttrib(vdk_egl.eglDisplay, config, EGL_NATIVE_VISUAL_ID, &visual_id)) {
++        assert(0);
++        return NULL;
++    }
++
++    Visual *visual = NULL;
++
++    if(config != 0) {
++        std::cerr << "eglChooseConfig ok\n";
++        visual = new NonxVisual(profile, config);
++    }
++    else {
++        std::cerr << "error: failed to get egl config\n";
++    }
++
++    return visual;
++}
++
++Drawable *
++createDrawable(const Visual *visual, int width, int height, bool pbuffer)
++{
++    return new NonxDrawable(visual, width, height, pbuffer);
++}
++
++Context *
++createContext(const Visual *_visual, Context *shareContext, bool debug)
++{
++    Profile profile = _visual->profile;
++    const NonxVisual *visual = static_cast<const NonxVisual *>(_visual);
++    EGLContext share_context = EGL_NO_CONTEXT;
++    EGLContext context;
++    Attributes<EGLint> attribs;
++
++    if (shareContext) {
++        share_context = static_cast<NonxContext*>(shareContext)->context;
++    }
++
++    int contextFlags = 0;
++    if (profile.api == glprofile::API_GL) {
++        load("libGL.so.1");
++
++        if (has_EGL_KHR_create_context) {
++            attribs.add(EGL_CONTEXT_MAJOR_VERSION_KHR, profile.major);
++            attribs.add(EGL_CONTEXT_MINOR_VERSION_KHR, profile.minor);
++            int profileMask = profile.core ? EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR : EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR;
++            attribs.add(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, profileMask);
++            if (profile.forwardCompatible) {
++                contextFlags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
++            }
++        } else if (profile.versionGreaterOrEqual(3, 2)) {
++            std::cerr << "error: EGL_KHR_create_context not supported\n";
++            return NULL;
++        }
++    } else if (profile.api == glprofile::API_GLES) {
++        if (profile.major >= 2) {
++            load("libGLESv2.so.2");
++        } else {
++            load("libGLESv1_CM.so.1");
++        }
++
++        if (has_EGL_KHR_create_context) {
++            attribs.add(EGL_CONTEXT_MAJOR_VERSION_KHR, profile.major);
++            attribs.add(EGL_CONTEXT_MINOR_VERSION_KHR, profile.minor);
++        } else {
++            attribs.add(EGL_CONTEXT_CLIENT_VERSION, profile.major);
++        }
++    } else {
++        assert(0);
++        return NULL;
++    }
++
++    if (debug) {
++        contextFlags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
++    }
++    if (contextFlags && has_EGL_KHR_create_context) {
++        attribs.add(EGL_CONTEXT_FLAGS_KHR, contextFlags);
++    }
++    attribs.end(EGL_NONE);
++
++    EGLenum api = translateAPI(profile);
++    bindAPI(api);
++
++    context = eglCreateContext(vdk_egl.eglDisplay, visual->config, share_context, attribs);
++    if (!context) {
++        if (debug) {
++            // XXX: Mesa has problems with EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR
++            // with OpenGL ES contexts, so retry without it
++            return createContext(_visual, shareContext, false);
++        }
++        return NULL;
++    }
++    return new NonxContext(visual, context);
++}
++
++bool
++makeCurrentInternal(Drawable *drawable, Context *context)
++{
++    if (!drawable || !context) {
++        return eglMakeCurrent(vdk_egl.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
++    } else {
++        NonxDrawable *eglDrawable = static_cast<NonxDrawable *>(drawable);
++        NonxContext *eglContext = static_cast<NonxContext *>(context);
++        EGLBoolean ok;
++
++        EGLenum api = translateAPI(eglContext->profile);
++        bindAPI(api);
++
++        ok = eglMakeCurrent(vdk_egl.eglDisplay, vdk_egl.eglSurface,
++                            vdk_egl.eglSurface, eglContext->context);
++
++        if (ok) {
++            eglDrawable->api = api;
++        }
++
++        return ok;
++    }
++}
++
++bool
++processEvents(void)
++{
++    return false;
++}
++
++}
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0010-cmake-use-glws_nonx-for-Vivante.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0010-cmake-use-glws_nonx-for-Vivante.patch
new file mode 100644
index 0000000..0112c29
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0010-cmake-use-glws_nonx-for-Vivante.patch
@@ -0,0 +1,62 @@
+From c0e8e603ef8b65ac039a2699554025661a3f62d2 Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Mon, 23 Jan 2017 12:27:56 +0200
+Subject: [PATCH 10/31] cmake: use glws_nonx for Vivante
+
+The nonX windowing system gets used when Apitrace is compiled
+
+with:
+   EGL
+
+and without:
+   X11
+   Win32
+   Apple
+   Waffle
+   Android
+---
+ retrace/CMakeLists.txt | 28 ++++++++++++++++++++++++++++
+ 1 file changed, 28 insertions(+)
+
+diff --git a/retrace/CMakeLists.txt b/retrace/CMakeLists.txt
+index cce69e1..9973e2c 100644
+--- a/retrace/CMakeLists.txt
++++ b/retrace/CMakeLists.txt
+@@ -158,6 +158,34 @@ if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE AND NOT ENABLE_WAFFLE)
+     install (TARGETS eglretrace RUNTIME DESTINATION bin) 
+ endif ()
+ 
++if (Vivante_FOUND AND ENABLE_EGL AND NOT X11_FOUND AND NOT WIN32 AND NOT APPLE AND NOT ENABLE_WAFFLE AND NOT ANDROID)
++    add_executable (eglretrace
++        glws_nonx.cpp
++    )
++
++    add_dependencies (eglretrace glproc)
++    include_directories (${CMAKE_SYSROOT}/usr/include/HAL/)
++
++    target_link_libraries (eglretrace
++        retrace_common
++        glretrace_common
++        glhelpers
++        glproc_egl
++        ${CMAKE_THREAD_LIBS_INIT}
++        ${CMAKE_DL_LIBS}
++        VDK
++    )
++
++    if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++        target_link_libraries (eglretrace rt)
++        if (READPROC_H_FOUND)
++            target_link_libraries (eglretrace ${proc_LIBRARY})
++        endif ()
++    endif ()
++
++    install (TARGETS eglretrace RUNTIME DESTINATION bin)
++endif ()
++
+ if (ENABLE_EGL)
+     if (ENABLE_WAFFLE)
+         add_executable (eglretrace
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0011-cli_trace-export-ENABLE_API_TRACE-1.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0011-cli_trace-export-ENABLE_API_TRACE-1.patch
new file mode 100644
index 0000000..93aaff7
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0011-cli_trace-export-ENABLE_API_TRACE-1.patch
@@ -0,0 +1,37 @@
+From 117de34b35888fc4dbacb394216c5127461778df Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Thu, 19 Jan 2017 09:52:31 +0200
+Subject: [PATCH 11/31] cli_trace: export ENABLE_API_TRACE=1
+
+No description of what the variable is for.
+---
+ cli/cli_trace.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/cli/cli_trace.cpp b/cli/cli_trace.cpp
+index adca8af..ea57878 100644
+--- a/cli/cli_trace.cpp
++++ b/cli/cli_trace.cpp
+@@ -251,6 +251,8 @@ traceProgram(trace::API api,
+             os::setEnvironment("TRACE_FILE", output);
+         }
+ 
++        os::setEnvironment("ENABLE_API_TRACE", "1");
++
+         for (char * const * arg = argv; *arg; ++arg) {
+             args.push_back(*arg);
+         }
+@@ -296,7 +298,9 @@ exit:
+     if (output) {
+         os::unsetEnvironment("TRACE_FILE");
+     }
+-    
++
++    os::unsetEnvironment("ENABLE_API_TRACE");
++
+     return status;
+ 
+ }
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0012-use-dlsym-to-get-function-pointers.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0012-use-dlsym-to-get-function-pointers.patch
new file mode 100644
index 0000000..aa6272d
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0012-use-dlsym-to-get-function-pointers.patch
@@ -0,0 +1,31 @@
+From b3e71db97c981fcb91eb6beaa6a7941fccdc25fc Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Thu, 19 Jan 2017 09:58:51 +0200
+Subject: [PATCH 12/31] use dlsym to get function pointers
+
+---
+ dispatch/glproc_gl.cpp | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/dispatch/glproc_gl.cpp b/dispatch/glproc_gl.cpp
+index 8ae40d4..7d162da 100644
+--- a/dispatch/glproc_gl.cpp
++++ b/dispatch/glproc_gl.cpp
+@@ -221,7 +221,13 @@ _getPublicProcAddress(const char *procName)
+ void *
+ _getPrivateProcAddress(const char *procName)
+ {
+-    return (void *)_glXGetProcAddressARB((const GLubyte *)procName);
++    void *proc;
++    proc = _getPublicProcAddress(procName);
++    if (!proc) {
++        proc = (void *)_glXGetProcAddressARB((const GLubyte *)procName);
++    }
++
++    return proc;
+ }
+ 
+ 
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0013-Vivante-driver-does-not-support-GL_RGB-in-openGL-dri.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0013-Vivante-driver-does-not-support-GL_RGB-in-openGL-dri.patch
new file mode 100644
index 0000000..6a78fd7
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0013-Vivante-driver-does-not-support-GL_RGB-in-openGL-dri.patch
@@ -0,0 +1,36 @@
+From 58ba383c0f51b02ebcf703c1d8a3e213dc08ae97 Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Thu, 19 Jan 2017 11:37:50 +0200
+Subject: [PATCH 13/31] Vivante driver does not support GL_RGB in openGL driver
+
+---
+ retrace/glstate_images.cpp | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/retrace/glstate_images.cpp b/retrace/glstate_images.cpp
+index 44a2633..f0805e2 100644
+--- a/retrace/glstate_images.cpp
++++ b/retrace/glstate_images.cpp
+@@ -1015,6 +1015,10 @@ getDrawBufferImage() {
+     if (context.ES) {
+         format = GL_RGBA;
+     }
++    else {
++        // Vivante driver does not support GL_RGB in openGL driver
++        format = GL_RGBA;
++    }
+ 
+     GLint channels = _gl_format_channels(format);
+     if (channels > 4) {
+@@ -1049,6 +1053,8 @@ getDrawBufferImage() {
+     {
+         // TODO: reset imaging state too
+         PixelPackState pps(context);
++        // FIXME! in case driver does not support full state
++        glGetError();
+         glReadPixels(0, 0, desc.width, desc.height, format, type, image->pixels);
+     }
+ 
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0014-MGS-469-GPU-hangs-when-retracing-OGLESParticles-on-m.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0014-MGS-469-GPU-hangs-when-retracing-OGLESParticles-on-m.patch
new file mode 100644
index 0000000..1d2d7d6
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0014-MGS-469-GPU-hangs-when-retracing-OGLESParticles-on-m.patch
@@ -0,0 +1,28 @@
+From 172058a38ebe53080264ceebd4c10f18ea0b14fd Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Thu, 19 Jan 2017 11:49:17 +0200
+Subject: [PATCH 14/31] MGS-469: GPU hangs when retracing OGLESParticles on
+ mx6sx
+
+---
+ retrace/retrace.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/retrace/retrace.py b/retrace/retrace.py
+index d506abc..164944e 100644
+--- a/retrace/retrace.py
++++ b/retrace/retrace.py
+@@ -465,7 +465,9 @@ class Retracer:
+         print '    if (retrace::verbosity >= 0) {'
+         print '        retrace::unsupported(call);'
+         print '    }'
+-        print '    return;'
++        # MGS-469: GPU hangs when retracing OGLESParticles on mx6sx
++        # Workaround: do not `return`
++        #print '    return;'
+ 
+     def extractArg(self, function, arg, arg_type, lvalue, rvalue):
+         ValueAllocator().visit(arg_type, lvalue, rvalue)
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0015-egl-define-egl-native-types-for-non-x11.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0015-egl-define-egl-native-types-for-non-x11.patch
new file mode 100644
index 0000000..67c42ee
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0015-egl-define-egl-native-types-for-non-x11.patch
@@ -0,0 +1,36 @@
+From 1c1f29f549a121ed0a402c95044376457a882a35 Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Thu, 19 Jan 2017 11:55:35 +0200
+Subject: [PATCH 15/31] egl: define egl native types for non-x11
+
+---
+ thirdparty/khronos/EGL/eglplatform.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/thirdparty/khronos/EGL/eglplatform.h b/thirdparty/khronos/EGL/eglplatform.h
+index 203f08c..ed189e2 100644
+--- a/thirdparty/khronos/EGL/eglplatform.h
++++ b/thirdparty/khronos/EGL/eglplatform.h
+@@ -111,6 +111,7 @@ typedef void *EGLNativeWindowType;
+ 
+ #elif defined(__unix__)
+ 
++#if defined(HAVE_X11)
+ /* X11 (tentative)  */
+ #include <X11/Xlib.h>
+ #include <X11/Xutil.h>
+@@ -118,6 +119,11 @@ typedef void *EGLNativeWindowType;
+ typedef Display *EGLNativeDisplayType;
+ typedef Pixmap   EGLNativePixmapType;
+ typedef Window   EGLNativeWindowType;
++#else
++typedef void *EGLNativeDisplayType;
++typedef void *EGLNativePixmapType;
++typedef void *EGLNativeWindowType;
++#endif
+ 
+ #else
+ #error "Platform not recognized"
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0016-don-t-recreate-the-EGL-surface-on-resize.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0016-don-t-recreate-the-EGL-surface-on-resize.patch
new file mode 100644
index 0000000..129f598
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0016-don-t-recreate-the-EGL-surface-on-resize.patch
@@ -0,0 +1,32 @@
+From 2646cdaf6ae97d205251634196d23679e9b026bb Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Wed, 29 Mar 2017 14:39:17 +0300
+Subject: [PATCH 16/31] don't recreate the EGL surface on resize
+
+---
+ retrace/glws_egl_xlib.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/retrace/glws_egl_xlib.cpp b/retrace/glws_egl_xlib.cpp
+index f4c363c..e50e6dd 100644
+--- a/retrace/glws_egl_xlib.cpp
++++ b/retrace/glws_egl_xlib.cpp
+@@ -173,6 +173,7 @@ public:
+ 
+         eglWaitNative(EGL_CORE_NATIVE_ENGINE);
+ 
++#if 0
+         /*
+          * Some implementations won't update the backbuffer unless we recreate
+          * the EGL surface.
+@@ -193,6 +194,7 @@ public:
+ 
+         assert(eglWidth == width);
+         assert(eglHeight == height);
++#endif
+     }
+ 
+     void show(void) {
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0017-add-Image-getMD5.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0017-add-Image-getMD5.patch
new file mode 100644
index 0000000..17ea445
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0017-add-Image-getMD5.patch
@@ -0,0 +1,69 @@
+From 6a49ded5002d9cc819a1810c16633b5c6e89881e Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Wed, 29 Mar 2017 14:41:42 +0300
+Subject: [PATCH 17/31] add Image::getMD5()
+
+---
+ image/image.hpp     |  3 +++
+ image/image_md5.cpp | 25 +++++++++++++++++++++++++
+ 2 files changed, 28 insertions(+)
+
+diff --git a/image/image.hpp b/image/image.hpp
+index e6f0d22..f128a34 100644
+--- a/image/image.hpp
++++ b/image/image.hpp
+@@ -114,6 +114,9 @@ public:
+     void
+     writeMD5(std::ostream &os) const;
+ 
++    char *
++    getMD5();
++
+     bool
+     writePNG(std::ostream &os, bool strip_alpha = false) const;
+ 
+diff --git a/image/image_md5.cpp b/image/image_md5.cpp
+index 85141e1..29a51b4 100644
+--- a/image/image_md5.cpp
++++ b/image/image_md5.cpp
+@@ -26,6 +26,7 @@
+ 
+ 
+ #include <fstream>
++#include <string.h>
+ #include "image.hpp"
+ 
+ #include "md5.h"
+@@ -60,5 +61,29 @@ Image::writeMD5(std::ostream &os) const {
+ }
+ 
+ 
++char *
++Image::getMD5() {
++    struct MD5Context md5c;
++    MD5Init(&md5c);
++    const unsigned char *row;
++    unsigned len = width*bytesPerPixel;
++    for (row = start(); row != end(); row += stride()) {
++        MD5Update(&md5c, (unsigned char *)row, len);
++    }
++    unsigned char signature[16];
++    MD5Final(signature, &md5c);
++
++    const char hex[] = "0123456789ABCDEF";
++    char csig[33];
++    for(int i = 0; i < sizeof signature; i++){
++        csig[2*i    ] = hex[signature[i] >> 4];
++        csig[2*i + 1] = hex[signature[i] & 0xf];
++    }
++    csig[32] = '\0';
++
++    return strdup(csig);
++}
++
++
+ } /* namespace image */
+ 
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0018-retrace-use-Image-getMD5-for-image-comparison.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0018-retrace-use-Image-getMD5-for-image-comparison.patch
new file mode 100644
index 0000000..6abf051
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0018-retrace-use-Image-getMD5-for-image-comparison.patch
@@ -0,0 +1,175 @@
+From f1c0525bec534db50cb8020d9679ac2076573bb7 Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Wed, 29 Mar 2017 14:48:49 +0300
+Subject: [PATCH 18/31] retrace: use Image::getMD5() for image comparison
+
+---
+ retrace/retrace_main.cpp | 96 +++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 95 insertions(+), 1 deletion(-)
+
+diff --git a/retrace/retrace_main.cpp b/retrace/retrace_main.cpp
+index ec49a16..72e0183 100644
+--- a/retrace/retrace_main.cpp
++++ b/retrace/retrace_main.cpp
+@@ -32,6 +32,7 @@
+ #include <getopt.h>
+ #ifndef _WIN32
+ #include <unistd.h> // for isatty()
++#include <fcntl.h>
+ #endif
+ 
+ #include "os_binary.hpp"
+@@ -60,6 +61,13 @@ static trace::CallSet snapshotFrequency;
+ static unsigned snapshotInterval = 0;
+ 
+ static unsigned dumpStateCallNo = ~0;
++static unsigned snapshotStart = 0;
++static unsigned snapshotStop = (unsigned)-1;
++static int compareImageFd = -1;
++
++
++static int checkMD5(char *md5, int framenr);
++
+ 
+ retrace::Retracer retracer;
+ 
+@@ -172,7 +180,13 @@ takeSnapshot(unsigned call_no) {
+                 src->writeRAW(std::cout);
+                 break;
+             case RAW_MD5:
+-                src->writeMD5(std::cout);
++                if(compareImageFd != -1) {
++                    char *md5 = src->getMD5();
++                    checkMD5(md5, snapshot_no);
++                }
++                else {
++                    src->writeMD5(std::cout);
++                }
+                 break;
+             default:
+                 assert(0);
+@@ -611,6 +625,9 @@ usage(const char *argv0) {
+         "      --snapshot-format=FMT       use (PNM, RGB, or MD5; default is PNM) when writing to stdout output\n"
+         "  -S, --snapshot=CALLSET  calls to snapshot (default is every frame)\n"
+         "      --snapshot-interval=N    specify a frame interval when generating snaphots (default is 0)\n"
++        "      --snapshot-start=N  start snapshot from frame N\n"
++        "      --snapshot-stop=N   stop snapshot before frame N\n"
++        "      --reference-dump=FILE    use a reference dump file to compare snapshot. Only MD5 is supported now.\n"
+         "  -v, --verbose           increase output verbosity\n"
+         "  -D, --dump-state=CALL   dump state at specific call no\n"
+         "      --dump-format=FORMAT dump state format (`json` or `ubjson`)\n"
+@@ -637,6 +654,9 @@ enum {
+     SINGLETHREAD_OPT,
+     SNAPSHOT_INTERVAL_OPT,
+     DUMP_FORMAT_OPT,
++    SNAPSHOT_STARTFRAME_OPT,
++    SNAPSHOT_STOPFRAME_OPT,
++    REFERENCE_DUMP_OPT,
+ };
+ 
+ const static char *
+@@ -669,6 +689,9 @@ longOptions[] = {
+     {"wait", no_argument, 0, 'w'},
+     {"loop", optional_argument, 0, LOOP_OPT},
+     {"singlethread", no_argument, 0, SINGLETHREAD_OPT},
++    {"snapshot-start", required_argument, 0, SNAPSHOT_STARTFRAME_OPT},
++    {"snapshot-stop", required_argument, 0, SNAPSHOT_STOPFRAME_OPT},
++    {"reference-dump", required_argument, 0, REFERENCE_DUMP_OPT},
+     {0, 0, 0, 0}
+ };
+ 
+@@ -678,6 +701,63 @@ static void exceptionCallback(void)
+     std::cerr << retrace::callNo << ": error: caught an unhandled exception\n";
+ }
+ 
++static int openReferenceDump(const char *file)
++{
++    compareImageFd = open(file, O_RDONLY);
++    if (compareImageFd == -1) {
++        std::cerr << "error: failed to open the reference dump file: " << file << std::endl;
++        return -1;
++    }
++    return 0;
++}
++
++// caller to free the return md5
++static char * getRefMD5(int fd, int frame)
++{
++    char buf[33];
++    // 33 chars per line (including '\n')
++    if(lseek(fd, frame * 33, SEEK_SET) == -1) {
++        std::cerr << "Failed to seek to frame " << frame << std::endl;
++        return NULL;
++    }
++    if(read(fd, buf, 32) != 32) {
++        std::cerr << "Failed to read 32 bytes\n";
++        return NULL;
++    }
++
++    buf[32] = 0;
++
++    return strdup(buf);
++}
++
++static int checkMD5(char *md5, int framenr)
++{
++    // read line #snapshot_no
++    char *md5ref = getRefMD5(compareImageFd, framenr);
++    int pass = 0;
++    if(md5 != NULL && md5ref != NULL && strcmp(md5, md5ref) == 0)
++    {
++        // pass
++        pass = 1;
++    }
++    else
++    {
++        // fail
++        pass = 0;
++    }
++    if(!pass) {
++        std::cerr << "Mismatch found for frame " << framenr
++            << ": reference " << (md5ref?md5ref:"(null)")
++            << ", but " << (md5?md5:"(null)") << " found\n";
++        exit(1); // no more test?
++    }
++    if(md5)
++        free(md5);
++    if(md5ref)
++        free(md5ref);
++
++    return 0;
++}
+ 
+ extern "C"
+ int main(int argc, char **argv)
+@@ -837,6 +917,17 @@ int main(int argc, char **argv)
+ 
+             retrace::profilingMemoryUsage = true;
+             break;
++        case SNAPSHOT_STARTFRAME_OPT:
++            snapshotStart = atoi(optarg);
++            break;
++        case SNAPSHOT_STOPFRAME_OPT:
++            snapshotStop = atoi(optarg);
++            break;
++        case REFERENCE_DUMP_OPT:
++            if (openReferenceDump(optarg)) {
++                return 1;
++            }
++            break;
+         default:
+             std::cerr << "error: unknown option " << opt << "\n";
+             usage(argv[0]);
+@@ -890,6 +981,9 @@ int main(int argc, char **argv)
+     // XXX: X often hangs on XCloseDisplay
+     //retrace::cleanUp();
+ 
++    if(compareImageFd != -1)
++        close(compareImageFd);
++
+ #ifdef _WIN32
+     if (mmRes == MMSYSERR_NOERROR) {
+         timeEndPeriod(tc.wPeriodMin);
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0019-egltrace-don-t-use-dlsym-on-aliased-functions.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0019-egltrace-don-t-use-dlsym-on-aliased-functions.patch
new file mode 100644
index 0000000..ac21ce8
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0019-egltrace-don-t-use-dlsym-on-aliased-functions.patch
@@ -0,0 +1,91 @@
+From f5a450353de6bc8005e76b4babd9f7b4a13f796d Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Thu, 19 Jan 2017 11:58:21 +0200
+Subject: [PATCH 19/31] egltrace: don't use dlsym on aliased functions
+
+Vivante driver uses function aliases for following OES/EXT:
+
+Extension API alias for GL_OES_texture_3D
+	glTexImage3DOES               glTexImage3D
+	glTexSubImage3DOES            glTexSubImage3D
+	glCopyTexSubImage3DOES        glCopyTexSubImage3D
+	glCompressedTexImage3DOES     glCompressedTexImage3D
+	glCompressedTexSubImage3DOES  glCompressedTexSubImage3D
+
+Extension API alias for GL_OES_get_program_binary
+	glGetProgramBinaryOES         glGetProgramBinary
+	glProgramBinaryOES            glProgramBinary
+
+Extension API alias for GL_OES_vertex_array_object
+	glBindVertexArrayOES          glBindVertexArray
+	glDeleteVertexArraysOES       glDeleteVertexArrays
+	glGenVertexArraysOES          glGenVertexArrays
+	glIsVertexArrayOES            glIsVertexArray
+
+Extension API alias for GL_OES_blend_minmax
+	glBlendEquationEXT            glBlendEquation
+---
+ wrappers/egltrace.py | 40 ++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 40 insertions(+)
+
+diff --git a/wrappers/egltrace.py b/wrappers/egltrace.py
+index 7d2d182..c7720bb 100644
+--- a/wrappers/egltrace.py
++++ b/wrappers/egltrace.py
+@@ -49,6 +49,9 @@ class EglTracer(GlTracer):
+     ]
+ 
+     def traceFunctionImplBody(self, function):
++        if function.name == 'eglGetProcAddress':
++            print '    procname = __get_alias_func_name(procname);'
++
+         GlTracer.traceFunctionImplBody(self, function)
+ 
+         if function.name == 'eglCreateContext':
+@@ -118,6 +121,43 @@ if __name__ == '__main__':
+     print '#include "glsize.hpp"'
+     print '#include "eglsize.hpp"'
+     print
++    print 'static const char *__get_alias_func_name(const char *origFunName)'
++    print '{'
++    print '    /* Vivante driver uses alias name for following OES/EXT functions, that means dlsym for thoese functions will fail */'
++    print '    static const char * __glExtProcAlias[][2] ='
++    print '    {'
++    print '        /* Extension API alias for GL_OES_texture_3D */'
++    print '        {"glTexImage3DOES",               "glTexImage3D"},'
++    print '        {"glTexSubImage3DOES",            "glTexSubImage3D"},'
++    print '        {"glCopyTexSubImage3DOES",        "glCopyTexSubImage3D"},'
++    print '        {"glCompressedTexImage3DOES",     "glCompressedTexImage3D"},'
++    print '        {"glCompressedTexSubImage3DOES",  "glCompressedTexSubImage3D"},'
++    print
++    print '        /* Extension API alias for GL_OES_get_program_binary */'
++    print '        {"glGetProgramBinaryOES",         "glGetProgramBinary"},'
++    print '        {"glProgramBinaryOES",            "glProgramBinary"},'
++    print
++    print '        /* Extension API alias for GL_OES_vertex_array_object */'
++    print '        {"glBindVertexArrayOES",          "glBindVertexArray"},'
++    print '        {"glDeleteVertexArraysOES",       "glDeleteVertexArrays"},'
++    print '        {"glGenVertexArraysOES",          "glGenVertexArrays"},'
++    print '        {"glIsVertexArrayOES",            "glIsVertexArray"},'
++    print
++    print '        /* Extension API alias for GL_OES_blend_minmax */'
++    print '        {"glBlendEquationEXT",            "glBlendEquation"}'
++    print '    };'
++    print
++    print '    int count = sizeof(__glExtProcAlias) / sizeof(__glExtProcAlias[0]);'
++    print '    int i;'
++    print
++    print '    for(i=0; i<count; i++)'
++    print '    {'
++    print '        if(strcmp(__glExtProcAlias[i][0], origFunName) == 0)'
++    print '            return __glExtProcAlias[i][1];'
++    print '    }'
++    print
++    print '    return origFunName;'
++    print '}'
+     
+     module = Module()
+     module.mergeModule(eglapi)
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0020-egl-glx-trace-add-ApiTraceEnabled.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0020-egl-glx-trace-add-ApiTraceEnabled.patch
new file mode 100644
index 0000000..58d9022
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0020-egl-glx-trace-add-ApiTraceEnabled.patch
@@ -0,0 +1,79 @@
+From b0b1ee6963cb87f7465c45fce756baa7e3ff6883 Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Wed, 19 Apr 2017 16:28:55 +0300
+Subject: [PATCH 20/31] (egl|glx)trace: add ApiTraceEnabled
+
+This is a dummy API to let the GPU driver know that we are in
+apitrace.
+---
+ wrappers/egltrace.py      | 11 +++++++++++
+ wrappers/egltrace.version |  1 +
+ wrappers/glxtrace.py      | 11 +++++++++++
+ wrappers/glxtrace.version |  1 +
+ 4 files changed, 24 insertions(+)
+
+diff --git a/wrappers/egltrace.py b/wrappers/egltrace.py
+index c7720bb..6d032eb 100644
+--- a/wrappers/egltrace.py
++++ b/wrappers/egltrace.py
+@@ -294,3 +294,14 @@ void APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, GLsizei stride,
+ 
+ 
+ '''
++    print r'''
++/*
++ * This is a dummy API to let the GPU driver know that we are in apitrace
++ */
++extern "C" PUBLIC
++void APIENTRY ApiTraceEnabled(void) {
++    // a dummy function
++    os::log("Dummy API function\n");
++}
++
++'''
+diff --git a/wrappers/egltrace.version b/wrappers/egltrace.version
+index 0e7e62b..4009857 100644
+--- a/wrappers/egltrace.version
++++ b/wrappers/egltrace.version
+@@ -5,6 +5,7 @@
+         egl[A-Z]*;
+         gl[A-Z]*;
+         dlopen;
++        ApiTraceEnabled;
+     local:
+         *;
+ };
+diff --git a/wrappers/glxtrace.py b/wrappers/glxtrace.py
+index e9c43a9..d9ffe56 100644
+--- a/wrappers/glxtrace.py
++++ b/wrappers/glxtrace.py
+@@ -227,3 +227,14 @@ void * dlopen(const char *filename, int flag)
+ 
+ 
+ '''
++    print r'''
++/*
++ * This is a dummy API to let the GPU driver know that we are in apitrace
++ */
++extern "C" PUBLIC
++void APIENTRY ApiTraceEnabled(void) {
++    // a dummy function
++    os::log("Dummy API function\n");
++}
++
++'''
+diff --git a/wrappers/glxtrace.version b/wrappers/glxtrace.version
+index 7d7a162..7402d6f 100644
+--- a/wrappers/glxtrace.version
++++ b/wrappers/glxtrace.version
+@@ -4,6 +4,7 @@
+         _fini;
+         gl[A-Z]*;
+         dlopen;
++        ApiTraceEnabled;
+     local:
+         *;
+ };
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0021-LocalWriter-make-a-writer-ignorable.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0021-LocalWriter-make-a-writer-ignorable.patch
new file mode 100644
index 0000000..5cbbe90
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0021-LocalWriter-make-a-writer-ignorable.patch
@@ -0,0 +1,101 @@
+From 60ed9aa18ddd36f5e9fa3169245df2091244dcb1 Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Wed, 19 Apr 2017 17:52:04 +0300
+Subject: [PATCH 21/31] LocalWriter: make a writer ignorable
+
+---
+ common/trace_writer_local.cpp | 34 ++++++++++++++++++++++++++++++++++
+ common/trace_writer_local.hpp | 25 +++++++++++++++++++++++++
+ 2 files changed, 59 insertions(+)
+
+diff --git a/common/trace_writer_local.cpp b/common/trace_writer_local.cpp
+index 41f39c8..17b6328 100644
+--- a/common/trace_writer_local.cpp
++++ b/common/trace_writer_local.cpp
+@@ -157,6 +157,9 @@ static uintptr_t next_thread_num = 1;
+ static OS_THREAD_SPECIFIC(uintptr_t)
+ thread_num;
+ 
++static OS_THREAD_SPECIFIC(uint32_t)
++ignored_num;
++
+ void LocalWriter::checkProcessId(void) {
+     if (m_file &&
+         os::getCurrentProcessId() != pid) {
+@@ -244,6 +247,37 @@ void LocalWriter::flush(void) {
+ }
+ 
+ 
++bool LocalWriter::isIgnored(void) {
++    mutex.lock();
++    if (0==ignored_num){
++        mutex.unlock();
++        return false;
++    } else {
++        mutex.unlock();
++        return true;
++    }
++}
++
++void LocalWriter::beginIgnore(void) {
++    mutex.lock();
++    ++ignored_num;
++}
++
++void LocalWriter::endIgnore(void) {
++    mutex.unlock();
++}
++
++void LocalWriter::beginTrace(void) {
++    mutex.lock();
++    --ignored_num;
++}
++
++void LocalWriter::endTrace(void) {
++    mutex.unlock();
++}
++
++
++
+ LocalWriter localWriter;
+ 
+ 
+diff --git a/common/trace_writer_local.hpp b/common/trace_writer_local.hpp
+index 5d55bd9..ed27dbb 100644
+--- a/common/trace_writer_local.hpp
++++ b/common/trace_writer_local.hpp
+@@ -108,6 +108,31 @@ namespace trace {
+         void endLeave(void);
+ 
+         void flush(void);
++
++        /**
++         * Check ingore state
++         */
++        bool isIgnored(void);
++
++        /**
++         * It will stop the trace apicall.
++         */
++        void beginIgnore(void);
++
++        /**
++         * It will release mutex.
++         */
++        void endIgnore(void);
++
++        /**
++         * It will resume the trace apicall.
++         */
++        void beginTrace(void);
++
++        /**
++         * It will release mutex.
++         */
++        void endTrace(void);
+     };
+ 
+     /**
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0022-MGS-309-ccc-retrace-tutorial3-is-different-with-trac.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0022-MGS-309-ccc-retrace-tutorial3-is-different-with-trac.patch
new file mode 100644
index 0000000..1f62814
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0022-MGS-309-ccc-retrace-tutorial3-is-different-with-trac.patch
@@ -0,0 +1,82 @@
+From 9131ba8b2484308ee3f5083e085ff2cf976bc4c1 Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Wed, 19 Apr 2017 17:58:14 +0300
+Subject: [PATCH 22/31] MGS-309 [#ccc] retrace "tutorial3" is different with
+ trace it.
+
+glMultiDrawElementsEXT is implemented by calling glDrawElements.
+
+Since apitrace traces both glMultiDrawElementsEXT and glDrawElements, this
+will mess up the trace.
+
+This patch will only trace glMultiDrawElementsEXT without the nested
+glDrawElements calls.
+---
+ wrappers/gltrace.py |  6 ++++++
+ wrappers/trace.py   | 12 ++++++++++++
+ 2 files changed, 18 insertions(+)
+
+diff --git a/wrappers/gltrace.py b/wrappers/gltrace.py
+index 769f2e3..6f96572 100644
+--- a/wrappers/gltrace.py
++++ b/wrappers/gltrace.py
+@@ -404,6 +404,7 @@ class GlTracer(Tracer):
+ 
+     # XXX: We currently ignore the gl*Draw*ElementArray* functions
+     draw_function_regex = re.compile(r'^gl([A-Z][a-z]+)*Draw(Range)?(Arrays|Elements)([A-Z][a-zA-Z]*)?$' )
++    multi_draw_function_regex = re.compile(r'^glMultiDraw(Arrays|Elements)([A-Z][a-zA-Z]*)?$' )
+ 
+     interleaved_formats = [
+          'GL_V2F',
+@@ -503,6 +504,11 @@ class GlTracer(Tracer):
+ 
+         # ... to the draw calls
+         if self.draw_function_regex.match(function.name):
++            if not self.multi_draw_function_regex.match(function.name):
++                print '    if (trace::localWriter.isIgnored()) {'
++                self.invokeFunction(function)
++                print '        return;'
++                print '    }'
+             print '    if (_need_user_arrays()) {'
+             if 'Indirect' in function.name:
+                 print r'        os::log("apitrace: warning: %s: indirect user arrays not supported\n");' % (function.name,)
+diff --git a/wrappers/trace.py b/wrappers/trace.py
+index cb51024..efb2fd5 100644
+--- a/wrappers/trace.py
++++ b/wrappers/trace.py
+@@ -35,6 +35,7 @@ import itertools
+ 
+ import specs.stdapi as stdapi
+ 
++import re
+ 
+ def getWrapperInterfaceName(interface):
+     return "Wrap" + interface.expr
+@@ -560,13 +561,24 @@ class Tracer:
+         print
+ 
+     def traceFunctionImplBody(self, function):
++        multi_draw_function_regex = re.compile(r'^glMultiDraw(Arrays|Elements)([A-Z][a-zA-Z]*)?$' )
+         if not function.internal:
+             print '    unsigned _call = trace::localWriter.beginEnter(&_%s_sig);' % (function.name,)
+             for arg in function.args:
+                 if not arg.output:
+                     self.serializeArg(function, arg)
+             print '    trace::localWriter.endEnter();'
++
++        if self.multi_draw_function_regex.match(function.name):
++            print '    trace::localWriter.beginIgnore();'
++            print '    trace::localWriter.endIgnore();'
++
+         self.invokeFunction(function)
++
++        if self.multi_draw_function_regex.match(function.name):
++            print '    trace::localWriter.beginTrace();'
++            print '    trace::localWriter.endTrace();'
++
+         if not function.internal:
+             print '    trace::localWriter.beginLeave(_call);'
+             print '    if (%s) {' % self.wasFunctionSuccessful(function)
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0023-add-support-for-Vivante-extensions.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0023-add-support-for-Vivante-extensions.patch
new file mode 100644
index 0000000..52a2996
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0023-add-support-for-Vivante-extensions.patch
@@ -0,0 +1,444 @@
+From 32fa35eca3f5f1fa9014a3cc2d29cecaa01dbe5d Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Thu, 20 Apr 2017 10:15:29 +0300
+Subject: [PATCH 23/31] add support for Vivante extensions
+
+glTexDirectVIVMap
+glTexDirectMapVIV
+glTexDirectTiledMapVIV
+
+Note: this adds a dependency on the G2D libraries.
+---
+ CMakeLists.txt          |  11 ++++
+ cmake/FindVivante.cmake |  29 ++++++++++
+ retrace/CMakeLists.txt  |   5 +-
+ retrace/glretrace.py    | 142 ++++++++++++++++++++++++++++++++++++++++++++++++
+ specs/glapi.py          |   7 +++
+ wrappers/egltrace.py    | 121 ++++++++++++++++++++++++++++++++++++++++-
+ 6 files changed, 313 insertions(+), 2 deletions(-)
+ create mode 100644 cmake/FindVivante.cmake
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ce5fd4c..5efc888 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -44,6 +44,8 @@ option (ENABLE_WAFFLE "Enable WAFFLE support." OFF)
+ 
+ option (ENABLE_FRAME_POINTER "Disable frame pointer omission" ON)
+ 
++option (ENABLE_VIVANTE "Enable Vivante support." OFF)
++
+ # Proprietary Linux games often ship their own libraries (zlib, libstdc++,
+ # etc.) in order to ship a single set of binaries across multiple
+ # distributions.  Given that apitrace wrapper modules will be loaded into those
+@@ -159,6 +161,15 @@ if (ENABLE_EGL AND ENABLE_WAFFLE)
+     find_package (Waffle REQUIRED)
+ endif ()
+ 
++if (ENABLE_VIVANTE)
++    find_package (Vivante)
++    if (Vivante_FOUND)
++        add_definitions (-DHAVE_VIVANTE_G2D)
++    else()
++        message (FATAL_ERROR "Vivante requested but not found.")
++    endif()
++endif ()
++
+ 
+ ##############################################################################
+ # Set global build options
+diff --git a/cmake/FindVivante.cmake b/cmake/FindVivante.cmake
+new file mode 100644
+index 0000000..6ec1352
+--- /dev/null
++++ b/cmake/FindVivante.cmake
+@@ -0,0 +1,29 @@
++# - Vivante headers and libraries
++#set (Vivante_INC_SEARCH_PATH "usr/include")
++find_path (Vivante_G2D_INCLUDE_DIR g2d.h
++	PATHS ${Vivante_INC_SEARCH_PATH}
++	DOC "The directory where gd2.h resides"
++	)
++
++find_library (Vivante_G2D_LIBRARY libg2d.so
++	PATHS ${Vivante_LIB_SEARCH_PATH}
++	DOC "The directory where libg2d resides"
++	)
++find_library (Vivante_VDK_LIBRARY libVDK.so
++	PATHS ${Vivante_LIB_SEARCH_PATH}
++	DOC "The directory where libVDK resides"
++	)
++
++if (Vivante_G2D_INCLUDE_DIR AND Vivante_G2D_LIBRARY AND Vivante_VDK_LIBRARY)
++	set (Vivante_FOUND 1)
++endif ()
++
++mark_as_advanced (
++	Vivante_G2D_INCLUDE_DIR
++	Vivante_G2D_LIBRARY
++	Vivante_VDK_LIBRARY
++)
++
++mark_as_advanced (
++	Vivante_FOUND
++)
+diff --git a/retrace/CMakeLists.txt b/retrace/CMakeLists.txt
+index 9973e2c..fb8e299 100644
+--- a/retrace/CMakeLists.txt
++++ b/retrace/CMakeLists.txt
+@@ -131,6 +131,7 @@ if (WIN32 OR APPLE OR X11_FOUND)
+             # http://stackoverflow.com/questions/2702628/gdb-cannot-find-new-threads-generic-error
+             ${CMAKE_THREAD_LIBS_INIT}
+             ${CMAKE_DL_LIBS}
++            ${Vivante_G2D_LIBRARY}
+         )
+     endif ()
+ 
+@@ -154,6 +155,7 @@ if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE AND NOT ENABLE_WAFFLE)
+         ${X11_X11_LIB}
+         ${CMAKE_THREAD_LIBS_INIT}
+         ${CMAKE_DL_LIBS}
++        ${Vivante_G2D_LIBRARY}
+     )
+     install (TARGETS eglretrace RUNTIME DESTINATION bin) 
+ endif ()
+@@ -173,7 +175,8 @@ if (Vivante_FOUND AND ENABLE_EGL AND NOT X11_FOUND AND NOT WIN32 AND NOT APPLE A
+         glproc_egl
+         ${CMAKE_THREAD_LIBS_INIT}
+         ${CMAKE_DL_LIBS}
+-        VDK
++        ${Vivante_G2D_LIBRARY}
++        ${Vivante_VDK_LIBRARY}
+     )
+ 
+     if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+diff --git a/retrace/glretrace.py b/retrace/glretrace.py
+index db351e8..6b5608b 100644
+--- a/retrace/glretrace.py
++++ b/retrace/glretrace.py
+@@ -174,6 +174,59 @@ class GlRetracer(Retracer):
+ 
+ 
+     def invokeFunction(self, function):
++        if function.name == "glTexDirectVIVMap" or function.name == "glTexDirectMapVIV" or function.name == "glTexDirectTiledMapVIV":
++            print '#if defined(HAVE_VIVANTE_G2D)'
++            print '    GLint tex;'
++            print '    glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex);'
++            print '    int32_t size = 0;'
++            print '    switch(format){'
++            print '    case GL_VIV_YV12:'
++            print '    case GL_VIV_I420:'
++            print '    case GL_VIV_NV12:'
++            print '    case GL_VIV_NV21:'
++            print '        size=width * height * 3 / 2;'
++            print '        break;'
++            print '    case GL_RGBA:'
++            print '    case GL_BGRA_EXT:'
++            print '        size=width * height * 4;'
++            print '        break;'
++            print '    case GL_RGB:'
++            print '        size=width * height *3;'
++            print '        break;'
++            print '    case GL_VIV_YUY2:'
++            print '    case GL_VIV_UYVY:'
++            print '    case GL_RGB565_OES:'
++            print '        size=width * height *2;'
++            print '        break;'
++            print '    default:'
++            print '        break;'
++            print '    }'
++            print '    if(tex != 0)'
++            print '    {'
++            print '        TEXDIRECTVIVDATA &data = _directTextureDataMap[tex];'
++            print '        if(data.privateData == 0) // new entry'
++            print '        {'
++            print '            data.privateData = alloc_dma_buffer(size, &data.logical, &data.physical);'
++            print '            data.index=Logical[0];'
++            print '            data.size=size;'
++            print '            retrace::addRegion(call,data.index,(void*)data.logical,size);'
++            print '        }'
++            print '        else // already have one; check size and index'
++            print '        {'
++            print '            if((size!=data.size)||(Logical[0]!=data.index))'
++            print '            {'
++            print '                retrace::delRegionByPointer((void*)data.logical);'
++            print '                free_dma_buffer(data.privateData);'
++            print '                data.privateData = alloc_dma_buffer(size, &data.logical, &data.physical);'
++            print '                data.index=Logical[0];'
++            print '                data.size=size;'
++            print '                retrace::addRegion(call,data.index,(void*)data.logical,size);'
++            print '            }'
++            print '        }'
++            print '        *Logical = data.logical;'
++            print '        *Physical = data.physical;'
++            print '    }'
++            print '#endif /* HAVE_VIVANTE_G2D */'
+         # Infer the drawable size from GL calls
+         if function.name == "glViewport":
+             print '    glretrace::updateDrawable(x + width, y + height);'
+@@ -356,6 +409,54 @@ class GlRetracer(Retracer):
+             print '        currentContext->insideBeginEnd = true;'
+             print '    }'
+ 
++        if function.name == "glTexDirectVIV":
++            print '#if defined(HAVE_VIVANTE_G2D)'
++            print '    int32_t ysize = 0;'
++            print '    int32_t usize = 0;'
++            print '    int32_t vsize = 0;'
++            print '    switch(format){'
++            print '    case GL_VIV_YV12:'
++            print '    case GL_VIV_I420:'
++            print '        ysize=width * height;'
++            print '        usize=ysize/4;'
++            print '        vsize=usize;'
++            print '        break;'
++            print '    case GL_VIV_NV12:'
++            print '    case GL_VIV_NV21:'
++            print '        ysize=width * height;'
++            print '        usize=ysize/2;'
++            print '        vsize=0;'
++            print '        break;'
++            print '    case GL_RGBA:'
++            print '    case GL_BGRA_EXT:'
++            print '        ysize=width * height *4;'
++            print '        usize=0;'
++            print '        vsize=0;'
++            print '        break;'
++            print '    case GL_RGB:'
++            print '        ysize=width * height *3;'
++            print '        usize=0;'
++            print '        vsize=0;'
++            print '        break;'
++            print '    case GL_VIV_YUY2:'
++            print '    case GL_VIV_UYVY:'
++            print '    case GL_RGB565_OES:'
++            print '        ysize=width * height *2;'
++            print '        usize=0;'
++            print '        vsize=0;'
++            print '        break;'
++            print '    default:'
++            print '        break;'
++            print '    }'
++            print '    const trace::Array * arrayGLvoid = (call.arg(4)).toArray();'
++            print '    if(ysize > 0)'
++            print '        retrace::addRegion(call,(*arrayGLvoid->values[0]).toUInt(),(GLvoid*)pixels[0], ysize);'
++            print '    if(usize > 0)'
++            print '        retrace::addRegion(call,(*arrayGLvoid->values[1]).toUInt(),(GLvoid*)pixels[1], usize);'
++            print '    if(vsize > 0)'
++            print '        retrace::addRegion(call,(*arrayGLvoid->values[2]).toUInt(),(GLvoid*)pixels[2], vsize);'
++            print '#endif /* HAVE_VIVANTE_G2D */'
++
+         print r'    if (currentContext && !currentContext->insideList && !currentContext->insideBeginEnd && retrace::profiling) {'
+         if profileDraw:
+             print r'        glretrace::endProfile(call, true);'
+@@ -545,6 +646,47 @@ _getActiveProgram(void);
+ static void
+ _validateActiveProgram(trace::Call &call);
+ 
++#if defined(HAVE_VIVANTE_G2D)
++
++#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 struct TexDirectVivData
++{
++    GLuint   logical; // used for glTexDirectVIVMap/glTexDirectMapVIV/glTexDirectTiledMapVIV
++    GLuint   physical;
++    GLuint   index;
++    uint32_t size;
++    void *privateData; // used to allocate buffer
++}TEXDIRECTVIVDATA;
++
++static std::map<GLint, TEXDIRECTVIVDATA> _directTextureDataMap;
++
++#include <g2d.h>
++
++static void * alloc_dma_buffer(int size, unsigned int *logical, unsigned int *physical)
++{
++    struct g2d_buf *buf = g2d_alloc(size, 0);
++    if(buf != NULL)
++    {
++        *logical = (unsigned int)buf->buf_vaddr;
++        *physical = (unsigned int)buf->buf_paddr ;
++    }
++    return buf;
++}
++
++static void free_dma_buffer(void *buf)
++{
++    if(buf != NULL)
++        g2d_free((g2d_buf *)buf);
++}
++
++#endif /* HAVE_VIVANTE_G2D */
++
+ '''
+     api = stdapi.API()
+     api.addModule(glapi.glapi)
+diff --git a/specs/glapi.py b/specs/glapi.py
+index d56d7fa..b0c30b3 100644
+--- a/specs/glapi.py
++++ b/specs/glapi.py
+@@ -3588,4 +3588,11 @@ glapi.addFunctions([
+     # GL_WIN_swap_hint
+     GlFunction(Void, "glAddSwapHintRectWIN", [(GLint, "x"), (GLint, "y"), (GLsizei, "width"), (GLsizei, "height")]),
+ 
++    # Vivante extension
++    GlFunction(Void, "glTexDirectVIV", [(GLenum, "target"), (GLsizei, "width"), (GLsizei, "height"), (GLenum, "format"), Out(Array(GLuint, 3), "pixels")]),
++    GlFunction(Void, "glTexDirectVIVMap", [(GLenum, "target"), (GLsizei, "width"), (GLsizei, "height"), (GLenum, "format"),      (Pointer(GLuint), "Logical"), (Pointer(Const(GLuint)), "Physical")]),
++    GlFunction(Void, "glTexDirectMapVIV", [(GLenum, "target"), (GLsizei, "width"), (GLsizei, "height"), (GLenum, "format"),       (Pointer(GLuint), "Logical"), (Pointer(Const(GLuint)), "Physical")]),
++    GlFunction(Void, "glTexDirectTiledMapVIV", [(GLenum, "target"), (GLsizei, "width"), (GLsizei, "height"), (GLenum, "format"), (Pointer(GLuint), "Logical"), (Pointer(Const(GLuint)), "Physical")]),
++    GlFunction(Void, "glTexDirectInvalidateVIV", [(GLenum, "target")]),
++
+ ])
+diff --git a/wrappers/egltrace.py b/wrappers/egltrace.py
+index 6d032eb..683f562 100644
+--- a/wrappers/egltrace.py
++++ b/wrappers/egltrace.py
+@@ -49,11 +49,109 @@ class EglTracer(GlTracer):
+     ]
+ 
+     def traceFunctionImplBody(self, function):
++        if function.name == 'glTexDirectMapVIV':
++            print '    // prevent loop call'
++            print '    glTexDirectVIVMap(target, width, height, format, Logical, Physical);'
++            return
++
++        if function.name == 'glTexDirectInvalidateVIV':
++            print '    // get current texture'
++            print '    GLint tex = 0;'
++            print '    int32_t size = 0;'
++            print '    int32_t ysize = 0;'
++            print '    int32_t usize = 0;'
++            print '    int32_t vsize = 0;'
++            print '    _glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex);'
++            print '    if(tex == 0)'
++            print '    {'
++            print '        return;'
++            print '    }'
++            print '    TEXDIRECTVIVDATA &data = _directTextureDataMap[tex];'
++            print '    switch(data.format){'
++            print '    case GL_VIV_YV12:'
++            print '    case GL_VIV_I420:'
++            print '        ysize=data.width * data.height;'
++            print '        usize=ysize/4;'
++            print '        vsize=usize;'
++            print '        break;'
++            print '    case GL_VIV_NV12:'
++            print '    case GL_VIV_NV21:'
++            print '        ysize=data.width * data.height;'
++            print '        usize=ysize/2;'
++            print '        vsize=0;'
++            print '        break;'
++            print '    case GL_RGBA:'
++            print '    case GL_BGRA_EXT:'
++            print '        ysize=data.width * data.height *4;'
++            print '        usize=0;'
++            print '        vsize=0;'
++            print '        break;'
++            print '    case GL_RGB:'
++            print '        ysize=data.width * data.height *3;'
++            print '        usize=0;'
++            print '        vsize=0;'
++            print '        break;'
++            print '    case GL_VIV_YUY2:'
++            print '    case GL_VIV_UYVY:'
++            print '    case GL_RGB565_OES:'
++            print '        ysize=data.width * data.height *2;'
++            print '        usize=0;'
++            print '        vsize=0;'
++            print '        break;'
++            print '    default:'
++            print '        return;'
++            print '    }'
++            print '    if (NULL==(GLvoid*)data.logical) {'
++            print '        if (ysize > 0) {'
++            self.emit_memcpy('(GLvoid*)data.planes[0]', 'ysize')
++            print '         }'
++            print '        if (usize > 0) {'
++            self.emit_memcpy('(GLvoid*)data.planes[1]', 'usize')
++            print '         }'
++            print '        if (vsize > 0) {'
++            self.emit_memcpy('(GLvoid*)data.planes[2]', 'vsize')
++            print '         }'
++            print '    } else {'
++            print '        size = ysize + usize + vsize;'
++            print '        if (size > 0) {'
++            self.emit_memcpy('(GLvoid*)data.logical', 'size')
++            print '         }'
++            print '    }'
++
+         if function.name == 'eglGetProcAddress':
+             print '    procname = __get_alias_func_name(procname);'
+ 
+         GlTracer.traceFunctionImplBody(self, function)
+ 
++        if function.name == 'glTexDirectVIV':
++            print '    // get current texture'
++            print '    GLint tex = 0;'
++            print '    _glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex);'
++            print '    if(tex != 0)'
++            print '    {'
++            print '        TEXDIRECTVIVDATA &data = _directTextureDataMap[tex];'
++            print '        data.width = width;'
++            print '        data.height = height;'
++            print '        data.format = format;'
++            print '        data.planes[0] = pixels[0];'
++            print '        data.planes[1] = pixels[1];'
++            print '        data.planes[2] = pixels[2];'
++            print '    }'
++
++        if function.name == 'glTexDirectVIVMap' or function.name == 'glTexDirectTiledMapVIV':
++            print '    // get current texture'
++            print '    GLint tex = 0;'
++            print '    _glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex);'
++            print '    if(tex != 0)'
++            print '    {'
++            print '        TEXDIRECTVIVDATA &data = _directTextureDataMap[tex];'
++            print '        data.width = width;'
++            print '        data.height = height;'
++            print '        data.format = format;'
++            print '        data.logical = *Logical; // Logical != NULL'
++            print '        data.physical = *Physical;'
++            print '    }'
++
+         if function.name == 'eglCreateContext':
+             print '    if (_result != EGL_NO_CONTEXT)'
+             print '        gltrace::createContext((uintptr_t)_result);'
+@@ -158,7 +256,28 @@ if __name__ == '__main__':
+     print
+     print '    return origFunName;'
+     print '}'
+-    
++
++    print
++    print 'typedef struct TexDirectVivData'
++    print '{'
++    print '    int width;'
++    print '    int height;'
++    print '    GLenum format;'
++    print '    GLuint planes[3]; // used for glTexDirectVIV'
++    print '    GLuint logical; // used for glTexDirectVIVMap/glTexDirectMapVIV/glTexDirectTiledMapVIV'
++    print '    GLuint physical;'
++    print '}TEXDIRECTVIVDATA;'
++    print
++    print 'static std::map<GLint, TEXDIRECTVIVDATA> _directTextureDataMap;'
++    print
++    print '#define GL_VIV_YV12                        0x8FC0'
++    print '#define GL_VIV_NV12                        0x8FC1'
++    print '#define GL_VIV_YUY2                        0x8FC2'
++    print '#define GL_VIV_UYVY                        0x8FC3'
++    print '#define GL_VIV_NV21                        0x8FC4'
++    print '#define GL_VIV_I420                        0x8FC5'
++    print
++
+     module = Module()
+     module.mergeModule(eglapi)
+     module.mergeModule(glapi)
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0024-MGS-470-ccc-cannot-trace-mesa-demos-vertexrate.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0024-MGS-470-ccc-cannot-trace-mesa-demos-vertexrate.patch
new file mode 100644
index 0000000..42db8e2
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0024-MGS-470-ccc-cannot-trace-mesa-demos-vertexrate.patch
@@ -0,0 +1,34 @@
+From 45925668371f89ac0dfffe59afac77e87588fc1e Mon Sep 17 00:00:00 2001
+From: Yang Dong <b56112@freescale.com>
+Date: Thu, 20 Apr 2017 10:27:12 +0300
+Subject: [PATCH 24/31] MGS-470 [#ccc] cannot trace mesa-demos/vertexrate
+
+Root cause: glxGetCurrentDisplay goes into a infinite loop.
+
+Solution: Before calling _glxGetCurrentDisplay, check the value of it.
+If _glxGetCurrentDisplay reference glxGetCurrentDisplay, redirect it to proper lib.
+
+Signed-off-by: Yang Dong <b56112@freescale.com>
+---
+ wrappers/glxtrace.py | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/wrappers/glxtrace.py b/wrappers/glxtrace.py
+index d9ffe56..e2d0fc4 100644
+--- a/wrappers/glxtrace.py
++++ b/wrappers/glxtrace.py
+@@ -66,6 +66,11 @@ class GlxTracer(GlTracer):
+         if function.name in self.destroyContextFunctionNames:
+             print '    gltrace::releaseContext((uintptr_t)ctx);'
+ 
++        if function.name == 'glXGetCurrentDisplay':
++            print '    if(_glXGetCurrentDisplay == &glXGetCurrentDisplay ){'
++            print '        _glXGetCurrentDisplay = (PFN_GLXGETCURRENTDISPLAY)_getPublicProcAddress("glXGetCurrentDisplay");'
++            print '    }'
++
+         GlTracer.traceFunctionImplBody(self, function)
+ 
+         if function.name in self.createContextFunctionNames:
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0025-MGS-1271-ccc-disable-X-debug-function.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0025-MGS-1271-ccc-disable-X-debug-function.patch
new file mode 100644
index 0000000..8194084
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0025-MGS-1271-ccc-disable-X-debug-function.patch
@@ -0,0 +1,30 @@
+From a36e8a1a3eb0fdb1217bc17d8c28d5b528855a87 Mon Sep 17 00:00:00 2001
+From: Yang Dong <b56112@freescale.com>
+Date: Fri, 20 Nov 2015 02:23:50 +0800
+Subject: [PATCH 25/31] MGS-1271 [#ccc] disable X debug function
+
+Accoring to the yocto cmake file, NDEBUG is not defined.
+So disable X debug to make apitrace's replay function work.
+
+Date: Nov 19, 2015
+Signed-off-by: Yang Dong <b56112@freescale.com>
+---
+ retrace/glws_xlib.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/retrace/glws_xlib.cpp b/retrace/glws_xlib.cpp
+index 56bb043..6e13124 100644
+--- a/retrace/glws_xlib.cpp
++++ b/retrace/glws_xlib.cpp
+@@ -111,7 +111,7 @@ void
+ initX(void)
+ {
+ #ifndef NDEBUG
+-    _Xdebug = 1;
++    _Xdebug = 0;
+ #endif
+ 
+     XInitThreads();
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0026-MGS-1721-ccc-fix-broken-build-on-AArch64.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0026-MGS-1721-ccc-fix-broken-build-on-AArch64.patch
new file mode 100644
index 0000000..0549278
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0026-MGS-1721-ccc-fix-broken-build-on-AArch64.patch
@@ -0,0 +1,43 @@
+From d210fab9154aa4ba45816e96b8b1fc4caebaeb01 Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Fri, 1 Apr 2016 01:59:39 +0800
+Subject: [PATCH 26/31] MGS-1721 [#ccc] fix broken build on AArch64
+
+modify the type of structure TEXDIRECTVIVDATA's member to fit the 32-bit and 64-bit OS
+
+Signed-off-by: Gan Yuchou <yuchou.gan@nxp.com>
+---
+ retrace/glretrace.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/retrace/glretrace.py b/retrace/glretrace.py
+index 6b5608b..870c84a 100644
+--- a/retrace/glretrace.py
++++ b/retrace/glretrace.py
+@@ -657,7 +657,7 @@ _validateActiveProgram(trace::Call &call);
+ 
+ typedef struct TexDirectVivData
+ {
+-    GLuint   logical; // used for glTexDirectVIVMap/glTexDirectMapVIV/glTexDirectTiledMapVIV
++    uintptr_t   logical; // used for glTexDirectVIVMap/glTexDirectMapVIV/glTexDirectTiledMapVIV
+     GLuint   physical;
+     GLuint   index;
+     uint32_t size;
+@@ -668,12 +668,12 @@ static std::map<GLint, TEXDIRECTVIVDATA> _directTextureDataMap;
+ 
+ #include <g2d.h>
+ 
+-static void * alloc_dma_buffer(int size, unsigned int *logical, unsigned int *physical)
++static void * alloc_dma_buffer(int size, uintptr_t *logical, unsigned int *physical)
+ {
+     struct g2d_buf *buf = g2d_alloc(size, 0);
+     if(buf != NULL)
+     {
+-        *logical = (unsigned int)buf->buf_vaddr;
++        *logical = (uintptr_t)buf->buf_vaddr;
+         *physical = (unsigned int)buf->buf_paddr ;
+     }
+     return buf;
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0027-MGS-1859-ccc-blank-screen-when-retracing-es20-sdk-ap.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0027-MGS-1859-ccc-blank-screen-when-retracing-es20-sdk-ap.patch
new file mode 100644
index 0000000..8c5588c
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0027-MGS-1859-ccc-blank-screen-when-retracing-es20-sdk-ap.patch
@@ -0,0 +1,58 @@
+From 6d25ba9cff1736fc69e4b7e0a3b5062545e9c128 Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Fri, 3 Jun 2016 17:16:44 +0800
+Subject: [PATCH 27/31] MGS-1859 [#ccc] blank screen when retracing es20 sdk
+ app DirectMultiSamplingVideoYUV_FB
+
+Add GL_ALPHA and GL_LUMINANCE8_ALPHA8_EXT format support for
+
+glTexDirectVIVMap and glTexDirectInvalidateVIV.
+
+Date June 3, 2016
+Signed-off-by: Gan Yuchou <yuchou.gan@nxp.com>
+---
+ retrace/glretrace.py | 4 ++++
+ wrappers/egltrace.py | 6 ++++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/retrace/glretrace.py b/retrace/glretrace.py
+index 870c84a..9618e52 100644
+--- a/retrace/glretrace.py
++++ b/retrace/glretrace.py
+@@ -196,8 +196,12 @@ class GlRetracer(Retracer):
+             print '    case GL_VIV_YUY2:'
+             print '    case GL_VIV_UYVY:'
+             print '    case GL_RGB565_OES:'
++            print '    case GL_LUMINANCE8_ALPHA8_EXT:'
+             print '        size=width * height *2;'
+             print '        break;'
++            print '    case GL_ALPHA:'
++            print '        size=width * height;'
++            print '        break;'
+             print '    default:'
+             print '        break;'
+             print '    }'
+diff --git a/wrappers/egltrace.py b/wrappers/egltrace.py
+index 683f562..572e67c 100644
+--- a/wrappers/egltrace.py
++++ b/wrappers/egltrace.py
+@@ -94,10 +94,16 @@ class EglTracer(GlTracer):
+             print '    case GL_VIV_YUY2:'
+             print '    case GL_VIV_UYVY:'
+             print '    case GL_RGB565_OES:'
++            print '    case GL_LUMINANCE8_ALPHA8_EXT:'
+             print '        ysize=data.width * data.height *2;'
+             print '        usize=0;'
+             print '        vsize=0;'
+             print '        break;'
++            print '    case GL_ALPHA:'
++            print '        ysize=data.width * data.height;'
++            print '        usize=0;'
++            print '        vsize=0;'
++            print '        break;'
+             print '    default:'
+             print '        return;'
+             print '    }'
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0028-MGS-2254-ccc-add-the-TOT-commit-SHA1-inside-the-bina.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0028-MGS-2254-ccc-add-the-TOT-commit-SHA1-inside-the-bina.patch
new file mode 100644
index 0000000..9a42cd5
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0028-MGS-2254-ccc-add-the-TOT-commit-SHA1-inside-the-bina.patch
@@ -0,0 +1,55 @@
+From 71899da21295172c21d0a8422af91063cda4e569 Mon Sep 17 00:00:00 2001
+From: Yuchou Gan <yuchou.gan@nxp.com>
+Date: Tue, 20 Sep 2016 00:39:13 +0800
+Subject: [PATCH 28/31] MGS-2254 [#ccc] add the TOT commit SHA1 inside the
+ binary
+
+Print the Tip Of Tree commit SHA1.
+In this way, we know which commit is in the released apitrace.
+
+Date: Sep 19, 2016
+Signed-off-by: Yuchou Gan <yuchou.gan@nxp.com>
+---
+ cli/CMakeLists.txt | 2 ++
+ cli/cli_main.cpp   | 8 ++++++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
+index 4c13c21..9b621bb 100644
+--- a/cli/CMakeLists.txt
++++ b/cli/CMakeLists.txt
+@@ -3,10 +3,12 @@
+ # TODO: Use the same directory layout, for both build and install directories,
+ # so that binaries can find each other using just relative paths.
+ #
++execute_process(COMMAND git log --pretty=format:"%h" -n 1 OUTPUT_VARIABLE GIT_STRING)
+ add_definitions(
+     -DAPITRACE_PROGRAMS_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/bin"
+     -DAPITRACE_SCRIPTS_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${SCRIPTS_INSTALL_DIR}"
+     -DAPITRACE_WRAPPERS_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${WRAPPER_INSTALL_DIR}"
++    -DGIT_STRING="${GIT_STRING}"
+ )
+ if (WIN32)
+     add_definitions (-DAPITRACE_PYTHON_EXECUTABLE="python")
+diff --git a/cli/cli_main.cpp b/cli/cli_main.cpp
+index 2317be2..31e8b85 100644
+--- a/cli/cli_main.cpp
++++ b/cli/cli_main.cpp
+@@ -40,6 +40,14 @@
+ 
+ #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
+ 
++#define _TXT2STR(t) #t
++#define TXT2STR(t) _TXT2STR(t)
++const char * VERSION = "\n\0$VERSION$"
++#ifdef GIT_STRING
++                            TXT2STR(GIT_STRING)
++#endif
++                            "$\n";
++
+ static const char *help_synopsis = "Print detailed help for the given command.";
+ 
+ static void list_commands(void);
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0029-MGS-815-ccc-avoid-memcpy-in-glTexDirectInvalidateVIV.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0029-MGS-815-ccc-avoid-memcpy-in-glTexDirectInvalidateVIV.patch
new file mode 100644
index 0000000..12b328c
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0029-MGS-815-ccc-avoid-memcpy-in-glTexDirectInvalidateVIV.patch
@@ -0,0 +1,283 @@
+From c460694f65760abc04cebb01db77a95da5d06c3e Mon Sep 17 00:00:00 2001
+From: Yang Dong <b56112@freescale.com>
+Date: Thu, 20 Apr 2017 11:24:35 +0300
+Subject: [PATCH 29/31] MGS-815 [#ccc] avoid memcpy in glTexDirectInvalidateVIV
+
+When a trace file is replayed, glTexDirectInvalidateVIV will
+trigger a memcpy to update the texture data.
+
+However, this data update is implemented by hardware in real mode.
+In order to achieve the realtime performance in apitrace,
+discard the memcpy used to update the VIV texture in performance mode.
+
+Signed-off-by: Yang Dong <b56112@freescale.com>
+---
+ common/trace_parser.cpp       |  5 +++++
+ common/trace_parser.hpp       |  2 ++
+ common/trace_writer_local.cpp | 23 +++++++++++++++++++++++
+ common/trace_writer_local.hpp |  2 ++
+ retrace/retrace.hpp           |  4 ++++
+ retrace/retrace_main.cpp      | 15 ++++++++++++++-
+ retrace/retrace_stdc.cpp      | 36 ++++++++++++++++++++++++++++++++++++
+ wrappers/egltrace.py          |  8 ++++----
+ wrappers/trace.py             |  3 +++
+ 9 files changed, 93 insertions(+), 5 deletions(-)
+
+diff --git a/common/trace_parser.cpp b/common/trace_parser.cpp
+index 99fa5e8..bcc7b9f 100644
+--- a/common/trace_parser.cpp
++++ b/common/trace_parser.cpp
+@@ -70,6 +70,7 @@ bool Parser::open(const char *filename) {
+         return false;
+     }
+     api = API_UNKNOWN;
++    skip_spec_call = false;
+ 
+     return true;
+ }
+@@ -442,6 +443,10 @@ void Parser::parse_enter(Mode mode) {
+ 
+     call->no = next_call_no++;
+ 
++    if((skip_spec_call == true)&&(sig->id==4)) {
++        mode = SCAN;
++    }
++
+     if (parse_call_details(call, mode)) {
+         calls.push_back(call);
+     } else {
+diff --git a/common/trace_parser.hpp b/common/trace_parser.hpp
+index b638aa1..1403b28 100644
+--- a/common/trace_parser.hpp
++++ b/common/trace_parser.hpp
+@@ -56,6 +56,8 @@ public:
+     virtual bool open(const char *filename) = 0;
+     virtual void close(void) = 0;
+     virtual unsigned long long getVersion(void) const = 0;
++public:
++    bool skip_spec_call;
+ };
+ 
+ 
+diff --git a/common/trace_writer_local.cpp b/common/trace_writer_local.cpp
+index 17b6328..d792f87 100644
+--- a/common/trace_writer_local.cpp
++++ b/common/trace_writer_local.cpp
+@@ -55,6 +55,9 @@ const FunctionSig free_sig = {2, "free", 1, free_args};
+ static const char *realloc_args[2] = {"ptr", "size"};
+ const FunctionSig realloc_sig = {3, "realloc", 2, realloc_args};
+ 
++static const char *memcpy_opt_args[3] = {"dest", "src", "n"};
++const FunctionSig memcpy_opt_sig = {0xFFFF, "memcpy_opt", 3, memcpy_opt_args};
++
+ 
+ static void exceptionCallback(void)
+ {
+@@ -316,6 +319,26 @@ void fakeMemcpy(const void *ptr, size_t size) {
+     localWriter.endLeave();
+ }
+ 
++void fakeMemcpyOpt(const void *ptr, size_t size) {
++    assert(ptr);
++    if (!size) {
++        return;
++    }
++    unsigned _call = localWriter.beginEnter(&memcpy_opt_sig, true);
++    localWriter.beginArg(0);
++    localWriter.writePointer((uintptr_t)ptr);
++    localWriter.endArg();
++    localWriter.beginArg(1);
++    localWriter.writeBlob(ptr, size);
++    localWriter.endArg();
++    localWriter.beginArg(2);
++    localWriter.writeUInt(size);
++    localWriter.endArg();
++    localWriter.endEnter();
++    localWriter.beginLeave(_call);
++    localWriter.endLeave();
++}
++
+ 
+ } /* namespace trace */
+ 
+diff --git a/common/trace_writer_local.hpp b/common/trace_writer_local.hpp
+index ed27dbb..0dbc96f 100644
+--- a/common/trace_writer_local.hpp
++++ b/common/trace_writer_local.hpp
+@@ -142,5 +142,7 @@ namespace trace {
+ 
+     void fakeMemcpy(const void *ptr, size_t size);
+ 
++    void fakeMemcpyOpt(const void *ptr, size_t size);
++
+ } /* namespace trace */
+ 
+diff --git a/retrace/retrace.hpp b/retrace/retrace.hpp
+index 1c9f0e6..1b1a6e1 100644
+--- a/retrace/retrace.hpp
++++ b/retrace/retrace.hpp
+@@ -134,6 +134,10 @@ extern bool profilingMemoryUsage;
+ extern bool dumpingState;
+ extern bool dumpingSnapshots;
+ 
++/**
++ * Whether to discard the memcpy called by the VIV texture.
++ */
++extern bool performance;
+ 
+ enum Driver {
+     DRIVER_DEFAULT,
+diff --git a/retrace/retrace_main.cpp b/retrace/retrace_main.cpp
+index 72e0183..95ca24c 100644
+--- a/retrace/retrace_main.cpp
++++ b/retrace/retrace_main.cpp
+@@ -35,6 +35,10 @@
+ #include <fcntl.h>
+ #endif
+ 
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
++
+ #include "os_binary.hpp"
+ #include "os_crtdbg.hpp"
+ #include "os_time.hpp"
+@@ -98,6 +102,7 @@ bool profilingPixelsDrawn = false;
+ bool profilingMemoryUsage = false;
+ bool useCallNos = true;
+ bool singleThread = false;
++bool performance = false;
+ 
+ unsigned frameNo = 0;
+ unsigned callNo = 0;
+@@ -633,7 +638,9 @@ usage(const char *argv0) {
+         "      --dump-format=FORMAT dump state format (`json` or `ubjson`)\n"
+         "  -w, --wait              waitOnFinish on final frame\n"
+         "      --loop[=N]          loop N times (N<0 continuously) replaying final frame.\n"
+-        "      --singlethread      use a single thread to replay command stream\n";
++        "      --singlethread      use a single thread to replay command stream\n"
++        "      --performance       discard the memcpy in retrace egl VIV extension\n"
++        ;
+ }
+ 
+ enum {
+@@ -657,6 +664,7 @@ enum {
+     SNAPSHOT_STARTFRAME_OPT,
+     SNAPSHOT_STOPFRAME_OPT,
+     REFERENCE_DUMP_OPT,
++    PERFORMANCE_OPT,
+ };
+ 
+ const static char *
+@@ -692,6 +700,7 @@ longOptions[] = {
+     {"snapshot-start", required_argument, 0, SNAPSHOT_STARTFRAME_OPT},
+     {"snapshot-stop", required_argument, 0, SNAPSHOT_STOPFRAME_OPT},
+     {"reference-dump", required_argument, 0, REFERENCE_DUMP_OPT},
++    {"performance", no_argument, 0, PERFORMANCE_OPT},
+     {0, 0, 0, 0}
+ };
+ 
+@@ -928,6 +937,10 @@ int main(int argc, char **argv)
+                 return 1;
+             }
+             break;
++        case PERFORMANCE_OPT:
++            retrace::performance = true;
++            parser->skip_spec_call = true;
++            break;
+         default:
+             std::cerr << "error: unknown option " << opt << "\n";
+             usage(argv[0]);
+diff --git a/retrace/retrace_stdc.cpp b/retrace/retrace_stdc.cpp
+index 2a57ef0..8a862ac 100644
+--- a/retrace/retrace_stdc.cpp
++++ b/retrace/retrace_stdc.cpp
+@@ -82,8 +82,44 @@ static void retrace_memcpy(trace::Call &call) {
+ }
+ 
+ 
++static void retrace_memcpy_opt(trace::Call &call) {
++    if(retrace::performance==true)
++    {
++        return;
++    }
++
++    void * destPtr;
++    size_t destLen;
++    retrace::toRange(call.arg(0), destPtr, destLen);
++
++    void * srcPtr;
++    size_t srcLen;
++    retrace::toRange(call.arg(1), srcPtr, srcLen);
++
++    size_t n = call.arg(2).toUInt();
++
++    if (!destPtr || !srcPtr || !n) {
++        return;
++    }
++
++    if (n > destLen) {
++        retrace::warning(call) << "dest buffer overflow of " << n - destLen << " bytes\n";
++    }
++
++    if (n > srcLen) {
++        retrace::warning(call) << "src buffer overflow of " << n - srcLen << " bytes\n";
++    }
++
++    n = std::min(n, destLen);
++    n = std::min(n, srcLen);
++
++    memcpy(destPtr, srcPtr, n);
++}
++
++
+ const retrace::Entry retrace::stdc_callbacks[] = {
+     {"malloc", &retrace_malloc},
+     {"memcpy", &retrace_memcpy},
++    {"memcpy_opt", &retrace_memcpy_opt},
+     {NULL, NULL}
+ };
+diff --git a/wrappers/egltrace.py b/wrappers/egltrace.py
+index 572e67c..9a292da 100644
+--- a/wrappers/egltrace.py
++++ b/wrappers/egltrace.py
+@@ -109,18 +109,18 @@ class EglTracer(GlTracer):
+             print '    }'
+             print '    if (NULL==(GLvoid*)data.logical) {'
+             print '        if (ysize > 0) {'
+-            self.emit_memcpy('(GLvoid*)data.planes[0]', 'ysize')
++            self.emit_memcpy_opt('(GLvoid*)data.planes[0]', 'ysize')
+             print '         }'
+             print '        if (usize > 0) {'
+-            self.emit_memcpy('(GLvoid*)data.planes[1]', 'usize')
++            self.emit_memcpy_opt('(GLvoid*)data.planes[1]', 'usize')
+             print '         }'
+             print '        if (vsize > 0) {'
+-            self.emit_memcpy('(GLvoid*)data.planes[2]', 'vsize')
++            self.emit_memcpy_opt('(GLvoid*)data.planes[2]', 'vsize')
+             print '         }'
+             print '    } else {'
+             print '        size = ysize + usize + vsize;'
+             print '        if (size > 0) {'
+-            self.emit_memcpy('(GLvoid*)data.logical', 'size')
++            self.emit_memcpy_opt('(GLvoid*)data.logical', 'size')
+             print '         }'
+             print '    }'
+ 
+diff --git a/wrappers/trace.py b/wrappers/trace.py
+index efb2fd5..7d1baa1 100644
+--- a/wrappers/trace.py
++++ b/wrappers/trace.py
+@@ -972,6 +972,9 @@ class Tracer:
+     def emit_memcpy(self, ptr, size):
+         print '    trace::fakeMemcpy(%s, %s);' % (ptr, size)
+     
++    def emit_memcpy_opt(self, ptr, size):
++        print '    trace::fakeMemcpyOpt(%s, %s);' % (ptr, size)
++
+     def fake_call(self, function, args):
+         print '            unsigned _fake_call = trace::localWriter.beginEnter(&_%s_sig, true);' % (function.name,)
+         for arg, instance in zip(function.args, args):
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0030-MGS-814-ccc-retrace-support-eglCreatePixmapSurface-o.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0030-MGS-814-ccc-retrace-support-eglCreatePixmapSurface-o.patch
new file mode 100644
index 0000000..9c0315d
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0030-MGS-814-ccc-retrace-support-eglCreatePixmapSurface-o.patch
@@ -0,0 +1,98 @@
+From 5645e1fbf239be0a3f5af059057cc8c381acbf0e Mon Sep 17 00:00:00 2001
+From: Yang Dong <b56112@freescale.com>
+Date: Thu, 20 Apr 2017 11:58:48 +0300
+Subject: [PATCH 30/31] MGS-814 [#ccc] retrace: support eglCreatePixmapSurface
+ on NonX backend
+
+Signed-off-by: Yang Dong <b56112@freescale.com>
+---
+ retrace/glretrace.hpp     |  3 +++
+ retrace/glretrace_egl.cpp | 26 +++++++++++++++++++++++++-
+ retrace/glretrace_ws.cpp  |  6 ++++++
+ 3 files changed, 34 insertions(+), 1 deletion(-)
+
+diff --git a/retrace/glretrace.hpp b/retrace/glretrace.hpp
+index 7e26d6d..f75b516 100644
+--- a/retrace/glretrace.hpp
++++ b/retrace/glretrace.hpp
+@@ -96,6 +96,9 @@ glws::Drawable *
+ createDrawable(glprofile::Profile profile);
+ 
+ glws::Drawable *
++createPixmapDrawable(glprofile::Profile profile);
++
++glws::Drawable *
+ createDrawable(void);
+ 
+ glws::Drawable *
+diff --git a/retrace/glretrace_egl.cpp b/retrace/glretrace_egl.cpp
+index c6fabdd..d1e63ed 100644
+--- a/retrace/glretrace_egl.cpp
++++ b/retrace/glretrace_egl.cpp
+@@ -118,6 +118,24 @@ static void createDrawable(unsigned long long orig_config, unsigned long long or
+     drawable_map[orig_surface] = drawable;
+ }
+ 
++static void createPixmapDrawable(unsigned long long orig_config, unsigned long long orig_surface)
++{
++    ProfileMap::iterator it = profile_map.find(orig_config);
++    glprofile::Profile profile;
++
++    // If the requested config is associated with a profile, use that
++    // profile. Otherwise, assume that the last used profile is what
++    // the user wants.
++    if (it != profile_map.end()) {
++        profile = it->second;
++    } else {
++        profile = last_profile;
++    }
++
++    glws::Drawable *drawable = glretrace::createPixmapDrawable(profile);
++    drawable_map[orig_surface] = drawable;
++}
++
+ static void retrace_eglChooseConfig(trace::Call &call) {
+     if (!call.ret->toSInt()) {
+         return;
+@@ -166,6 +184,12 @@ static void retrace_eglCreatePbufferSurface(trace::Call &call) {
+     // TODO: Respect the pbuffer dimensions too
+ }
+ 
++static void retrace_eglCreatePixmapSurface(trace::Call &call) {
++    unsigned long long orig_config = call.arg(1).toUIntPtr();
++    unsigned long long orig_surface = call.ret->toUIntPtr();
++    createPixmapDrawable(orig_config, orig_surface);
++}
++
+ static void retrace_eglDestroySurface(trace::Call &call) {
+     unsigned long long orig_surface = call.arg(1).toUIntPtr();
+ 
+@@ -293,7 +317,7 @@ const retrace::Entry glretrace::egl_callbacks[] = {
+     {"eglGetConfigAttrib", &retrace::ignore},
+     {"eglCreateWindowSurface", &retrace_eglCreateWindowSurface},
+     {"eglCreatePbufferSurface", &retrace_eglCreatePbufferSurface},
+-    //{"eglCreatePixmapSurface", &retrace::ignore},
++    {"eglCreatePixmapSurface", &retrace_eglCreatePixmapSurface},
+     {"eglDestroySurface", &retrace_eglDestroySurface},
+     {"eglQuerySurface", &retrace::ignore},
+     {"eglBindAPI", &retrace_eglBindAPI},
+diff --git a/retrace/glretrace_ws.cpp b/retrace/glretrace_ws.cpp
+index 4d617f7..376b055 100644
+--- a/retrace/glretrace_ws.cpp
++++ b/retrace/glretrace_ws.cpp
+@@ -99,6 +99,12 @@ createDrawable(glprofile::Profile profile) {
+ 
+ 
+ glws::Drawable *
++createPixmapDrawable(glprofile::Profile profile) {
++    return createDrawableHelper(profile, false, true);
++}
++
++
++glws::Drawable *
+ createDrawable(void) {
+     return createDrawable(defaultProfile);
+ }
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0031-libbacktrace-define-HAVE_STDINT_H-in-config.h.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0031-libbacktrace-define-HAVE_STDINT_H-in-config.h.patch
new file mode 100644
index 0000000..1f89b19
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0031-libbacktrace-define-HAVE_STDINT_H-in-config.h.patch
@@ -0,0 +1,36 @@
+From 2ce83ecdb8c5dbe8c9e2d3375a789f4fdddc72f1 Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <groleo@gmail.com>
+Date: Tue, 25 Apr 2017 17:00:03 +0300
+Subject: [PATCH 31/31] libbacktrace: define HAVE_STDINT_H in config.h
+
+---
+ thirdparty/libbacktrace/backtrace.h       | 1 +
+ thirdparty/libbacktrace/config.h.in.cmake | 3 +++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/thirdparty/libbacktrace/backtrace.h b/thirdparty/libbacktrace/backtrace.h
+index da16e3d..553e561 100644
+--- a/thirdparty/libbacktrace/backtrace.h
++++ b/thirdparty/libbacktrace/backtrace.h
+@@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.  */
+ 
+ #include <stddef.h>
+ #include <stdio.h>
++#include "config.h"
+ 
+ /* We want to get a definition for uintptr_t, but we still care about
+    systems that don't have <stdint.h>.  */
+diff --git a/thirdparty/libbacktrace/config.h.in.cmake b/thirdparty/libbacktrace/config.h.in.cmake
+index 4ac1326..2178416 100644
+--- a/thirdparty/libbacktrace/config.h.in.cmake
++++ b/thirdparty/libbacktrace/config.h.in.cmake
+@@ -22,3 +22,6 @@
+ 
+ /* Define to 1 if dwarf.h is in the libdwarf folder */
+ #cmakedefine HAVE_LIBDWARF_DWARF_H 1
++
++/* Define to 1 if you have the <stdint.h> header file. */
++#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0032-changed-disable-X11-mechanism.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0032-changed-disable-X11-mechanism.patch
new file mode 100644
index 0000000..64ed8a1
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0032-changed-disable-X11-mechanism.patch
@@ -0,0 +1,18 @@
+--- a/CMakeLists.txt	2017-04-26 12:05:19.511369999 +0300
++++ b/CMakeLists.txt	2017-04-26 12:06:46.651930949 +0300
+@@ -144,7 +144,14 @@
+ elseif (APPLE)
+     set (ENABLE_EGL false)
+ else ()
+-    find_package (X11)
++
++    if (NOT DISABLE_X11)
++        message ("DISABLE_X11 is not set")
++        find_package (X11)
++    else ()
++        message ("DISABLE_X11 is set")
++        set (X11_FOUND false)
++    endif ()
+ 
+     if (X11_FOUND)
+         include_directories (${X11_INCLUDE_DIR})
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0033-MGS-2963-ccc-Miss-usr-bin-eglretrace-file-in-FB-and-.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0033-MGS-2963-ccc-Miss-usr-bin-eglretrace-file-in-FB-and-.patch
new file mode 100644
index 0000000..fa031bb
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0033-MGS-2963-ccc-Miss-usr-bin-eglretrace-file-in-FB-and-.patch
@@ -0,0 +1,70 @@
+From f35af2704c6e8a1552b0df37f69afeb4265a6c4b Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <adrian.negreanu@nxp.com>
+Date: Thu, 8 Jun 2017 18:08:03 +0300
+Subject: [PATCH] MGS-2963 [#ccc] Miss /usr/bin/eglretrace file in FB and XWLD
+ rootfs.
+
+Not yet upstreamable since the NonX backend is not yet upstream.
+
+Upstream-Status: Inappropriate [other]
+Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
+---
+ retrace/glws_nonx.cpp | 29 +++++++++++++++++++++++++----
+ 1 file changed, 25 insertions(+), 4 deletions(-)
+
+diff --git a/retrace/glws_nonx.cpp b/retrace/glws_nonx.cpp
+index fa8db97..18df45a 100644
+--- a/retrace/glws_nonx.cpp
++++ b/retrace/glws_nonx.cpp
+@@ -74,8 +74,8 @@ public:
+     EGLNativePixmapType native_pixmap;
+     EGLenum api;
+ 
+-    NonxDrawable(const Visual *vis, int w, int h, bool pbuffer) :
+-        Drawable (vis, w, h, pbuffer),
++    NonxDrawable(const Visual *vis, int w, int h, const pbuffer_info *info) :
++        Drawable (vis, w, h, info),
+         api(EGL_OPENGL_ES_API)
+     {
+         native_pixmap = (EGLNativePixmapType)0;
+@@ -387,9 +387,10 @@ createVisual(bool doubleBuffer, unsigned samples, Profile profile) {
+ }
+ 
+ Drawable *
+-createDrawable(const Visual *visual, int width, int height, bool pbuffer)
++createDrawable(const Visual *visual, int width, int height,
++        const pbuffer_info *info)
+ {
+-    return new NonxDrawable(visual, width, height, pbuffer);
++    return new NonxDrawable(visual, width, height, info);
+ }
+ 
+ Context *
+@@ -492,4 +493,24 @@ processEvents(void)
+     return false;
+ }
+ 
++bool
++bindTexImage(Drawable *pBuffer, int iBuffer) {
++    std::cerr << "error: NonX::wglBindTexImageARB not implemented.\n";
++    assert(pBuffer->pbuffer);
++    return true;
++}
++
++bool
++releaseTexImage(Drawable *pBuffer, int iBuffer) {
++    std::cerr << "error: NonX::wglReleaseTexImageARB not implemented.\n";
++    assert(pBuffer->pbuffer);
++    return true;
++}
++
++bool
++setPbufferAttrib(Drawable *pBuffer, const int *attribList) {
++    assert(pBuffer->pbuffer);
++    return true;
++}
++
+ }
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0034-MGS-make-multiarch-optional.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0034-MGS-make-multiarch-optional.patch
new file mode 100644
index 0000000..d12346a
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0034-MGS-make-multiarch-optional.patch
@@ -0,0 +1,22 @@
+Index: git/CMakeLists.txt
+===================================================================
+--- git.orig/CMakeLists.txt	2017-06-13 16:30:37.707992787 -0500
++++ git/CMakeLists.txt	2017-06-13 16:40:37.534967169 -0500
+@@ -40,6 +40,8 @@
+ 
+ option (ENABLE_EGL "Enable EGL support." ON)
+ 
++option (ENABLE_MULTIARCH "Enable multiarch support." ON)
++
+ option (ENABLE_WAFFLE "Enable WAFFLE support." OFF)
+ 
+ option (ENABLE_FRAME_POINTER "Disable frame pointer omission" ON)
+@@ -377,7 +379,7 @@
+ ##############################################################################
+ # Installation directories
+ 
+-if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
++if (ENABLE_MULTIARCH AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
+     # Debian multiarch support
+     execute_process(COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
+         OUTPUT_VARIABLE ARCH_SUBDIR
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0035-dlopen-don-t-override-symbols-in-Vivante-libs.patch b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0035-dlopen-don-t-override-symbols-in-Vivante-libs.patch
new file mode 100644
index 0000000..5ba5794
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace/0035-dlopen-don-t-override-symbols-in-Vivante-libs.patch
@@ -0,0 +1,101 @@
+From 33f1a0293d2c16068d4da1d3c4da9004f4f6a5ef Mon Sep 17 00:00:00 2001
+From: Adrian Negreanu <adrian.negreanu@nxp.com>
+Date: Mon, 10 Jul 2017 22:13:44 +0300
+Subject: [PATCH] dlopen: don't override symbols in Viv libs
+
+---
+ wrappers/egltrace.py | 20 +++++++++++++++++++-
+ wrappers/glxtrace.py | 20 ++++++++++++++++++--
+ 2 files changed, 37 insertions(+), 3 deletions(-)
+
+diff --git a/wrappers/egltrace.py b/wrappers/egltrace.py
+index 9a292da..f7f03db 100644
+--- a/wrappers/egltrace.py
++++ b/wrappers/egltrace.py
+@@ -318,6 +318,19 @@ void * dlopen(const char *filename, int flag)
+             strcmp(filename, "libGL.so") == 0 ||
+             strcmp(filename, "libGL.so.1") == 0;
+ 
++        void *caller = __builtin_return_address(0);
++        Dl_info info;
++        if (dladdr(caller, &info)) {
++            const char *caller_module = info.dli_fname;
++            os::log("apitrace: dlopen(%s) called from %s\n", filename, caller_module);
++            if ( (strcmp(caller_module, "/usr/lib/libGAL.so") == 0)
++              || (strcmp(caller_module, "/usr/lib/libVDK.so") == 0)
++               )
++            {
++                intercept = false;
++            }
++        }
++
+         if (intercept) {
+             os::log("apitrace: redirecting dlopen(\"%s\", 0x%x)\n", filename, flag);
+ 
+@@ -332,7 +345,11 @@ void * dlopen(const char *filename, int flag)
+         }
+     }
+ 
+-    void *handle = _dlopen(filename, flag);
++    void *handle = _dlopen(filename, RTLD_NOW);
++    if (!handle) {
++        os::log("apitrace: warning: dlopen(%s,%x) failed %s\n", filename, flag, dlerror());
++        return handle;
++    }
+ 
+     if (intercept) {
+         // Get the file path for our shared object, and use it instead
+@@ -353,6 +370,7 @@ void * dlopen(const char *filename, int flag)
+         }
+     }
+ 
++    os::log("apitrace: %p\n", handle);
+     return handle;
+ }
+ 
+diff --git a/wrappers/glxtrace.py b/wrappers/glxtrace.py
+index e2d0fc4..ee5097d 100644
+--- a/wrappers/glxtrace.py
++++ b/wrappers/glxtrace.py
+@@ -198,7 +198,11 @@ void * dlopen(const char *filename, int flag)
+ {
+     void *handle;
+ 
+-    handle = _dlopen(filename, flag);
++    handle = _dlopen(filename, RTLD_NOW);
++    if (!handle) {
++        os::log("apitrace: warning: dlopen(%s,%x) failed %s\n", filename, flag, dlerror());
++        return handle;
++    }
+ 
+     const char * libgl_filename = getenv("TRACE_LIBGL");
+ 
+@@ -211,12 +215,24 @@ void * dlopen(const char *filename, int flag)
+         if (strcmp(filename, "libGL.so") == 0 ||
+             strcmp(filename, "libGL.so.1") == 0) {
+ 
++            void *caller = __builtin_return_address(0);
++            Dl_info info;
++            if (dladdr(caller, &info)) {
++                const char *caller_module = info.dli_fname;
++                os::log("apitrace: dlopen(%s) called from %s\n", filename, caller_module);
++                if ( (strcmp(caller_module, "/usr/lib/libGAL.so") == 0)
++                  || (strcmp(caller_module, "/usr/lib/libVDK.so") == 0)
++                   )
++                {
++                    return handle;
++                }
++            }
++
+             // Use the true libGL.so handle instead of RTLD_NEXT from now on
+             _libGlHandle = handle;
+ 
+             // Get the file path for our shared object, and use it instead
+             static int dummy = 0xdeedbeef;
+-            Dl_info info;
+             if (dladdr(&dummy, &info)) {
+                 os::log("apitrace: redirecting dlopen(\"%s\", 0x%x)\n", filename, flag);
+                 handle = _dlopen(info.dli_fname, flag);
+-- 
+2.7.4
+
diff --git a/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace_7.1.0.bb b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace_7.1.0.bb
new file mode 100644
index 0000000..acad772
--- /dev/null
+++ b/recipes-graphics/imx-gpu-apitrace/imx-gpu-apitrace_7.1.0.bb
@@ -0,0 +1,57 @@
+SUMMARY = "Samples for OpenGL ES"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=aeb969185a143c3c25130bc2c3ef9a50"
+DEPENDS = "virtual/libg2d imx-gpu-viv zlib libpng procps"
+
+SRC_URI = "git://github.com/apitrace/apitrace.git;nobranch=1;tag=7.1 \
+          file://0001-add-docs-HOWTO.markdown.patch \
+          file://0002-add-docs-Freescale_apitrace_user_guide.markdown.patch \
+          file://0003-add-docs-Freescale_apitrace.markdown.patch \
+          file://0004-add-docs-apitrace_test.markdown.patch \
+          file://0005-add-apitrace_dalvik.sh.patch \
+          file://0006-add-test_android.sh.patch \
+          file://0007-add-test_yocto.sh.patch \
+          file://0009-add-retrace-glws_nonx.cpp.patch \
+          file://0010-cmake-use-glws_nonx-for-Vivante.patch \
+          file://0011-cli_trace-export-ENABLE_API_TRACE-1.patch \
+          file://0012-use-dlsym-to-get-function-pointers.patch \
+          file://0013-Vivante-driver-does-not-support-GL_RGB-in-openGL-dri.patch \
+          file://0014-MGS-469-GPU-hangs-when-retracing-OGLESParticles-on-m.patch \
+          file://0015-egl-define-egl-native-types-for-non-x11.patch \
+          file://0016-don-t-recreate-the-EGL-surface-on-resize.patch \
+          file://0017-add-Image-getMD5.patch \
+          file://0018-retrace-use-Image-getMD5-for-image-comparison.patch \
+          file://0019-egltrace-don-t-use-dlsym-on-aliased-functions.patch \
+          file://0020-egl-glx-trace-add-ApiTraceEnabled.patch \
+          file://0021-LocalWriter-make-a-writer-ignorable.patch \
+          file://0022-MGS-309-ccc-retrace-tutorial3-is-different-with-trac.patch \
+          file://0023-add-support-for-Vivante-extensions.patch \
+          file://0024-MGS-470-ccc-cannot-trace-mesa-demos-vertexrate.patch \
+          file://0025-MGS-1271-ccc-disable-X-debug-function.patch \
+          file://0026-MGS-1721-ccc-fix-broken-build-on-AArch64.patch \
+          file://0027-MGS-1859-ccc-blank-screen-when-retracing-es20-sdk-ap.patch \
+          file://0028-MGS-2254-ccc-add-the-TOT-commit-SHA1-inside-the-bina.patch \
+          file://0029-MGS-815-ccc-avoid-memcpy-in-glTexDirectInvalidateVIV.patch \
+          file://0030-MGS-814-ccc-retrace-support-eglCreatePixmapSurface-o.patch \
+          file://0031-libbacktrace-define-HAVE_STDINT_H-in-config.h.patch \
+          file://0032-changed-disable-X11-mechanism.patch \
+          file://0033-MGS-2963-ccc-Miss-usr-bin-eglretrace-file-in-FB-and-.patch \
+          file://0034-MGS-make-multiarch-optional.patch \
+          file://0035-dlopen-don-t-override-symbols-in-Vivante-libs.patch \
+"
+
+S = "${WORKDIR}/git"
+
+inherit cmake lib_package pkgconfig perlnative pythonnative
+
+EXTRA_OECMAKE += "-DENABLE_VIVANTE=ON -DENABLE_MULTIARCH=OFF"
+EXTRA_OECMAKE += \
+    "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', '-DDISABLE_X11=ON', \
+        bb.utils.contains('DISTRO_FEATURES',     'x11', '', \
+                                                        '-DDISABLE_X11=ON', d), d)}"
+
+FILES_${PN} = "${bindir} ${libdir}"
+FILES_${PN}-dbg += "${libdir}/*/*/.debug"
+
+PACKAGE_ARCH = "${MACHINE_SOCARCH}"
+COMPATIBLE_MACHINE = "(mx6q|mx6dl|mx6sx|mx6sl|mx7ulp)"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 04/14] imx-gpu-g2d: Move imx-gpu-g2d out of imx-gpu-viv v6
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (2 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 03/14] imx-gpu-apitrace: Move apitrace out of imx-gpu-viv v6 Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-22  2:53   ` S. Lockwood-Childs
  2017-11-15 21:02 ` [PATCH v2 05/14] imx-gpu-viv: Upgrade to 6.2.2.p0 Tom Hochstein
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 conf/machine/include/imx-base.inc                  |  2 +-
 .../imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb            | 36 ++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb

diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc
index f5df54e..1dbe148 100644
--- a/conf/machine/include/imx-base.inc
+++ b/conf/machine/include/imx-base.inc
@@ -212,7 +212,7 @@ PREFERRED_PROVIDER_virtual/libgl_mx6ul ?= "mesa"
 PREFERRED_PROVIDER_virtual/libgl_mx6ull ?= "mesa"
 PREFERRED_PROVIDER_virtual/libgl_mx7ulp ?= "imx-gpu-viv"
 
-PREFERRED_PROVIDER_virtual/libg2d_mx6 ?= "imx-gpu-viv"
+PREFERRED_PROVIDER_virtual/libg2d_mx6 ?= "imx-gpu-g2d"
 PREFERRED_PROVIDER_virtual/libg2d_mx6sll ?= ""
 PREFERRED_PROVIDER_virtual/libg2d_mx6ul = ""
 PREFERRED_PROVIDER_virtual/libg2d_mx6ull = ""
diff --git a/recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb b/recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb
new file mode 100644
index 0000000..8be05f9
--- /dev/null
+++ b/recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb
@@ -0,0 +1,36 @@
+# Copyright (C) 2016 Freescale Semiconductor
+# Copyright 2017 NXP
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "GPU G2D library and apps for imx6"
+LICENSE = "Proprietary"
+LIC_FILES_CHKSUM = "file://COPYING;md5=08fd295cce89b0a9c74b9b83ed74f671"
+
+PROVIDES += "virtual/libg2d"
+
+SRC_URI = "${FSL_MIRROR}/${PN}-${PV}.bin;fsl-eula=true"
+
+S="${WORKDIR}/${PN}-${PV}"
+
+inherit fsl-eula-unpack
+
+SRC_URI[md5sum] = "64720dda9b96fd7af5be7e2c654ab72a"
+SRC_URI[sha256sum] = "070a95aa9942bd67e8ba4012962df74143bffb9998301ac097dab5e1437000d8"
+
+do_install () {
+
+    install -d ${D}${libdir}
+    install -d ${D}${includedir}
+
+    cp ${S}/g2d/usr/lib/*.so* ${D}${libdir}
+    cp -Pr ${S}/g2d/usr/include/* ${D}${includedir}
+    cp -r ${S}/gpu-demos/opt ${D}
+}
+
+RDEPENDS_${PN} = "libgal-imx"
+
+FILES_${PN} = "${libdir}/libg2d* /opt"
+FILES_${PN}-dev = "${includedir}"
+INSANE_SKIP_${PN} = "ldflags"
+
+COMPATIBLE_MACHINE = "(mx6|mx7ulp)"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 05/14] imx-gpu-viv: Upgrade to 6.2.2.p0
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (3 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 04/14] imx-gpu-g2d: Move imx-gpu-g2d " Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-16 11:37   ` Gary Bisson
  2017-11-15 21:02 ` [PATCH v2 06/14] imx-gpu-viv: Add systemd init Tom Hochstein
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

Key Features of the Vivante 6.2.2.p0 Driver Series

- Full support for Khronos Vulkan 1.0 API and WSI extension APIs
Vulkan is a new generation graphics and compute API that provides
high-efficiency, cross-platform access to modern GPUs used in a wide
variety of devices. Vivante’s Vulkan 1.0 implementation has passed
Khronos Vulkan 1.0 Conformance Test. Vivante GC7000XS* GPU core has
been certified by Khronos as a Vulkan 1.0 compliant product.
- Full support for Khronos OpenGL ES 3.2 API
The new OpenGL ES 3.2 and OpenGL ES Shading Language 3.20
specifications bring AEP, plus additional functionality, into core
OpenGL ES. Vivante OpenGL ES 3.2 implementation has passed Khronos
OpenGL ES 3.2 Conformance Test. And Vivante GC7000XS* GPU core has
been certified by Khronos as an OpenGL ES 3.2 compliant product.
- Draw calls specifying a base vertex parameter
- Floating-point framebuffers
- Robust buffer access control
- Support for querying CONTEXT_FLAGS, as needed by debug and robust buffer access functionality.
- Khronos OpenVX 1.0.1 API
- Khronos OpenCL 1.2 API

Improvements

1. Added mutex protection for referencing gctSIGNAL in gckOS_MapSignal to fix a MT race issue.
2. Streamlined GPU address calculation base on MC20 (0/1) and MMU (0/1) combinations.
3. Fixed multiple Android HWC 2.0 rendering issues. Refined HWC 2.0 driver implementation.
4. Improved HWC2.0 composition performance by composing damaged regions only.
6. Enabled offline/online compiler IR assembly dump function for users.
7. Implemented the direct rendering support (no-resolve) for Wayland platform.
8. Added EGL_EXT_buffer_age extension for Wayland and fbdev platforms.
9. Updated wayland-viv protocol to support tile status sync from client to server.
10. Improved OpenCL 1.2 builtin function support with native GPU instructions.
11. Enabled OpenCL 1.2 API trace dump function controlled by VIV_TRACE environment variable.
12. Support for OpenGL4.0
13. Cleaned up driver code issues reported by Klocwork and Coverity.

Changes and Bug Fixes

VG3D:   MGS-2972 fix 3D OpenVG render target orientation
EGL:    MGS-2790 6sx-sdb Met memory dump when do xwld stress test
EGL:    MGS-2885 fix recursive call to dequeue buffer issue on wayland
EGL:    MGS-2785 Meet segmentation fault when test qt5nmapper on wayland
EGL:    MGS-2734 fix x11 memory leak issue
Gralloc:MA-9561 fix crash issue on new gralloc1 interface.
2D:     MGS-2900 fix filterblt memory leak
VG2D/6SL: MGS-2882 fix video memory allocator
OCL:    MGS-2732 clCopyImage with max_images in OCL1.1 cts, crashes.
GLES:   MGS-2747 enable the full config for ES3 CTS
GLES:   MGS-1832 fix Mirada performance issue. optimize cpu load for fence check
WEBGL:  MGS-2779 webgl 1.0.2 conformance test met out of memory
General:MGS-2923 fix gc2000 gpu hang when flush TS cache
General:MGS-2907 fix wrong cache invalidate with dma_map_area
General:MGS-2902 fix wrong release_mem_region
General:MGS-2848 fix gpu hang for flat mapping optimization
General:MGS-2848 Optimize MMUv1 FlatMapping performances
General:MGS-2857 fix spinlock in gpu kernel driver
General:MGS-2805 Enable gcdENABLE_VG by default.
General:MGS-2827 fix serious performance drop on imx6q
General:MGS-2832 fix axi bus error with correct baseaddress
General:MA-9483  Refine android native fence code to match 4.9 kernel
General:MA-9473 Fix gpu random crash issue caused by NULL pointer
General:MGS-2804 fix flat mapping overflow issue
General:MGS-2786 fix gpu kernel panic with debugfs
General:GS-2776  fix galcore device open failure
General:MGS-2767 i.MX7ULP GPU suspend/resume problem
Coverity:MGS-2858 Double free in __driUtilUpdateExtraDrawableInfo

Known Issues

OpenCL 1.1 CTS failures. Will be addresed in 6.2.3
MGS-3027 GPU: X11 manywin draw error. 100%
MGS-2935 [imx6QP] X11: glxs app test some frames render incorrectly. 100%
MGS-2860 [MX7ULP/imx6SLEVK] X11/Xwld: XWindow 2D Acceleration performance test met "X Error of failed request: BadMatch (invalid parameter attributes)" error. 100%
MGS-2829 [imx6qp/imx6d] xwld: mm06 Samurai and Proxycon performance regression comparing with L4.1 using 5.0.11p8
MGS-2310 [imx6qp/imx6dq/imx6dl/imx6sx] webgl: two items performance data is lower than L4.1_GA
MGS-1828 [imx6qp_sd/imx6Q/imx6dl] X11/xwld: VGMARK on vg3d have some items performance drop comparing with L4.1 GA
MGS-1350 [imx6qp-sd] X/FB: Some Basemark test items performance drop comparing with L3.14.52GA which use 5.0.11p7

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc       | 233 +++++++++++----------
 .../imx-gpu-viv/imx-gpu-viv_5.0.11.p8.6-hfp.bb     |   7 -
 .../imx-gpu-viv/imx-gpu-viv_6.2.2.p0-aarch32.bb    |  12 ++
 .../kernel-module-imx-gpu-viv_5.0.11.p8.6.bb       |  19 --
 .../kernel-module-imx-gpu-viv_6.2.2.p0.bb          |  16 ++
 5 files changed, 150 insertions(+), 137 deletions(-)
 delete mode 100644 recipes-graphics/imx-gpu-viv/imx-gpu-viv_5.0.11.p8.6-hfp.bb
 create mode 100644 recipes-graphics/imx-gpu-viv/imx-gpu-viv_6.2.2.p0-aarch32.bb
 delete mode 100644 recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_5.0.11.p8.6.bb
 create mode 100644 recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0.bb

diff --git a/recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc b/recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc
index 9c98132..b6f5f24 100644
--- a/recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc
+++ b/recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc
@@ -2,17 +2,17 @@
 # Copyright (C) 2012-2016 O.S. Systems Software LTDA.
 # Released under the MIT license (see COPYING.MIT for the terms)
 
-DESCRIPTION = "GPU driver and apps for imx6"
+DESCRIPTION = "GPU driver and apps for i.MX"
 SECTION = "libs"
 LICENSE = "Proprietary"
-LIC_FILES_CHKSUM = "file://gpu-core/usr/include/gc_vdk.h;beginline=5;endline=11;md5=12c028cbbbedb4b8770267131500592c"
+LIC_FILES_CHKSUM = "file://COPYING;md5=08fd295cce89b0a9c74b9b83ed74f671"
 
 DEPENDS += " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', \
        bb.utils.contains('DISTRO_FEATURES',     'x11', 'virtual/libx11 libxdamage libxext libxfixes', \
                                                        '', d), d)} \
-    libpng \
 "
+DEPENDS += "libdrm"
 
 # imx-gpu-viv does not provide everything it needs to for virtual/libgl
 # on x11 backend or on Wayland backend with XWayland support.
@@ -20,8 +20,11 @@ DEPENDS += " \
 DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'mesa', '', d)}"
 
 EXTRA_PROVIDES = ""
-EXTRA_PROVIDES_imxgpu3d = " virtual/libgl virtual/libgles1 virtual/libgles2"
-PROVIDES += "virtual/wayland-egl virtual/libgal-x11 virtual/egl virtual/libopenvg virtual/libg2d ${EXTRA_PROVIDES}"
+EXTRA_PROVIDES_append_imxgpu3d = " virtual/libgl virtual/libgles1 virtual/libgles2"
+EXTRA_PROVIDES_append_mx6q     = " virtual/opencl-icd opencl-headers"
+PROVIDES += "imx-gpu-viv virtual/wayland-egl virtual/libgal-x11 virtual/egl virtual/libopenvg ${EXTRA_PROVIDES}"
+
+RPROVIDES_${PN}_imxgpu3d += "imx-gpu-viv"
 
 PE = "1"
 
@@ -29,37 +32,37 @@ inherit fsl-eula-unpack
 
 SRC_URI = "${FSL_MIRROR}/${PN}-${PV}.bin;fsl-eula=true"
 
-PACKAGES =+ "libclc-mx6 libclc-mx6-dev \
-	libgl-mx6 libgl-mx6-dev \
-	libgles-mx6 libgles-mx6-dev \
-	libgles2-mx6 libgles2-mx6-dev \
-	libgles3-mx6-dev \
-	libglslc-mx6 libglslc-mx6-dev \
-	libopencl-mx6 libopencl-mx6-dev \
-	libopenvg-mx6 libopenvg-mx6-dev \
-	libvdk-mx6 libvdk-mx6-dev \
-	libegl-mx6 libegl-mx6-dev \
-	libgal-mx6 libgal-mx6-dev \
-	libvivante-mx6 libvivante-mx6-dev \
-	libvivante-dri-mx6 \
-	libvsc-mx6 \
-	libwayland-viv-mx6 libwayland-viv-mx6-dev \
-	libgc-wayland-protocol-mx6 libgc-wayland-protocol-mx6-dev \
-	libwayland-egl-mx6-dev \
-	imx-gpu-viv-g2d imx-gpu-viv-g2d-dev \
+# Note : If you add a package here, to prevent a naming conflict see the python_anonymous() futher below
+PACKAGES =+ "libclc-imx libclc-imx-dev \
+	libgl-imx libgl-imx-dev \
+	libgles-imx libgles-imx-dev \
+	libgles2-imx libgles2-imx-dev \
+	libgles3-imx-dev \
+	libglslc-imx libglslc-imx-dev \
+	libopencl-imx libopencl-imx-dev \
+	libopenvg-imx libopenvg-imx-dev \
+	libvdk-imx libvdk-imx-dev \
+	libegl-imx libegl-imx-dev \
+	libgal-imx libgal-imx-dev \
+	libvivante-dri-imx \
+	libvsc-imx \
+	libgbm-imx libgbm-imx-dev \
+	libwayland-viv-imx libwayland-viv-imx-dev \
+	libgc-wayland-protocol-imx libgc-wayland-protocol-imx-dev \
+	libwayland-egl-imx-dev \
 	imx-gpu-viv-tools \
-	imx-gpu-viv-tools-apitrace \
 	imx-gpu-viv-demos \
+	libvulkan-imx libvulkan-imx-dev \
+	libopenvx-imx libopenvx-imx-dev \
 "
-
 python __anonymous () {
         has_vivante_kernel_driver_support = (d.getVar('MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT', True) or '0')
         if has_vivante_kernel_driver_support != '1':
                 raise bb.parse.SkipPackage('The kernel of machine needs to have Vivante kernel driver support for this recipe to be used.')
 }
 
-HAS_X11 = "${@bb.utils.contains("DISTRO_FEATURES", "x11", "yes", "no", d)}"
-HAS_WL = "${@bb.utils.contains("DISTRO_FEATURES", "wayland", "yes", "no", d)}"
+USE_X11 = "${@bb.utils.contains("DISTRO_FEATURES", "x11", "yes", "no", d)}"
+USE_WL = "${@bb.utils.contains("DISTRO_FEATURES", "wayland", "yes", "no", d)}"
 
 # Inhibit warnings about files being stripped.
 INHIBIT_PACKAGE_STRIP = "1"
@@ -71,7 +74,7 @@ REALSOLIBS := "${SOLIBS}"
 SOLIBS = "${SOLIBSDEV}"
 
 # For the packages that make up the OpenGL interfaces, inject variables so that
-# they don't get Debian-renamed (which would remove the -mx6 suffix).
+# they don't get Debian-renamed (which would remove the -imx suffix).
 #
 # FIXME: All binaries lack GNU_HASH in elf binary but as we don't have
 # the source we cannot fix it. Disable the insane check for now.
@@ -82,8 +85,8 @@ python __anonymous() {
 
     for p in (("libegl", "libegl1"), ("libgl", "libgl1"),
               ("libgles1", "libglesv1-cm1"), ("libgles2", "libglesv2-2"),
-              ("libgles3",)):
-        fullp = p[0] + "-mx6"
+              ("libgles3",) , ("libvulkan",)):
+        fullp = p[0] + "-imx"
         pkgs = " ".join(p)
         d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
         d.appendVar("RREPLACES_" + fullp, pkgs)
@@ -99,8 +102,8 @@ python __anonymous() {
         d.appendVar("RCONFLICTS_" + fullp, pkgs)
 }
 
-IMXGPU_imxgpu3d = "3d"
-IMXGPU_imxgpu2d = "2d"
+IS_MX6SL = "0"
+IS_MX6SL_mx6sl = "1"
 
 do_install () {
     install -d ${D}${libdir}
@@ -108,18 +111,15 @@ do_install () {
     install -d ${D}${bindir}
 
     cp -P ${S}/gpu-core/usr/lib/*.so* ${D}${libdir}
-    cp  ${S}/g2d/usr/lib/*.so* ${D}${libdir}
     cp -r ${S}/gpu-core/usr/include/* ${D}${includedir}
-    cp -Pr ${S}/g2d/usr/include/* ${D}${includedir}
     cp -r ${S}/gpu-demos/opt ${D}
     cp -r ${S}/gpu-tools/gmem-info/usr/bin/* ${D}${bindir}
 
+
     install -d ${D}${libdir}/pkgconfig
 
     # The preference order, based in DISTRO_FEATURES, is Wayland (with or without X11), X11 and fb
-    if [ "${HAS_WL}" = "yes" ]; then
-        cp -r ${S}/apitrace/non-x11/usr/lib/* ${D}${libdir}
-        cp -r ${S}/apitrace/non-x11/usr/bin/* ${D}${bindir}
+    if [ "${USE_WL}" = "yes" ]; then
 
         backend=wl
 
@@ -130,23 +130,26 @@ do_install () {
         install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/gc_wayland_protocol.pc ${D}${libdir}/pkgconfig/gc_wayland_protocol.pc
         install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/wayland-egl.pc ${D}${libdir}/pkgconfig/wayland-egl.pc
         install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/wayland-viv.pc ${D}${libdir}/pkgconfig/wayland-viv.pc
+        install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/gbm.pc ${D}${libdir}/pkgconfig/gbm.pc
+
+       if [ "${USE_X11}" = "yes" ]; then
 
-        if [ "${HAS_X11}" = "yes" ]; then
-            cp -r ${S}/gpu-core/usr/lib/dri ${D}${libdir}
-        fi
+        cp -r ${S}/gpu-core/usr/lib/dri ${D}${libdir}
+
+       fi
 
-    elif [ "${HAS_X11}" = "yes" ]; then
+    elif [ "${USE_X11}" = "yes" ]; then
 
         cp -r ${S}/gpu-core/usr/lib/dri ${D}${libdir}
-        cp -r ${S}/apitrace/x11/usr/lib/* ${D}${libdir}
-        cp -r ${S}/apitrace/x11/usr/bin/* ${D}${bindir}
 
         backend=x11
 
+        install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/gl_x11.pc ${D}${libdir}/pkgconfig/gl.pc
         install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/egl_x11.pc ${D}${libdir}/pkgconfig/egl.pc
         install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/glesv1_cm_x11.pc ${D}${libdir}/pkgconfig/glesv1_cm.pc
         install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/glesv2_x11.pc ${D}${libdir}/pkgconfig/glesv2.pc
         install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/vg_x11.pc ${D}${libdir}/pkgconfig/vg.pc
+
     else
         install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/glesv1_cm.pc ${D}${libdir}/pkgconfig/glesv1_cm.pc
         install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/glesv2.pc ${D}${libdir}/pkgconfig/glesv2.pc
@@ -154,9 +157,9 @@ do_install () {
 
         # Regular framebuffer
         install -m 0644 ${S}/gpu-core/usr/lib/pkgconfig/egl_linuxfb.pc ${D}${libdir}/pkgconfig/egl.pc
-        cp -r ${S}/apitrace/non-x11/usr/lib/* ${D}${libdir}
-        cp -r ${S}/apitrace/non-x11/usr/bin/* ${D}${bindir}
+
         backend=fb
+
     fi
 
     # Install Vendor ICDs for OpenCL's installable client driver loader (ICDs Loader)
@@ -173,7 +176,7 @@ do_install () {
     ln -sf libEGL.so.1.0 ${D}${libdir}/libEGL.so.1
     ln -sf libEGL.so.1.0 ${D}${libdir}/libEGL.so
     mv ${D}${libdir}/libGAL-${backend}.so ${D}${libdir}/libGAL.so
-    mv ${D}${libdir}/libVIVANTE-${backend}.so ${D}${libdir}/libVIVANTE.so
+    mv ${D}${libdir}/libVDK-${backend}.so ${D}${libdir}/libVDK.so
 
     # update libglesv2 as backend dependent
     rm -rf ${D}${libdir}/libGLESv2*
@@ -182,28 +185,27 @@ do_install () {
     ln -sf libGLESv2.so.2.0.0 ${D}${libdir}/libGLESv2.so
 
     # skip packaging wayland libraries if no support is requested
-    if [ "${HAS_WL}" = "no" ]; then
+    if [ "${USE_WL}" = "no" ]; then
         rm ${D}${libdir}/libgc_wayland_protocol.*
         rm ${D}${libdir}/libwayland-viv.*
     fi
 
-    for backend in wl x11 fb dri; do
-        find ${D}${libdir} -name "*-$backend.so" -exec rm '{}' ';'
-        find ${D}${libdir} -name "*.$backend.so" -exec rm '{}' ';'
+    for i in wl x11 fb dri; do
+        find ${D}${libdir} -name "*-$i.so" -exec rm '{}' ';'
+        find ${D}${libdir} -name "*.$i.so" -exec rm '{}' ';'
     done
 
-    # FIXME: For 2D only GPU, we need to remove some content which is
-    #        3D specific.
-    if [ "${IMXGPU}" = "2d" ]; then
+    # FIXME: MX6SL does not have 3D support; hack it for now
+    if [ "${IS_MX6SL}" = "1" ]; then
         rm -rf ${D}${libdir}/libCLC* ${D}${includedir}/CL \
                \
-               ${D}${libdir}/libGL* ${D}${includedir}/GL* \
+               ${D}${libdir}/libGL* ${D}${includedir}/GL* ${D}${libdir}/pkgconfig/gl.pc \ 
                \
-               ${D}${libdir}/libGLES* ${D}${libdir}/pkgconfig/glesv1_cm.pc ${D}${libdir}/pkgconfig/glesv2.pc \
+               ${D}${libdir}/libGLES* ${D}${libdir}/pkgconfig/gles*.pc \
                \
                ${D}${libdir}/libOpenCL* ${D}${includedir}/CL \
                \
-               ${D}${libdir}/libOpenVG.so ${D}${libdir}/libOpenVG.3d.so \
+               ${D}${libdir}/libOpenVG.3d.so \
                \
                ${D}${libdir}/libVivanteOpenCL.so \
                \
@@ -221,84 +223,93 @@ do_install () {
 
 ALLOW_EMPTY_${PN} = "1"
 
-FILES_libclc-mx6 = "${libdir}/libCLC${SOLIBS}"
-FILES_libclc-mx6-dev = "${includedir}/CL ${libdir}/libCLC${SOLIBSDEV}"
+# FIXME: Remove the following lines after adding libopenvx package
+INSANE_SKIP_imx-gpu-viv-dev += "dev-elf"
+INSANE_SKIP_libclc-imx += "dev-deps"
+
+FILES_libclc-imx = "${libdir}/libCLC${SOLIBS}"
+FILES_libclc-imx-dev = "${includedir}/CL ${libdir}/libCLC${SOLIBSDEV}"
 
 # libEGL.so is used by some demo apps from Freescale
-INSANE_SKIP_libegl-mx6 += "dev-so"
-FILES_libegl-mx6 = "${libdir}/libEGL${REALSOLIBS} ${libdir}/libEGL${SOLIBSDEV} "
-FILES_libegl-mx6-dev = "${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc"
+INSANE_SKIP_libegl-imx += "dev-so"
+FILES_libegl-imx = "${libdir}/libEGL${REALSOLIBS} ${libdir}/libEGL${SOLIBSDEV} "
+FILES_libegl-imx-dev = "${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc"
+RDEPENDS_libegl-imx += "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'libgc-wayland-protocol-imx libwayland-viv-imx libgc-wayland-protocol-imx', '', d)}"
+RDEPENDS_libegl-imx-dev += "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'libwayland-egl-imx-dev', '', d)}"
+
+FILES_libgal-imx = "${libdir}/libGAL${SOLIBS} ${libdir}/libGAL_egl${SOLIBS}"
+FILES_libgal-imx-dev = "${libdir}/libGAL${SOLIBSDEV} ${includedir}/HAL"
+RDEPENDS_libgal-imx += "kernel-module-imx-gpu-viv"
+RPROVIDES_libgal-imx += "libgal-imx"
+INSANE_SKIP_libgal-imx += "build-deps"
+
+FILES_libvsc-imx = "${libdir}/libVSC${SOLIBS}"
 
-FILES_libgal-mx6 = "${libdir}/libGAL${SOLIBS} ${libdir}/libGAL_egl${SOLIBS}"
-FILES_libgal-mx6-dev = "${libdir}/libGAL${SOLIBSDEV} ${includedir}/HAL"
-RDEPENDS_libgal-mx6 += "kernel-module-imx-gpu-viv"
-INSANE_SKIP_libgal-mx6 += "build-deps"
+FILES_libgbm-imx = "${libdir}/libgbm${SOLIBS} ${libdir}/gbm_viv${SOLIBS}"
+FILES_libgbm-imx-dev = "${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h ${libdir}/libgbm${SOLIBSDEV}"
+RDEPENDS_libgbm-imx += "libdrm"
 
-FILES_libvsc-mx6 = "${libdir}/libVSC${SOLIBS}"
+FILES_libvulkan-imx = "${libdir}/vulkan/libvulkan_VSI${SOLIBS}"
+FILES_libvulkan-imx-dev = "${includedir}/vulkan ${libdir}/vulkan/libvulkan_VSI${SOLIBSDEV}"
+INSANE_SKIP_libvulkan-imx += "dev-deps dev-so"
 
-FILES_libgl-mx6 = "${libdir}/libGL${REALSOLIBS}"
-FILES_libgl-mx6-dev = "${libdir}/libGL${SOLIBSDEV}"
+FILES_libopenvx-imx = "${libdir}/libOpenVX${SOLIBS} ${libdir}/libOpenVXC${SOLIBS} ${libdir}/libOpenVXU${SOLIBS}"
+FILES_libopenvx-imx-dev = "${includedir}/VX ${libdir}/libopenVX${SOLIBSDEV}"
+
+FILES_libgl-imx = "${libdir}/libGL${REALSOLIBS}"
+FILES_libgl-imx-dev = "${libdir}/libGL${SOLIBSDEV} ${includedir}/GL"
 # Includes GL headers from mesa
-RDEPENDS_libgl-mx6-dev += "libgl-mesa-dev"
+RDEPENDS_libgl-imx-dev += "libgl-mesa-dev"
 
 # libEGL needs to open libGLESv1.so
-INSANE_SKIP_libgles-mx6 += "dev-so"
-FILES_libgles-mx6 = "${libdir}/libGLESv1*${REALSOLIBS} ${libdir}/libGLESv1*${SOLIBS} ${libdir}/libGLES_*${REALSOLIBS} ${libdir}/libGLES_*${SOLIBS}"
-FILES_libgles-mx6-dev = "${includedir}/GLES ${libdir}/libGLESv1*${SOLIBS} ${libdir}/libGLES_*${SOLIBSDEV} ${libdir}/pkgconfig/glesv1_cm.pc"
+INSANE_SKIP_libgles-imx += "dev-so"
+FILES_libgles-imx = "${libdir}/libGLESv1*${REALSOLIBS} ${libdir}/libGLESv1*${SOLIBS} ${libdir}/libGLES_*${REALSOLIBS} ${libdir}/libGLES_*${SOLIBS}"
+FILES_libgles-imx-dev = "${includedir}/GLES ${libdir}/libGLESv1*${SOLIBS} ${libdir}/libGLES_*${SOLIBSDEV} ${libdir}/pkgconfig/glesv1_cm.pc"
 
 # libEGL needs to open libGLESv2.so
-INSANE_SKIP_libgles2-mx6 += "dev-so"
-FILES_libgles2-mx6 = "${libdir}/libGLESv2${REALSOLIBS} ${libdir}/libGLESv2${SOLIBS}"
-FILES_libgles2-mx6-dev = "${includedir}/GLES2 ${libdir}/libGLESv2${SOLIBSDEV} ${libdir}/pkgconfig/glesv2.pc"
-RDEPENDS_libgles2-mx6 = "libglslc-mx6"
+INSANE_SKIP_libgles2-imx += "dev-so"
+FILES_libgles2-imx = "${libdir}/libGLESv2${REALSOLIBS} ${libdir}/libGLESv2${SOLIBS}"
+FILES_libgles2-imx-dev = "${includedir}/GLES2 ${libdir}/libGLESv2${SOLIBSDEV} ${libdir}/pkgconfig/glesv2.pc"
+RDEPENDS_libgles2-imx = "libglslc-imx"
 
-FILES_libgles3-mx6-dev = "${includedir}/GLES3"
-# as long as there is no libgles3-mx6: ship libgles3-mx6-dev along with
-# libgles2-mx6-dev - otherwise GLES3 headers have to be added manually
-RDEPENDS_libgles2-mx6-dev += "libgles3-mx6-dev"
+FILES_libgles3-imx-dev = "${includedir}/GLES3"
+# as long as there is no libgles3: ship libgles3-dev along with
+# libgles2-dev - otherwise GLES3 headers have to be added manually
+RDEPENDS_libgles2-imx-dev += "libgles3-imx-dev"
 
-FILES_libglslc-mx6 = "${libdir}/libGLSLC${SOLIBS}"
-FILES_libglslc-mx6-dev = "${includedir}/CL ${libdir}/libGLSLC${SOLIBSDEV}"
+FILES_libglslc-imx = "${libdir}/libGLSLC${SOLIBS}"
+FILES_libglslc-imx-dev = "${includedir}/CL ${libdir}/libGLSLC${SOLIBSDEV}"
 
-FILES_libopencl-mx6 = "${libdir}/libOpenCL${SOLIBS} \
+FILES_libopencl-imx = "${libdir}/libOpenCL${SOLIBS} \
                        ${libdir}/libVivanteOpenCL${SOLIBS} \
                        ${sysconfdir}/OpenCL/vendors/Vivante.icd"
-FILES_libopencl-mx6-dev = "${includedir}/CL ${libdir}/libOpenCL${SOLIBSDEV}"
-RDEPENDS_libopencl-mx6 = "libclc-mx6"
-
-INSANE_SKIP_libopenvg-mx6 += "dev-so"
-FILES_libopenvg-mx6 = "${libdir}/libOpenVG*${SOLIBS}"
-FILES_libopenvg-mx6-dev = "${includedir}/VG ${libdir}/libOpenVG*${SOLIBSDEV} ${libdir}/pkgconfig/vg.pc"
+FILES_libopencl-imx-dev = "${includedir}/CL ${libdir}/libOpenCL${SOLIBSDEV}"
+RDEPENDS_libopencl-imx= "libclc-imx"
 
-FILES_libvdk-mx6 = "${libdir}/libVDK${SOLIBS}"
-FILES_libvdk-mx6-dev = "${includedir}/*vdk*.h ${libdir}/libVDK${SOLIBSDEV}"
+INSANE_SKIP_libopenvg-imx += "dev-so"
+FILES_libopenvg-imx = "${libdir}/libOpenVG*${SOLIBS}"
+FILES_libopenvg-imx-dev = "${includedir}/VG ${libdir}/libOpenVG*${SOLIBSDEV} ${libdir}/pkgconfig/vg.pc"
 
-FILES_libvivante-mx6 = "${libdir}/libVIVANTE${SOLIBS}"
-FILES_libvivante-mx6-dev = "${libdir}/libVIVANTE${SOLIBSDEV}"
+FILES_libvdk-imx = "${libdir}/libVDK${SOLIBS}"
+FILES_libvdk-imx-dev = "${includedir}/*vdk*.h ${libdir}/libVDK${SOLIBSDEV}"
 
-FILES_libvivante-dri-mx6 = "${libdir}/dri/vivante_dri.so"
-RDEPENDS_libvivante-dri-mx6 = "libdrm"
+FILES_libvivante-dri-imx = "${libdir}/dri/vivante_dri.so"
+RDEPENDS_libvivante-dri-imx = "libdrm"
 
-INSANE_SKIP_libwayland-viv-mx6 += "dev-so"
-FILES_libwayland-viv-mx6 =  "${libdir}/libwayland-viv${REALSOLIBS}  ${libdir}/libwayland-viv${SOLIBS}"
-FILES_libwayland-viv-mx6-dev = "${includedir}/wayland-viv ${libdir})/libwayland-viv${SOLIBSDEV} ${libdir}/pkgconfig/wayland-viv.pc"
-RPROVIDES_libwayland-viv-mx6 += "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'xf86-video-imxfb-vivante', '', d)}"
+INSANE_SKIP_libwayland-viv-imx += "dev-so"
+FILES_libwayland-viv-imx =  "${libdir}/libwayland-viv${REALSOLIBS}  ${libdir}/libwayland-viv${SOLIBS}"
+FILES_libwayland-viv-imx-dev = "${includedir}/wayland-viv ${libdir})/libwayland-viv${SOLIBSDEV} ${libdir}/pkgconfig/wayland-viv.pc"
+RPROVIDES_libwayland-viv-imx += "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'xf86-video-imxfb-vivante', '', d)}"
 
-INSANE_SKIP_libgc-wayland-protocol-mx6 += "dev-so"
-FILES_libgc-wayland-protocol-mx6 = "${libdir}/libgc_wayland_protocol${REALSOLIBS} ${libdir}/libgc_wayland_protocol${SOLIBS}"
-FILES_libgc-wayland-protocol-mx6-dev = "${libdir}/libgc_wayland_protocol${SOLIBSDEV} ${libdir}/pkgconfig/gc_wayland_protocol.pc"
+INSANE_SKIP_libgc-wayland-protocol-imx += "dev-so"
+FILES_libgc-wayland-protocol-imx = "${libdir}/libgc_wayland_protocol${REALSOLIBS} ${libdir}/libgc_wayland_protocol${SOLIBS}"
+FILES_libgc-wayland-protocol-imx-dev = "${libdir}/libgc_wayland_protocol${SOLIBSDEV} ${libdir}/pkgconfig/gc_wayland_protocol.pc"
 
-FILES_libwayland-egl-mx6-dev = "${libdir}/pkgconfig/wayland-egl.pc"
-
-INSANE_SKIP_imx-gpu-viv-g2d += "dev-so"
-FILES_imx-gpu-viv-g2d = "${libdir}/libg2d* "
-FILES_imx-gpu-viv-g2d-dev = "${includedir}/g2d.h"
+FILES_libwayland-egl-imx-dev = "${libdir}/pkgconfig/wayland-egl.pc"
 
 FILES_imx-gpu-viv-tools = "${bindir}/gmem_info"
 
-FILES_imx-gpu-viv-tools-apitrace = "${bindir} ${libdir}"
-
 FILES_imx-gpu-viv-demos = "/opt"
-INSANE_SKIP_imx-gpu-viv-demos += "rpaths"
+INSANE_SKIP_imx-gpu-viv-demos += "rpaths dev-deps"
 
-COMPATIBLE_MACHINE = "(mx6q|mx6dl|mx6sx|mx6sl)"
+# COMPATIBLE_MACHINE = "(mx6q|mx6dl|mx6sx|mx6sl)"
diff --git a/recipes-graphics/imx-gpu-viv/imx-gpu-viv_5.0.11.p8.6-hfp.bb b/recipes-graphics/imx-gpu-viv/imx-gpu-viv_5.0.11.p8.6-hfp.bb
deleted file mode 100644
index d619a71..0000000
--- a/recipes-graphics/imx-gpu-viv/imx-gpu-viv_5.0.11.p8.6-hfp.bb
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (C) 2013-2016 Freescale Semiconductor
-# Released under the MIT license (see COPYING.MIT for the terms)
-
-require imx-gpu-viv.inc
-
-SRC_URI[md5sum] = "92fc34fc37b0865f61be1bd931f5166f"
-SRC_URI[sha256sum] = "caaabd59a259e29aa5b7f9d1d7f3fe71cff9336ba44904485d258baef276351f"
diff --git a/recipes-graphics/imx-gpu-viv/imx-gpu-viv_6.2.2.p0-aarch32.bb b/recipes-graphics/imx-gpu-viv/imx-gpu-viv_6.2.2.p0-aarch32.bb
new file mode 100644
index 0000000..36ab217
--- /dev/null
+++ b/recipes-graphics/imx-gpu-viv/imx-gpu-viv_6.2.2.p0-aarch32.bb
@@ -0,0 +1,12 @@
+# Copyright (C) 2013-2016 Freescale Semiconductor
+# Copyright 2017 NXP
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc
+
+SRC_URI[md5sum] = "7d43f73b8bc0c1c442587f819218a1d5"
+SRC_URI[sha256sum] = "4f93a4412c93ca5959aa2437bfed2ecbaf983b5b272be5977f76a967de5db150"
+
+PACKAGE_FP_TYPE = "hardfp"
+
+COMPATIBLE_MACHINE = "(mx6q|mx6dl|mx6sx|mx6sl|mx7ulp)"
diff --git a/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_5.0.11.p8.6.bb b/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_5.0.11.p8.6.bb
deleted file mode 100644
index 6c9089f..0000000
--- a/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_5.0.11.p8.6.bb
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (C) 2015-2016 Freescale Semiconductor
-
-SUMMARY = "Kernel loadable module for Vivante GPU"
-DESCRIPTION = "Builds the Vivante GPU kernel driver as a loadable kernel module, \
-allowing flexibility to use an older kernel with a newer graphics release."
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e"
-
-SRC_URI = "${FSL_MIRROR}/${PN}-${PV}.tar.gz"
-SRC_URI[md5sum] = "ed31740763b2aa6d56ecbe64d9cea565"
-SRC_URI[sha256sum] = "3e748fc53ee46ffcf80b94d5f9535c58a3875aa107a3c77b550d8100df15de4f"
-
-do_install_prepend() {
-    install ${B}/kernel-module-imx-gpu-viv-src/Module.symvers ${B}
-}
-
-inherit module
-
-KERNEL_MODULE_AUTOLOAD = "galcore"
diff --git a/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0.bb b/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0.bb
new file mode 100644
index 0000000..8bf61dc
--- /dev/null
+++ b/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv_6.2.2.p0.bb
@@ -0,0 +1,16 @@
+# Copyright (C) 2015-2016 Freescale Semiconductor
+# Copyright 2017 NXP
+
+SUMMARY = "Kernel loadable module for Vivante GPU"
+DESCRIPTION = "Builds the Vivante GPU kernel driver as a loadable kernel module, \
+allowing flexibility to use an older kernel with a newer graphics release."
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e"
+
+SRC_URI = "${FSL_MIRROR}/${PN}-${PV}.tar.gz"
+SRC_URI[md5sum] = "c5922730046c159fd5055ad114e027b9"
+SRC_URI[sha256sum] = "01b13fa5e1ab69475ce401e997fe8e42775b7792b1233e871b2b28555f8a3a66"
+
+inherit module
+
+KERNEL_MODULE_AUTOLOAD = "galcore"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 06/14] imx-gpu-viv: Add systemd init
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (4 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 05/14] imx-gpu-viv: Upgrade to 6.2.2.p0 Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-16 15:50   ` Otavio Salvador
  2017-11-15 21:02 ` [PATCH v2 07/14] mesa: Remove parts provided by imx-gpu-viv v6 Tom Hochstein
                   ` (8 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc          | 11 +++++++++--
 recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig    | 19 +++++++++++++++++++
 .../imx-gpu-viv/imx-gpu-viv/gpuconfig.service         |  8 ++++++++
 3 files changed, 36 insertions(+), 2 deletions(-)
 create mode 100644 recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig
 create mode 100644 recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig.service

diff --git a/recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc b/recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc
index b6f5f24..66537b2 100644
--- a/recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc
+++ b/recipes-graphics/imx-gpu-viv/imx-gpu-viv.inc
@@ -28,9 +28,15 @@ RPROVIDES_${PN}_imxgpu3d += "imx-gpu-viv"
 
 PE = "1"
 
-inherit fsl-eula-unpack
+inherit fsl-eula-unpack systemd
+
+SYSTEMD_SERVICE_${PN} = "gpuconfig.service"
 
 SRC_URI = "${FSL_MIRROR}/${PN}-${PV}.bin;fsl-eula=true"
+SRC_URI += " \
+    file://gpuconfig.service \
+    file://gpuconfig \
+"
 
 # Note : If you add a package here, to prevent a naming conflict see the python_anonymous() futher below
 PACKAGES =+ "libclc-imx libclc-imx-dev \
@@ -114,7 +120,8 @@ do_install () {
     cp -r ${S}/gpu-core/usr/include/* ${D}${includedir}
     cp -r ${S}/gpu-demos/opt ${D}
     cp -r ${S}/gpu-tools/gmem-info/usr/bin/* ${D}${bindir}
-
+    install -Dm0644 ${WORKDIR}/gpuconfig.service ${D}${systemd_system_unitdir}/gpuconfig.service
+    install -Dm0755 ${WORKDIR}/gpuconfig ${D}${sysconfdir}/gpuconfig
 
     install -d ${D}${libdir}/pkgconfig
 
diff --git a/recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig b/recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig
new file mode 100644
index 0000000..792ab6c
--- /dev/null
+++ b/recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig
@@ -0,0 +1,19 @@
+#!/bin/sh
+CPUREV=$(cat /sys/devices/soc0/soc_id)
+FILEVG=/usr/lib/libOpenVG.so
+FILEVG3D=/usr/lib/libOpenVG.3d.so
+FILEVG355=/usr/lib/libOpenVG.2d.so
+if  [ -e $FILEVG3D ] && [ -e $FILEVG355 ]
+then
+  if [ -e  $FILEVG ]
+  then
+        rm -f $FILEVG
+  fi
+  if [ $CPUREV == "i.MX6QP" ] || [ $CPUREV == "i.MX6Q" ] || [ $CPUREV == "i.MX6SL" ]
+  then
+        # Use GC355 VG
+        ln -s $FILEVG355 $FILEVG
+  else
+        ln -s $FILEVG3D $FILEVG
+  fi
+fi
diff --git a/recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig.service b/recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig.service
new file mode 100644
index 0000000..9881e7c
--- /dev/null
+++ b/recipes-graphics/imx-gpu-viv/imx-gpu-viv/gpuconfig.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Configuration for i.MX GPU (Former rc_gpu.S)
+
+[Service]
+ExecStart=/etc/gpuconfig
+
+[Install]
+WantedBy=multi-user.target
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 07/14] mesa: Remove parts provided by imx-gpu-viv v6
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (5 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 06/14] imx-gpu-viv: Add systemd init Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 08/14] piglit: Remove redundant dependency Tom Hochstein
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 recipes-graphics/mesa/mesa_%.bbappend | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/recipes-graphics/mesa/mesa_%.bbappend b/recipes-graphics/mesa/mesa_%.bbappend
index eaa94ee..c014b2d 100644
--- a/recipes-graphics/mesa/mesa_%.bbappend
+++ b/recipes-graphics/mesa/mesa_%.bbappend
@@ -1,6 +1,6 @@
-PACKAGECONFIG_remove_imxgpu2d = "egl gles"
+PACKAGECONFIG_remove_imxgpu2d = "egl gles gbm"
 
-PROVIDES_remove_imxgpu2d = "virtual/libgles1 virtual/libgles2 virtual/libopenvg virtual/egl"
+PROVIDES_remove_imxgpu2d = "virtual/libgles1 virtual/libgles2 virtual/libopenvg virtual/egl gbm"
 PROVIDES_remove_imxgpu3d = "virtual/libgl"
 
 # FIXME: mesa should support 'x11-no-tls' option
@@ -17,9 +17,23 @@ python () {
 PACKAGECONFIG_append_use-mainline-bsp = " gallium"
 GALLIUMDRIVERS_append_use-mainline-bsp = ",etnaviv,imx"
 
+BACKEND = \
+    "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', \
+        bb.utils.contains('DISTRO_FEATURES',     'x11',     'x11', \
+                                                             'fb', d), d)}"
+
 # FIXME: Dirty hack to allow use of Vivante GPU libGL binary
 do_install_append_imxgpu3d () {
     rm -f ${D}${libdir}/libGL.* \
           ${D}${includedir}/GL/gl.h \
-          ${D}${includedir}/GL/glext.h
+          ${D}${includedir}/GL/glext.h \
+          ${D}${includedir}/GL/glx.h \
+          ${D}${includedir}/GL/glxext.h
+    if [ "${BACKEND}" = "x11" ]; then
+        rm -f ${D}${libdir}/pkgconfig/gl.pc
+    fi
+}
+
+do_install_append_imxgpu2d () {
+    rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc
 }
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 08/14] piglit: Remove redundant dependency
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (6 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 07/14] mesa: Remove parts provided by imx-gpu-viv v6 Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 09/14] xserver-xf86-config: Add Xorg configuration for i.MX 6SLL and 7ULP Tom Hochstein
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

The dependency on virtual/egl is in the base recipe now.

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 recipes-graphics/piglit/piglit_git.bbappend | 1 -
 1 file changed, 1 deletion(-)
 delete mode 100644 recipes-graphics/piglit/piglit_git.bbappend

diff --git a/recipes-graphics/piglit/piglit_git.bbappend b/recipes-graphics/piglit/piglit_git.bbappend
deleted file mode 100644
index 41bfa9a..0000000
--- a/recipes-graphics/piglit/piglit_git.bbappend
+++ /dev/null
@@ -1 +0,0 @@
-DEPENDS_append_imxgpu2d = " virtual/egl"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 09/14] xserver-xf86-config: Add Xorg configuration for i.MX 6SLL and 7ULP
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (7 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 08/14] piglit: Remove redundant dependency Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 10/14] xf86-video-imxfb-vivante: Upgrade to 6.2.2.p0 Tom Hochstein
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 .../xorg-xserver/xserver-xf86-config/mx6sll/xorg.conf     | 12 ++++++++++++
 .../xorg-xserver/xserver-xf86-config/mx7ulp/xorg.conf     | 15 +++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100755 recipes-graphics/xorg-xserver/xserver-xf86-config/mx6sll/xorg.conf
 create mode 100755 recipes-graphics/xorg-xserver/xserver-xf86-config/mx7ulp/xorg.conf

diff --git a/recipes-graphics/xorg-xserver/xserver-xf86-config/mx6sll/xorg.conf b/recipes-graphics/xorg-xserver/xserver-xf86-config/mx6sll/xorg.conf
new file mode 100755
index 0000000..79b6c0f
--- /dev/null
+++ b/recipes-graphics/xorg-xserver/xserver-xf86-config/mx6sll/xorg.conf
@@ -0,0 +1,12 @@
+Section "Device"
+    Identifier  "Kernel Framebuffer Device"
+    Driver      "fbdev"
+    Option      "fbdev" "/dev/fb0"
+EndSection
+
+Section "ServerFlags"
+    Option "BlankTime"  "0"
+    Option "StandbyTime"  "0"
+    Option "SuspendTime"  "0"
+    Option "OffTime"  "0"
+EndSection
diff --git a/recipes-graphics/xorg-xserver/xserver-xf86-config/mx7ulp/xorg.conf b/recipes-graphics/xorg-xserver/xserver-xf86-config/mx7ulp/xorg.conf
new file mode 100755
index 0000000..de6307a
--- /dev/null
+++ b/recipes-graphics/xorg-xserver/xserver-xf86-config/mx7ulp/xorg.conf
@@ -0,0 +1,15 @@
+Section "Device"
+    Identifier  "i.MX Accelerated Framebuffer Device"
+    Driver      "vivante"
+    Option      "fbdev"     "/dev/fb0"
+    Option      "vivante_fbdev" "/dev/fb0"
+    Option      "HWcursor"  "false"
+    Option      "VivCacheMem"  "false"
+EndSection
+
+Section "ServerFlags"
+    Option "BlankTime"  "0"
+    Option "StandbyTime"  "0"
+    Option "SuspendTime"  "0"
+    Option "OffTime"  "0"
+EndSection
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 10/14] xf86-video-imxfb-vivante: Upgrade to 6.2.2.p0
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (8 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 09/14] xserver-xf86-config: Add Xorg configuration for i.MX 6SLL and 7ULP Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 11/14] gtk+3: Use egl pkgconfig for build setup Tom Hochstein
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante.inc      |  8 +++-----
 .../xorg-driver/xf86-video-imxfb-vivante_5.0.11.p8.6.bb        | 10 ----------
 .../xorg-driver/xf86-video-imxfb-vivante_6.2.2.p0.bb           |  9 +++++++++
 3 files changed, 12 insertions(+), 15 deletions(-)
 delete mode 100644 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_5.0.11.p8.6.bb
 create mode 100644 recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_6.2.2.p0.bb

diff --git a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante.inc b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante.inc
index a6d722b..c16da67 100644
--- a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante.inc
+++ b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante.inc
@@ -8,7 +8,7 @@ PE = "3"
 
 inherit autotools-brokensep update-rc.d pkgconfig
 
-DEPENDS += "virtual/xserver virtual/libx11 virtual/libgal-x11 imx-gpu-viv pixman"
+DEPENDS += "virtual/xserver virtual/libx11 virtual/libgal-x11 imx-gpu-viv virtual/libg2d pixman"
 
 LIC_FILES_CHKSUM = "file://COPYING-MIT;md5=b5e9d9f5c02ea831ab3ecf802bb7c4f3"
 
@@ -32,8 +32,6 @@ CFLAGS += "-I${STAGING_INCDIR}/xorg \
            -I${STAGING_INCDIR}/drm \
            -I../../DRI_1.10.4/src"
 
-S = "${WORKDIR}/xserver-xorg-video-imx-viv-${PV}/"
-
 PACKAGES =+ "xserver-xorg-extension-viv-autohdmi"
 
 # FIXME: The Freescale provided Makefile has hardcodec include paths
@@ -55,7 +53,7 @@ do_install_append () {
 	find ${D}${includedir} -type f -exec chmod 660 {} \;
 }
 
-RDEPENDS_${PN} += "libvivante-dri-mx6 \
+RDEPENDS_${PN} += "libvivante-dri-imx \
                    xserver-xorg-module-exa \
                    mesa-driver-swrast \
                    xserver-xorg-extension-dri \
@@ -72,4 +70,4 @@ FILES_${PN}-dbg = "${libdir}/*/*/*/.debug ${libdir}/.debug/libfsl_x11_ext${SOLIB
 FILES_xserver-xorg-extension-viv-autohdmi = " ${libdir}/libfsl_x11_ext${SOLIBS} ${exec_prefix}/bin/autohdmi ${sysconfdir}/init.d/rc.autohdmi"
 
 PACKAGE_ARCH = "${MACHINE_SOCARCH}"
-COMPATIBLE_MACHINE = "(mx6)"
+COMPATIBLE_MACHINE = "(mx6|mx7ulp)"
diff --git a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_5.0.11.p8.6.bb b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_5.0.11.p8.6.bb
deleted file mode 100644
index a15033e..0000000
--- a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_5.0.11.p8.6.bb
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (C) 2012-2016 Freescale Semiconductor
-# Copyright (C) 2012-2014 O.S. Systems Software LTDA.
-# Released under the MIT license (see COPYING.MIT for the terms)
-
-require xf86-video-imxfb-vivante.inc
-
-SRC_URI += "file://Stop-using-Git-to-write-local-version.patch"
-
-SRCBRANCH = "nxp/imx_4.9.11_1.0.0_ga"
-SRCREV = "07ef065dfe09f1c05a1a188c371577faa3677a17"
diff --git a/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_6.2.2.p0.bb b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_6.2.2.p0.bb
new file mode 100644
index 0000000..5514962
--- /dev/null
+++ b/recipes-graphics/xorg-driver/xf86-video-imxfb-vivante_6.2.2.p0.bb
@@ -0,0 +1,9 @@
+# Copyright (C) 2012-2016 Freescale Semiconductor
+# Copyright (C) 2012-2014 O.S. Systems Software LTDA.
+# Copyright 2017 NXP
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require xf86-video-imxfb-vivante.inc
+
+SRCBRANCH = "nxp/imx_4.9.11_1.0.0_ga"
+SRCREV = "07ef065dfe09f1c05a1a188c371577faa3677a17"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 11/14] gtk+3: Use egl pkgconfig for build setup
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (9 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 10/14] xf86-video-imxfb-vivante: Upgrade to 6.2.2.p0 Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 12/14] weston: Switch to 2.0 with i.MX fork Tom Hochstein
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 recipes-graphics/gtk+/gtk+3_%.bbappend | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/recipes-graphics/gtk+/gtk+3_%.bbappend b/recipes-graphics/gtk+/gtk+3_%.bbappend
index 7377c2c..be2bac7 100644
--- a/recipes-graphics/gtk+/gtk+3_%.bbappend
+++ b/recipes-graphics/gtk+/gtk+3_%.bbappend
@@ -1,8 +1,5 @@
+DEPENDS_append_imxgpu2d = " virtual/egl"
+
 PACKAGECONFIG_remove_imxgpu2d = " \
     ${@bb.utils.contains("DISTRO_FEATURES", "wayland", "x11", "", d)} \
 "
-
-CFLAGS_append_imxgpu2d = " \
-    -DLINUX \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', '-DEGL_API_FB -DEGL_API_WL', '', d)} \
-"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 12/14] weston: Switch to 2.0 with i.MX fork
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (10 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 11/14] gtk+3: Use egl pkgconfig for build setup Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 13/14] weston-init: Fix weston 2.0 startup for pam, systemd case Tom Hochstein
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

EGL support was removed from the fbdev compositor in Weston 2.0. Add
it back via an i.MX fork.

This has been verified with imx-gpu-viv v6 only.

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 conf/machine/include/imx-base.inc                  |    6 +-
 ...-configuration-option-for-no-input-device.patch |  112 --
 ...2-ccc-Add-GPU-VIV-support-for-weston-1.11.patch |  135 --
 ...1-configure.ac-Fix-wayland-protocols-path.patch |    2 +-
 .../wayland/weston/0001-make-error-portable.patch  |   12 +-
 .../0001-shared-include-stdint.h-for-int32_t.patch |   23 -
 ...ch-Provide-a-default-version-that-doesn-t.patch |   52 +-
 ...1-ccc-Enable-g2d-renderer-for-weston-1.11.patch | 1605 --------------------
 ...ld-Add-clone-mode-support-for-multi-displ.patch |  104 --
 ...68-xwld-System-can-not-boot-up-to-desktop.patch |   44 -
 ...ld-G2D-compositor-build-failed-in-slevk-b.patch |  146 --
 .../weston/0006-Link-compositor-to-egl.patch       |   12 -
 ...d-Fix-crash-when-run-with-no-input-device.patch |   47 -
 recipes-graphics/wayland/weston_1.11.1.bb          |  113 --
 recipes-graphics/wayland/weston_1.11.1.bbappend    |   46 -
 recipes-graphics/wayland/weston_2.0.0.bb           |  113 ++
 recipes-graphics/wayland/weston_2.0.0.bbappend     |   37 +
 17 files changed, 189 insertions(+), 2420 deletions(-)
 delete mode 100644 recipes-graphics/wayland/weston/0001-Add-configuration-option-for-no-input-device.patch
 delete mode 100644 recipes-graphics/wayland/weston/0001-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-1.11.patch
 delete mode 100644 recipes-graphics/wayland/weston/0001-shared-include-stdint.h-for-int32_t.patch
 delete mode 100644 recipes-graphics/wayland/weston/0002-MGS-2521-ccc-Enable-g2d-renderer-for-weston-1.11.patch
 delete mode 100644 recipes-graphics/wayland/weston/0003-MGS-1783-xwld-Add-clone-mode-support-for-multi-displ.patch
 delete mode 100644 recipes-graphics/wayland/weston/0004-MGS-1668-xwld-System-can-not-boot-up-to-desktop.patch
 delete mode 100644 recipes-graphics/wayland/weston/0005-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch
 delete mode 100644 recipes-graphics/wayland/weston/0006-Link-compositor-to-egl.patch
 delete mode 100644 recipes-graphics/wayland/weston/0007-xwayland-Fix-crash-when-run-with-no-input-device.patch
 delete mode 100644 recipes-graphics/wayland/weston_1.11.1.bb
 delete mode 100644 recipes-graphics/wayland/weston_1.11.1.bbappend
 create mode 100644 recipes-graphics/wayland/weston_2.0.0.bb
 create mode 100644 recipes-graphics/wayland/weston_2.0.0.bbappend

diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc
index 1dbe148..2d89bdb 100644
--- a/conf/machine/include/imx-base.inc
+++ b/conf/machine/include/imx-base.inc
@@ -218,6 +218,8 @@ PREFERRED_PROVIDER_virtual/libg2d_mx6ul = ""
 PREFERRED_PROVIDER_virtual/libg2d_mx6ull = ""
 PREFERRED_PROVIDER_virtual/libg2d_mx7ulp ?= "imx-gpu-viv"
 
+PREFERRED_VERSION_weston_imxgpu2d = "2.0.0"
+
 # Handle default kernel
 IMX_DEFAULT_KERNEL = "linux-imx"
 IMX_DEFAULT_KERNEL_mxs = "linux-fslc"
@@ -263,9 +265,5 @@ KERNEL_IMAGETYPE = "zImage"
 
 MACHINE_FEATURES = "usbgadget usbhost vfat alsa touchscreen"
 
-# Use weston 1.11.1 for mx6 and mx7 machines
-PREFERRED_VERSION_weston_mx6 = "1.11.1"
-PREFERRED_VERSION_weston_mx7 = "1.11.1"
-
 # Add the ability to specify _imx machines
 MACHINEOVERRIDES =. "imx:"
diff --git a/recipes-graphics/wayland/weston/0001-Add-configuration-option-for-no-input-device.patch b/recipes-graphics/wayland/weston/0001-Add-configuration-option-for-no-input-device.patch
deleted file mode 100644
index c45f3ad..0000000
--- a/recipes-graphics/wayland/weston/0001-Add-configuration-option-for-no-input-device.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-From 75b7197f4e072a4e2de124ddbe93b85cffb1c0f8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <daniel.diaz@linaro.org>
-Date: Fri, 21 Oct 2016 14:03:13 -0500
-Subject: [PATCH] Add configuration option for no input device.
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-As it has been discussed in the past [1], running Weston
-without any input device at launch might be beneficial for
-some use cases.
-
-Certainly, it's best for the vast majority of users (and
-the project) to require an input device to be present, as
-to avoid frustration and hassle, but for those brave souls
-that so prefer, this patch lets them run without any input
-device at all.
-
-This introduces a simple configuration in weston.ini:
-  [core]
-  require-input=true
-
-True is the default, so no behavioral change is introduced.
-
-[1] https://lists.freedesktop.org/archives/wayland-devel/2015-November/025193.html
-
-Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
-Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-Reviewed-by: Daniel Stone <daniels@collabora.com>
-
-Upstream-Status: backport from
-https://cgit.freedesktop.org/wayland/weston/commit/?id=75b7197f
----
- man/weston.ini.man  |    5 +++++
- src/compositor.h    |    3 +++
- src/libinput-seat.c |    6 ++++++
- src/main.c          |    5 +++++
- weston.ini.in       |    1 +
- 5 files changed, 20 insertions(+)
-
---- a/src/main.c
-+++ b/src/main.c
-@@ -1298,6 +1298,7 @@ int main(int argc, char *argv[])
- 	struct wl_client *primary_client;
- 	struct wl_listener primary_client_destroyed;
- 	struct weston_seat *seat;
-+      int require_input;
- 
- 	const struct weston_option core_options[] = {
- 		{ WESTON_OPTION_STRING, "backend", 'B', &backend },
-@@ -1373,6 +1374,10 @@ int main(int argc, char *argv[])
- 	if (weston_compositor_init_config(ec, config) < 0)
- 		goto out;
- 
-+	weston_config_section_get_bool(section, "require-input",
-+				       &require_input, true);
-+	ec->require_input = require_input;
-+
- 	if (load_backend(ec, backend, &argc, argv, config) < 0) {
- 		weston_log("fatal: failed to create compositor backend\n");
- 		goto out;
---- a/src/compositor.h
-+++ b/src/compositor.h
-@@ -803,6 +803,9 @@ struct weston_compositor {
- 
- 	void *user_data;
- 	void (*exit)(struct weston_compositor *c);
-+
-+	/* Whether to let the compositor run without any input device. */
-+	bool require_input;
- };
- 
- struct weston_buffer {
---- a/src/libinput-seat.c
-+++ b/src/libinput-seat.c
-@@ -255,6 +255,12 @@ udev_input_enable(struct udev_input *inp
- 			devices_found = 1;
- 	}
- 
-+	if (devices_found == 0 && !c->require_input) {
-+		weston_log("warning: no input devices found, but none required "
-+			   "as per configuration.\n");
-+		return 0;
-+	}
-+
- 	if (devices_found == 0) {
- 		weston_log(
- 			"warning: no input devices on entering Weston. "
---- a/man/weston.ini.man
-+++ b/man/weston.ini.man
-@@ -169,6 +169,11 @@ time, the one specified in the command-l
- hand, if none of these sets the value, default idle timeout will be
- set to 300 seconds.
- .RS
-+.PP
-+.RE
-+.TP 7
-+.BI "require-input=" true
-+require an input device for launch
- 
- .SH "LIBINPUT SECTION"
- The
---- a/weston.ini.in
-+++ b/weston.ini.in
-@@ -2,6 +2,7 @@
- #modules=xwayland.so,cms-colord.so
- #shell=desktop-shell.so
- #gbm-format=xrgb2101010
-+#require-input=true
- 
- [shell]
- background-image=/usr/share/backgrounds/gnome/Aqua.jpg
diff --git a/recipes-graphics/wayland/weston/0001-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-1.11.patch b/recipes-graphics/wayland/weston/0001-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-1.11.patch
deleted file mode 100644
index 37a2d4c..0000000
--- a/recipes-graphics/wayland/weston/0001-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-1.11.patch
+++ /dev/null
@@ -1,135 +0,0 @@
-From dfad4d734412e4ec53bfff29c7c503479857f66c Mon Sep 17 00:00:00 2001
-From: Meng Mingming <mingming.meng@nxp.com>
-Date: Mon, 9 Jan 2017 15:04:27 +0800
-Subject: [PATCH 1/5] MGS-2352 [#ccc] Add GPU-VIV support for weston 1.11
-
-Add GPU-VIV support for weston 1.11
-
-Upstream Status: Inappropriate [i.MX specific]
-
-Date: Jan 09, 2017
-Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
----
- src/compositor-fbdev.c | 37 ++++++++++++++++++++++++++++---------
- 1 file changed, 28 insertions(+), 9 deletions(-)
-
-diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
-index ee762e3..06f4696 100644
---- a/src/compositor-fbdev.c
-+++ b/src/compositor-fbdev.c
-@@ -61,6 +61,7 @@ struct fbdev_backend {
- 	int use_pixman;
- 	uint32_t output_transform;
- 	struct wl_listener session_listener;
-+	NativeDisplayType display;
- };
- 
- struct fbdev_screeninfo {
-@@ -93,6 +94,9 @@ struct fbdev_output {
- 	/* pixman details. */
- 	pixman_image_t *hw_surface;
- 	uint8_t depth;
-+
-+	NativeDisplayType display;
-+	NativeWindowType  window;
- };
- 
- struct gl_renderer_interface *gl_renderer;
-@@ -443,6 +447,10 @@ fbdev_frame_buffer_destroy(struct fbdev_output *output)
- 		           strerror(errno));
- 
- 	output->fb = NULL;
-+	if(output->window)
-+		fbDestroyWindow(output->window);
-+	if(output->display)
-+		fbDestroyDisplay(output->display);
- }
- 
- static void fbdev_output_destroy(struct weston_output *base);
-@@ -450,13 +458,13 @@ static void fbdev_output_disable(struct weston_output *base);
- 
- static int
- fbdev_output_create(struct fbdev_backend *backend,
--                    const char *device)
-+                   int x, int y, const char *device)
- {
- 	struct fbdev_output *output;
- 	int fb_fd;
- 	struct wl_event_loop *loop;
- 
--	weston_log("Creating fbdev output.\n");
-+	weston_log("Creating fbdev output. %s x=%d y=%d\n", device, x, y);
- 
- 	output = zalloc(sizeof *output);
- 	if (output == NULL)
-@@ -500,7 +508,7 @@ fbdev_output_create(struct fbdev_backend *backend,
- 	output->base.name = strdup("fbdev");
- 
- 	weston_output_init(&output->base, backend->compositor,
--	                   0, 0, output->fb_info.width_mm,
-+	                   x, y, output->fb_info.width_mm,
- 	                   output->fb_info.height_mm,
- 	                   backend->output_transform,
- 			   1);
-@@ -510,8 +518,13 @@ fbdev_output_create(struct fbdev_backend *backend,
- 			goto out_hw_surface;
- 	} else {
- 		setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
-+		output->window = fbCreateWindow(backend->display, -1, -1, 0, 0);
-+		if (output->window == NULL) {
-+			fprintf(stderr, "failed to create window\n");
-+			return 0;
-+		}
- 		if (gl_renderer->output_create(&output->base,
--					       (EGLNativeWindowType)NULL, NULL,
-+					       (EGLNativeWindowType)output->window, NULL,
- 					       gl_renderer->opaque_attribs,
- 					       NULL, 0) < 0) {
- 			weston_log("gl_renderer_output_create failed.\n");
-@@ -622,7 +635,7 @@ fbdev_output_reenable(struct fbdev_backend *backend,
- 		 * are re-initialised. */
- 		device = strdup(output->device);
- 		fbdev_output_destroy(&output->base);
--		fbdev_output_create(backend, device);
-+		fbdev_output_create(backend, 0, 0, device);
- 		free(device);
- 
- 		return 0;
-@@ -785,17 +798,21 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
- 			goto out_launcher;
- 		}
- 
-+		backend->display = fbGetDisplay(backend->compositor->wl_display);
-+		if (backend->display == NULL) {
-+			weston_log("fbGetDisplay failed.\n");
-+			goto out_launcher;
-+		}
- 		if (gl_renderer->create(compositor, NO_EGL_PLATFORM,
--					EGL_DEFAULT_DISPLAY,
-+					backend->display,
- 					gl_renderer->opaque_attribs,
- 					NULL, 0) < 0) {
- 			weston_log("gl_renderer_create failed.\n");
- 			goto out_launcher;
- 		}
- 	}
--
--	if (fbdev_output_create(backend, param->device) < 0)
--		goto out_launcher;
-+	if (fbdev_output_create(backend, 0, 0, param->device) < 0)
-+			goto out_launcher;
- 
- 	udev_input_init(&backend->input, compositor, backend->udev, seat_id);
- 
-@@ -844,6 +861,8 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
- 	config_init_to_defaults(&config);
- 	memcpy(&config, config_base, config_base->struct_size);
- 
-+	config.use_gl = 1;
-+
- 	b = fbdev_backend_create(compositor, argc, argv, wc, &config);
- 	if (b == NULL)
- 		return -1;
--- 
-2.7.4
-
diff --git a/recipes-graphics/wayland/weston/0001-configure.ac-Fix-wayland-protocols-path.patch b/recipes-graphics/wayland/weston/0001-configure.ac-Fix-wayland-protocols-path.patch
index edd3b91..5f4d79c 100644
--- a/recipes-graphics/wayland/weston/0001-configure.ac-Fix-wayland-protocols-path.patch
+++ b/recipes-graphics/wayland/weston/0001-configure.ac-Fix-wayland-protocols-path.patch
@@ -21,7 +21,7 @@ Upstream-Status: Inappropriate [embedded specific]
 @@ -187,7 +187,7 @@ PKG_CHECK_MODULES(LIBINPUT_BACKEND, [lib
  PKG_CHECK_MODULES(COMPOSITOR, [$COMPOSITOR_MODULES])
  
- PKG_CHECK_MODULES(WAYLAND_PROTOCOLS, [wayland-protocols >= 1.2],
+ PKG_CHECK_MODULES(WAYLAND_PROTOCOLS, [wayland-protocols >= 1.7],
 -		  [ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`])
 +		  [ac_wayland_protocols_pkgdatadir=${WAYLAND_PROTOCOLS_SYSROOT_DIR}`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`])
  AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
diff --git a/recipes-graphics/wayland/weston/0001-make-error-portable.patch b/recipes-graphics/wayland/weston/0001-make-error-portable.patch
index f7b5284..e2213ac 100644
--- a/recipes-graphics/wayland/weston/0001-make-error-portable.patch
+++ b/recipes-graphics/wayland/weston/0001-make-error-portable.patch
@@ -10,9 +10,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
 Upstream-Status: Submitted
 
- configure.ac        |    2 ++
- src/weston-error.h  |   20 ++++++++++++++++++++
- src/weston-launch.c |    2 +-
+ configure.ac              |    2 ++
+ libweston/weston-error.h  |   20 ++++++++++++++++++++
+ libweston/weston-launch.c |    2 +-
  3 files changed, 23 insertions(+), 1 deletion(-)
  create mode 100644 src/weston-error.h
 
@@ -28,7 +28,7 @@ Upstream-Status: Submitted
  
  COMPOSITOR_MODULES="wayland-server >= $WAYLAND_PREREQ_VERSION pixman-1 >= 0.25.2"
 --- /dev/null
-+++ b/src/weston-error.h
++++ b/libweston/weston-error.h
 @@ -0,0 +1,20 @@
 +#ifndef _WESTON_ERROR_H
 +#define _WESTON_ERROR_H
@@ -50,8 +50,8 @@ Upstream-Status: Submitted
 +
 +#endif
 +
---- a/src/weston-launch.c
-+++ b/src/weston-launch.c
+--- a/libweston/weston-launch.c
++++ b/libweston/weston-launch.c
 @@ -33,7 +33,6 @@
  #include <poll.h>
  #include <errno.h>
diff --git a/recipes-graphics/wayland/weston/0001-shared-include-stdint.h-for-int32_t.patch b/recipes-graphics/wayland/weston/0001-shared-include-stdint.h-for-int32_t.patch
deleted file mode 100644
index ee66c20..0000000
--- a/recipes-graphics/wayland/weston/0001-shared-include-stdint.h-for-int32_t.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From ba02b8abe4e2afac2bfbf2559972d5059d75a041 Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Date: Sat, 16 Jul 2016 22:50:19 +0300
-Subject: [PATCH weston] shared: include stdint.h for int32_t
-
-This fixes build on musl.
-
-Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Upstream-Status: Submitted
----
- shared/xalloc.h |    1 +
- 1 file changed, 1 insertion(+)
-
---- a/shared/xalloc.h
-+++ b/shared/xalloc.h
-@@ -30,6 +30,7 @@
- extern "C" {
- #endif
- 
-+#include <stdint.h>
- #include <stdlib.h>
- #include <string.h>
- 
diff --git a/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch b/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch
index d684b1c..70b9888 100644
--- a/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch
+++ b/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch
@@ -1,6 +1,6 @@
-From d02226b3d5872b184c1d50c7f4706ac9467ffb81 Mon Sep 17 00:00:00 2001
+From 8ff6ed03ec4079f32e9b34085414e57be4730e04 Mon Sep 17 00:00:00 2001
 From: Tom Hochstein <tom.hochstein@nxp.com>
-Date: Fri, 15 Jul 2016 11:00:15 +0300
+Date: Wed, 22 Feb 2017 15:53:30 +0200
 Subject: [PATCH] weston-launch: Provide a default version that doesn't require
  PAM
 
@@ -13,14 +13,17 @@ without non-root-user support.
 Upstream-Status: Pending
 
 Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
 ---
- configure.ac        |    9 +++++++--
- src/weston-launch.c |   20 ++++++++++++++++++++
+ configure.ac              |  9 +++++++--
+ libweston/weston-launch.c | 20 ++++++++++++++++++++
  2 files changed, 27 insertions(+), 2 deletions(-)
 
+diff --git a/configure.ac b/configure.ac
+index 46cb2c7..bb45f46 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -416,13 +416,17 @@ AC_ARG_ENABLE(resize-optimization,
+@@ -435,13 +435,17 @@ AC_ARG_ENABLE(resize-optimization,
  AS_IF([test "x$enable_resize_optimization" = "xyes"],
        [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a performance optimization])])
  
@@ -28,11 +31,11 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
 +            AS_HELP_STRING([--with-pam], [Use PAM]),
 +            [use_pam=$withval], [use_pam=yes])
  AC_ARG_ENABLE(weston-launch, [  --enable-weston-launch],, enable_weston_launch=yes)
- AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch == xyes)
--if test x$enable_weston_launch == xyes; then
+ AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch = xyes)
+-if test x$enable_weston_launch = xyes; then
 +if test x$enable_weston_launch = xyes -a x$use_pam = xyes; then
    WESTON_SEARCH_LIBS([PAM], [pam], [pam_open_session], [have_pam=yes], [have_pam=no])
-   if test x$have_pam == xno; then
+   if test x$have_pam = xno; then
 -    AC_ERROR([weston-launch requires pam])
 +    AC_ERROR([PAM support is explicitly requested, but libpam couldn't be found])
    fi
@@ -40,7 +43,7 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  fi
  
  AM_CONDITIONAL(HAVE_PANGO, test "x$have_pango" = "xyes")
-@@ -673,6 +677,7 @@ AC_MSG_RESULT([
+@@ -701,6 +705,7 @@ AC_MSG_RESULT([
  	Enable developer documentation	${enable_devdocs}
  
  	weston-launch utility		${enable_weston_launch}
@@ -48,8 +51,10 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  	systemd-login support		${have_systemd_login}
  	systemd notify support		${enable_systemd_notify}
  
---- a/src/weston-launch.c
-+++ b/src/weston-launch.c
+diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c
+index 0491896..07e7469 100644
+--- a/libweston/weston-launch.c
++++ b/libweston/weston-launch.c
 @@ -51,7 +51,9 @@
  
  #include <pwd.h>
@@ -71,7 +76,7 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  	int tty;
  	int ttynr;
  	int sock[2];
-@@ -181,6 +185,7 @@ weston_launch_allowed(struct weston_laun
+@@ -181,6 +185,7 @@ weston_launch_allowed(struct weston_launch *wl)
  	return false;
  }
  
@@ -87,7 +92,7 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  
  static int
  setup_launcher_socket(struct weston_launch *wl)
-@@ -414,6 +420,7 @@ quit(struct weston_launch *wl, int statu
+@@ -414,6 +420,7 @@ quit(struct weston_launch *wl, int status)
  	close(wl->signalfd);
  	close(wl->sock[0]);
  
@@ -95,7 +100,7 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  	if (wl->new_user) {
  		err = pam_close_session(wl->ph, 0);
  		if (err)
-@@ -421,6 +428,7 @@ quit(struct weston_launch *wl, int statu
+@@ -421,6 +428,7 @@ quit(struct weston_launch *wl, int status)
  				err, pam_strerror(wl->ph, err));
  		pam_end(wl->ph, err);
  	}
@@ -103,7 +108,7 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  
  	if (ioctl(wl->tty, KDSKBMUTE, 0) &&
  	    ioctl(wl->tty, KDSKBMODE, wl->kb_mode))
-@@ -600,6 +608,7 @@ setup_session(struct weston_launch *wl)
+@@ -600,6 +608,7 @@ setup_session(struct weston_launch *wl, char **child_argv)
  	setenv("HOME", wl->pw->pw_dir, 1);
  	setenv("SHELL", wl->pw->pw_shell, 1);
  
@@ -111,15 +116,15 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  	env = pam_getenvlist(wl->ph);
  	if (env) {
  		for (i = 0; env[i]; ++i) {
-@@ -608,6 +617,7 @@ setup_session(struct weston_launch *wl)
+@@ -608,6 +617,7 @@ setup_session(struct weston_launch *wl, char **child_argv)
  		}
  		free(env);
  	}
 +#endif
- }
  
- static void
-@@ -665,7 +675,9 @@ static void
+ 	/*
+ 	 * We open a new session, so it makes sense
+@@ -675,7 +685,9 @@ static void
  help(const char *name)
  {
  	fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\n", name);
@@ -129,7 +134,7 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  	fprintf(stderr, "  -t, --tty       Start session on alternative tty\n");
  	fprintf(stderr, "  -v, --verbose   Be verbose\n");
  	fprintf(stderr, "  -h, --help      Display this help message\n");
-@@ -678,7 +690,9 @@ main(int argc, char *argv[])
+@@ -688,7 +700,9 @@ main(int argc, char *argv[])
  	int i, c;
  	char *tty = NULL;
  	struct option opts[] = {
@@ -139,7 +144,7 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  		{ "tty",     required_argument, NULL, 't' },
  		{ "verbose", no_argument,       NULL, 'v' },
  		{ "help",    no_argument,       NULL, 'h' },
-@@ -690,9 +704,13 @@ main(int argc, char *argv[])
+@@ -700,9 +714,13 @@ main(int argc, char *argv[])
  	while ((c = getopt_long(argc, argv, "u:t::vh", opts, &i)) != -1) {
  		switch (c) {
  		case 'u':
@@ -153,7 +158,7 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  			break;
  		case 't':
  			tty = optarg;
-@@ -732,8 +750,10 @@ main(int argc, char *argv[])
+@@ -740,8 +758,10 @@ main(int argc, char *argv[])
  	if (setup_tty(&wl, tty) < 0)
  		exit(EXIT_FAILURE);
  
@@ -164,3 +169,6 @@ Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
  
  	if (setup_launcher_socket(&wl) < 0)
  		exit(EXIT_FAILURE);
+-- 
+2.1.4
+
diff --git a/recipes-graphics/wayland/weston/0002-MGS-2521-ccc-Enable-g2d-renderer-for-weston-1.11.patch b/recipes-graphics/wayland/weston/0002-MGS-2521-ccc-Enable-g2d-renderer-for-weston-1.11.patch
deleted file mode 100644
index 858cb81..0000000
--- a/recipes-graphics/wayland/weston/0002-MGS-2521-ccc-Enable-g2d-renderer-for-weston-1.11.patch
+++ /dev/null
@@ -1,1605 +0,0 @@
-From 1995ec08267c8063ca72590e700c8612b04a63b5 Mon Sep 17 00:00:00 2001
-From: Meng Mingming <mingming.meng@nxp.com>
-Date: Mon, 16 Jan 2017 10:15:02 +0800
-Subject: [PATCH 2/5] MGS-2521 [#ccc] Enable g2d-renderer for weston 1.11
-
-Enable g2d-renderer for weston 1.11
-weston-start -- --use-g2d=1(--use-gl=1) $OPTARGS
-
-Upstream Status: Inappropriate [i.MX specific]
-
-Date: Jan 16, 2017
-Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
----
- Makefile.am            |   16 +
- src/compositor-fbdev.c |   66 ++-
- src/compositor-fbdev.h |    1 +
- src/g2d-renderer.c     | 1317 ++++++++++++++++++++++++++++++++++++++++++++++++
- src/g2d-renderer.h     |   47 ++
- src/main.c             |    6 +-
- 6 files changed, 1448 insertions(+), 5 deletions(-)
- create mode 100644 src/g2d-renderer.c
- create mode 100644 src/g2d-renderer.h
-
-diff --git a/Makefile.am b/Makefile.am
-index 00b74e5..a044b64 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -248,6 +248,22 @@ gl_renderer_la_SOURCES =			\
- 	shared/helpers.h
- endif
- 
-+module_LTLIBRARIES += g2d-renderer.la
-+g2d_renderer_la_LDFLAGS = -module -avoid-version
-+g2d_renderer_la_LIBADD = $(COMPOSITOR_LIBS) $(EGL_LIBS) -lg2d
-+g2d_renderer_la_CFLAGS =                       \
-+       $(COMPOSITOR_CFLAGS)                    \
-+       $(EGL_CFLAGS)                           \
-+       $(GCC_CFLAGS) -DHAVE_G2D
-+g2d_renderer_la_SOURCES =                      \
-+       src/g2d-renderer.h                      \
-+       src/g2d-renderer.c                      \
-+       src/vertex-clipping.c                   \
-+       src/vertex-clipping.h
-+if ENABLE_EGL
-+g2d_renderer_la_CFLAGS += -DENABLE_EGL
-+endif
-+
- if ENABLE_X11_COMPOSITOR
- module_LTLIBRARIES += x11-backend.la
- x11_backend_la_LDFLAGS = -module -avoid-version
-diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
-index 06f4696..cff9513 100644
---- a/src/compositor-fbdev.c
-+++ b/src/compositor-fbdev.c
-@@ -50,6 +50,7 @@
- #include "libinput-seat.h"
- #include "gl-renderer.h"
- #include "presentation-time-server-protocol.h"
-+#include "g2d-renderer.h"
- 
- struct fbdev_backend {
- 	struct weston_backend base;
-@@ -59,6 +60,7 @@ struct fbdev_backend {
- 	struct udev *udev;
- 	struct udev_input input;
- 	int use_pixman;
-+	int use_g2d;
- 	uint32_t output_transform;
- 	struct wl_listener session_listener;
- 	NativeDisplayType display;
-@@ -100,6 +102,7 @@ struct fbdev_output {
- };
- 
- struct gl_renderer_interface *gl_renderer;
-+struct g2d_renderer_interface *g2d_renderer;
- 
- static const char default_seat[] = "seat0";
- 
-@@ -516,6 +519,14 @@ fbdev_output_create(struct fbdev_backend *backend,
- 	if (backend->use_pixman) {
- 		if (pixman_renderer_output_create(&output->base) < 0)
- 			goto out_hw_surface;
-+	} else if(backend->use_g2d) {
-+		const char *g2d_device = device;
-+
-+		if (g2d_renderer->output_create(&output->base,
-+							backend->compositor->wl_display, g2d_device) < 0) {
-+				weston_log("g2d_renderer_output_create failed.\n");
-+				goto out_hw_surface;
-+		}
- 	} else {
- 		setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
- 		output->window = fbCreateWindow(backend->display, -1, -1, 0, 0);
-@@ -571,6 +582,8 @@ fbdev_output_destroy(struct weston_output *base)
- 	if (backend->use_pixman) {
- 		if (base->renderer_state != NULL)
- 			pixman_renderer_output_destroy(base);
-+	} else if(backend->use_g2d) {
-+		g2d_renderer->output_destroy(base);
- 	} else {
- 		gl_renderer->output_destroy(base);
- 	}
-@@ -782,7 +795,8 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
- 	backend->base.restore = fbdev_restore;
- 
- 	backend->prev_state = WESTON_COMPOSITOR_ACTIVE;
--	backend->use_pixman = !param->use_gl;
-+	backend->use_pixman = !(param->use_gl || param->use_g2d);
-+	backend->use_g2d = param->use_g2d;
- 	backend->output_transform = param->output_transform;
- 
- 	weston_setup_vt_switch_bindings(compositor);
-@@ -790,6 +804,46 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
- 	if (backend->use_pixman) {
- 		if (pixman_renderer_init(compositor) < 0)
- 			goto out_launcher;
-+	} else if(backend->use_g2d) {
-+		int x = 0, y = 0;
-+		int i=0;
-+		int count = 0;
-+		int k=0, dispCount = 0;
-+		char displays[5][32];
-+		g2d_renderer = weston_load_module("g2d-renderer.so",
-+											"g2d_renderer_interface");
-+		if (!g2d_renderer) {
-+			weston_log("could not load g2d renderer\n");
-+			goto out_launcher;
-+		}
-+
-+		if (g2d_renderer->create(backend->compositor) < 0) {
-+			weston_log("g2d_renderer_create failed.\n");
-+			goto out_launcher;
-+		}
-+
-+		weston_log("param->device=%s\n",param->device);
-+		count = strlen(param->device);
-+
-+		for(i= 0; i < count; i++) {
-+			if(param->device[i] == ',') {
-+				displays[dispCount][k] = '\0';
-+				dispCount++;
-+				k = 0;
-+				continue;
-+			}
-+			displays[dispCount][k++] = param->device[i];
-+		}
-+		displays[dispCount][k] = '\0';
-+		dispCount++;
-+
-+		for(i= 0; i < dispCount; i++){
-+			if (fbdev_output_create(backend, x, y, displays[i]) < 0)
-+				goto out_launcher;
-+			x += container_of(backend->compositor->output_list.prev,
-+							struct weston_output,
-+							link)->width;
-+		}
- 	} else {
- 		gl_renderer = weston_load_module("gl-renderer.so",
- 						 "gl_renderer_interface");
-@@ -811,7 +865,8 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
- 			goto out_launcher;
- 		}
- 	}
--	if (fbdev_output_create(backend, 0, 0, param->device) < 0)
-+	if(!backend->use_g2d)
-+		if (fbdev_output_create(backend, 0, 0, param->device) < 0)
- 			goto out_launcher;
- 
- 	udev_input_init(&backend->input, compositor, backend->udev, seat_id);
-@@ -840,6 +895,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config *config)
- 	config->tty = 0; /* default to current tty */
- 	config->device = "/dev/fb0"; /* default frame buffer */
- 	config->use_gl = 0;
-+	config->use_g2d = 0;
- 	config->output_transform = WL_OUTPUT_TRANSFORM_NORMAL;
- }
- 
-@@ -861,7 +917,11 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
- 	config_init_to_defaults(&config);
- 	memcpy(&config, config_base, config_base->struct_size);
- 
--	config.use_gl = 1;
-+	if(config.use_g2d) {
-+		config.use_gl = 0;
-+	} else {
-+		config.use_gl = 1;
-+	}
- 
- 	b = fbdev_backend_create(compositor, argc, argv, wc, &config);
- 	if (b == NULL)
-diff --git a/src/compositor-fbdev.h b/src/compositor-fbdev.h
-index bd60bdc..32a8598 100644
---- a/src/compositor-fbdev.h
-+++ b/src/compositor-fbdev.h
-@@ -40,6 +40,7 @@ struct weston_fbdev_backend_config {
- 	int tty;
- 	char *device;
- 	int use_gl;
-+	int use_g2d;
- 
- 	uint32_t output_transform;
- };
-diff --git a/src/g2d-renderer.c b/src/g2d-renderer.c
-new file mode 100644
-index 0000000..c30aa62
---- /dev/null
-+++ b/src/g2d-renderer.c
-@@ -0,0 +1,1317 @@
-+/*
-+ * Copyright (c) 2016 Freescale Semiconductor, Inc.
-+ * Copyright © 2012 Intel Corporation
-+ * Copyright © 2015 Collabora, Ltd.
-+ *
-+ * 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.
-+ */
-+
-+#define _GNU_SOURCE
-+
-+#include <stdlib.h>
-+#include <string.h>
-+#include <ctype.h>
-+#include <float.h>
-+#include <assert.h>
-+#include <pthread.h>
-+#include <linux/fb.h>
-+#include <sys/ioctl.h>
-+#include <fcntl.h>
-+#include <unistd.h>
-+#include <g2dExt.h>
-+#include <HAL/gc_hal_eglplatform.h>
-+
-+#include "compositor.h"
-+#include "g2d-renderer.h"
-+#include "vertex-clipping.h"
-+#include "shared/helpers.h"
-+
-+#define BUFFER_DAMAGE_COUNT 2
-+#define ALIGN_WIDTH(a) (((a) + 15) & ~15)
-+
-+struct wl_viv_buffer
-+{
-+    struct wl_resource *resource;
-+    gcoSURF  surface;
-+    gctINT32 width;
-+    gctINT32 height;
-+    gctINT32 format;
-+    gctUINT alignedWidth;
-+    gctUINT alignedHeight;
-+    gctUINT32 physical[3];
-+    gctUINT32 gpuBaseAddr;
-+    gceTILING tiling;
-+};
-+
-+typedef struct _g2dRECT
-+{
-+	int left;
-+	int top;
-+	int right;
-+	int bottom;
-+} g2dRECT;
-+
-+struct fb_screeninfo {
-+	struct fb_var_screeninfo varinfo;
-+	struct fb_fix_screeninfo fixinfo;
-+	unsigned int x_resolution;
-+	unsigned int y_resolution;
-+	size_t buffer_length; /* length of frame buffer memory in bytes */
-+	size_t physical;
-+	size_t stride;
-+	size_t stride_bytes;
-+	enum g2d_format pixel_format; /* frame buffer pixel format */
-+	int fb_fd;
-+};
-+
-+struct g2d_output_state {
-+	int current_buffer;
-+	pixman_region32_t buffer_damage[BUFFER_DAMAGE_COUNT];
-+	struct g2d_surfaceEx *renderSurf;
-+	int nNumBuffers;
-+	int activebuffer;
-+	struct g2d_surfaceEx offscreenSurface;
-+	struct g2d_buf *offscreen_buf;
-+	struct fb_screeninfo fb_info;
-+	struct fb_screeninfo *mirror_fb_info;
-+	struct g2d_surfaceEx *mirrorSurf;
-+	int directBlit;
-+	int clone_display_num;
-+	int width;
-+	int height;
-+};
-+
-+struct g2d_surface_state {
-+	float color[4];
-+	struct weston_buffer_reference buffer_ref;
-+	int pitch; /* in pixels */
-+	int attached;
-+	pixman_region32_t texture_damage;
-+	struct g2d_surfaceEx g2d_surface;
-+	struct g2d_buf *shm_buf;
-+	int shm_buf_length;
-+	int bpp;
-+
-+	struct weston_surface *surface;
-+	struct wl_listener surface_destroy_listener;
-+	struct wl_listener renderer_destroy_listener;
-+};
-+
-+struct g2d_renderer {
-+	struct weston_renderer base;
-+	struct wl_signal destroy_signal;
-+#ifdef ENABLE_EGL
-+	NativeDisplayType display;
-+	EGLDisplay egl_display;
-+	struct wl_display *wl_display;
-+#endif
-+	void *handle;
-+};
-+
-+static int
-+g2d_renderer_create_surface(struct weston_surface *surface);
-+
-+static inline struct g2d_surface_state *
-+get_surface_state(struct weston_surface *surface)
-+{
-+	if (!surface->renderer_state)
-+		g2d_renderer_create_surface(surface);
-+	return (struct g2d_surface_state *)surface->renderer_state;
-+}
-+
-+static inline struct g2d_renderer *
-+get_renderer(struct weston_compositor *ec)
-+{
-+	return (struct g2d_renderer *)ec->renderer;
-+}
-+
-+#define max(a, b) (((a) > (b)) ? (a) : (b))
-+#define min(a, b) (((a) > (b)) ? (b) : (a))
-+/*
-+ * Compute the boundary vertices of the intersection of the global coordinate
-+ * aligned rectangle 'rect', and an arbitrary quadrilateral produced from
-+ * 'surf_rect' when transformed from surface coordinates into global coordinates.
-+ * The vertices are written to 'ex' and 'ey', and the return value is the
-+ * number of vertices. Vertices are produced in clockwise winding order.
-+ * Guarantees to produce either zero vertices, or 3-8 vertices with non-zero
-+ * polygon area.
-+ */
-+static int
-+calculate_edges(struct weston_view *ev, pixman_box32_t *rect,
-+		pixman_box32_t *surf_rect, float *ex, float *ey)
-+{
-+
-+	struct clip_context ctx;
-+	int i, n;
-+	float min_x, max_x, min_y, max_y;
-+	struct polygon8 surf = {
-+		{ surf_rect->x1, surf_rect->x2, surf_rect->x2, surf_rect->x1 },
-+		{ surf_rect->y1, surf_rect->y1, surf_rect->y2, surf_rect->y2 },
-+		4
-+	};
-+
-+	ctx.clip.x1 = rect->x1;
-+	ctx.clip.y1 = rect->y1;
-+	ctx.clip.x2 = rect->x2;
-+	ctx.clip.y2 = rect->y2;
-+
-+	/* transform surface to screen space: */
-+	for (i = 0; i < surf.n; i++)
-+		weston_view_to_global_float(ev, surf.x[i], surf.y[i],
-+					    &surf.x[i], &surf.y[i]);
-+
-+	/* find bounding box: */
-+	min_x = max_x = surf.x[0];
-+	min_y = max_y = surf.y[0];
-+
-+	for (i = 1; i < surf.n; i++) {
-+		min_x = min(min_x, surf.x[i]);
-+		max_x = max(max_x, surf.x[i]);
-+		min_y = min(min_y, surf.y[i]);
-+		max_y = max(max_y, surf.y[i]);
-+	}
-+
-+	/* First, simple bounding box check to discard early transformed
-+	 * surface rects that do not intersect with the clip region:
-+	 */
-+	if ((min_x >= ctx.clip.x2) || (max_x <= ctx.clip.x1) ||
-+	    (min_y >= ctx.clip.y2) || (max_y <= ctx.clip.y1))
-+		return 0;
-+
-+	/* Simple case, bounding box edges are parallel to surface edges,
-+	 * there will be only four edges.  We just need to clip the surface
-+	 * vertices to the clip rect bounds:
-+	 */
-+	if (!ev->transform.enabled)
-+		return clip_simple(&ctx, &surf, ex, ey);
-+
-+	/* Transformed case: use a general polygon clipping algorithm to
-+	 * clip the surface rectangle with each side of 'rect'.
-+	 * The algorithm is Sutherland-Hodgman, as explained in
-+	 * http://www.codeguru.com/cpp/misc/misc/graphics/article.php/c8965/Polygon-Clipping.htm
-+	 * but without looking at any of that code.
-+	 */
-+	n = clip_transformed(&ctx, &surf, ex, ey);
-+
-+	if (n < 3)
-+		return 0;
-+
-+	return n;
-+}
-+
-+
-+static inline struct g2d_output_state *
-+get_output_state(struct weston_output *output)
-+{
-+	return (struct g2d_output_state *)output->renderer_state;
-+}
-+
-+static void
-+g2d_getG2dTiling(IN gceTILING tiling, enum g2d_tiling* g2dTiling)
-+{
-+	switch(tiling)
-+	{
-+	case gcvLINEAR:
-+		*g2dTiling = G2D_LINEAR;
-+		break;
-+	case gcvTILED:
-+		*g2dTiling = G2D_TILED;
-+		break;
-+	case gcvSUPERTILED:
-+		*g2dTiling = G2D_SUPERTILED;
-+		break;
-+	default:
-+		weston_log("Error in function %s\n", __func__);
-+		break;
-+	}
-+}
-+
-+static void
-+g2d_getG2dFormat(IN gceSURF_FORMAT Format, enum g2d_format* g2dFormat)
-+{
-+	switch(Format)
-+	{
-+	case gcvSURF_R5G6B5:
-+		*g2dFormat = G2D_RGB565;
-+		break;
-+	case gcvSURF_A8B8G8R8:
-+		*g2dFormat = G2D_RGBA8888;
-+		break;
-+	case gcvSURF_X8B8G8R8:
-+		*g2dFormat = G2D_RGBA8888;
-+		break;
-+	case gcvSURF_A8R8G8B8:
-+		*g2dFormat = G2D_BGRA8888;
-+		break;
-+	case gcvSURF_X8R8G8B8:
-+		*g2dFormat = G2D_BGRX8888;
-+		break;
-+	case gcvSURF_B5G6R5:
-+		*g2dFormat = G2D_BGR565;
-+		break;
-+	case gcvSURF_B8G8R8A8:
-+		*g2dFormat = G2D_ARGB8888;
-+		break;
-+	case gcvSURF_R8G8B8A8:
-+		*g2dFormat = G2D_ABGR8888;
-+		break;
-+	case gcvSURF_B8G8R8X8:
-+		*g2dFormat = G2D_XRGB8888;
-+		break;
-+	case gcvSURF_R8G8B8X8:
-+		*g2dFormat = G2D_XBGR8888;
-+		break;
-+	case gcvSURF_NV12:
-+		*g2dFormat = G2D_NV12;
-+		break;
-+	case gcvSURF_NV21:
-+		*g2dFormat = G2D_NV21;
-+		break;
-+	case gcvSURF_I420:
-+		*g2dFormat = G2D_I420;
-+		break;
-+	case gcvSURF_YV12:
-+		*g2dFormat = G2D_YV12;
-+		break;
-+	case gcvSURF_YUY2:
-+		*g2dFormat = G2D_YUYV;
-+		break;
-+	case gcvSURF_YVYU:
-+		*g2dFormat = G2D_YVYU;
-+		break;
-+	case gcvSURF_UYVY:
-+		*g2dFormat = G2D_UYVY;
-+		break;
-+	case gcvSURF_VYUY:
-+		*g2dFormat = G2D_VYUY;
-+		break;
-+	case gcvSURF_NV16:
-+		*g2dFormat = G2D_NV16;
-+		break;
-+	case gcvSURF_NV61:
-+		*g2dFormat = G2D_NV61;
-+		break;
-+	default:
-+		weston_log("Error in function %s, Format not supported\n", __func__);
-+		break;
-+	}
-+}
-+
-+static void printG2dSurfaceInfo(struct g2d_surfaceEx* g2dSurface, const char* msg)
-+{
-+	weston_log("%s physicAddr = %x left = %d right = %d top=%d bottom=%d stride= %d tiling = %d, format=%d \n",
-+				msg,
-+				g2dSurface->base.planes[0],
-+				g2dSurface->base.left,
-+				g2dSurface->base.right,
-+				g2dSurface->base.top,
-+				g2dSurface->base.bottom,
-+				g2dSurface->base.stride,
-+				g2dSurface->tiling,
-+				g2dSurface->base.format);
-+}
-+
-+static void
-+get_g2dSurface(struct wl_viv_buffer *buffer, struct g2d_surfaceEx *g2dSurface)
-+{
-+	if(buffer->width < 0 || buffer->height < 0)
-+	{
-+		weston_log("invalid EGL buffer in function %s\n", __func__);
-+		return;
-+	}
-+	g2d_getG2dFormat(buffer->format, &g2dSurface->base.format);
-+	g2d_getG2dTiling(buffer->tiling, &g2dSurface->tiling);
-+	g2dSurface->base.planes[0] = buffer->physical[0] + buffer->gpuBaseAddr;
-+	g2dSurface->base.planes[1] = buffer->physical[1] + buffer->gpuBaseAddr;
-+	g2dSurface->base.planes[2] = buffer->physical[2] + buffer->gpuBaseAddr;
-+	g2dSurface->base.left = 0;
-+	g2dSurface->base.top = 0;
-+	g2dSurface->base.right = buffer->width;
-+	g2dSurface->base.bottom = buffer->height;
-+	g2dSurface->base.stride = buffer->alignedWidth;
-+	g2dSurface->base.width  = buffer->width;
-+	g2dSurface->base.height = buffer->height;
-+	g2dSurface->base.rot    = G2D_ROTATION_0;
-+}
-+
-+static void
-+g2d_SetSurfaceRect(struct g2d_surfaceEx* g2dSurface, g2dRECT* rect)
-+{
-+	if(g2dSurface && rect)
-+	{
-+		g2dSurface->base.left   = rect->left;
-+		g2dSurface->base.top    = rect->top;
-+		g2dSurface->base.right  = rect->right;
-+		g2dSurface->base.bottom = rect->bottom;
-+	}
-+}
-+
-+static int
-+g2d_blitSurface(void *handle, struct g2d_surfaceEx * srcG2dSurface, struct g2d_surfaceEx *dstG2dSurface, 
-+	g2dRECT *srcRect, g2dRECT *dstRect)
-+{
-+	g2d_SetSurfaceRect(srcG2dSurface, srcRect);
-+	g2d_SetSurfaceRect(dstG2dSurface, dstRect);
-+	srcG2dSurface->base.blendfunc = G2D_ONE;
-+	dstG2dSurface->base.blendfunc = G2D_ONE_MINUS_SRC_ALPHA;
-+
-+	if(g2d_blitEx(handle, srcG2dSurface, dstG2dSurface))
-+	{
-+		printG2dSurfaceInfo(srcG2dSurface, "SRC:");
-+		printG2dSurfaceInfo(dstG2dSurface, "DST:");
-+		return -1;
-+	}
-+	return 0;
-+}
-+
-+static void
-+g2d_flip_surface(struct weston_output *output)
-+{
-+	struct g2d_output_state *go = get_output_state(output);
-+	go->fb_info.varinfo.yoffset  = go->activebuffer * go->fb_info.y_resolution;
-+
-+	if(ioctl(go->fb_info.fb_fd, FBIOPAN_DISPLAY, &(go->fb_info.varinfo)) < 0)
-+	{
-+		weston_log("FBIOPAN_DISPLAY Failed\n");
-+	}
-+	go->activebuffer = (go->activebuffer + 1)  % go->nNumBuffers;
-+}
-+
-+static void
-+copy_to_framebuffer(struct weston_output *output)
-+{
-+	struct g2d_renderer *gr = get_renderer(output->compositor);
-+	struct g2d_output_state *go = get_output_state(output);
-+	if(!go->directBlit && go->nNumBuffers == 1)
-+	{
-+		g2dRECT srcRect  = {0, 0, go->offscreenSurface.base.width, go->offscreenSurface.base.height};
-+		g2dRECT dstrect  = srcRect;
-+		g2dRECT clipRect = srcRect;
-+		g2d_set_clipping(gr->handle, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
-+		g2d_blitSurface(gr->handle, &go->offscreenSurface,
-+			&go->renderSurf[go->activebuffer], &srcRect, &dstrect);
-+	}
-+
-+	if(go->clone_display_num)
-+	{
-+		int i = 0;
-+		for(i = 0; i < go->clone_display_num; i++)
-+		{
-+			g2dRECT srcRect  = {0, 0, go->renderSurf[go->activebuffer].base.width, go->renderSurf[go->activebuffer].base.height};
-+			g2dRECT dstrect  = {0, 0, go->mirrorSurf[i].base.width, go->mirrorSurf[i].base.height};
-+			g2dRECT clipRect = srcRect;
-+			g2d_set_clipping(gr->handle, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
-+			if(go->directBlit || go->nNumBuffers > 1)
-+			{
-+				g2d_blitSurface(gr->handle, &go->renderSurf[go->activebuffer],
-+				&go->mirrorSurf[i], &srcRect, &dstrect);
-+			}
-+			else
-+			{
-+				g2d_blitSurface(gr->handle, &go->offscreenSurface,
-+					&go->mirrorSurf[i], &srcRect, &dstrect);
-+			}
-+		}
-+	}
-+
-+	g2d_finish(gr->handle);
-+
-+	if(go->nNumBuffers > 1)
-+	{
-+		g2d_flip_surface(output);
-+	}
-+}
-+
-+static int
-+is_view_visible(struct weston_view *view)
-+{
-+	/* Return false, if surface is guaranteed to be totally obscured. */
-+	int ret;
-+	pixman_region32_t unocc;
-+
-+	pixman_region32_init(&unocc);
-+	pixman_region32_subtract(&unocc, &view->transform.boundingbox,
-+				 &view->clip);
-+	ret = pixman_region32_not_empty(&unocc);
-+	pixman_region32_fini(&unocc);
-+
-+	return ret;
-+}
-+ 
-+static void
-+use_output(struct weston_output *output)
-+{
-+	struct weston_compositor *compositor = output->compositor;
-+	struct weston_view *view;
-+	struct g2d_output_state *go = get_output_state(output);
-+	int visibleViews=0;
-+	int fullscreenViews=0;
-+
-+	if(go->nNumBuffers == 1)
-+	{
-+		wl_list_for_each_reverse(view, &compositor->view_list, link)
-+			if (view->plane == &compositor->primary_plane && is_view_visible(view))
-+			{
-+				visibleViews++;
-+				if(view->surface->width == go->width && view->surface->height == go->height)
-+				{
-+					pixman_box32_t *bb_rects;
-+					int nbb=0;
-+					bb_rects = pixman_region32_rectangles(&view->transform.boundingbox, &nbb);
-+					if(nbb == 1)
-+						if(bb_rects[0].x1 == 0 && bb_rects[0].y1 ==0)
-+							fullscreenViews++;
-+				}
-+			}
-+
-+		go->directBlit = ((visibleViews == 1) || (fullscreenViews > 1));
-+	}
-+}
-+
-+static int
-+g2d_renderer_read_pixels(struct weston_output *output,
-+			       pixman_format_code_t format, void *pixels,
-+			       uint32_t x, uint32_t y,
-+			       uint32_t width, uint32_t height)
-+{
-+	return 0;
-+}
-+
-+static int g2d_int_from_double(double d)
-+{
-+	return wl_fixed_to_int(wl_fixed_from_double(d));
-+}
-+
-+static void
-+repaint_region(struct weston_view *ev, struct weston_output *output, struct g2d_output_state *go, pixman_region32_t *region,
-+		pixman_region32_t *surf_region){
-+
-+	struct g2d_renderer *gr = get_renderer(ev->surface->compositor);
-+	struct g2d_surface_state *gs = get_surface_state(ev->surface);
-+
-+	pixman_box32_t *rects, *surf_rects, *bb_rects;
-+	int i, j, nrects, nsurf, nbb=0;
-+	g2dRECT srcRect = {0};
-+	g2dRECT dstrect = {0};
-+	g2dRECT clipRect = {0};
-+	int dstWidth = 0;
-+	int dstHeight = 0;
-+	struct g2d_surfaceEx *dstsurface;
-+
-+	bb_rects = pixman_region32_rectangles(&ev->transform.boundingbox, &nbb);
-+
-+	if(!gs->attached || nbb <= 0)
-+	{
-+		return;
-+	}
-+
-+	rects = pixman_region32_rectangles(region, &nrects);
-+	surf_rects = pixman_region32_rectangles(surf_region, &nsurf);
-+	srcRect.left = ev->geometry.x < 0.0 ? g2d_int_from_double(fabsf(ev->geometry.x)) : 0;
-+	srcRect.top  = ev->geometry.y < 0.0 ? g2d_int_from_double(fabsf(ev->geometry.y)) : 0;
-+	srcRect.right  = ev->surface->width;
-+	srcRect.bottom = ev->surface->height;
-+	if(go->nNumBuffers > 1 || go->directBlit)
-+	{
-+		dstsurface = &go->renderSurf[go->activebuffer];
-+	}
-+	else
-+	{
-+		dstsurface = &go->offscreenSurface;
-+	}
-+	dstWidth  = dstsurface->base.width;
-+	dstHeight = dstsurface->base.height;
-+	for (i = 0; i < nrects; i++)
-+	{
-+		pixman_box32_t *rect = &rects[i];
-+		gctFLOAT min_x, max_x, min_y, max_y;
-+
-+		dstrect.left = (bb_rects[0].x1 < 0) ? rect->x1 : bb_rects[0].x1;
-+		dstrect.top = (bb_rects[0].y1 < 0) ? rect->y1 : bb_rects[0].y1;
-+		dstrect.right = bb_rects[0].x2;
-+		dstrect.bottom = bb_rects[0].y2;
-+		/*Multi display support*/
-+		if(output->x > 0)
-+		{
-+			dstrect.left = dstrect.left - output->x;
-+			dstrect.right = dstrect.right - output->x;
-+		}
-+		if(dstrect.left < 0)
-+		{
-+			srcRect.left -= dstrect.left;
-+			dstrect.left = 0;
-+			if(srcRect.left > ev->surface->width)
-+				break;
-+		}
-+		if(dstrect.right > dstWidth)
-+		{
-+			dstrect.right = dstWidth;
-+			srcRect.right = srcRect.left + dstrect.right - dstrect.left;
-+			if(srcRect.right > ev->surface->width)
-+				break;
-+		}
-+		if(dstrect.bottom > dstHeight)
-+		{
-+			dstrect.bottom = dstHeight;
-+			srcRect.bottom = srcRect.top + dstrect.bottom - dstrect.top;
-+			if(srcRect.bottom < 0)
-+				break;
-+		}
-+
-+		for (j = 0; j < nsurf; j++)
-+		{
-+			pixman_box32_t *surf_rect = &surf_rects[j];
-+			gctFLOAT ex[8], ey[8];          /* edge points in screen space */
-+			int n;
-+			int m=0;
-+			n = calculate_edges(ev, rect, surf_rect, ex, ey);
-+			if (n < 3)
-+				continue;
-+
-+			min_x = max_x = ex[0];
-+			min_y = max_y = ey[0];
-+			for (m = 1; m < n; m++)
-+			{
-+				min_x = min(min_x, ex[m]);
-+				max_x = max(max_x, ex[m]);
-+				min_y = min(min_y, ey[m]);
-+				max_y = max(max_y, ey[m]);
-+			}
-+
-+			clipRect.left = g2d_int_from_double(min_x);
-+			clipRect.top = g2d_int_from_double(min_y);
-+			clipRect.right = g2d_int_from_double(max_x);
-+			clipRect.bottom = g2d_int_from_double(max_y);
-+
-+			if(output->x > 0)
-+			{
-+				clipRect.left = clipRect.left - output->x;
-+				clipRect.right = clipRect.right - output->x;
-+			}
-+			g2d_set_clipping(gr->handle, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
-+			g2d_blitSurface(gr->handle, &gs->g2d_surface, dstsurface, &srcRect, &dstrect);
-+		}
-+	}
-+}
-+
-+static void
-+draw_view(struct weston_view *ev, struct weston_output *output,
-+	     pixman_region32_t *damage) /* in global coordinates */
-+{
-+	struct weston_compositor *ec = ev->surface->compositor;	
-+	struct g2d_output_state *go = get_output_state(output);
-+	struct g2d_surface_state *gs = get_surface_state(ev->surface);
-+	/* repaint bounding region in global coordinates: */
-+	pixman_region32_t repaint;
-+	/* non-opaque region in surface coordinates: */
-+	pixman_region32_t surface_blend;
-+	pixman_region32_t *buffer_damage;
-+
-+	pixman_region32_init(&repaint);
-+	pixman_region32_intersect(&repaint,
-+				  &ev->transform.boundingbox, damage);
-+	pixman_region32_subtract(&repaint, &repaint, &ev->clip);
-+
-+	if (!pixman_region32_not_empty(&repaint))
-+		goto out;
-+
-+	buffer_damage = &go->buffer_damage[go->current_buffer];
-+	pixman_region32_subtract(buffer_damage, buffer_damage, &repaint);
-+
-+	/* blended region is whole surface minus opaque region: */
-+	pixman_region32_init_rect(&surface_blend, 0, 0,
-+				  ev->surface->width, ev->surface->height);
-+	pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque);
-+
-+	struct g2d_renderer *gr = get_renderer(ec);
-+	if (pixman_region32_not_empty(&ev->surface->opaque)) {
-+		repaint_region(ev, output, go, &repaint, &ev->surface->opaque);
-+	}
-+
-+	if (pixman_region32_not_empty(&surface_blend)) {
-+		g2d_enable(gr->handle,G2D_BLEND);
-+		if (ev->alpha < 1.0)
-+		{
-+			g2d_enable(gr->handle, G2D_GLOBAL_ALPHA);
-+			gs->g2d_surface.base.global_alpha = ev->alpha * 0xFF;
-+		}
-+		repaint_region(ev, output, go, &repaint, &surface_blend);
-+		g2d_disable(gr->handle, G2D_GLOBAL_ALPHA);
-+		g2d_disable(gr->handle, G2D_BLEND);
-+	}
-+	pixman_region32_fini(&surface_blend);
-+
-+out:
-+	pixman_region32_fini(&repaint);
-+}
-+
-+static void
-+repaint_views(struct weston_output *output, pixman_region32_t *damage)
-+{
-+	struct weston_compositor *compositor = output->compositor;
-+	struct weston_view *view;
-+
-+	wl_list_for_each_reverse(view, &compositor->view_list, link)
-+		if (view->plane == &compositor->primary_plane)
-+			draw_view(view, output, damage);
-+}
-+
-+static void
-+g2d_renderer_repaint_output(struct weston_output *output,
-+			     pixman_region32_t *output_damage)
-+{
-+	struct g2d_output_state *go = get_output_state(output);
-+	struct weston_compositor *compositor = output->compositor;
-+	struct g2d_renderer *gr = get_renderer(compositor);
-+	int i;
-+
-+	use_output(output);
-+	for (i = 0; i < 2; i++)
-+		pixman_region32_union(&go->buffer_damage[i],
-+				      &go->buffer_damage[i],
-+				      output_damage);
-+
-+	pixman_region32_union(output_damage, output_damage,
-+			      &go->buffer_damage[go->current_buffer]);
-+
-+	repaint_views(output, output_damage);
-+	g2d_finish(gr->handle);
-+
-+	pixman_region32_copy(&output->previous_damage, output_damage);
-+	wl_signal_emit(&output->frame_signal, output);
-+	copy_to_framebuffer(output);
-+	go->current_buffer ^= 1;
-+}
-+
-+static void
-+g2d_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer)
-+{
-+	struct wl_viv_buffer *vivBuffer = wl_resource_get_user_data(buffer->resource);
-+	struct g2d_surface_state *gs = get_surface_state(es);
-+	buffer->width = vivBuffer->width;
-+	buffer->height = vivBuffer->height;
-+	get_g2dSurface(vivBuffer, &gs->g2d_surface);
-+}
-+
-+static void
-+g2d_renderer_flush_damage(struct weston_surface *surface)
-+{
-+	struct g2d_surface_state *gs = get_surface_state(surface);
-+	struct weston_buffer *buffer = gs->buffer_ref.buffer;
-+    struct weston_view *view;
-+	int texture_used;
-+	pixman_region32_union(&gs->texture_damage,
-+			      &gs->texture_damage, &surface->damage);
-+
-+	if (!buffer)
-+		return;
-+
-+	texture_used = 0;
-+	wl_list_for_each(view, &surface->views, surface_link) {
-+		if (view->plane == &surface->compositor->primary_plane) {
-+			texture_used = 1;
-+			break;
-+		}
-+	}
-+	if (!texture_used)
-+		return;
-+
-+	if (!pixman_region32_not_empty(&gs->texture_damage))
-+		goto done;
-+
-+	if(wl_shm_buffer_get(buffer->resource))
-+	{
-+		uint8_t *src = wl_shm_buffer_get_data(buffer->shm_buffer);
-+		uint8_t *dst = gs->shm_buf->buf_vaddr;
-+		int bpp      = gs->bpp;
-+		wl_shm_buffer_begin_access(buffer->shm_buffer);
-+		if(gs->shm_buf)
-+		{
-+			int alignedWidth = ALIGN_WIDTH(buffer->width);
-+			if(alignedWidth == buffer->width)
-+			{
-+				int size = wl_shm_buffer_get_stride(buffer->shm_buffer)*buffer->height;
-+				memcpy(dst, src, size);
-+			}
-+			else
-+			{
-+				int i, j;
-+				for (i = 0; i < buffer->height; i++)
-+				{
-+					for (j = 0; j < buffer->width; j++)
-+					{
-+						int dstOff = i * alignedWidth + j;
-+						int srcOff = (i * buffer->width + j);
-+						memcpy(dst + dstOff * bpp, src + srcOff * bpp, bpp);
-+					}
-+				}
-+			}
-+		}
-+		else
-+		{
-+			weston_log("Error: This shm buffer was not attached\n");
-+		}
-+		wl_shm_buffer_end_access(buffer->shm_buffer);
-+	}
-+	else
-+	{
-+		g2d_renderer_attach_egl(surface, buffer);
-+	}
-+
-+done:
-+	pixman_region32_fini(&gs->texture_damage);
-+	pixman_region32_init(&gs->texture_damage);
-+
-+	weston_buffer_reference(&gs->buffer_ref, NULL);
-+}
-+
-+static void
-+g2d_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer,
-+			struct wl_shm_buffer *shm_buffer)
-+{
-+	struct g2d_surface_state *gs = get_surface_state(es);
-+	int buffer_length = 0;
-+	int alloc_new_buff = 1;
-+	int alignedWidth = 0;
-+	enum g2d_format g2dFormat = 0;
-+	buffer->shm_buffer = shm_buffer;
-+	buffer->width = wl_shm_buffer_get_width(shm_buffer);
-+	buffer->height = wl_shm_buffer_get_height(shm_buffer);
-+	alignedWidth = ALIGN_WIDTH(buffer->width);
-+
-+	switch (wl_shm_buffer_get_format(shm_buffer)) {
-+	case WL_SHM_FORMAT_XRGB8888:
-+		g2dFormat = G2D_BGRX8888;
-+		gs->bpp = 4;
-+		break;
-+	case WL_SHM_FORMAT_ARGB8888:
-+		g2dFormat = G2D_BGRA8888;
-+		gs->bpp = 4;
-+		break;
-+	case WL_SHM_FORMAT_RGB565:
-+		g2dFormat = G2D_RGB565;
-+		gs->bpp = 2;
-+		break;
-+	default:
-+		weston_log("warning: unknown shm buffer format: %08x\n",
-+			   wl_shm_buffer_get_format(shm_buffer));
-+		return;
-+	}
-+
-+	buffer_length = alignedWidth * buffer->height * gs->bpp;
-+
-+	/* Only allocate a new g2d buff if it is larger than existing one.*/
-+	gs->shm_buf_length = buffer_length;
-+	if(gs->shm_buf && gs->shm_buf->buf_size > buffer_length)
-+	{
-+		alloc_new_buff = 0;
-+	}
-+
-+	if(alloc_new_buff)
-+	{
-+		if(gs->shm_buf)
-+			g2d_free(gs->shm_buf);
-+		gs->shm_buf = g2d_alloc(buffer_length, 0);
-+		gs->g2d_surface.base.planes[0] = gs->shm_buf->buf_paddr;
-+	}
-+	gs->g2d_surface.base.left = 0;
-+	gs->g2d_surface.base.top  = 0;
-+	gs->g2d_surface.base.right  = buffer->width;
-+	gs->g2d_surface.base.bottom = buffer->height;
-+	gs->g2d_surface.base.stride = alignedWidth;
-+	gs->g2d_surface.base.width  = buffer->width;
-+	gs->g2d_surface.base.height = buffer->height;
-+	gs->g2d_surface.base.rot    = G2D_ROTATION_0;
-+	gs->g2d_surface.base.clrcolor = 0xFF400000;
-+	gs->g2d_surface.tiling = G2D_LINEAR;
-+	gs->g2d_surface.base.format = g2dFormat;
-+}
-+
-+static void
-+g2d_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
-+{
-+	struct g2d_surface_state *gs = get_surface_state(es);
-+	struct wl_shm_buffer *shm_buffer;
-+	weston_buffer_reference(&gs->buffer_ref, buffer);
-+
-+	if(buffer==NULL)
-+		return;
-+
-+	shm_buffer = wl_shm_buffer_get(buffer->resource);
-+
-+	if(shm_buffer)
-+	{
-+		g2d_renderer_attach_shm(es, buffer, shm_buffer);
-+	}
-+	else
-+	{
-+		g2d_renderer_attach_egl(es, buffer);
-+	}
-+	gs->attached = 1;
-+}
-+
-+static void
-+surface_state_destroy(struct g2d_surface_state *gs, struct g2d_renderer *gr)
-+{
-+	wl_list_remove(&gs->surface_destroy_listener.link);
-+	wl_list_remove(&gs->renderer_destroy_listener.link);
-+	if(gs->surface)
-+		gs->surface->renderer_state = NULL;
-+	
-+	if(gs->shm_buf)
-+	{
-+		g2d_free(gs->shm_buf);
-+		gs->shm_buf = NULL;
-+	}
-+
-+	weston_buffer_reference(&gs->buffer_ref, NULL);
-+	free(gs);
-+}
-+
-+static void
-+surface_state_handle_surface_destroy(struct wl_listener *listener, void *data)
-+{
-+	struct g2d_surface_state *gs;
-+	struct g2d_renderer *gr;
-+
-+	gs = container_of(listener, struct g2d_surface_state,
-+			  surface_destroy_listener);
-+
-+	gr = get_renderer(gs->surface->compositor);
-+	surface_state_destroy(gs, gr);
-+}
-+
-+static void
-+surface_state_handle_renderer_destroy(struct wl_listener *listener, void *data)
-+{
-+	struct g2d_surface_state *gs;
-+	struct g2d_renderer *gr;
-+
-+	gr = data;
-+
-+	gs = container_of(listener, struct g2d_surface_state,
-+			  renderer_destroy_listener);
-+
-+	surface_state_destroy(gs, gr);
-+}
-+
-+
-+static int
-+g2d_renderer_create_surface(struct weston_surface *surface)
-+{
-+	struct g2d_surface_state *gs;
-+	struct g2d_renderer *gr = get_renderer(surface->compositor);
-+
-+	gs = zalloc(sizeof *gs);
-+	if (gs == NULL)
-+		return -1;
-+
-+	/* A buffer is never attached to solid color surfaces, yet
-+	 * they still go through texcoord computations. Do not divide
-+	 * by zero there.
-+	 */
-+	gs->pitch = 1;
-+
-+	gs->surface = surface;
-+
-+	pixman_region32_init(&gs->texture_damage);
-+	surface->renderer_state = gs;
-+
-+	gs->surface_destroy_listener.notify =
-+		surface_state_handle_surface_destroy;
-+	wl_signal_add(&surface->destroy_signal,
-+		      &gs->surface_destroy_listener);
-+
-+	gs->renderer_destroy_listener.notify =
-+		surface_state_handle_renderer_destroy;
-+	wl_signal_add(&gr->destroy_signal,
-+		      &gs->renderer_destroy_listener);
-+
-+	if (surface->buffer_ref.buffer) {
-+		g2d_renderer_attach(surface, surface->buffer_ref.buffer);
-+		g2d_renderer_flush_damage(surface);
-+	}
-+    
-+    return 0;
-+}
-+
-+static void
-+g2d_renderer_surface_set_color(struct weston_surface *surface,
-+		 float red, float green, float blue, float alpha)
-+{
-+	struct g2d_surface_state *gs = get_surface_state(surface);
-+
-+	gs->color[0] = red;
-+	gs->color[1] = green;
-+	gs->color[2] = blue;
-+	gs->color[3] = alpha;
-+}
-+
-+
-+static void
-+g2d_renderer_output_destroy(struct weston_output *output)
-+{
-+	struct g2d_output_state *go = get_output_state(output);
-+	int i;
-+
-+	for (i = 0; i < 2; i++)
-+	{
-+		pixman_region32_fini(&go->buffer_damage[i]);
-+	}
-+
-+	if(go->offscreen_buf)
-+	{
-+		g2d_free(go->offscreen_buf);
-+		go->offscreen_buf = NULL;
-+	}
-+
-+	if(go->fb_info.fb_fd)
-+	{
-+		close(go->fb_info.fb_fd);
-+		go->fb_info.fb_fd = 0;
-+	}
-+
-+	if(go->renderSurf)
-+	{
-+		free(go->renderSurf);
-+		go->renderSurf = NULL;
-+	}
-+	for (i = 0; i < go->clone_display_num; i++)
-+	{
-+		if(go->mirror_fb_info[i].fb_fd)
-+		{
-+			close(go->mirror_fb_info[i].fb_fd);
-+			go->mirror_fb_info[i].fb_fd = 0;
-+		}
-+	}
-+	if(go->mirrorSurf)
-+	{
-+		free(go->mirrorSurf);
-+		go->mirrorSurf = NULL;
-+	}
-+	if(go->mirror_fb_info)
-+	{
-+		free(go->mirror_fb_info);
-+		go->mirror_fb_info = NULL;
-+	}
-+
-+	free(go);
-+}
-+
-+static void
-+g2d_renderer_destroy(struct weston_compositor *ec)
-+{
-+	struct g2d_renderer *gr = get_renderer(ec);
-+
-+	wl_signal_emit(&gr->destroy_signal, gr);
-+	g2d_close(gr->handle);
-+#ifdef ENABLE_EGL
-+	eglUnbindWaylandDisplayWL(gr->egl_display);
-+	eglTerminate(gr->egl_display);
-+	fbDestroyDisplay(gr->display);
-+#endif
-+	free(ec->renderer);
-+	ec->renderer = NULL;
-+}
-+
-+static int
-+g2d_renderer_create(struct weston_compositor *ec)
-+{
-+	struct g2d_renderer *gr;
-+	gr = malloc(sizeof *gr);
-+	if (gr == NULL)
-+		return -1;
-+
-+	gr->base.read_pixels = g2d_renderer_read_pixels;
-+	gr->base.repaint_output = g2d_renderer_repaint_output;
-+	gr->base.flush_damage = g2d_renderer_flush_damage;
-+	gr->base.attach = g2d_renderer_attach;
-+		gr->base.surface_set_color = g2d_renderer_surface_set_color;
-+	gr->base.destroy = g2d_renderer_destroy;
-+
-+	if(g2d_open(&gr->handle))
-+	{
-+		weston_log("g2d_open fail.\n");
-+		return -1;
-+	}
-+	ec->renderer = &gr->base; 
-+		wl_signal_init(&gr->destroy_signal);
-+	return 0;
-+}
-+
-+static int
-+calculate_g2d_format(struct fb_var_screeninfo *varinfo, enum g2d_format *g2dFormat)
-+{
-+	/* Get the color format. */
-+	switch (varinfo->green.length)
-+	{
-+		case 6:
-+			*g2dFormat= G2D_RGB565;
-+			break;
-+
-+		case 8:
-+			if (varinfo->blue.offset == 0)
-+			{
-+				*g2dFormat = (varinfo->transp.length == 0) ? G2D_BGRX8888 : G2D_BGRA8888;
-+			}
-+			else
-+			{
-+				*g2dFormat = (varinfo->transp.length == 0) ? G2D_RGBX8888 : G2D_RGBA8888;
-+			}
-+			break;
-+
-+		default:
-+			*g2dFormat = -1;
-+			break;
-+	}
-+	return 0;
-+}
-+
-+static int
-+get_G2dSurface_from_screeninfo(struct fb_screeninfo *info, struct g2d_surfaceEx* g2dSurface)
-+{
-+	if(info && g2dSurface)
-+	{
-+		g2dSurface->base.planes[0] = info->physical;
-+		g2dSurface->base.left = 0;
-+		g2dSurface->base.top  = 0;
-+		g2dSurface->base.right  = info->x_resolution;
-+		g2dSurface->base.bottom = info->y_resolution;
-+		g2dSurface->base.stride = info->stride;
-+		g2dSurface->base.width  = info->x_resolution;
-+		g2dSurface->base.height = info->y_resolution;
-+		g2dSurface->base.format = info->pixel_format;
-+		g2dSurface->base.rot    = G2D_ROTATION_0;
-+		g2dSurface->base.clrcolor = 0xFF400000;
-+		g2dSurface->tiling = G2D_LINEAR;
-+		return 0;
-+	}
-+	return -1;
-+}
-+
-+static int
-+fb_query_screen_info(struct g2d_output_state *output, int fd,
-+                        struct fb_screeninfo *info)
-+{
-+	struct g2d_output_state *go = output;
-+	struct fb_var_screeninfo *varinfo = &info->varinfo;
-+	struct fb_fix_screeninfo *fixinfo = &info->fixinfo;
-+
-+	/* Probe the device for screen information. */
-+	if (ioctl(fd, FBIOGET_VSCREENINFO, varinfo) < 0) {
-+		return -1;
-+	}
-+
-+	if(go->nNumBuffers > 1){
-+		varinfo->yres_virtual = varinfo->yres * go->nNumBuffers;
-+		if (ioctl(fd, FBIOPUT_VSCREENINFO, varinfo) < 0)
-+			return -1;
-+	}
-+
-+	if (ioctl(fd, FBIOGET_FSCREENINFO, fixinfo) < 0 ||
-+		ioctl(fd, FBIOGET_VSCREENINFO, varinfo) < 0){
-+		return -1;
-+	}
-+	/* Store the pertinent data. */
-+	info->x_resolution = varinfo->xres;
-+	info->y_resolution = varinfo->yres;
-+	info->physical = fixinfo->smem_start;
-+	info->buffer_length = fixinfo->smem_len;
-+	info->stride = fixinfo->line_length / (varinfo->bits_per_pixel >> 3);
-+	info->stride_bytes = fixinfo->line_length;
-+	calculate_g2d_format(varinfo, &info->pixel_format);
-+
-+	if (info->pixel_format < 0) {
-+		weston_log("Frame buffer uses an unsupported format.\n");
-+		return -1;
-+	}
-+
-+	return 0;
-+}
-+
-+static int
-+fb_frame_buffer_open(struct g2d_output_state *output, const char *fb_dev,
-+                        struct fb_screeninfo *screen_info)
-+{
-+	/* Open the frame buffer device. */
-+	screen_info->fb_fd = open(fb_dev, O_RDWR | O_CLOEXEC);
-+	if (screen_info->fb_fd < 0) {
-+		weston_log("Failed to open frame buffer device%s \n", fb_dev);
-+		return -1;
-+	}
-+
-+	/* Grab the screen info. */
-+	if (fb_query_screen_info(output, screen_info->fb_fd, screen_info) < 0) {
-+		weston_log("Failed to get frame buffer info \n");
-+
-+		close(screen_info->fb_fd);
-+		return -1;
-+	}
-+
-+	return 0;
-+}
-+
-+static void
-+getBufferNumber(struct g2d_output_state *go)
-+{
-+	char *p = NULL;
-+	p = getenv("FB_MULTI_BUFFER");
-+	if (p == gcvNULL)
-+	{
-+		go->nNumBuffers = 1;
-+	}
-+	else
-+	{
-+		go->nNumBuffers = atoi(p);
-+		if (go->nNumBuffers < 2)
-+		{
-+			go->nNumBuffers  = 1;
-+		}
-+		else if(go->nNumBuffers >= 2)
-+		{
-+			go->nNumBuffers = 2;
-+			go->activebuffer = 1;
-+		}
-+	}
-+	weston_log("FB_MULTI_BUFFER = %d\n", go->nNumBuffers);
-+}
-+
-+static int
-+g2d_renderer_surface_create(struct g2d_output_state *go, struct g2d_renderer *gr, const char *device)
-+{
-+	int i = 0;
-+	int offset = 0;
-+	weston_log("Opend device=%s\n", device);
-+	if(fb_frame_buffer_open(go, device, &go->fb_info) < 0)
-+	{
-+		weston_log("Open frame buffer failed.\n");
-+		return -1;
-+	}
-+	go->renderSurf = zalloc(sizeof(struct g2d_surfaceEx) * go->nNumBuffers);
-+	offset = go->fb_info.stride_bytes * go->fb_info.y_resolution;
-+	for(i = 0; i < go->nNumBuffers; i++)
-+	{
-+		get_G2dSurface_from_screeninfo(&go->fb_info, &go->renderSurf[i]);
-+		go->renderSurf[i].base.planes[0] = go->fb_info.physical
-+											+ (offset * i);
-+		g2d_clear(gr->handle, &go->renderSurf[i].base);
-+	}
-+
-+	if(go->nNumBuffers == 1)
-+	{
-+		go->offscreenSurface = (go->renderSurf[go->activebuffer]);
-+		go->offscreen_buf = g2d_alloc(go->fb_info.buffer_length, 0);
-+		go->offscreenSurface.base.planes[0] = go->offscreen_buf->buf_paddr;
-+		g2d_clear(gr->handle, &go->offscreenSurface.base);
-+	}
-+	return 0;
-+}
-+
-+static int
-+g2d_renderer_output_create(struct weston_output *output, struct wl_display *wl_display, const char *device)
-+
-+ {
-+	struct g2d_renderer *gr = get_renderer(output->compositor);
-+	struct g2d_output_state *go;
-+	int i;
-+	int clone_display_num = 0;
-+	int count = 0;
-+	int k=0, dispCount = 0;
-+	char displays[5][32];
-+	weston_log("g2d_renderer_output_create device=%s\n", device);
-+	count = strlen(device);
-+
-+	if(count > 0)
-+	{
-+		for(i= 0; i < count; i++)
-+		{
-+			if(device[i] == ',')
-+			{
-+				displays[dispCount][k] = '\0';
-+				dispCount++;
-+				k = 0;
-+				continue;
-+			}
-+			else if(device[i] != ' ')
-+			{
-+				displays[dispCount][k++] = device[i];
-+			}
-+		}
-+		displays[dispCount][k] = '\0';
-+		clone_display_num = dispCount++;
-+		weston_log("clone_display_num = %d\n", clone_display_num);
-+	}
-+	else
-+	{
-+		weston_log("Invalid device name\n");
-+		return -1;
-+	}
-+
-+	go = zalloc(sizeof *go);
-+	if (go == NULL)
-+		return -1;
-+	go->clone_display_num  = clone_display_num;
-+	output->renderer_state = go;
-+#ifdef ENABLE_EGL
-+	gr->wl_display = wl_display;
-+	gr->display = fbGetDisplay(wl_display);
-+	gr->egl_display = eglGetDisplay(gr->display);
-+	eglBindWaylandDisplayWL(gr->egl_display, wl_display);
-+#endif
-+	getBufferNumber(go);
-+
-+	if(g2d_renderer_surface_create(go, gr, displays[0]) < 0)
-+	{
-+		weston_log("Create Render surface failed.\n");
-+		return -1;
-+	}
-+
-+	if(go->clone_display_num)
-+	{
-+		go->mirrorSurf = zalloc(sizeof(struct g2d_surfaceEx) * clone_display_num);
-+		go->mirror_fb_info = zalloc(sizeof(struct fb_screeninfo) * clone_display_num);
-+		if(go->mirrorSurf == NULL || go->mirror_fb_info == NULL)
-+			return -1;
-+
-+		for(i = 0; i < clone_display_num; i++)
-+		{
-+			if(fb_frame_buffer_open(go, displays[i + 1], &go->mirror_fb_info[i]) < 0)
-+			{
-+				weston_log("Open frame buffer failed.\n");
-+				return -1;
-+			}
-+			get_G2dSurface_from_screeninfo(&go->mirror_fb_info[i], &go->mirrorSurf[i]);
-+			go->mirrorSurf[i].base.planes[0] = go->mirror_fb_info[i].physical;
-+			g2d_clear(gr->handle, &go->mirrorSurf[i].base);
-+		}
-+	}
-+	g2d_finish(gr->handle);
-+	for (i = 0; i < BUFFER_DAMAGE_COUNT; i++)
-+		pixman_region32_init(&go->buffer_damage[i]);
-+    return 0;
-+ }
-+
-+ WL_EXPORT struct g2d_renderer_interface g2d_renderer_interface = {
-+	.create = g2d_renderer_create,
-+	.output_create = g2d_renderer_output_create,
-+	.output_destroy = g2d_renderer_output_destroy,
-+};
-diff --git a/src/g2d-renderer.h b/src/g2d-renderer.h
-new file mode 100644
-index 0000000..fc4ca49
---- /dev/null
-+++ b/src/g2d-renderer.h
-@@ -0,0 +1,47 @@
-+/*
-+ * Copyright (c) 2015 Freescale Semiconductor, Inc.
-+ * Copyright © 2013 Vasily Khoruzhick <anarsoul@gmail.com>
-+ *
-+ * 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.
-+ */
-+#ifndef __g2d_renderer_h_
-+#define __g2d_renderer_h_
-+
-+#include  "compositor.h"
-+
-+#ifdef ENABLE_EGL
-+#include <EGL/egl.h>
-+#include <EGL/eglext.h>
-+#endif
-+
-+struct g2d_renderer_interface {
-+
-+	int (*create)(struct weston_compositor *ec);
-+
-+	int (*output_create)(struct weston_output *output,
-+		         struct wl_display *wl_display,
-+		         const char *device);
-+
-+	void (*output_destroy)(struct weston_output *output);
-+};
-+
-+#endif
-diff --git a/src/main.c b/src/main.c
-index 3279ac6..5d0bdc4 100644
---- a/src/main.c
-+++ b/src/main.c
-@@ -285,7 +285,8 @@ usage(int error_code)
- 		"Options for fbdev-backend.so:\n\n"
- 		"  --tty=TTY\t\tThe tty to use\n"
- 		"  --device=DEVICE\tThe framebuffer device to use\n"
--		"  --use-gl\t\tUse the GL renderer\n\n");
-+		"  --use-gl=1\t\tUse the GL renderer\n"
-+		"  --use-g2d=1\t\tUse the g2d renderer\n\n");
- #endif
- 
- #if defined(BUILD_HEADLESS_COMPOSITOR)
-@@ -868,7 +869,8 @@ load_fbdev_backend(struct weston_compositor *c, char const * backend,
- 	const struct weston_option fbdev_options[] = {
- 		{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
- 		{ WESTON_OPTION_STRING, "device", 0, &config.device },
--		{ WESTON_OPTION_BOOLEAN, "use-gl", 0, &config.use_gl },
-+		{ WESTON_OPTION_INTEGER, "use-gl", 0, &config.use_gl },
-+		{ WESTON_OPTION_INTEGER, "use-g2d", 0, &config.use_g2d },
- 	};
- 
- 	parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
--- 
-2.7.4
-
diff --git a/recipes-graphics/wayland/weston/0003-MGS-1783-xwld-Add-clone-mode-support-for-multi-displ.patch b/recipes-graphics/wayland/weston/0003-MGS-1783-xwld-Add-clone-mode-support-for-multi-displ.patch
deleted file mode 100644
index 328213c..0000000
--- a/recipes-graphics/wayland/weston/0003-MGS-1783-xwld-Add-clone-mode-support-for-multi-displ.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From d22509cd41f9d44d9e66522307e30ad4ae4bace0 Mon Sep 17 00:00:00 2001
-From: Meng Mingming <mingming.meng@nxp.com>
-Date: Mon, 16 Jan 2017 10:23:13 +0800
-Subject: [PATCH 3/5] MGS-1783: xwld: Add clone mode support for multi display
-
-Support more than two displays to show the same contents
-
-Upstream Status: Inappropriate [i.MX specific]
-
-Date: May 16, 2016
-Signed-off-by: Yong Gan <yong.gan@nxp.com>
----
- src/compositor-fbdev.c | 18 +++++++++++++++---
- src/compositor-fbdev.h |  1 +
- src/main.c             |  1 +
- 3 files changed, 17 insertions(+), 3 deletions(-)
-
-diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
-index cff9513..0a05e7d 100644
---- a/src/compositor-fbdev.c
-+++ b/src/compositor-fbdev.c
-@@ -61,6 +61,8 @@ struct fbdev_backend {
- 	struct udev_input input;
- 	int use_pixman;
- 	int use_g2d;
-+	int clone_mode;
-+	char *clone_device;
- 	uint32_t output_transform;
- 	struct wl_listener session_listener;
- 	NativeDisplayType display;
-@@ -521,6 +523,8 @@ fbdev_output_create(struct fbdev_backend *backend,
- 			goto out_hw_surface;
- 	} else if(backend->use_g2d) {
- 		const char *g2d_device = device;
-+		if (backend->clone_mode)
-+			g2d_device = backend->clone_device;
- 
- 		if (g2d_renderer->output_create(&output->base,
- 							backend->compositor->wl_display, g2d_device) < 0) {
-@@ -797,6 +801,8 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
- 	backend->prev_state = WESTON_COMPOSITOR_ACTIVE;
- 	backend->use_pixman = !(param->use_gl || param->use_g2d);
- 	backend->use_g2d = param->use_g2d;
-+	backend->clone_mode = param->clone_mode;
-+	backend->clone_device = param->device;
- 	backend->output_transform = param->output_transform;
- 
- 	weston_setup_vt_switch_bindings(compositor);
-@@ -837,12 +843,17 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
- 		displays[dispCount][k] = '\0';
- 		dispCount++;
- 
--		for(i= 0; i < dispCount; i++){
--			if (fbdev_output_create(backend, x, y, displays[i]) < 0)
-+		if(backend->clone_mode){
-+			if (fbdev_output_create(backend, x, y, displays[0]) < 0)
- 				goto out_launcher;
--			x += container_of(backend->compositor->output_list.prev,
-+		} else {
-+			for(i= 0; i < dispCount; i++){
-+				if (fbdev_output_create(backend, x, y, displays[i]) < 0)
-+					goto out_launcher;
-+				x += container_of(backend->compositor->output_list.prev,
- 							struct weston_output,
- 							link)->width;
-+			}
- 		}
- 	} else {
- 		gl_renderer = weston_load_module("gl-renderer.so",
-@@ -896,6 +907,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config *config)
- 	config->device = "/dev/fb0"; /* default frame buffer */
- 	config->use_gl = 0;
- 	config->use_g2d = 0;
-+	config->clone_mode = 0;
- 	config->output_transform = WL_OUTPUT_TRANSFORM_NORMAL;
- }
- 
-diff --git a/src/compositor-fbdev.h b/src/compositor-fbdev.h
-index 32a8598..a28ef3b 100644
---- a/src/compositor-fbdev.h
-+++ b/src/compositor-fbdev.h
-@@ -41,6 +41,7 @@ struct weston_fbdev_backend_config {
- 	char *device;
- 	int use_gl;
- 	int use_g2d;
-+	int clone_mode;
- 
- 	uint32_t output_transform;
- };
-diff --git a/src/main.c b/src/main.c
-index 5d0bdc4..18fe5e0 100644
---- a/src/main.c
-+++ b/src/main.c
-@@ -871,6 +871,7 @@ load_fbdev_backend(struct weston_compositor *c, char const * backend,
- 		{ WESTON_OPTION_STRING, "device", 0, &config.device },
- 		{ WESTON_OPTION_INTEGER, "use-gl", 0, &config.use_gl },
- 		{ WESTON_OPTION_INTEGER, "use-g2d", 0, &config.use_g2d },
-+		{ WESTON_OPTION_BOOLEAN, "clone-mode", 0, &config.clone_mode },
- 	};
- 
- 	parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv);
--- 
-2.7.4
-
diff --git a/recipes-graphics/wayland/weston/0004-MGS-1668-xwld-System-can-not-boot-up-to-desktop.patch b/recipes-graphics/wayland/weston/0004-MGS-1668-xwld-System-can-not-boot-up-to-desktop.patch
deleted file mode 100644
index 95a88e6..0000000
--- a/recipes-graphics/wayland/weston/0004-MGS-1668-xwld-System-can-not-boot-up-to-desktop.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 2e5260168b59c96688b10912cff3d95ec1fbb3d8 Mon Sep 17 00:00:00 2001
-From: Meng Mingming <mingming.meng@nxp.com>
-Date: Mon, 16 Jan 2017 10:25:29 +0800
-Subject: [PATCH 4/5] MGS-1668: xwld: System can not boot up to desktop
-
-System can not boot up to desktop if press touch panel continuously during booting up.
-The weston view was not initialed completely, so add a protection to the pointer.
-
-Upstream Status: Denied [Could not reproduce]
-
-Date: MAR 08, 2016
-Signed-off-by: Yong Gan <yong.gan@nxp.com>
----
- src/compositor.c | 14 ++++++++------
- 1 file changed, 8 insertions(+), 6 deletions(-)
-
-diff --git a/src/compositor.c b/src/compositor.c
-index b6ef7f3..9d9805d 100644
---- a/src/compositor.c
-+++ b/src/compositor.c
-@@ -1470,12 +1470,14 @@ weston_view_from_global_fixed(struct weston_view *view,
- {
- 	float vxf, vyf;
- 
--	weston_view_from_global_float(view,
--				      wl_fixed_to_double(x),
--				      wl_fixed_to_double(y),
--				      &vxf, &vyf);
--	*vx = wl_fixed_from_double(vxf);
--	*vy = wl_fixed_from_double(vyf);
-+	if(view != NULL) {
-+		weston_view_from_global_float(view,
-+						wl_fixed_to_double(x),
-+						wl_fixed_to_double(y),
-+						&vxf, &vyf);
-+		*vx = wl_fixed_from_double(vxf);
-+		*vy = wl_fixed_from_double(vyf);
-+	}
- }
- 
- WL_EXPORT void
--- 
-2.7.4
-
diff --git a/recipes-graphics/wayland/weston/0005-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch b/recipes-graphics/wayland/weston/0005-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch
deleted file mode 100644
index 73b298c..0000000
--- a/recipes-graphics/wayland/weston/0005-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From 3c11ac3c4b8416752c0e147ccde067070005597e Mon Sep 17 00:00:00 2001
-From: Meng Mingming <mingming.meng@nxp.com>
-Date: Mon, 16 Jan 2017 10:28:28 +0800
-Subject: [PATCH 5/5] MGS-1724: xwld: G2D compositor build failed in slevk
- board
-
-Add macro ENABLE_EGL to make sure the EGL was not built in slevk board.
-
-Upstream Status: Inappropriate [i.MX specific]
-
-Date: Jan 16, 2017
-Signed-off-by: Meng Mingming <mingming.meng@nxp.com>
----
- src/compositor-fbdev.c | 18 ++++++++++++------
- src/main.c             | 22 +++++++++++++++++++---
- 2 files changed, 31 insertions(+), 9 deletions(-)
-
-diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
-index 0a05e7d..22d349b 100644
---- a/src/compositor-fbdev.c
-+++ b/src/compositor-fbdev.c
-@@ -65,7 +65,9 @@ struct fbdev_backend {
- 	char *clone_device;
- 	uint32_t output_transform;
- 	struct wl_listener session_listener;
-+#ifdef ENABLE_EGL
- 	NativeDisplayType display;
-+#endif
- };
- 
- struct fbdev_screeninfo {
-@@ -99,8 +101,10 @@ struct fbdev_output {
- 	pixman_image_t *hw_surface;
- 	uint8_t depth;
- 
-+#ifdef ENABLE_EGL
- 	NativeDisplayType display;
- 	NativeWindowType  window;
-+#endif
- };
- 
- struct gl_renderer_interface *gl_renderer;
-@@ -452,10 +456,13 @@ fbdev_frame_buffer_destroy(struct fbdev_output *output)
- 		           strerror(errno));
- 
- 	output->fb = NULL;
-+
-+#ifdef ENABLE_EGL
- 	if(output->window)
- 		fbDestroyWindow(output->window);
- 	if(output->display)
- 		fbDestroyDisplay(output->display);
-+#endif
- }
- 
- static void fbdev_output_destroy(struct weston_output *base);
-@@ -532,6 +539,7 @@ fbdev_output_create(struct fbdev_backend *backend,
- 				goto out_hw_surface;
- 		}
- 	} else {
-+#ifdef ENABLE_EGL
- 		setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
- 		output->window = fbCreateWindow(backend->display, -1, -1, 0, 0);
- 		if (output->window == NULL) {
-@@ -545,6 +553,7 @@ fbdev_output_create(struct fbdev_backend *backend,
- 			weston_log("gl_renderer_output_create failed.\n");
- 			goto out_hw_surface;
- 		}
-+#endif
- 	}
- 
- 	loop = wl_display_get_event_loop(backend->compositor->wl_display);
-@@ -856,6 +865,7 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
- 			}
- 		}
- 	} else {
-+#ifdef ENABLE_EGL
- 		gl_renderer = weston_load_module("gl-renderer.so",
- 						 "gl_renderer_interface");
- 		if (!gl_renderer) {
-@@ -875,7 +885,9 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
- 			weston_log("gl_renderer_create failed.\n");
- 			goto out_launcher;
- 		}
-+#endif
- 	}
-+
- 	if(!backend->use_g2d)
- 		if (fbdev_output_create(backend, 0, 0, param->device) < 0)
- 			goto out_launcher;
-@@ -929,12 +941,6 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
- 	config_init_to_defaults(&config);
- 	memcpy(&config, config_base, config_base->struct_size);
- 
--	if(config.use_g2d) {
--		config.use_gl = 0;
--	} else {
--		config.use_gl = 1;
--	}
--
- 	b = fbdev_backend_create(compositor, argc, argv, wc, &config);
- 	if (b == NULL)
- 		return -1;
-diff --git a/src/main.c b/src/main.c
-index 18fe5e0..a0a5471 100644
---- a/src/main.c
-+++ b/src/main.c
-@@ -285,8 +285,14 @@ usage(int error_code)
- 		"Options for fbdev-backend.so:\n\n"
- 		"  --tty=TTY\t\tThe tty to use\n"
- 		"  --device=DEVICE\tThe framebuffer device to use\n"
--		"  --use-gl=1\t\tUse the GL renderer\n"
--		"  --use-g2d=1\t\tUse the g2d renderer\n\n");
-+#if defined(ENABLE_EGL)
-+		"  --use-gl=1\t\tUse the GL renderer (default is 1)\n"
-+		"  --use-g2d=1\t\tUse the G2D renderer (default is 0)\n"
-+#else
-+		"  --use-gl=1\t\tUse the GL renderer (default is 0)\n"
-+		"  --use-g2d=1\t\tUse the G2D renderer (default is 1)\n"
-+#endif
-+		"  --clone-mode\t\tClone display to multiple devices\n\n");
- #endif
- 
- #if defined(BUILD_HEADLESS_COMPOSITOR)
-@@ -861,7 +867,17 @@ static int
- load_fbdev_backend(struct weston_compositor *c, char const * backend,
- 		      int *argc, char **argv, struct weston_config *wc)
- {
--	struct weston_fbdev_backend_config config = {{ 0, }};
-+	struct weston_fbdev_backend_config config = {
-+		.base = {0},
-+#ifdef ENABLE_EGL
-+		.use_gl = 1,
-+		.use_g2d = 0,
-+#else
-+		.use_gl = 0,
-+		.use_g2d = 1,
-+#endif
-+		.clone_mode = 0,
-+	};
- 	struct weston_config_section *section;
- 	char *s = NULL;
- 	int ret = 0;
--- 
-2.7.4
-
diff --git a/recipes-graphics/wayland/weston/0006-Link-compositor-to-egl.patch b/recipes-graphics/wayland/weston/0006-Link-compositor-to-egl.patch
deleted file mode 100644
index 3cad74f..0000000
--- a/recipes-graphics/wayland/weston/0006-Link-compositor-to-egl.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-Index: weston-1.11.1/configure.ac
-===================================================================
---- weston-1.11.1.orig/configure.ac	2016-11-08 17:26:14.266564760 -0600
-+++ weston-1.11.1/configure.ac	2016-11-09 19:38:58.000000000 -0600
-@@ -93,6 +93,7 @@
- 	PKG_CHECK_MODULES(EGL, [egl glesv2])
-         PKG_CHECK_MODULES([EGL_TESTS], [egl glesv2 wayland-client wayland-egl])
- 	PKG_CHECK_MODULES([GL_RENDERER], [libdrm])
-+	COMPOSITOR_MODULES="$COMPOSITOR_MODULES egl"
- fi
- 
- AC_ARG_ENABLE(xkbcommon,
diff --git a/recipes-graphics/wayland/weston/0007-xwayland-Fix-crash-when-run-with-no-input-device.patch b/recipes-graphics/wayland/weston/0007-xwayland-Fix-crash-when-run-with-no-input-device.patch
deleted file mode 100644
index e3b1fa8..0000000
--- a/recipes-graphics/wayland/weston/0007-xwayland-Fix-crash-when-run-with-no-input-device.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 60f8817f371123b9c36b3ff1120eec1e8f9e3d10 Mon Sep 17 00:00:00 2001
-From: Tom Hochstein <tom.hochstein@nxp.com>
-Date: Mon, 31 Oct 2016 19:21:58 -0500
-Subject: [PATCH weston] xwayland: Fix crash when run with no input device
-
-Starting an xterm with no input device led to a crash
-because weston_wm_pick_seat() was returning garbage and
-weston_wm_selection_init() was trying to use the garbage.
-
-Upstream-Status: Accepted [https://cgit.freedesktop.org/wayland/weston/commit/?id=e7fff215ada3fd3d1b2af664888f960c082f9065]
-
-Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
----
- xwayland/selection.c      | 10 +++++++---
- xwayland/window-manager.c |  6 ++++--
- 2 files changed, 11 insertions(+), 5 deletions(-)
-
-Index: weston-1.11.0/xwayland/selection.c
-===================================================================
---- weston-1.11.0.orig/xwayland/selection.c	2016-05-19 16:36:04.000000000 -0500
-+++ weston-1.11.0/xwayland/selection.c	2016-11-01 14:32:48.000000000 -0500
-@@ -708,6 +708,8 @@
- 					  wm->atom.clipboard, mask);
- 
- 	seat = weston_wm_pick_seat(wm);
-+	if (seat == NULL)
-+		return;
- 	wm->selection_listener.notify = weston_wm_set_selection;
- 	wl_signal_add(&seat->selection_signal, &wm->selection_listener);
- 
-Index: weston-1.11.0/xwayland/window-manager.c
-===================================================================
---- weston-1.11.0.orig/xwayland/window-manager.c	2016-05-19 16:36:04.000000000 -0500
-+++ weston-1.11.0/xwayland/window-manager.c	2016-11-01 11:47:14.549606964 -0500
-@@ -1303,8 +1303,10 @@
- struct weston_seat *
- weston_wm_pick_seat(struct weston_wm *wm)
- {
--	return container_of(wm->server->compositor->seat_list.next,
--			    struct weston_seat, link);
-+	struct wl_list *seats = wm->server->compositor->seat_list.next;
-+	if (wl_list_empty(seats))
-+		return NULL;
-+	return container_of(seats, struct weston_seat, link);
- }
- 
- static struct weston_seat *
diff --git a/recipes-graphics/wayland/weston_1.11.1.bb b/recipes-graphics/wayland/weston_1.11.1.bb
deleted file mode 100644
index 22b30ad..0000000
--- a/recipes-graphics/wayland/weston_1.11.1.bb
+++ /dev/null
@@ -1,113 +0,0 @@
-SUMMARY = "Weston, a Wayland compositor"
-DESCRIPTION = "Weston is the reference implementation of a Wayland compositor"
-HOMEPAGE = "http://wayland.freedesktop.org"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://COPYING;md5=d79ee9e66bb0f95d3386a7acae780b70 \
-                    file://src/compositor.c;endline=26;md5=e342df749174a8ee11065583157c7a38"
-
-SRC_URI = "https://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
-           file://weston.png \
-           file://weston.desktop \
-           file://0001-make-error-portable.patch \
-           file://0001-configure.ac-Fix-wayland-protocols-path.patch \
-           file://0001-shared-include-stdint.h-for-int32_t.patch \
-           file://xwayland.weston-start \
-           file://0001-weston-launch-Provide-a-default-version-that-doesn-t.patch \
-           file://0001-Add-configuration-option-for-no-input-device.patch \
-"
-SRC_URI[md5sum] = "c5fdc02ab67d33c0fca8f72d341facdf"
-SRC_URI[sha256sum] = "548973496a5c8613d6690f9120f21066946a544df65ce4fe0ef153a8dc0bf6de"
-
-inherit autotools pkgconfig useradd distro_features_check
-# depends on virtual/egl
-REQUIRED_DISTRO_FEATURES = "opengl"
-
-DEPENDS = "libxkbcommon gdk-pixbuf pixman cairo glib-2.0 jpeg"
-DEPENDS += "wayland wayland-protocols libinput virtual/egl pango wayland-native"
-
-EXTRA_OECONF = "--enable-setuid-install \
-                --disable-rpi-compositor \
-                --disable-rdp-compositor \
-                WAYLAND_PROTOCOLS_SYSROOT_DIR=${RECIPE_SYSROOT} \
-                "
-EXTRA_OECONF_append_qemux86 = "\
-		WESTON_NATIVE_BACKEND=fbdev-backend.so \
-		"
-EXTRA_OECONF_append_qemux86-64 = "\
-		WESTON_NATIVE_BACKEND=fbdev-backend.so \
-		"
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms fbdev wayland egl', '', d)} \
-                   ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', '', d)} \
-                   ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd x11', d)} \
-                   clients launch"
-#
-# Compositor choices
-#
-# Weston on KMS
-PACKAGECONFIG[kms] = "--enable-drm-compositor,--disable-drm-compositor,drm udev virtual/mesa mtdev"
-# Weston on Wayland (nested Weston)
-PACKAGECONFIG[wayland] = "--enable-wayland-compositor,--disable-wayland-compositor,virtual/mesa"
-# Weston on X11
-PACKAGECONFIG[x11] = "--enable-x11-compositor,--disable-x11-compositor,virtual/libx11 libxcb libxcb libxcursor cairo"
-# Headless Weston
-PACKAGECONFIG[headless] = "--enable-headless-compositor,--disable-headless-compositor"
-# Weston on framebuffer
-PACKAGECONFIG[fbdev] = "--enable-fbdev-compositor,--disable-fbdev-compositor,udev mtdev"
-# weston-launch
-PACKAGECONFIG[launch] = "--enable-weston-launch,--disable-weston-launch,drm"
-# VA-API desktop recorder
-PACKAGECONFIG[vaapi] = "--enable-vaapi-recorder,--disable-vaapi-recorder,libva"
-# Weston with EGL support
-PACKAGECONFIG[egl] = "--enable-egl --enable-simple-egl-clients,--disable-egl --disable-simple-egl-clients,virtual/egl"
-# Weston with cairo glesv2 support
-PACKAGECONFIG[cairo-glesv2] = "--with-cairo-glesv2,--with-cairo=image,cairo"
-# Weston with lcms support
-PACKAGECONFIG[lcms] = "--enable-lcms,--disable-lcms,lcms"
-# Weston with webp support
-PACKAGECONFIG[webp] = "--with-webp,--without-webp,libwebp"
-# Weston with unwinding support
-PACKAGECONFIG[libunwind] = "--enable-libunwind,--disable-libunwind,libunwind"
-# Weston with systemd-login support
-PACKAGECONFIG[systemd] = "--enable-systemd-login,--disable-systemd-login,systemd dbus"
-# Weston with Xwayland support (requires X11 and Wayland)
-PACKAGECONFIG[xwayland] = "--enable-xwayland,--disable-xwayland"
-# colord CMS support
-PACKAGECONFIG[colord] = "--enable-colord,--disable-colord,colord"
-# Clients support
-PACKAGECONFIG[clients] = "--enable-clients --enable-simple-clients --enable-demo-clients-install,--disable-clients --disable-simple-clients"
-# Weston with PAM support
-PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam"
-
-do_install_append() {
-	# Weston doesn't need the .la files to load modules, so wipe them
-	rm -f ${D}/${libdir}/weston/*.la
-
-	# If X11, ship a desktop file to launch it
-	if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then
-		install -d ${D}${datadir}/applications
-		install ${WORKDIR}/weston.desktop ${D}${datadir}/applications
-
-		install -d ${D}${datadir}/icons/hicolor/48x48/apps
-		install ${WORKDIR}/weston.png ${D}${datadir}/icons/hicolor/48x48/apps
-	fi
-
-	if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then
-		install -Dm 644 ${WORKDIR}/xwayland.weston-start ${D}${datadir}/weston-start/xwayland
-	fi
-}
-
-PACKAGE_BEFORE_PN += "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', '${PN}-xwayland', '', d)}"
-PACKAGES += "${PN}-examples"
-
-FILES_${PN} = "${bindir}/weston ${bindir}/weston-terminal ${bindir}/weston-info ${bindir}/weston-launch ${bindir}/wcap-decode ${libexecdir} ${libdir}/${BPN}/*.so ${datadir}"
-FILES_${PN}-examples = "${bindir}/*"
-
-FILES_${PN}-xwayland = "${libdir}/${BPN}/xwayland.so"
-RDEPENDS_${PN}-xwayland += "xserver-xorg-xwayland"
-
-RDEPENDS_${PN} += "xkeyboard-config"
-RRECOMMENDS_${PN} = "liberation-fonts"
-RRECOMMENDS_${PN}-dev += "wayland-protocols"
-
-USERADD_PACKAGES = "${PN}"
-GROUPADD_PARAM_${PN} = "--system weston-launch"
diff --git a/recipes-graphics/wayland/weston_1.11.1.bbappend b/recipes-graphics/wayland/weston_1.11.1.bbappend
deleted file mode 100644
index ccbf393..0000000
--- a/recipes-graphics/wayland/weston_1.11.1.bbappend
+++ /dev/null
@@ -1,46 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-
-SRC_URI_append_imxgpu3d = " \
-    file://0001-MGS-2352-ccc-Add-GPU-VIV-support-for-weston-1.11.patch     \
-    file://0002-MGS-2521-ccc-Enable-g2d-renderer-for-weston-1.11.patch     \
-    file://0003-MGS-1783-xwld-Add-clone-mode-support-for-multi-displ.patch \
-    file://0004-MGS-1668-xwld-System-can-not-boot-up-to-desktop.patch      \
-    file://0005-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch \
-    file://0006-Link-compositor-to-egl.patch                               \
-"
-
-SRC_URI_append = " \
-    file://0007-xwayland-Fix-crash-when-run-with-no-input-device.patch     \
-"
-
-# The 'egl' configuration of weston requires gles support, and consideration
-# must be taken for the different SoC capabilities:
-# - For SoCs with 3d support, imx-gpu-viv provides hardware-accelerated
-#   egl and gles, so weston egl configuration is enabled.
-# - For SoCs with VG2D, like i.MX 6SoloLite, imx-gpu-viv provides
-#   hardware-accelerated egl but does not provide a compatible software
-#   version of gles, so weston egl configuration is disabled.
-# - For SoCs with no GPU, mesa provides software implementations of egl
-#   and gles, so weston egl configuration is enabled.
-PACKAGECONFIG_IMX_TO_APPEND = ""
-PACKAGECONFIG_IMX_TO_APPEND_imxgpu3d = "cairo-glesv2"
-PACKAGECONFIG_IMX_TO_REMOVE = ""
-PACKAGECONFIG_IMX_TO_REMOVE_imxgpu2d = "egl"
-PACKAGECONFIG_IMX_TO_REMOVE_imxgpu3d = ""
-
-PACKAGECONFIG_append = " ${PACKAGECONFIG_IMX_TO_APPEND}"
-PACKAGECONFIG_remove = " ${PACKAGECONFIG_IMX_TO_REMOVE}"
-
-
-EXTRA_OECONF_IMX_COMMON = " \
-    --disable-libunwind \
-    --disable-xwayland-test \
-    WESTON_NATIVE_BACKEND=fbdev-backend.so \
-"
-EXTRA_OECONF_IMX          = ""
-EXTRA_OECONF_IMX_imxpxp   = "${EXTRA_OECONF_IMX_COMMON}"
-EXTRA_OECONF_IMX_imxgpu2d = "${EXTRA_OECONF_IMX_COMMON}"
-
-EXTRA_OECONF_append = " ${EXTRA_OECONF_IMX}"
-
-PACKAGE_ARCH = "${MACHINE_SOCARCH}"
diff --git a/recipes-graphics/wayland/weston_2.0.0.bb b/recipes-graphics/wayland/weston_2.0.0.bb
new file mode 100644
index 0000000..8160f55
--- /dev/null
+++ b/recipes-graphics/wayland/weston_2.0.0.bb
@@ -0,0 +1,113 @@
+SUMMARY = "Weston, a Wayland compositor"
+DESCRIPTION = "Weston is the reference implementation of a Wayland compositor"
+HOMEPAGE = "http://wayland.freedesktop.org"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d79ee9e66bb0f95d3386a7acae780b70 \
+                    file://libweston/compositor.c;endline=26;md5=e342df749174a8ee11065583157c7a38"
+
+SRC_URI = "https://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
+           file://weston.png \
+           file://weston.desktop \
+           file://0001-make-error-portable.patch \
+           file://0001-configure.ac-Fix-wayland-protocols-path.patch \
+           file://xwayland.weston-start \
+           file://0001-weston-launch-Provide-a-default-version-that-doesn-t.patch \
+"
+SRC_URI[md5sum] = "15f38945942bf2a91fe2687145fb4c7d"
+SRC_URI[sha256sum] = "b4e446ac27f118196f1609dab89bb3cb3e81652d981414ad860e733b355365d8"
+
+inherit autotools pkgconfig useradd distro_features_check
+# depends on virtual/egl
+REQUIRED_DISTRO_FEATURES = "opengl"
+
+DEPENDS = "libxkbcommon gdk-pixbuf pixman cairo glib-2.0 jpeg"
+DEPENDS += "wayland wayland-protocols libinput virtual/egl pango wayland-native"
+
+EXTRA_OECONF = "--enable-setuid-install \
+                --disable-rdp-compositor \
+                "
+EXTRA_OECONF_append_qemux86 = "\
+		WESTON_NATIVE_BACKEND=fbdev-backend.so \
+		"
+EXTRA_OECONF_append_qemux86-64 = "\
+		WESTON_NATIVE_BACKEND=fbdev-backend.so \
+		"
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms fbdev wayland egl', '', d)} \
+                   ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', '', d)} \
+                   ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd x11', d)} \
+                   clients launch"
+#
+# Compositor choices
+#
+# Weston on KMS
+PACKAGECONFIG[kms] = "--enable-drm-compositor,--disable-drm-compositor,drm udev virtual/mesa mtdev"
+# Weston on Wayland (nested Weston)
+PACKAGECONFIG[wayland] = "--enable-wayland-compositor,--disable-wayland-compositor,virtual/mesa"
+# Weston on X11
+PACKAGECONFIG[x11] = "--enable-x11-compositor,--disable-x11-compositor,virtual/libx11 libxcb libxcb libxcursor cairo"
+# Headless Weston
+PACKAGECONFIG[headless] = "--enable-headless-compositor,--disable-headless-compositor"
+# Weston on framebuffer
+PACKAGECONFIG[fbdev] = "--enable-fbdev-compositor,--disable-fbdev-compositor,udev mtdev"
+# weston-launch
+PACKAGECONFIG[launch] = "--enable-weston-launch,--disable-weston-launch,drm"
+# VA-API desktop recorder
+PACKAGECONFIG[vaapi] = "--enable-vaapi-recorder,--disable-vaapi-recorder,libva"
+# Weston with EGL support
+PACKAGECONFIG[egl] = "--enable-egl --enable-simple-egl-clients,--disable-egl --disable-simple-egl-clients,virtual/egl"
+# Weston with cairo glesv2 support
+PACKAGECONFIG[cairo-glesv2] = "--with-cairo-glesv2,--with-cairo=image,cairo"
+# Weston with lcms support
+PACKAGECONFIG[lcms] = "--enable-lcms,--disable-lcms,lcms"
+# Weston with webp support
+PACKAGECONFIG[webp] = "--with-webp,--without-webp,libwebp"
+# Weston with unwinding support
+PACKAGECONFIG[libunwind] = "--enable-libunwind,--disable-libunwind,libunwind"
+# Weston with systemd-login support
+PACKAGECONFIG[systemd] = "--enable-systemd-login,--disable-systemd-login,systemd dbus"
+# Weston with Xwayland support (requires X11 and Wayland)
+PACKAGECONFIG[xwayland] = "--enable-xwayland,--disable-xwayland"
+# colord CMS support
+PACKAGECONFIG[colord] = "--enable-colord,--disable-colord,colord"
+# Clients support
+PACKAGECONFIG[clients] = "--enable-clients --enable-simple-clients --enable-demo-clients-install,--disable-clients --disable-simple-clients"
+# Weston with PAM support
+PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam"
+
+do_install_append() {
+	# Weston doesn't need the .la files to load modules, so wipe them
+	rm -f ${D}/${libdir}/libweston-2/*.la
+
+	# If X11, ship a desktop file to launch it
+	if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then
+		install -d ${D}${datadir}/applications
+		install ${WORKDIR}/weston.desktop ${D}${datadir}/applications
+
+		install -d ${D}${datadir}/icons/hicolor/48x48/apps
+		install ${WORKDIR}/weston.png ${D}${datadir}/icons/hicolor/48x48/apps
+	fi
+
+	if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then
+		install -Dm 644 ${WORKDIR}/xwayland.weston-start ${D}${datadir}/weston-start/xwayland
+	fi
+}
+
+PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', '${PN}-xwayland', '', d)} \
+             libweston-2 ${PN}-examples"
+
+FILES_${PN} = "${bindir}/weston ${bindir}/weston-terminal ${bindir}/weston-info ${bindir}/weston-launch ${bindir}/wcap-decode ${libexecdir} ${libdir}/${BPN}/*.so ${datadir}"
+
+FILES_libweston-2 = "${libdir}/lib*${SOLIBS} ${libdir}/libweston-2/*.so"
+SUMMARY_libweston-2 = "Helper library for implementing 'wayland window managers'."
+
+FILES_${PN}-examples = "${bindir}/*"
+
+FILES_${PN}-xwayland = "${libdir}/libweston-2/xwayland.so"
+RDEPENDS_${PN}-xwayland += "xserver-xorg-xwayland"
+
+RDEPENDS_${PN} += "xkeyboard-config"
+RRECOMMENDS_${PN} = "liberation-fonts"
+RRECOMMENDS_${PN}-dev += "wayland-protocols"
+
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "--system weston-launch"
diff --git a/recipes-graphics/wayland/weston_2.0.0.bbappend b/recipes-graphics/wayland/weston_2.0.0.bbappend
new file mode 100644
index 0000000..bda9932
--- /dev/null
+++ b/recipes-graphics/wayland/weston_2.0.0.bbappend
@@ -0,0 +1,37 @@
+SUMMARY_append = " (with i.MX support)"
+
+DEPENDS_append_imxgpu2d = " virtual/libg2d"
+
+# Use i.MX fork of weston for customizations.
+SRC_URI_remove_imxgpu2d = "https://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz"
+WESTON_SRC ?= "git://source.codeaurora.org/external/imx/weston-imx.git;protocol=https"
+SRCBRANCH = "weston-imx-2.0"
+SRC_URI_prepend_imxgpu2d = "${WESTON_SRC};branch=${SRCBRANCH} "
+SRCREV_imxgpu2d = "506dc2d69b7cf7b7e7d1ea94ce29c8203215a67e"
+S_imxgpu2d = "${WORKDIR}/git"
+
+# Define RECIPE_SYSROOT since it doesn't exist in morty
+# for this backported recipe
+RECIPE_SYSROOT = "${STAGING_DIR}/${MACHINE}"
+
+EXTRA_OECONF_IMX_COMMON = "WESTON_NATIVE_BACKEND=fbdev-backend.so"
+EXTRA_OECONF_IMX          = ""
+EXTRA_OECONF_IMX_imxpxp   = "${EXTRA_OECONF_IMX_COMMON}"
+EXTRA_OECONF_IMX_imxgpu2d = "${EXTRA_OECONF_IMX_COMMON}"
+EXTRA_OECONF_append = " ${EXTRA_OECONF_IMX}"
+
+# Disable OpenGL for parts with GPU support for 2D but not 3D
+IMX_REQUIRED_DISTRO_FEATURES_REMOVE          = ""
+IMX_REQUIRED_DISTRO_FEATURES_REMOVE_imxgpu2d = "opengl"
+IMX_REQUIRED_DISTRO_FEATURES_REMOVE_imxgpu3d = ""
+REQUIRED_DISTRO_FEATURES_remove = "${IMX_REQUIRED_DISTRO_FEATURES_REMOVE}"
+IMX_EXTRA_OECONF_OPENGL          = ""
+IMX_EXTRA_OECONF_OPENGL_imxgpu2d = " --disable-opengl"
+IMX_EXTRA_OECONF_OPENGL_imxgpu3d = ""
+EXTRA_OECONF_append = "${IMX_EXTRA_OECONF_OPENGL}"
+
+PACKAGECONFIG_append_imxgpu3d = " cairo-glesv2"
+
+RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-loginuid', '', d)}"
+
+PACKAGE_ARCH = "${MACHINE_SOCARCH}"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 13/14] weston-init: Fix weston 2.0 startup for pam, systemd case
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (11 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 12/14] weston: Switch to 2.0 with i.MX fork Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-15 21:02 ` [PATCH v2 14/14] libepoxy: Fix build break for EGL_CAST dependency Tom Hochstein
  2017-11-16 15:54 ` [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Otavio Salvador
  14 siblings, 0 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

The weston-start script for starting Weston does not work
well for Weston 2.0.

Daniel Diaz's proposal [1] for the systemd case with pam
seems to work, except that starting an xterm under XWayland
causes the desktop to crash. Using weston-launch instead of
weston works better.

[1] http://lists.openembedded.org/pipermail/openembedded-core/2016-December/129986.html

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 recipes-graphics/wayland/weston-init.bbappend      | 23 ++++++++++++++
 recipes-graphics/wayland/weston-init/weston.config |  2 ++
 .../wayland/weston-init/weston.service             | 37 ++++++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 recipes-graphics/wayland/weston-init.bbappend
 create mode 100644 recipes-graphics/wayland/weston-init/weston.config
 create mode 100644 recipes-graphics/wayland/weston-init/weston.service

diff --git a/recipes-graphics/wayland/weston-init.bbappend b/recipes-graphics/wayland/weston-init.bbappend
new file mode 100644
index 0000000..8a5d9a8
--- /dev/null
+++ b/recipes-graphics/wayland/weston-init.bbappend
@@ -0,0 +1,23 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+REQUIRED_DISTRO_FEATURES_REMOVE_IMXGPU          = ""
+REQUIRED_DISTRO_FEATURES_REMOVE_IMXGPU_imxgpu2d = "opengl"
+REQUIRED_DISTRO_FEATURES_REMOVE_IMXGPU_imxgpu3d = ""
+REQUIRED_DISTRO_FEATURES_remove = "${REQUIRED_DISTRO_FEATURES_REMOVE_IMXGPU}"
+
+SRC_URI_append = \
+    "${@bb.utils.contains('DISTRO_FEATURES', 'wayland x11', \
+        ' file://weston.config', '', d)}"
+
+HAS_XWAYLAND = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland x11', 'true', 'false', d)}"
+
+do_install_append() {
+    sed -i \
+        -e 's,/usr/bin,${bindir},g' \
+        -e 's,/etc,${sysconfdir},g' \
+        -e 's,/var,${localstatedir},g' \
+        ${D}${systemd_system_unitdir}/weston.service
+    if ${HAS_XWAYLAND}; then
+        install -Dm0755 ${WORKDIR}/weston.config ${D}${sysconfdir}/default/weston
+    fi
+}
diff --git a/recipes-graphics/wayland/weston-init/weston.config b/recipes-graphics/wayland/weston-init/weston.config
new file mode 100644
index 0000000..7c92cf1
--- /dev/null
+++ b/recipes-graphics/wayland/weston-init/weston.config
@@ -0,0 +1,2 @@
+#!/bin/sh
+OPTARGS="--xwayland"
diff --git a/recipes-graphics/wayland/weston-init/weston.service b/recipes-graphics/wayland/weston-init/weston.service
new file mode 100644
index 0000000..e3938c9
--- /dev/null
+++ b/recipes-graphics/wayland/weston-init/weston.service
@@ -0,0 +1,37 @@
+[Unit]
+Description=Weston Wayland Compositor (on tty7)
+RequiresMountsFor=/run
+Conflicts=getty@tty7.service plymouth-quit.service
+After=systemd-user-sessions.service getty@tty7.service plymouth-quit-wait.service
+
+[Service]
+User=root
+PermissionsStartOnly=true
+
+# Log us in via PAM so we get our XDG & co. environment and
+# are treated as logged in so we can use the tty:
+PAMName=login
+
+# Grab tty7
+UtmpIdentifier=tty7
+TTYPath=/dev/tty7
+TTYReset=yes
+TTYVHangup=yes
+TTYVTDisallocate=yes
+
+# stderr to journal so our logging doesn't get thrown into /dev/null
+StandardOutput=tty
+StandardInput=tty
+StandardError=journal
+
+EnvironmentFile=-/etc/default/weston
+
+# Weston does not successfully change VT, nor does systemd place us on
+# the VT it just activated for us. Switch manually:
+ExecStartPre=/usr/bin/chvt 7
+ExecStart=/usr/bin/weston-launch -- --log=/var/log/weston.log $OPTARGS
+
+IgnoreSIGPIPE=no
+
+[Install]
+WantedBy=multi-user.target
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v2 14/14] libepoxy: Fix build break for EGL_CAST dependency
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (12 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 13/14] weston-init: Fix weston 2.0 startup for pam, systemd case Tom Hochstein
@ 2017-11-15 21:02 ` Tom Hochstein
  2017-11-16 15:48   ` Otavio Salvador
  2017-11-16 15:54 ` [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Otavio Salvador
  14 siblings, 1 reply; 27+ messages in thread
From: Tom Hochstein @ 2017-11-15 21:02 UTC (permalink / raw)
  To: meta-freescale

This is a backport [1] to fix the following build error:

| In file included from /home/r60874/upstream/xwayland/tmp/work/armv7at2hf-neon-mx6qdl-fslc-linux-gnueabi/gtk+3/3.22.17-r0/recipe-sysroot/usr/include/epoxy/egl.h:46:0,
|                  from ../../../gtk+-3.22.17/gdk/wayland/gdkglcontext-wayland.h:32,
|                  from ../../../gtk+-3.22.17/gdk/wayland/gdkglcontext-wayland.c:24:
| ../../../gtk+-3.22.17/gdk/wayland/gdkglcontext-wayland.c: In function 'gdk_wayland_gl_context_realize':
| ../../../gtk+-3.22.17/gdk/wayland/gdkglcontext-wayland.c:179:43: error: expected expression before 'EGLContext'
|                                          : EGL_NO_CONTEXT,
|                                            ^

[1] https://github.com/anholt/libepoxy/commit/ebe3a53db1c0bb34e1ca963b95d1f222115f93f8

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 .../Add-fallback-definition-for-EGL-CAST.patch     | 31 ++++++++++++++++++++++
 recipes-graphics/libepoxy/libepoxy_%.bbappend      |  3 +++
 2 files changed, 34 insertions(+)
 create mode 100644 recipes-graphics/libepoxy/libepoxy/Add-fallback-definition-for-EGL-CAST.patch
 create mode 100644 recipes-graphics/libepoxy/libepoxy_%.bbappend

diff --git a/recipes-graphics/libepoxy/libepoxy/Add-fallback-definition-for-EGL-CAST.patch b/recipes-graphics/libepoxy/libepoxy/Add-fallback-definition-for-EGL-CAST.patch
new file mode 100644
index 0000000..daa1785
--- /dev/null
+++ b/recipes-graphics/libepoxy/libepoxy/Add-fallback-definition-for-EGL-CAST.patch
@@ -0,0 +1,31 @@
+Add fallback definition for EGL_CAST
+
+The EGL API update from d11104f introduced a dependency on the
+EGL_CAST() macro, provided by an updated eglplatform.h. Given that we
+don't provide eglplatform.h, add a fallback definition for if we're
+building against Mesa 17.0.x or similar.
+
+https://bugs.gentoo.org/show_bug.cgi?id=623926
+
+Upstream-Status: Backport [https://github.com/anholt/libepoxy/commit/ebe3a53db1c0bb34e1ca963b95d1f222115f93f8]
+
+Index: libepoxy-1.4.3/src/gen_dispatch.py
+===================================================================
+--- libepoxy-1.4.3.orig/src/gen_dispatch.py	2017-06-06 04:24:13.000000000 -0500
++++ libepoxy-1.4.3/src/gen_dispatch.py	2017-11-06 12:45:43.594966473 -0600
+@@ -491,6 +491,15 @@
+             self.outln('#include "epoxy/gl.h"')
+             if self.target == "egl":
+                 self.outln('#include "EGL/eglplatform.h"')
++                # Account for older eglplatform.h, which doesn't define
++                # the EGL_CAST macro.
++                self.outln('#ifndef EGL_CAST')
++                self.outln('#if defined(__cplusplus)')
++                self.outln('#define EGL_CAST(type, value) (static_cast<type>(value))')
++                self.outln('#else')
++                self.outln('#define EGL_CAST(type, value) ((type) (value))')
++                self.outln('#endif')
++                self.outln('#endif')
+         else:
+             # Add some ridiculous inttypes.h redefinitions that are
+             # from khrplatform.h and not included in the XML.  We
diff --git a/recipes-graphics/libepoxy/libepoxy_%.bbappend b/recipes-graphics/libepoxy/libepoxy_%.bbappend
new file mode 100644
index 0000000..2655037
--- /dev/null
+++ b/recipes-graphics/libepoxy/libepoxy_%.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
+
+SRC_URI += "file://Add-fallback-definition-for-EGL-CAST.patch"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 05/14] imx-gpu-viv: Upgrade to 6.2.2.p0
  2017-11-15 21:02 ` [PATCH v2 05/14] imx-gpu-viv: Upgrade to 6.2.2.p0 Tom Hochstein
@ 2017-11-16 11:37   ` Gary Bisson
  2017-11-16 12:43     ` Otavio Salvador
  0 siblings, 1 reply; 27+ messages in thread
From: Gary Bisson @ 2017-11-16 11:37 UTC (permalink / raw)
  To: Tom Hochstein; +Cc: meta-freescale Mailing List

Hi Tom,

On Wed, Nov 15, 2017 at 10:02 PM, Tom Hochstein <tom.hochstein@nxp.com> wrote:
> Key Features of the Vivante 6.2.2.p0 Driver Series
>
> - Full support for Khronos Vulkan 1.0 API and WSI extension APIs
> Vulkan is a new generation graphics and compute API that provides
> high-efficiency, cross-platform access to modern GPUs used in a wide
> variety of devices. Vivante’s Vulkan 1.0 implementation has passed
> Khronos Vulkan 1.0 Conformance Test. Vivante GC7000XS* GPU core has
> been certified by Khronos as a Vulkan 1.0 compliant product.
> - Full support for Khronos OpenGL ES 3.2 API
> The new OpenGL ES 3.2 and OpenGL ES Shading Language 3.20
> specifications bring AEP, plus additional functionality, into core
> OpenGL ES. Vivante OpenGL ES 3.2 implementation has passed Khronos
> OpenGL ES 3.2 Conformance Test. And Vivante GC7000XS* GPU core has
> been certified by Khronos as an OpenGL ES 3.2 compliant product.
> - Draw calls specifying a base vertex parameter
> - Floating-point framebuffers
> - Robust buffer access control
> - Support for querying CONTEXT_FLAGS, as needed by debug and robust buffer access functionality.
> - Khronos OpenVX 1.0.1 API
> - Khronos OpenCL 1.2 API
>
> Improvements
>
> 1. Added mutex protection for referencing gctSIGNAL in gckOS_MapSignal to fix a MT race issue.
> 2. Streamlined GPU address calculation base on MC20 (0/1) and MMU (0/1) combinations.
> 3. Fixed multiple Android HWC 2.0 rendering issues. Refined HWC 2.0 driver implementation.
> 4. Improved HWC2.0 composition performance by composing damaged regions only.
> 6. Enabled offline/online compiler IR assembly dump function for users.
> 7. Implemented the direct rendering support (no-resolve) for Wayland platform.
> 8. Added EGL_EXT_buffer_age extension for Wayland and fbdev platforms.
> 9. Updated wayland-viv protocol to support tile status sync from client to server.
> 10. Improved OpenCL 1.2 builtin function support with native GPU instructions.
> 11. Enabled OpenCL 1.2 API trace dump function controlled by VIV_TRACE environment variable.
> 12. Support for OpenGL4.0
> 13. Cleaned up driver code issues reported by Klocwork and Coverity.
>
> Changes and Bug Fixes
>
> VG3D:   MGS-2972 fix 3D OpenVG render target orientation
> EGL:    MGS-2790 6sx-sdb Met memory dump when do xwld stress test
> EGL:    MGS-2885 fix recursive call to dequeue buffer issue on wayland
> EGL:    MGS-2785 Meet segmentation fault when test qt5nmapper on wayland
> EGL:    MGS-2734 fix x11 memory leak issue
> Gralloc:MA-9561 fix crash issue on new gralloc1 interface.
> 2D:     MGS-2900 fix filterblt memory leak
> VG2D/6SL: MGS-2882 fix video memory allocator
> OCL:    MGS-2732 clCopyImage with max_images in OCL1.1 cts, crashes.
> GLES:   MGS-2747 enable the full config for ES3 CTS
> GLES:   MGS-1832 fix Mirada performance issue. optimize cpu load for fence check
> WEBGL:  MGS-2779 webgl 1.0.2 conformance test met out of memory
> General:MGS-2923 fix gc2000 gpu hang when flush TS cache
> General:MGS-2907 fix wrong cache invalidate with dma_map_area
> General:MGS-2902 fix wrong release_mem_region
> General:MGS-2848 fix gpu hang for flat mapping optimization
> General:MGS-2848 Optimize MMUv1 FlatMapping performances
> General:MGS-2857 fix spinlock in gpu kernel driver
> General:MGS-2805 Enable gcdENABLE_VG by default.
> General:MGS-2827 fix serious performance drop on imx6q
> General:MGS-2832 fix axi bus error with correct baseaddress
> General:MA-9483  Refine android native fence code to match 4.9 kernel
> General:MA-9473 Fix gpu random crash issue caused by NULL pointer
> General:MGS-2804 fix flat mapping overflow issue
> General:MGS-2786 fix gpu kernel panic with debugfs
> General:GS-2776  fix galcore device open failure
> General:MGS-2767 i.MX7ULP GPU suspend/resume problem
> Coverity:MGS-2858 Double free in __driUtilUpdateExtraDrawableInfo
>
> Known Issues
>
> OpenCL 1.1 CTS failures. Will be addresed in 6.2.3
> MGS-3027 GPU: X11 manywin draw error. 100%
> MGS-2935 [imx6QP] X11: glxs app test some frames render incorrectly. 100%
> MGS-2860 [MX7ULP/imx6SLEVK] X11/Xwld: XWindow 2D Acceleration performance test met "X Error of failed request: BadMatch (invalid parameter attributes)" error. 100%
> MGS-2829 [imx6qp/imx6d] xwld: mm06 Samurai and Proxycon performance regression comparing with L4.1 using 5.0.11p8
> MGS-2310 [imx6qp/imx6dq/imx6dl/imx6sx] webgl: two items performance data is lower than L4.1_GA
> MGS-1828 [imx6qp_sd/imx6Q/imx6dl] X11/xwld: VGMARK on vg3d have some items performance drop comparing with L4.1 GA
> MGS-1350 [imx6qp-sd] X/FB: Some Basemark test items performance drop comparing with L3.14.52GA which use 5.0.11p7

If I may, I have one more issue to add to the list:
[imx6q/imx6qp/imx6dl] Does not work if cma region is above 'base + 2G'

Have you tried this driver on an i.MX6 platform with 4GB of RAM &
kernel 4.9 (rel_imx_4.9.x_1.0.0_ga)?

Here it fails because the region of cma in such case is located at the
end of the RAM (0xea000000 exactly) which the driver doesn't seem to
support.

Note that a similar issue was seen and fixed on Etnaviv[1]. I guess a
similar patch is required for this driver as well.

Forcing the cma area to be under 0x90000000 (for imx6qdl) makes the driver work.

Also, the driver works fine on 4.1.15 kernel, because the cma region
is allocated @0x6a000000 by default and therefore everything is fine.

Using 4.1.15 of_reserved_mem.c works too but that is just a
workaround, the viv driver should manage that case since Etnaviv does.

Let me know if you have any question.

Regards,
Gary

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=471070ab


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 05/14] imx-gpu-viv: Upgrade to 6.2.2.p0
  2017-11-16 11:37   ` Gary Bisson
@ 2017-11-16 12:43     ` Otavio Salvador
  2017-11-17 22:37       ` Prabhu Sundararaj
  0 siblings, 1 reply; 27+ messages in thread
From: Otavio Salvador @ 2017-11-16 12:43 UTC (permalink / raw)
  To: Gary Bisson; +Cc: meta-freescale Mailing List, Prabhu Sundararaj

Hello Gary,

Thanks for getting involved on this. I am adding Prabhu to the Cc as well.

On Thu, Nov 16, 2017 at 9:37 AM, Gary Bisson
<gary.bisson@boundarydevices.com> wrote:
> Hi Tom,
>
> On Wed, Nov 15, 2017 at 10:02 PM, Tom Hochstein <tom.hochstein@nxp.com> wrote:
>> Key Features of the Vivante 6.2.2.p0 Driver Series
>>
>> - Full support for Khronos Vulkan 1.0 API and WSI extension APIs
>> Vulkan is a new generation graphics and compute API that provides
>> high-efficiency, cross-platform access to modern GPUs used in a wide
>> variety of devices. Vivante’s Vulkan 1.0 implementation has passed
>> Khronos Vulkan 1.0 Conformance Test. Vivante GC7000XS* GPU core has
>> been certified by Khronos as a Vulkan 1.0 compliant product.
>> - Full support for Khronos OpenGL ES 3.2 API
>> The new OpenGL ES 3.2 and OpenGL ES Shading Language 3.20
>> specifications bring AEP, plus additional functionality, into core
>> OpenGL ES. Vivante OpenGL ES 3.2 implementation has passed Khronos
>> OpenGL ES 3.2 Conformance Test. And Vivante GC7000XS* GPU core has
>> been certified by Khronos as an OpenGL ES 3.2 compliant product.
>> - Draw calls specifying a base vertex parameter
>> - Floating-point framebuffers
>> - Robust buffer access control
>> - Support for querying CONTEXT_FLAGS, as needed by debug and robust buffer access functionality.
>> - Khronos OpenVX 1.0.1 API
>> - Khronos OpenCL 1.2 API
>>
>> Improvements
>>
>> 1. Added mutex protection for referencing gctSIGNAL in gckOS_MapSignal to fix a MT race issue.
>> 2. Streamlined GPU address calculation base on MC20 (0/1) and MMU (0/1) combinations.
>> 3. Fixed multiple Android HWC 2.0 rendering issues. Refined HWC 2.0 driver implementation.
>> 4. Improved HWC2.0 composition performance by composing damaged regions only.
>> 6. Enabled offline/online compiler IR assembly dump function for users.
>> 7. Implemented the direct rendering support (no-resolve) for Wayland platform.
>> 8. Added EGL_EXT_buffer_age extension for Wayland and fbdev platforms.
>> 9. Updated wayland-viv protocol to support tile status sync from client to server.
>> 10. Improved OpenCL 1.2 builtin function support with native GPU instructions.
>> 11. Enabled OpenCL 1.2 API trace dump function controlled by VIV_TRACE environment variable.
>> 12. Support for OpenGL4.0
>> 13. Cleaned up driver code issues reported by Klocwork and Coverity.
>>
>> Changes and Bug Fixes
>>
>> VG3D:   MGS-2972 fix 3D OpenVG render target orientation
>> EGL:    MGS-2790 6sx-sdb Met memory dump when do xwld stress test
>> EGL:    MGS-2885 fix recursive call to dequeue buffer issue on wayland
>> EGL:    MGS-2785 Meet segmentation fault when test qt5nmapper on wayland
>> EGL:    MGS-2734 fix x11 memory leak issue
>> Gralloc:MA-9561 fix crash issue on new gralloc1 interface.
>> 2D:     MGS-2900 fix filterblt memory leak
>> VG2D/6SL: MGS-2882 fix video memory allocator
>> OCL:    MGS-2732 clCopyImage with max_images in OCL1.1 cts, crashes.
>> GLES:   MGS-2747 enable the full config for ES3 CTS
>> GLES:   MGS-1832 fix Mirada performance issue. optimize cpu load for fence check
>> WEBGL:  MGS-2779 webgl 1.0.2 conformance test met out of memory
>> General:MGS-2923 fix gc2000 gpu hang when flush TS cache
>> General:MGS-2907 fix wrong cache invalidate with dma_map_area
>> General:MGS-2902 fix wrong release_mem_region
>> General:MGS-2848 fix gpu hang for flat mapping optimization
>> General:MGS-2848 Optimize MMUv1 FlatMapping performances
>> General:MGS-2857 fix spinlock in gpu kernel driver
>> General:MGS-2805 Enable gcdENABLE_VG by default.
>> General:MGS-2827 fix serious performance drop on imx6q
>> General:MGS-2832 fix axi bus error with correct baseaddress
>> General:MA-9483  Refine android native fence code to match 4.9 kernel
>> General:MA-9473 Fix gpu random crash issue caused by NULL pointer
>> General:MGS-2804 fix flat mapping overflow issue
>> General:MGS-2786 fix gpu kernel panic with debugfs
>> General:GS-2776  fix galcore device open failure
>> General:MGS-2767 i.MX7ULP GPU suspend/resume problem
>> Coverity:MGS-2858 Double free in __driUtilUpdateExtraDrawableInfo
>>
>> Known Issues
>>
>> OpenCL 1.1 CTS failures. Will be addresed in 6.2.3
>> MGS-3027 GPU: X11 manywin draw error. 100%
>> MGS-2935 [imx6QP] X11: glxs app test some frames render incorrectly. 100%
>> MGS-2860 [MX7ULP/imx6SLEVK] X11/Xwld: XWindow 2D Acceleration performance test met "X Error of failed request: BadMatch (invalid parameter attributes)" error. 100%
>> MGS-2829 [imx6qp/imx6d] xwld: mm06 Samurai and Proxycon performance regression comparing with L4.1 using 5.0.11p8
>> MGS-2310 [imx6qp/imx6dq/imx6dl/imx6sx] webgl: two items performance data is lower than L4.1_GA
>> MGS-1828 [imx6qp_sd/imx6Q/imx6dl] X11/xwld: VGMARK on vg3d have some items performance drop comparing with L4.1 GA
>> MGS-1350 [imx6qp-sd] X/FB: Some Basemark test items performance drop comparing with L3.14.52GA which use 5.0.11p7
>
> If I may, I have one more issue to add to the list:
> [imx6q/imx6qp/imx6dl] Does not work if cma region is above 'base + 2G'
>
> Have you tried this driver on an i.MX6 platform with 4GB of RAM &
> kernel 4.9 (rel_imx_4.9.x_1.0.0_ga)?
>
> Here it fails because the region of cma in such case is located at the
> end of the RAM (0xea000000 exactly) which the driver doesn't seem to
> support.
>
> Note that a similar issue was seen and fixed on Etnaviv[1]. I guess a
> similar patch is required for this driver as well.
>
> Forcing the cma area to be under 0x90000000 (for imx6qdl) makes the driver work.
>
> Also, the driver works fine on 4.1.15 kernel, because the cma region
> is allocated @0x6a000000 by default and therefore everything is fine.
>
> Using 4.1.15 of_reserved_mem.c works too but that is just a
> workaround, the viv driver should manage that case since Etnaviv does.
>
> Let me know if you have any question.
>
> Regards,
> Gary
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=471070ab
> --
> _______________________________________________
> meta-freescale mailing list
> meta-freescale@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-freescale



-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 14/14] libepoxy: Fix build break for EGL_CAST dependency
  2017-11-15 21:02 ` [PATCH v2 14/14] libepoxy: Fix build break for EGL_CAST dependency Tom Hochstein
@ 2017-11-16 15:48   ` Otavio Salvador
  0 siblings, 0 replies; 27+ messages in thread
From: Otavio Salvador @ 2017-11-16 15:48 UTC (permalink / raw)
  To: Tom Hochstein; +Cc: meta-freescale

On Wed, Nov 15, 2017 at 7:02 PM, Tom Hochstein <tom.hochstein@nxp.com> wrote:
> This is a backport [1] to fix the following build error:
>
> | In file included from /home/r60874/upstream/xwayland/tmp/work/armv7at2hf-neon-mx6qdl-fslc-linux-gnueabi/gtk+3/3.22.17-r0/recipe-sysroot/usr/include/epoxy/egl.h:46:0,
> |                  from ../../../gtk+-3.22.17/gdk/wayland/gdkglcontext-wayland.h:32,
> |                  from ../../../gtk+-3.22.17/gdk/wayland/gdkglcontext-wayland.c:24:
> | ../../../gtk+-3.22.17/gdk/wayland/gdkglcontext-wayland.c: In function 'gdk_wayland_gl_context_realize':
> | ../../../gtk+-3.22.17/gdk/wayland/gdkglcontext-wayland.c:179:43: error: expected expression before 'EGLContext'
> |                                          : EGL_NO_CONTEXT,
> |                                            ^
>
> [1] https://github.com/anholt/libepoxy/commit/ebe3a53db1c0bb34e1ca963b95d1f222115f93f8
>
> Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>

This must be sent to OE-Core. This is not an i.MX BSP specific thing
so it must go through the core layers.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 06/14] imx-gpu-viv: Add systemd init
  2017-11-15 21:02 ` [PATCH v2 06/14] imx-gpu-viv: Add systemd init Tom Hochstein
@ 2017-11-16 15:50   ` Otavio Salvador
  0 siblings, 0 replies; 27+ messages in thread
From: Otavio Salvador @ 2017-11-16 15:50 UTC (permalink / raw)
  To: Tom Hochstein; +Cc: meta-freescale

On Wed, Nov 15, 2017 at 7:02 PM, Tom Hochstein <tom.hochstein@nxp.com> wrote:
> Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>

Nack!

We use different binaries for different SoCs and the packages are done
accordingly. This approach goes on the against the producible build
effort.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 03/14] imx-gpu-apitrace: Move apitrace out of imx-gpu-viv v6
  2017-11-15 21:02 ` [PATCH v2 03/14] imx-gpu-apitrace: Move apitrace out of imx-gpu-viv v6 Tom Hochstein
@ 2017-11-16 15:52   ` Otavio Salvador
  0 siblings, 0 replies; 27+ messages in thread
From: Otavio Salvador @ 2017-11-16 15:52 UTC (permalink / raw)
  To: Tom Hochstein; +Cc: meta-freescale

On Wed, Nov 15, 2017 at 7:02 PM, Tom Hochstein <tom.hochstein@nxp.com> wrote:
> Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>

Instead of adding those patches please point to code aurora Git, with
the respective branch and SRCREV.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0
  2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
                   ` (13 preceding siblings ...)
  2017-11-15 21:02 ` [PATCH v2 14/14] libepoxy: Fix build break for EGL_CAST dependency Tom Hochstein
@ 2017-11-16 15:54 ` Otavio Salvador
  2017-11-16 16:26   ` Tom Hochstein
  14 siblings, 1 reply; 27+ messages in thread
From: Otavio Salvador @ 2017-11-16 15:54 UTC (permalink / raw)
  To: Tom Hochstein; +Cc: meta-freescale

On Wed, Nov 15, 2017 at 7:02 PM, Tom Hochstein <tom.hochstein@nxp.com> wrote:

We did review most of patches and we did merge few. Please rebase them
and address our comments on a v3 version, so we can be at same page
again :-)

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0
  2017-11-16 15:54 ` [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Otavio Salvador
@ 2017-11-16 16:26   ` Tom Hochstein
  2017-11-16 16:36     ` Otavio Salvador
  0 siblings, 1 reply; 27+ messages in thread
From: Tom Hochstein @ 2017-11-16 16:26 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: meta-freescale

Our fork is at 2.0. We will not have a tested 3.0 solution for one or two months.

Tom

-----Original Message-----
From: Otavio Salvador [mailto:otavio.salvador@ossystems.com.br] 
Sent: Thursday, November 16, 2017 9:54 AM
To: Tom Hochstein <tom.hochstein@nxp.com>
Cc: meta-freescale@yoctoproject.org
Subject: Re: [meta-freescale] [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0

On Wed, Nov 15, 2017 at 7:02 PM, Tom Hochstein <tom.hochstein@nxp.com> wrote:

We did review most of patches and we did merge few. Please rebase them
and address our comments on a v3 version, so we can be at same page
again :-)

-- 
Otavio Salvador                             O.S. Systems
https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ossystems.com.br&data=02%7C01%7Ctom.hochstein%40nxp.com%7Cbcf9cbb0397047c7f1b508d52d0a4d78%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636464444632909183&sdata=2ZDMnCY7HSZB570SZoVEPBvW7BX8rqf4fROZ8stgqMg%3D&reserved=0        https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcode.ossystems.com.br&data=02%7C01%7Ctom.hochstein%40nxp.com%7Cbcf9cbb0397047c7f1b508d52d0a4d78%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636464444632909183&sdata=aHOfRn9czOhHHibpNMHPtO698cGim2ZWNlVmODw%2F43I%3D&reserved=0
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0
  2017-11-16 16:26   ` Tom Hochstein
@ 2017-11-16 16:36     ` Otavio Salvador
  0 siblings, 0 replies; 27+ messages in thread
From: Otavio Salvador @ 2017-11-16 16:36 UTC (permalink / raw)
  To: Tom Hochstein; +Cc: meta-freescale

On Thu, Nov 16, 2017 at 2:26 PM, Tom Hochstein <tom.hochstein@nxp.com> wrote:
> Our fork is at 2.0. We will not have a tested 3.0 solution for one or two months.

I know; so add a weston-imx recipe which fetches from tthe git.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 05/14] imx-gpu-viv: Upgrade to 6.2.2.p0
  2017-11-16 12:43     ` Otavio Salvador
@ 2017-11-17 22:37       ` Prabhu Sundararaj
  2017-11-20 11:26         ` Otavio Salvador
  0 siblings, 1 reply; 27+ messages in thread
From: Prabhu Sundararaj @ 2017-11-17 22:37 UTC (permalink / raw)
  To: Otavio Salvador, Gary Bisson; +Cc: meta-freescale Mailing List

Hi Otavio, Gary,
We tested only on SABRE boards and it got only 2GB MAX DDR.

> Using 4.1.15 of_reserved_mem.c works too but that is just a 
> workaround, the viv driver should manage that case since Etnaviv does.
Wondering whether this restriction came in 4.9?

This is not regression from in my point of view. May be we consider this a requirement and fix it in separate patch.
Fixing this and validation would require some time.

-----Original Message-----
From: Otavio Salvador [mailto:otavio.salvador@ossystems.com.br] 
Sent: Thursday, November 16, 2017 6:44 AM
To: Gary Bisson <gary.bisson@boundarydevices.com>
Cc: Tom Hochstein <tom.hochstein@nxp.com>; meta-freescale Mailing List <meta-freescale@yoctoproject.org>; Prabhu Sundararaj <prabhu.sundararaj@nxp.com>
Subject: Re: [meta-freescale] [PATCH v2 05/14] imx-gpu-viv: Upgrade to 6.2.2.p0

Hello Gary,

Thanks for getting involved on this. I am adding Prabhu to the Cc as well.

On Thu, Nov 16, 2017 at 9:37 AM, Gary Bisson <gary.bisson@boundarydevices.com> wrote:
> Hi Tom,
>
> On Wed, Nov 15, 2017 at 10:02 PM, Tom Hochstein <tom.hochstein@nxp.com> wrote:
>> Key Features of the Vivante 6.2.2.p0 Driver Series
>>
>> - Full support for Khronos Vulkan 1.0 API and WSI extension APIs 
>> Vulkan is a new generation graphics and compute API that provides 
>> high-efficiency, cross-platform access to modern GPUs used in a wide 
>> variety of devices. Vivante’s Vulkan 1.0 implementation has passed 
>> Khronos Vulkan 1.0 Conformance Test. Vivante GC7000XS* GPU core has 
>> been certified by Khronos as a Vulkan 1.0 compliant product.
>> - Full support for Khronos OpenGL ES 3.2 API The new OpenGL ES 3.2 
>> and OpenGL ES Shading Language 3.20 specifications bring AEP, plus 
>> additional functionality, into core OpenGL ES. Vivante OpenGL ES 3.2 
>> implementation has passed Khronos OpenGL ES 3.2 Conformance Test. And 
>> Vivante GC7000XS* GPU core has been certified by Khronos as an OpenGL 
>> ES 3.2 compliant product.
>> - Draw calls specifying a base vertex parameter
>> - Floating-point framebuffers
>> - Robust buffer access control
>> - Support for querying CONTEXT_FLAGS, as needed by debug and robust buffer access functionality.
>> - Khronos OpenVX 1.0.1 API
>> - Khronos OpenCL 1.2 API
>>
>> Improvements
>>
>> 1. Added mutex protection for referencing gctSIGNAL in gckOS_MapSignal to fix a MT race issue.
>> 2. Streamlined GPU address calculation base on MC20 (0/1) and MMU (0/1) combinations.
>> 3. Fixed multiple Android HWC 2.0 rendering issues. Refined HWC 2.0 driver implementation.
>> 4. Improved HWC2.0 composition performance by composing damaged regions only.
>> 6. Enabled offline/online compiler IR assembly dump function for users.
>> 7. Implemented the direct rendering support (no-resolve) for Wayland platform.
>> 8. Added EGL_EXT_buffer_age extension for Wayland and fbdev platforms.
>> 9. Updated wayland-viv protocol to support tile status sync from client to server.
>> 10. Improved OpenCL 1.2 builtin function support with native GPU instructions.
>> 11. Enabled OpenCL 1.2 API trace dump function controlled by VIV_TRACE environment variable.
>> 12. Support for OpenGL4.0
>> 13. Cleaned up driver code issues reported by Klocwork and Coverity.
>>
>> Changes and Bug Fixes
>>
>> VG3D:   MGS-2972 fix 3D OpenVG render target orientation
>> EGL:    MGS-2790 6sx-sdb Met memory dump when do xwld stress test
>> EGL:    MGS-2885 fix recursive call to dequeue buffer issue on wayland
>> EGL:    MGS-2785 Meet segmentation fault when test qt5nmapper on wayland
>> EGL:    MGS-2734 fix x11 memory leak issue
>> Gralloc:MA-9561 fix crash issue on new gralloc1 interface.
>> 2D:     MGS-2900 fix filterblt memory leak
>> VG2D/6SL: MGS-2882 fix video memory allocator
>> OCL:    MGS-2732 clCopyImage with max_images in OCL1.1 cts, crashes.
>> GLES:   MGS-2747 enable the full config for ES3 CTS
>> GLES:   MGS-1832 fix Mirada performance issue. optimize cpu load for fence check
>> WEBGL:  MGS-2779 webgl 1.0.2 conformance test met out of memory
>> General:MGS-2923 fix gc2000 gpu hang when flush TS cache
>> General:MGS-2907 fix wrong cache invalidate with dma_map_area
>> General:MGS-2902 fix wrong release_mem_region
>> General:MGS-2848 fix gpu hang for flat mapping optimization
>> General:MGS-2848 Optimize MMUv1 FlatMapping performances
>> General:MGS-2857 fix spinlock in gpu kernel driver
>> General:MGS-2805 Enable gcdENABLE_VG by default.
>> General:MGS-2827 fix serious performance drop on imx6q
>> General:MGS-2832 fix axi bus error with correct baseaddress
>> General:MA-9483  Refine android native fence code to match 4.9 kernel
>> General:MA-9473 Fix gpu random crash issue caused by NULL pointer
>> General:MGS-2804 fix flat mapping overflow issue
>> General:MGS-2786 fix gpu kernel panic with debugfs
>> General:GS-2776  fix galcore device open failure
>> General:MGS-2767 i.MX7ULP GPU suspend/resume problem
>> Coverity:MGS-2858 Double free in __driUtilUpdateExtraDrawableInfo
>>
>> Known Issues
>>
>> OpenCL 1.1 CTS failures. Will be addresed in 6.2.3
>> MGS-3027 GPU: X11 manywin draw error. 100%
>> MGS-2935 [imx6QP] X11: glxs app test some frames render incorrectly. 
>> 100%
>> MGS-2860 [MX7ULP/imx6SLEVK] X11/Xwld: XWindow 2D Acceleration 
>> performance test met "X Error of failed request: BadMatch (invalid 
>> parameter attributes)" error. 100%
>> MGS-2829 [imx6qp/imx6d] xwld: mm06 Samurai and Proxycon performance 
>> regression comparing with L4.1 using 5.0.11p8
>> MGS-2310 [imx6qp/imx6dq/imx6dl/imx6sx] webgl: two items performance 
>> data is lower than L4.1_GA
>> MGS-1828 [imx6qp_sd/imx6Q/imx6dl] X11/xwld: VGMARK on vg3d have some 
>> items performance drop comparing with L4.1 GA
>> MGS-1350 [imx6qp-sd] X/FB: Some Basemark test items performance drop 
>> comparing with L3.14.52GA which use 5.0.11p7
>
> If I may, I have one more issue to add to the list:
> [imx6q/imx6qp/imx6dl] Does not work if cma region is above 'base + 2G'
>
> Have you tried this driver on an i.MX6 platform with 4GB of RAM & 
> kernel 4.9 (rel_imx_4.9.x_1.0.0_ga)?
>
> Here it fails because the region of cma in such case is located at the 
> end of the RAM (0xea000000 exactly) which the driver doesn't seem to 
> support.
>
> Note that a similar issue was seen and fixed on Etnaviv[1]. I guess a 
> similar patch is required for this driver as well.
>
> Forcing the cma area to be under 0x90000000 (for imx6qdl) makes the driver work.
>
> Also, the driver works fine on 4.1.15 kernel, because the cma region 
> is allocated @0x6a000000 by default and therefore everything is fine.
>
> Using 4.1.15 of_reserved_mem.c works too but that is just a 
> workaround, the viv driver should manage that case since Etnaviv does.
>
> Let me know if you have any question.
>
> Regards,
> Gary
>
> [1] 
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit
> .kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fstable%2Flinux-stable
> .git%2Fcommit%2F%3Fid%3D471070ab&data=02%7C01%7Cprabhu.sundararaj%40nx
> p.com%7C0a2c9ac866ef4588749308d52cefaf83%7C686ea1d3bc2b4c6fa92cd99c5c3
> 01635%7C0%7C0%7C636464330308145513&sdata=nVIrYQ62nOUECfWanh3naXVnQ%2FG
> yLROUBi4ldsxYBWo%3D&reserved=0
> --
> _______________________________________________
> meta-freescale mailing list
> meta-freescale@yoctoproject.org
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
> ts.yoctoproject.org%2Flistinfo%2Fmeta-freescale&data=02%7C01%7Cprabhu.
> sundararaj%40nxp.com%7C0a2c9ac866ef4588749308d52cefaf83%7C686ea1d3bc2b
> 4c6fa92cd99c5c301635%7C0%7C0%7C636464330308145513&sdata=TXQ7EObxl5RrlE
> 4kmhuYryL1rx3FWEEOPv5TgyPVHQg%3D&reserved=0



-- 
Otavio Salvador                             O.S. Systems
https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ossystems.com.br&data=02%7C01%7Cprabhu.sundararaj%40nxp.com%7C0a2c9ac866ef4588749308d52cefaf83%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636464330308145513&sdata=%2BgDEk4N4Xsy6S70U5cN76O101dhTnFM1AMHzVG6es%2Bw%3D&reserved=0        https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcode.ossystems.com.br&data=02%7C01%7Cprabhu.sundararaj%40nxp.com%7C0a2c9ac866ef4588749308d52cefaf83%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636464330308145513&sdata=3eP%2Bifz5Pj4iw9Wjrovqlw%2BYxizJyroy2YJFUmrbNxE%3D&reserved=0
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 05/14] imx-gpu-viv: Upgrade to 6.2.2.p0
  2017-11-17 22:37       ` Prabhu Sundararaj
@ 2017-11-20 11:26         ` Otavio Salvador
  0 siblings, 0 replies; 27+ messages in thread
From: Otavio Salvador @ 2017-11-20 11:26 UTC (permalink / raw)
  To: Prabhu Sundararaj; +Cc: meta-freescale Mailing List

Hello Prabhu,

On Fri, Nov 17, 2017 at 8:37 PM, Prabhu Sundararaj
<prabhu.sundararaj@nxp.com> wrote:
> Hi Otavio, Gary,
> We tested only on SABRE boards and it got only 2GB MAX DDR.

Ok, this is a valid point but this does not mean it covers all
possible use-cases.

>> Using 4.1.15 of_reserved_mem.c works too but that is just a
>> workaround, the viv driver should manage that case since Etnaviv does.
> Wondering whether this restriction came in 4.9?
>
> This is not regression from in my point of view. May be we consider this a requirement and fix it in separate patch.

Sorry but it is a regression. The previous GA release works with 4GiB
of RAM. The new one does not.

> Fixing this and validation would require some time.

Gary did figure out the root cause. He found two important information pieces:

 - A similar issue was seen and fixed on Etnaviv[1]. I guess a
similar patch is required for this driver as well. Forcing the cma
area to be under 0x90000000 (for imx6qdl) makes the driver work.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?id=471070ab

 - A new patch[2], that is included in 4.9, changes the behavior of it

[2] https://github.com/boundarydevices/linux-imx6/commit/e53b50c0cbe392c946807abf7d07615a3c588642

Another important aspect is that the 6.2.3.p0[3] available for i.MX8
adds a new gc_hal_kernel_allocator_reserved_mem.c to address this very
issue.

[3] http://git.freescale.com/git/cgit.cgi/imx/linux-imx.git/commit/drivers/mxc/gpu-viv?id=fe649d5ca8e6088d54eee89825705257f404576d

So I think it all provides a good information about the issue. It
seems that backporting the gc_hal_kernel_allocator_reserved_mem.c is
the best option as it allows for no diverting of Linux kernel official
behavior.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 04/14] imx-gpu-g2d: Move imx-gpu-g2d out of imx-gpu-viv v6
  2017-11-15 21:02 ` [PATCH v2 04/14] imx-gpu-g2d: Move imx-gpu-g2d " Tom Hochstein
@ 2017-11-22  2:53   ` S. Lockwood-Childs
  2017-11-22 18:09     ` Tom Hochstein
  0 siblings, 1 reply; 27+ messages in thread
From: S. Lockwood-Childs @ 2017-11-22  2:53 UTC (permalink / raw)
  To: Tom Hochstein; +Cc: meta-freescale

On Wed, Nov 15, 2017 at 03:02:13PM -0600, Tom Hochstein wrote:
> Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
> ---
>  conf/machine/include/imx-base.inc                  |  2 +-
>  .../imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb            | 36 ++++++++++++++++++++++
>  2 files changed, 37 insertions(+), 1 deletion(-)
>  create mode 100644 recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb

Do you have a corresponding patch to fix up packagegroup-fsl-tools-gpu in 
meta-fsl-demos with the renames 
(imx-gpu-viv-g2d -> imx-gpu-g2d, imx-gpu-viv-apitrace -> imx-gpu-apitrace)? 
If not I'd be happy to submit one.  


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v2 04/14] imx-gpu-g2d: Move imx-gpu-g2d out of imx-gpu-viv v6
  2017-11-22  2:53   ` S. Lockwood-Childs
@ 2017-11-22 18:09     ` Tom Hochstein
  0 siblings, 0 replies; 27+ messages in thread
From: Tom Hochstein @ 2017-11-22 18:09 UTC (permalink / raw)
  To: S. Lockwood-Childs; +Cc: meta-freescale



> -----Original Message-----
> From: S. Lockwood-Childs [mailto:sjl@vctlabs.com]
> Sent: Tuesday, November 21, 2017 8:54 PM
> To: Tom Hochstein <tom.hochstein@nxp.com>
> Cc: meta-freescale@yoctoproject.org
> Subject: Re: [meta-freescale] [PATCH v2 04/14] imx-gpu-g2d: Move imx-gpu-g2d out of imx-gpu-viv v6
> 
> On Wed, Nov 15, 2017 at 03:02:13PM -0600, Tom Hochstein wrote:
> > Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
> > ---
> >  conf/machine/include/imx-base.inc                  |  2 +-
> >  .../imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb            | 36 ++++++++++++++++++++++
> >  2 files changed, 37 insertions(+), 1 deletion(-)
> >  create mode 100644 recipes-graphics/imx-gpu-g2d/imx-gpu-g2d_6.2.2.p0.bb
> 
> Do you have a corresponding patch to fix up packagegroup-fsl-tools-gpu in
> meta-fsl-demos with the renames
> (imx-gpu-viv-g2d -> imx-gpu-g2d, imx-gpu-viv-apitrace -> imx-gpu-apitrace)?
> If not I'd be happy to submit one.

Thanks, but I already took care of this at the time of the initial submission.

https://lists.yoctoproject.org/pipermail/meta-freescale/2017-October/021535.html



^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2017-11-22 19:41 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-15 21:02 [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 01/14] libdrm: Extend ARM support to mx7 Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 02/14] eglinfo-fb: Use generic header Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 03/14] imx-gpu-apitrace: Move apitrace out of imx-gpu-viv v6 Tom Hochstein
2017-11-16 15:52   ` Otavio Salvador
2017-11-15 21:02 ` [PATCH v2 04/14] imx-gpu-g2d: Move imx-gpu-g2d " Tom Hochstein
2017-11-22  2:53   ` S. Lockwood-Childs
2017-11-22 18:09     ` Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 05/14] imx-gpu-viv: Upgrade to 6.2.2.p0 Tom Hochstein
2017-11-16 11:37   ` Gary Bisson
2017-11-16 12:43     ` Otavio Salvador
2017-11-17 22:37       ` Prabhu Sundararaj
2017-11-20 11:26         ` Otavio Salvador
2017-11-15 21:02 ` [PATCH v2 06/14] imx-gpu-viv: Add systemd init Tom Hochstein
2017-11-16 15:50   ` Otavio Salvador
2017-11-15 21:02 ` [PATCH v2 07/14] mesa: Remove parts provided by imx-gpu-viv v6 Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 08/14] piglit: Remove redundant dependency Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 09/14] xserver-xf86-config: Add Xorg configuration for i.MX 6SLL and 7ULP Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 10/14] xf86-video-imxfb-vivante: Upgrade to 6.2.2.p0 Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 11/14] gtk+3: Use egl pkgconfig for build setup Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 12/14] weston: Switch to 2.0 with i.MX fork Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 13/14] weston-init: Fix weston 2.0 startup for pam, systemd case Tom Hochstein
2017-11-15 21:02 ` [PATCH v2 14/14] libepoxy: Fix build break for EGL_CAST dependency Tom Hochstein
2017-11-16 15:48   ` Otavio Salvador
2017-11-16 15:54 ` [PATCH v2 00/14] Graphics updates for L4.9.11-1.0.0 BSP Release plus Weston 2.0 Otavio Salvador
2017-11-16 16:26   ` Tom Hochstein
2017-11-16 16:36     ` Otavio Salvador

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.