diff options
author | Martijn Kaijser <martijn@xbmc.org> | 2016-09-08 19:46:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-08 19:46:47 +0200 |
commit | af03511cbc5c8ba7058a18c97ddfa530e1f446f9 (patch) | |
tree | 33a562737bb60525b083f269f35b777157a6b976 | |
parent | 00385848e80df36333300c0bec61c743e6a7a2d4 (diff) | |
parent | 4733383b8f1c1dd0b95e9e5358425d8a0b7ba8fc (diff) |
Merge pull request #10417 from MartijnKaijser/droid_rk
[droid] Drop RK specific code and fix cmake AML building
-rw-r--r-- | xbmc/utils/SystemInfo.cpp | 4 | ||||
-rw-r--r-- | xbmc/windowing/egl/CMakeLists.txt | 6 | ||||
-rw-r--r-- | xbmc/windowing/egl/EGLNativeTypeRKAndroid.cpp | 231 | ||||
-rw-r--r-- | xbmc/windowing/egl/EGLNativeTypeRKAndroid.h | 45 | ||||
-rw-r--r-- | xbmc/windowing/egl/EGLWrapper.cpp | 18 | ||||
-rw-r--r-- | xbmc/windowing/egl/Makefile.in | 1 |
6 files changed, 16 insertions, 289 deletions
diff --git a/xbmc/utils/SystemInfo.cpp b/xbmc/utils/SystemInfo.cpp index c0b4dff6c0..8f9107b607 100644 --- a/xbmc/utils/SystemInfo.cpp +++ b/xbmc/utils/SystemInfo.cpp @@ -56,8 +56,10 @@ #include "utils/XMLUtils.h" #if defined(TARGET_ANDROID) #include "platform/android/jni/Build.h" +#if defined(HAS_LIBAMCODEC) #include "utils/AMLUtils.h" #endif +#endif /* Platform identification */ #if defined(TARGET_DARWIN) @@ -868,9 +870,11 @@ bool CSysInfo::IsAeroDisabled() bool CSysInfo::HasHW3DInterlaced() { #if defined(TARGET_ANDROID) +#if defined(HAS_LIBAMCODEC) if (aml_hw3d_present()) return true; #endif +#endif return false; } diff --git a/xbmc/windowing/egl/CMakeLists.txt b/xbmc/windowing/egl/CMakeLists.txt index 40265498c5..3ab603e448 100644 --- a/xbmc/windowing/egl/CMakeLists.txt +++ b/xbmc/windowing/egl/CMakeLists.txt @@ -12,10 +12,8 @@ if(OPENGLES_FOUND) endif() if(CORE_SYSTEM_NAME STREQUAL android) - list(APPEND SOURCES EGLNativeTypeAndroid.cpp - EGLNativeTypeRKAndroid.cpp) - list(APPEND HEADERS EGLNativeTypeAndroid.h - EGLNativeTypeRKAndroid.h) + list(APPEND SOURCES EGLNativeTypeAndroid.cpp) + list(APPEND HEADERS EGLNativeTypeAndroid.h) if(AML_FOUND) list(APPEND SOURCES EGLNativeTypeAmlAndroid.cpp) list(APPEND HEADERS EGLNativeTypeAmlAndroid.h) diff --git a/xbmc/windowing/egl/EGLNativeTypeRKAndroid.cpp b/xbmc/windowing/egl/EGLNativeTypeRKAndroid.cpp deleted file mode 100644 index c368592b96..0000000000 --- a/xbmc/windowing/egl/EGLNativeTypeRKAndroid.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/* - * 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 "platform/android/activity/XBMCApp.h" -#include "platform/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 deleted file mode 100644 index 98b89f17ea..0000000000 --- a/xbmc/windowing/egl/EGLNativeTypeRKAndroid.h +++ /dev/null @@ -1,45 +0,0 @@ -#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 <string> -#include <vector> - -#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 007402768f..30f57577d6 100644 --- a/xbmc/windowing/egl/EGLWrapper.cpp +++ b/xbmc/windowing/egl/EGLWrapper.cpp @@ -24,8 +24,9 @@ #include <assert.h> #if defined(TARGET_ANDROID) #include "EGLNativeTypeAndroid.h" +#if defined(HAS_LIBAMCODEC) #include "EGLNativeTypeAmlAndroid.h" - #include "EGLNativeTypeRKAndroid.h" +#endif #endif #if defined(TARGET_RASPBERRY_PI) #include "EGLNativeTypeRaspberryPI.h" @@ -33,7 +34,9 @@ #if defined(HAS_IMXVPU) #include "EGLNativeTypeIMX.h" #endif +#if defined(TARGET_LINUX) && defined(HAS_LIBAMCODEC) #include "EGLNativeTypeAmlogic.h" +#endif #include "EGLWrapper.h" #define CheckError() m_result = eglGetError(); if(m_result != EGL_SUCCESS) CLog::Log(LOGERROR, "EGL error in %s: %x",__FUNCTION__, m_result); @@ -88,16 +91,15 @@ 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 ( -#if defined(TARGET_ANDROID) - (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAmlAndroid>(implementation)) || - (nativeGuess = CreateEGLNativeType<CEGLNativeTypeRKAndroid>(implementation)) || - (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAndroid>(implementation)) || -#endif -#if defined(TARGET_RASPBERRY_PI) +#if defined(TARGET_ANDROID) && defined(HAS_LIBAMCODEC) + (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAmlAndroid>(implementation)) +#elif defined(TARGET_ANDROID) + (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAndroid>(implementation)) +#elif defined(TARGET_RASPBERRY_PI) (nativeGuess = CreateEGLNativeType<CEGLNativeTypeRaspberryPI>(implementation)) #elif defined(HAS_IMXVPU) (nativeGuess = CreateEGLNativeType<CEGLNativeTypeIMX>(implementation)) -#else +#elif defined(TARGET_LINUX) && defined(HAS_LIBAMCODEC) (nativeGuess = CreateEGLNativeType<CEGLNativeTypeAmlogic>(implementation)) #endif ) diff --git a/xbmc/windowing/egl/Makefile.in b/xbmc/windowing/egl/Makefile.in index 37542330ff..68f7862dfe 100644 --- a/xbmc/windowing/egl/Makefile.in +++ b/xbmc/windowing/egl/Makefile.in @@ -5,7 +5,6 @@ SRCS+= EGLNativeTypeAmlogic.cpp ifeq (@USE_ANDROID@,1) SRCS+= EGLNativeTypeAndroid.cpp SRCS+= EGLNativeTypeAmlAndroid.cpp -SRCS+= EGLNativeTypeRKAndroid.cpp endif ifeq (@USE_MMAL@,1) SRCS+= EGLNativeTypeRaspberryPI.cpp |