aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjenkins4kodi <jenkins4kodi@users.noreply.github.com>2015-04-12 10:10:36 +0200
committerjenkins4kodi <jenkins4kodi@users.noreply.github.com>2015-04-12 10:10:36 +0200
commit4aa98b0e62a69a44111855daa64d69bcb04d4084 (patch)
tree67415653795c4ed5353b8bee28507039e3d29ab6
parent98d40a75af81bba2a0da7852f4e5abff10dadec2 (diff)
parent0500be8123a45353239e5e0dbf6cc3db5bf24057 (diff)
Merge pull request #6233 from koying/addamlrkegl
-rw-r--r--xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp13
-rw-r--r--xbmc/windowing/egl/EGLNativeTypeAmlAndroid.cpp182
-rw-r--r--xbmc/windowing/egl/EGLNativeTypeAmlAndroid.h41
-rw-r--r--xbmc/windowing/egl/EGLNativeTypeAndroid.cpp19
-rw-r--r--xbmc/windowing/egl/EGLNativeTypeRKAndroid.cpp231
-rw-r--r--xbmc/windowing/egl/EGLNativeTypeRKAndroid.h42
-rw-r--r--xbmc/windowing/egl/EGLWrapper.cpp36
-rw-r--r--xbmc/windowing/egl/Makefile.in10
8 files changed, 538 insertions, 36 deletions
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
index 8c7d4a11d3..0503becd7c 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
@@ -1684,15 +1684,8 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
std::string strScaler;
SysfsUtils::GetString("/sys/class/ppmgr/ppscaler", strScaler);
- if (strScaler.find("enabled") != std::string::npos) // Scaler not enabled, use screen size
- {
- CLog::Log(LOGDEBUG, "ppscaler not enabled");
- std::string mode;
- SysfsUtils::GetString("/sys/class/display/mode", mode);
- RESOLUTION_INFO res;
- if (aml_mode_to_resolution(mode.c_str(), &res))
- m_display_rect = CRect(0, 0, res.iScreenWidth, res.iScreenHeight);
- }
+ if (strScaler.find("enabled") == std::string::npos) // Scaler not enabled, use screen size
+ m_display_rect = CRect(0, 0, CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenWidth, CDisplaySettings::Get().GetCurrentResolutionInfo().iScreenHeight);
/*
// if display is set to 1080xxx, then disable deinterlacer for HD content
@@ -2317,7 +2310,7 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
SetVideo3dMode(MODE_3D_DISABLE);
}
-#if 0
+#if 1
std::string s_dst_rect = StringUtils::Format("%i,%i,%i,%i",
(int)dst_rect.x1, (int)dst_rect.y1,
(int)dst_rect.Width(), (int)dst_rect.Height());
diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlAndroid.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlAndroid.cpp
new file mode 100644
index 0000000000..5ea1d7c13c
--- /dev/null
+++ b/xbmc/windowing/egl/EGLNativeTypeAmlAndroid.cpp
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2011-2014 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "system.h"
+#include <EGL/egl.h>
+#include "EGLNativeTypeAmlAndroid.h"
+#include "utils/log.h"
+#include "guilib/gui3d.h"
+#include "android/activity/XBMCApp.h"
+#include "utils/StringUtils.h"
+#include "utils/SysfsUtils.h"
+#include "utils/AMLUtils.h"
+
+bool CEGLNativeTypeAmlAndroid::CheckCompatibility()
+{
+ if (aml_present())
+ {
+ if (SysfsUtils::HasRW("/sys/class/display/mode"))
+ return true;
+ else
+ CLog::Log(LOGERROR, "AMLEGL: no rw on /sys/class/display/mode");
+ }
+ return false;
+}
+
+bool CEGLNativeTypeAmlAndroid::GetNativeResolution(RESOLUTION_INFO *res) const
+{
+ CEGLNativeTypeAndroid::GetNativeResolution(&m_fb_res);
+
+ std::string mode;
+ RESOLUTION_INFO hdmi_res;
+ if (SysfsUtils::GetString("/sys/class/display/mode", mode) == 0 && aml_mode_to_resolution(mode.c_str(), &hdmi_res))
+ {
+ m_curHdmiResolution = mode;
+ *res = hdmi_res;
+ res->iWidth = m_fb_res.iWidth;
+ res->iHeight = m_fb_res.iHeight;
+ res->iSubtitles = (int)(0.965 * res->iHeight);
+ }
+ else
+ *res = m_fb_res;
+
+ return true;
+}
+
+bool CEGLNativeTypeAmlAndroid::SetNativeResolution(const RESOLUTION_INFO &res)
+{
+ switch((int)(res.fRefreshRate*10))
+ {
+ default:
+ case 600:
+ switch(res.iScreenWidth)
+ {
+ default:
+ case 1280:
+ return SetDisplayResolution("720p");
+ break;
+ case 1920:
+ if (res.dwFlags & D3DPRESENTFLAG_INTERLACED)
+ return SetDisplayResolution("1080i");
+ else
+ return SetDisplayResolution("1080p");
+ break;
+ }
+ break;
+ case 500:
+ switch(res.iScreenWidth)
+ {
+ default:
+ case 1280:
+ return SetDisplayResolution("720p50hz");
+ break;
+ case 1920:
+ if (res.dwFlags & D3DPRESENTFLAG_INTERLACED)
+ return SetDisplayResolution("1080i50hz");
+ else
+ return SetDisplayResolution("1080p50hz");
+ break;
+ }
+ break;
+ case 300:
+ switch(res.iScreenWidth)
+ {
+ case 3840:
+ return SetDisplayResolution("4k2k30hz");
+ break;
+ default:
+ return SetDisplayResolution("1080p30hz");
+ break;
+ }
+ break;
+ case 250:
+ switch(res.iScreenWidth)
+ {
+ case 3840:
+ return SetDisplayResolution("4k2k25hz");
+ break;
+ default:
+ return SetDisplayResolution("1080p25hz");
+ break;
+ }
+ break;
+ case 240:
+ switch(res.iScreenWidth)
+ {
+ case 3840:
+ return SetDisplayResolution("4k2k24hz");
+ break;
+ case 4096:
+ return SetDisplayResolution("4k2ksmpte");
+ break;
+ default:
+ return SetDisplayResolution("1080p24hz");
+ break;
+ }
+ break;
+ }
+
+ return false;
+}
+
+bool CEGLNativeTypeAmlAndroid::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions)
+{
+ CEGLNativeTypeAndroid::GetNativeResolution(&m_fb_res);
+
+ std::string valstr;
+ if (SysfsUtils::GetString("/sys/class/amhdmitx/amhdmitx0/disp_cap", valstr) < 0)
+ return false;
+ std::vector<std::string> probe_str = StringUtils::Split(valstr, "\n");
+
+ resolutions.clear();
+ RESOLUTION_INFO res;
+ for (size_t i = 0; i < probe_str.size(); i++)
+ {
+ if(aml_mode_to_resolution(probe_str[i].c_str(), &res))
+ {
+ res.iWidth = m_fb_res.iWidth;
+ res.iHeight = m_fb_res.iHeight;
+ res.iSubtitles = (int)(0.965 * res.iHeight);
+ resolutions.push_back(res);
+ }
+ }
+ return resolutions.size() > 0;
+
+}
+
+bool CEGLNativeTypeAmlAndroid::GetPreferredResolution(RESOLUTION_INFO *res) const
+{
+ return GetNativeResolution(res);
+}
+
+bool CEGLNativeTypeAmlAndroid::SetDisplayResolution(const char *resolution)
+{
+ if (m_curHdmiResolution == resolution)
+ return true;
+
+ // switch display resolution
+ if (SysfsUtils::SetString("/sys/class/display/mode", resolution) < 0)
+ return false;
+
+ m_curHdmiResolution = resolution;
+
+ return true;
+}
+
diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlAndroid.h b/xbmc/windowing/egl/EGLNativeTypeAmlAndroid.h
new file mode 100644
index 0000000000..27a935ba58
--- /dev/null
+++ b/xbmc/windowing/egl/EGLNativeTypeAmlAndroid.h
@@ -0,0 +1,41 @@
+#pragma once
+
+/*
+ * Copyright (C) 2011-2014 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "EGLNativeTypeAndroid.h"
+class CEGLNativeTypeAmlAndroid : public CEGLNativeTypeAndroid
+{
+public:
+ virtual std::string GetNativeName() const { return "amlandroid"; }
+ virtual bool CheckCompatibility();
+ virtual int GetQuirks() { return EGL_QUIRK_DESTROY_NATIVE_WINDOW_WITH_SURFACE; }
+
+ virtual bool GetNativeResolution(RESOLUTION_INFO *res) const;
+ virtual bool SetNativeResolution(const RESOLUTION_INFO &res);
+ virtual bool ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions);
+ virtual bool GetPreferredResolution(RESOLUTION_INFO *res) const;
+
+protected:
+ mutable std::string m_curHdmiResolution;
+ mutable RESOLUTION_INFO m_fb_res;
+
+ bool SetDisplayResolution(const char *resolution);
+};
diff --git a/xbmc/windowing/egl/EGLNativeTypeAndroid.cpp b/xbmc/windowing/egl/EGLNativeTypeAndroid.cpp
index 641d53daf4..735abcb6e7 100644
--- a/xbmc/windowing/egl/EGLNativeTypeAndroid.cpp
+++ b/xbmc/windowing/egl/EGLNativeTypeAndroid.cpp
@@ -23,9 +23,7 @@
#include "EGLNativeTypeAndroid.h"
#include "utils/log.h"
#include "guilib/gui3d.h"
-#if defined(TARGET_ANDROID)
- #include "android/activity/XBMCApp.h"
-#endif
+#include "android/activity/XBMCApp.h"
#include "utils/StringUtils.h"
CEGLNativeTypeAndroid::CEGLNativeTypeAndroid()
@@ -38,10 +36,7 @@ CEGLNativeTypeAndroid::~CEGLNativeTypeAndroid()
bool CEGLNativeTypeAndroid::CheckCompatibility()
{
-#if defined(TARGET_ANDROID)
return true;
-#endif
- return false;
}
void CEGLNativeTypeAndroid::Initialize()
@@ -61,12 +56,8 @@ bool CEGLNativeTypeAndroid::CreateNativeDisplay()
bool CEGLNativeTypeAndroid::CreateNativeWindow()
{
-#if defined(TARGET_ANDROID)
// Android hands us a window, we don't have to create it
return true;
-#else
- return false;
-#endif
}
bool CEGLNativeTypeAndroid::GetNativeDisplay(XBNativeDisplayType **nativeDisplay) const
@@ -79,14 +70,10 @@ bool CEGLNativeTypeAndroid::GetNativeDisplay(XBNativeDisplayType **nativeDisplay
bool CEGLNativeTypeAndroid::GetNativeWindow(XBNativeWindowType **nativeWindow) const
{
-#if defined(TARGET_ANDROID)
if (!nativeWindow)
return false;
*nativeWindow = (XBNativeWindowType*) CXBMCApp::GetNativeWindow(30000);
return (*nativeWindow != NULL);
-#else
- return false;
-#endif
}
bool CEGLNativeTypeAndroid::DestroyNativeDisplay()
@@ -101,7 +88,6 @@ bool CEGLNativeTypeAndroid::DestroyNativeWindow()
bool CEGLNativeTypeAndroid::GetNativeResolution(RESOLUTION_INFO *res) const
{
-#if defined(TARGET_ANDROID)
EGLNativeWindowType *nativeWindow = (EGLNativeWindowType*)CXBMCApp::GetNativeWindow(30000);
if (!nativeWindow)
return false;
@@ -123,9 +109,6 @@ bool CEGLNativeTypeAndroid::GetNativeResolution(RESOLUTION_INFO *res) const
res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
CLog::Log(LOGNOTICE,"Current resolution: %s\n",res->strMode.c_str());
return true;
-#else
- return false;
-#endif
}
bool CEGLNativeTypeAndroid::SetNativeResolution(const RESOLUTION_INFO &res)
diff --git a/xbmc/windowing/egl/EGLNativeTypeRKAndroid.cpp b/xbmc/windowing/egl/EGLNativeTypeRKAndroid.cpp
new file mode 100644
index 0000000000..a8af8ad52e
--- /dev/null
+++ b/xbmc/windowing/egl/EGLNativeTypeRKAndroid.cpp
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2011-2014 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <stdlib.h>
+
+#include "system.h"
+#include <EGL/egl.h>
+#include "EGLNativeTypeRKAndroid.h"
+#include "utils/log.h"
+#include "guilib/gui3d.h"
+#include "android/activity/XBMCApp.h"
+#include "android/jni/Build.h"
+#include "utils/StringUtils.h"
+#include "utils/SysfsUtils.h"
+#include "utils/RegExp.h"
+
+bool CEGLNativeTypeRKAndroid::CheckCompatibility()
+{
+ if (StringUtils::StartsWithNoCase(CJNIBuild::HARDWARE, "rk3")) // Rockchip
+ {
+ if (SysfsUtils::HasRW("/sys/class/display/display0.HDMI/mode"))
+ return true;
+ else
+ CLog::Log(LOGERROR, "RKEGL: no rw on /sys/class/display/display0.HDMI/mode");
+ }
+ return false;
+}
+
+bool CEGLNativeTypeRKAndroid::SysModeToResolution(std::string mode, RESOLUTION_INFO *res) const
+{
+ if (!res)
+ return false;
+
+ res->iWidth = 0;
+ res->iHeight= 0;
+
+ if(mode.empty())
+ return false;
+
+ std::string fromMode = mode;
+ if (!isdigit(mode[0]))
+ fromMode = StringUtils::Mid(mode, 2);
+ StringUtils::Trim(fromMode);
+
+ CRegExp split(true);
+ split.RegComp("([0-9]+)x([0-9]+)([pi])-([0-9]+)");
+ if (split.RegFind(fromMode) < 0)
+ return false;
+
+ int w = atoi(split.GetMatch(1).c_str());
+ int h = atoi(split.GetMatch(2).c_str());
+ std::string p = split.GetMatch(3);
+ int r = atoi(split.GetMatch(4).c_str());
+
+ res->iWidth = w;
+ res->iHeight= h;
+ res->iScreenWidth = w;
+ res->iScreenHeight= h;
+ res->fRefreshRate = r;
+ res->dwFlags = p[0] == 'p' ? D3DPRESENTFLAG_PROGRESSIVE : D3DPRESENTFLAG_INTERLACED;
+
+ res->iScreen = 0;
+ res->bFullScreen = true;
+ res->iSubtitles = (int)(0.965 * res->iHeight);
+ res->fPixelRatio = 1.0f;
+ res->strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
+ res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
+ res->strId = mode;
+
+ return res->iWidth > 0 && res->iHeight> 0;
+}
+
+bool CEGLNativeTypeRKAndroid::GetNativeResolution(RESOLUTION_INFO *res) const
+{
+ CEGLNativeTypeAndroid::GetNativeResolution(&m_fb_res);
+
+ std::string mode;
+ RESOLUTION_INFO hdmi_res;
+ if (SysfsUtils::GetString("/sys/class/display/display0.HDMI/mode", mode) == 0 && SysModeToResolution(mode, &hdmi_res))
+ {
+ m_curHdmiResolution = mode;
+ *res = hdmi_res;
+ res->iWidth = m_fb_res.iWidth;
+ res->iHeight = m_fb_res.iHeight;
+ res->iSubtitles = (int)(0.965 * res->iHeight);
+ }
+ else
+ *res = m_fb_res;
+
+ return true;
+}
+
+bool CEGLNativeTypeRKAndroid::SetNativeResolution(const RESOLUTION_INFO &res)
+{
+ switch((int)(res.fRefreshRate*10))
+ {
+ default:
+ case 600:
+ switch(res.iScreenWidth)
+ {
+ default:
+ case 1280:
+ return SetDisplayResolution("1280x720p-60");
+ break;
+ case 1920:
+ if (res.dwFlags & D3DPRESENTFLAG_INTERLACED)
+ return SetDisplayResolution("1920x1080i-60");
+ else
+ return SetDisplayResolution("1920x1080p-60");
+ break;
+ }
+ break;
+ case 500:
+ switch(res.iScreenWidth)
+ {
+ default:
+ case 1280:
+ return SetDisplayResolution("1280x720p-50");
+ break;
+ case 1920:
+ if (res.dwFlags & D3DPRESENTFLAG_INTERLACED)
+ return SetDisplayResolution("1920x1080i-50");
+ else
+ return SetDisplayResolution("1920x1080p-50");
+ break;
+ }
+ break;
+ case 300:
+ switch(res.iScreenWidth)
+ {
+ case 3840:
+ return SetDisplayResolution("4k2k30hz");
+ break;
+ default:
+ return SetDisplayResolution("1920x1080p-30");
+ break;
+ }
+ break;
+ case 250:
+ switch(res.iScreenWidth)
+ {
+ case 3840:
+ return SetDisplayResolution("4k2k25hz");
+ break;
+ default:
+ return SetDisplayResolution("1920x1080p-25");
+ break;
+ }
+ break;
+ case 240:
+ switch(res.iScreenWidth)
+ {
+ case 3840:
+ return SetDisplayResolution("4k2k24hz");
+ break;
+ case 4096:
+ return SetDisplayResolution("4k2ksmpte");
+ break;
+ default:
+ return SetDisplayResolution("1920x1080p-24");
+ break;
+ }
+ break;
+ }
+
+ return false;
+}
+
+bool CEGLNativeTypeRKAndroid::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions)
+{
+ CEGLNativeTypeAndroid::GetNativeResolution(&m_fb_res);
+
+ std::string valstr;
+ if (SysfsUtils::GetString("/sys/class/display/display0.HDMI/modes", valstr) < 0)
+ return false;
+ std::vector<std::string> probe_str = StringUtils::Split(valstr, "\n");
+
+ resolutions.clear();
+ RESOLUTION_INFO res;
+ for (size_t i = 0; i < probe_str.size(); i++)
+ {
+ if(SysModeToResolution(probe_str[i].c_str(), &res))
+ {
+ res.iWidth = m_fb_res.iWidth;
+ res.iHeight = m_fb_res.iHeight;
+ res.iSubtitles = (int)(0.965 * res.iHeight);
+ resolutions.push_back(res);
+ }
+ }
+ return resolutions.size() > 0;
+
+}
+
+bool CEGLNativeTypeRKAndroid::GetPreferredResolution(RESOLUTION_INFO *res) const
+{
+ return GetNativeResolution(res);
+}
+
+bool CEGLNativeTypeRKAndroid::SetDisplayResolution(const char *resolution)
+{
+ if (m_curHdmiResolution == resolution)
+ return true;
+
+ // switch display resolution
+ std::string out = resolution;
+ out += '\n';
+ if (SysfsUtils::SetString("/sys/class/display/display0.HDMI/mode", out.c_str()) < 0)
+ return false;
+
+ m_curHdmiResolution = resolution;
+
+ return true;
+}
+
diff --git a/xbmc/windowing/egl/EGLNativeTypeRKAndroid.h b/xbmc/windowing/egl/EGLNativeTypeRKAndroid.h
new file mode 100644
index 0000000000..69baaed48e
--- /dev/null
+++ b/xbmc/windowing/egl/EGLNativeTypeRKAndroid.h
@@ -0,0 +1,42 @@
+#pragma once
+
+/*
+ * Copyright (C) 2011-2014 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "EGLNativeTypeAndroid.h"
+class CEGLNativeTypeRKAndroid : public CEGLNativeTypeAndroid
+{
+public:
+ virtual std::string GetNativeName() const { return "rkandroid"; }
+ virtual bool CheckCompatibility();
+ virtual int GetQuirks() { return EGL_QUIRK_DESTROY_NATIVE_WINDOW_WITH_SURFACE; }
+
+ virtual bool GetNativeResolution(RESOLUTION_INFO *res) const;
+ virtual bool SetNativeResolution(const RESOLUTION_INFO &res);
+ virtual bool ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions);
+ virtual bool GetPreferredResolution(RESOLUTION_INFO *res) const;
+
+protected:
+ mutable std::string m_curHdmiResolution;
+ mutable RESOLUTION_INFO m_fb_res;
+
+ bool SetDisplayResolution(const char *resolution);
+ bool SysModeToResolution(std::string mode, RESOLUTION_INFO *res) const;
+};
diff --git a/xbmc/windowing/egl/EGLWrapper.cpp b/xbmc/windowing/egl/EGLWrapper.cpp
index 8310d4b0ff..036d4b9b59 100644
--- a/xbmc/windowing/egl/EGLWrapper.cpp
+++ b/xbmc/windowing/egl/EGLWrapper.cpp
@@ -21,11 +21,22 @@
#ifdef HAS_EGL
#include "utils/log.h"
-#include "EGLNativeTypeAndroid.h"
+#include <assert.h>
+#if defined(HAVE_WAYLAND)
+ #include "EGLNativeTypeWayland.h"
+#endif
+#if defined(TARGET_ANDROID)
+ #include "EGLNativeTypeAndroid.h"
+ #include "EGLNativeTypeAmlAndroid.h"
+ #include "EGLNativeTypeRKAndroid.h"
+#endif
+#if defined(TARGET_RASPBERRY_PI)
+ #include "EGLNativeTypeRaspberryPI.h"
+#endif
+#if defined(HAS_IMXVPU)
+ #include "EGLNativeTypeIMX.h"
+#endif
#include "EGLNativeTypeAmlogic.h"
-#include "EGLNativeTypeRaspberryPI.h"
-#include "EGLNativeTypeWayland.h"
-#include "EGLNativeTypeIMX.h"
#include "EGLWrapper.h"
#define CheckError() m_result = eglGetError(); if(m_result != EGL_SUCCESS) CLog::Log(LOGERROR, "EGL error in %s: %x",__FUNCTION__, m_result);
@@ -79,11 +90,22 @@ bool CEGLWrapper::Initialize(const std::string &implementation)
// Try to create each backend in sequence and go with the first one
// that we know will work
- if ((nativeGuess = CreateEGLNativeType<CEGLNativeTypeWayland>(implementation)) ||
+ if (
+#if defined(HAVE_WAYLAND)
+ (nativeGuess = CreateEGLNativeType<CEGLNativeTypeWayland>(implementation)) ||
+#endif
+#if defined(TARGET_ANDROID)
+ (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAmlAndroid>(implementation)) ||
+ (nativeGuess = CreateEGLNativeType<CEGLNativeTypeRKAndroid>(implementation)) ||
(nativeGuess = CreateEGLNativeType<CEGLNativeTypeAndroid>(implementation)) ||
- (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAmlogic>(implementation)) ||
+#endif
+#if defined(TARGET_RASPBERRY_PI)
(nativeGuess = CreateEGLNativeType<CEGLNativeTypeRaspberryPI>(implementation)) ||
- (nativeGuess = CreateEGLNativeType<CEGLNativeTypeIMX>(implementation))
+#endif
+#if defined(HAS_IMXVPU)
+ (nativeGuess = CreateEGLNativeType<CEGLNativeTypeIMX>(implementation)) ||
+#endif
+ (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAmlogic>(implementation))
)
{
m_nativeTypes = nativeGuess;
diff --git a/xbmc/windowing/egl/Makefile.in b/xbmc/windowing/egl/Makefile.in
index f59f9cb7f9..32fb168c51 100644
--- a/xbmc/windowing/egl/Makefile.in
+++ b/xbmc/windowing/egl/Makefile.in
@@ -2,14 +2,22 @@ INCLUDES=-I.
SRCS = WinSystemEGL.cpp
SRCS+= EGLNativeTypeAmlogic.cpp
+ifeq (@USE_ANDROID@,1)
SRCS+= EGLNativeTypeAndroid.cpp
+SRCS+= EGLNativeTypeAmlAndroid.cpp
+SRCS+= EGLNativeTypeRKAndroid.cpp
+endif
+ifeq (@USE_MMAL@,1)
SRCS+= EGLNativeTypeRaspberryPI.cpp
-SRCS+= EGLNativeTypeWayland.cpp
+endif
+ifeq (@USE_IMXVPU@,1)
SRCS+= EGLNativeTypeIMX.cpp
+endif
SRCS+= EGLWrapper.cpp
# Wayland specific detail
ifeq (@USE_WAYLAND@,1)
+SRCS+= EGLNativeTypeWayland.cpp
SRCS+= wayland/Callback.cpp \
wayland/Compositor.cpp \
wayland/Display.cpp \