mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
IMX: Backport general changes needed for new imx code
This commit is contained in:
parent
7a64ea21b3
commit
a61ad190a1
@ -0,0 +1,80 @@
|
||||
From 38bc5699178afdbf85f22cd5fc3cf151c4defa6b Mon Sep 17 00:00:00 2001
|
||||
From: Stanislav Vlasic <svlasic@gmail.com>
|
||||
Date: Mon, 13 Oct 2014 13:20:11 +0200
|
||||
Subject: [PATCH 1/3] Add aml_support_hevc function and recognize S812 chip
|
||||
|
||||
---
|
||||
xbmc/utils/AMLUtils.cpp | 26 ++++++++++++++++++++++++--
|
||||
xbmc/utils/AMLUtils.h | 5 ++++-
|
||||
2 files changed, 28 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/xbmc/utils/AMLUtils.cpp b/xbmc/utils/AMLUtils.cpp
|
||||
index 9553745..ac921db 100644
|
||||
--- a/xbmc/utils/AMLUtils.cpp
|
||||
+++ b/xbmc/utils/AMLUtils.cpp
|
||||
@@ -159,6 +159,22 @@ void aml_permissions()
|
||||
}
|
||||
}
|
||||
|
||||
+bool aml_support_hevc()
|
||||
+{
|
||||
+ char valstr[1024];
|
||||
+ if(aml_get_sysfs_str("/sys/class/amstream/vcodec_profile", valstr, 1024) != 0)
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+ char* p = strstr(valstr, "hevc:");
|
||||
+ if(p == NULL)
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
enum AML_DEVICE_TYPE aml_get_device_type()
|
||||
{
|
||||
static enum AML_DEVICE_TYPE aml_device_type = AML_DEVICE_TYPE_UNINIT;
|
||||
@@ -173,8 +189,14 @@ enum AML_DEVICE_TYPE aml_get_device_type()
|
||||
aml_device_type = AML_DEVICE_TYPE_M3;
|
||||
else if (cpu_hardware.find("Meson6") != std::string::npos)
|
||||
aml_device_type = AML_DEVICE_TYPE_M6;
|
||||
- else if (cpu_hardware.find("Meson8") != std::string::npos)
|
||||
- aml_device_type = AML_DEVICE_TYPE_M8;
|
||||
+ else if ((cpu_hardware.find("Meson8") != std::string::npos) && (cpu_hardware.find("Meson8B") == std::string::npos))
|
||||
+ {
|
||||
+ if (aml_support_hevc())
|
||||
+ aml_device_type = AML_DEVICE_TYPE_M8M2;
|
||||
+ else
|
||||
+ aml_device_type = AML_DEVICE_TYPE_M8;
|
||||
+ } else if (cpu_hardware.find("Meson8B") != std::string::npos)
|
||||
+ aml_device_type = AML_DEVICE_TYPE_M8B;
|
||||
else
|
||||
aml_device_type = AML_DEVICE_TYPE_UNKNOWN;
|
||||
}
|
||||
diff --git a/xbmc/utils/AMLUtils.h b/xbmc/utils/AMLUtils.h
|
||||
index 9778e9b..208f9d3 100644
|
||||
--- a/xbmc/utils/AMLUtils.h
|
||||
+++ b/xbmc/utils/AMLUtils.h
|
||||
@@ -28,7 +28,9 @@ enum AML_DEVICE_TYPE
|
||||
AML_DEVICE_TYPE_M1,
|
||||
AML_DEVICE_TYPE_M3,
|
||||
AML_DEVICE_TYPE_M6,
|
||||
- AML_DEVICE_TYPE_M8
|
||||
+ AML_DEVICE_TYPE_M8, // S802
|
||||
+ AML_DEVICE_TYPE_M8B, // S805
|
||||
+ AML_DEVICE_TYPE_M8M2 // S812
|
||||
};
|
||||
|
||||
enum AML_DISPLAY_AXIS_PARAM
|
||||
@@ -48,6 +50,7 @@ bool aml_present();
|
||||
void aml_permissions();
|
||||
bool aml_hw3d_present();
|
||||
bool aml_wired_present();
|
||||
+bool aml_support_hevc();
|
||||
enum AML_DEVICE_TYPE aml_get_device_type();
|
||||
void aml_cpufreq_min(bool limit);
|
||||
void aml_cpufreq_max(bool limit);
|
||||
--
|
||||
1.9.1
|
||||
|
@ -0,0 +1,814 @@
|
||||
From a8fb1fdd478d7150d9d0b68bc6fef825241d7ef6 Mon Sep 17 00:00:00 2001
|
||||
From: "Chris \"Koying\" Browet" <cbro@semperpax.com>
|
||||
Date: Wed, 31 Dec 2014 15:08:12 +0100
|
||||
Subject: [PATCH 2/3] CHG: Extract SysfsUtils from the AML utils
|
||||
|
||||
---
|
||||
xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp | 46 +++++-----
|
||||
xbmc/utils/AMLUtils.cpp | 95 ++++----------------
|
||||
xbmc/utils/AMLUtils.h | 5 --
|
||||
xbmc/utils/Makefile.in | 1 +
|
||||
xbmc/utils/SysfsUtils.cpp | 104 ++++++++++++++++++++++
|
||||
xbmc/utils/SysfsUtils.h | 32 +++++++
|
||||
xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp | 100 ++++++++++-----------
|
||||
xbmc/windowing/egl/EGLNativeTypeIMX.cpp | 44 ++-------
|
||||
xbmc/windowing/egl/EGLNativeTypeIMX.h | 2 -
|
||||
9 files changed, 234 insertions(+), 195 deletions(-)
|
||||
create mode 100644 xbmc/utils/SysfsUtils.cpp
|
||||
create mode 100644 xbmc/utils/SysfsUtils.h
|
||||
|
||||
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
|
||||
index 26db4a1..b74d361 100644
|
||||
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
|
||||
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "utils/AMLUtils.h"
|
||||
#include "utils/log.h"
|
||||
#include "utils/StringUtils.h"
|
||||
+#include "utils/SysfsUtils.h"
|
||||
#include "utils/TimeUtils.h"
|
||||
|
||||
#if defined(TARGET_ANDROID)
|
||||
@@ -1643,7 +1644,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
|
||||
m_dll->codec_set_cntl_avthresh(&am_private->vcodec, AV_SYNC_THRESH);
|
||||
m_dll->codec_set_cntl_syncthresh(&am_private->vcodec, 0);
|
||||
// disable tsync, we are playing video disconnected from audio.
|
||||
- aml_set_sysfs_int("/sys/class/tsync/enable", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/tsync/enable", 0);
|
||||
|
||||
am_private->am_pkt.codec = &am_private->vcodec;
|
||||
pre_header_feeding(am_private, &am_private->am_pkt);
|
||||
@@ -1655,15 +1656,15 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
|
||||
|
||||
m_display_rect = CRect(0, 0, CDisplaySettings::Get().GetCurrentResolutionInfo().iWidth, CDisplaySettings::Get().GetCurrentResolutionInfo().iHeight);
|
||||
|
||||
- char buffer[256] = {0};
|
||||
- aml_get_sysfs_str("/sys/class/ppmgr/ppscaler", buffer, 255);
|
||||
- if (!strstr(buffer, "enabled")) // Scaler not enabled, use screen size
|
||||
+ 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");
|
||||
- memset(buffer, 0, 256);
|
||||
- aml_get_sysfs_str("/sys/class/display/mode", buffer, 255);
|
||||
+ std::string mode;
|
||||
+ SysfsUtils::GetString("/sys/class/display/mode", mode);
|
||||
RESOLUTION_INFO res;
|
||||
- if (aml_mode_to_resolution(buffer, &res))
|
||||
+ if (aml_mode_to_resolution(mode.c_str(), &res))
|
||||
m_display_rect = CRect(0, 0, res.iScreenWidth, res.iScreenHeight);
|
||||
}
|
||||
|
||||
@@ -1671,11 +1672,11 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
|
||||
// if display is set to 1080xxx, then disable deinterlacer for HD content
|
||||
// else bandwidth usage is too heavy and it will slow down video decoder.
|
||||
char display_mode[256] = {0};
|
||||
- aml_get_sysfs_str("/sys/class/display/mode", display_mode, 255);
|
||||
+ SysfsUtils::GetString("/sys/class/display/mode", display_mode, 255);
|
||||
if (strstr(display_mode,"1080"))
|
||||
- aml_set_sysfs_int("/sys/module/di/parameters/bypass_all", 1);
|
||||
+ SysfsUtils::SetInt("/sys/module/di/parameters/bypass_all", 1);
|
||||
else
|
||||
- aml_set_sysfs_int("/sys/module/di/parameters/bypass_all", 0);
|
||||
+ SysfsUtils::SetInt("/sys/module/di/parameters/bypass_all", 0);
|
||||
*/
|
||||
|
||||
m_opened = true;
|
||||
@@ -1708,7 +1709,7 @@ void CAMLCodec::CloseDecoder()
|
||||
free(am_private->extradata);
|
||||
am_private->extradata = NULL;
|
||||
// return tsync to default so external apps work
|
||||
- aml_set_sysfs_int("/sys/class/tsync/enable", 1);
|
||||
+ SysfsUtils::SetInt("/sys/class/tsync/enable", 1);
|
||||
|
||||
ShowMainVideo(false);
|
||||
}
|
||||
@@ -1721,8 +1722,9 @@ void CAMLCodec::Reset()
|
||||
return;
|
||||
|
||||
// set the system blackout_policy to leave the last frame showing
|
||||
- int blackout_policy = aml_get_sysfs_int("/sys/class/video/blackout_policy");
|
||||
- aml_set_sysfs_int("/sys/class/video/blackout_policy", 0);
|
||||
+ int blackout_policy;
|
||||
+ SysfsUtils::GetInt("/sys/class/video/blackout_policy", blackout_policy);
|
||||
+ SysfsUtils::SetInt("/sys/class/video/blackout_policy", 0);
|
||||
|
||||
// restore the speed (some amcodec versions require this)
|
||||
if (m_speed != DVD_PLAYSPEED_NORMAL)
|
||||
@@ -1742,7 +1744,7 @@ void CAMLCodec::Reset()
|
||||
pre_header_feeding(am_private, &am_private->am_pkt);
|
||||
|
||||
// restore the saved system blackout_policy value
|
||||
- aml_set_sysfs_int("/sys/class/video/blackout_policy", blackout_policy);
|
||||
+ SysfsUtils::SetInt("/sys/class/video/blackout_policy", blackout_policy);
|
||||
|
||||
// reset some interal vars
|
||||
m_1st_pts = 0;
|
||||
@@ -2065,7 +2067,7 @@ void CAMLCodec::ShowMainVideo(const bool show)
|
||||
if (saved_disable_video == disable_video)
|
||||
return;
|
||||
|
||||
- aml_set_sysfs_int("/sys/class/video/disable_video", disable_video);
|
||||
+ SysfsUtils::SetInt("/sys/class/video/disable_video", disable_video);
|
||||
saved_disable_video = disable_video;
|
||||
}
|
||||
|
||||
@@ -2074,7 +2076,7 @@ void CAMLCodec::SetVideoZoom(const float zoom)
|
||||
// input zoom range is 0.5 to 2.0 with a default of 1.0.
|
||||
// output zoom range is 2 to 300 with default of 100.
|
||||
// we limit that to a range of 50 to 200 with default of 100.
|
||||
- aml_set_sysfs_int("/sys/class/video/zoom", (int)(100 * zoom));
|
||||
+ SysfsUtils::SetInt("/sys/class/video/zoom", (int)(100 * zoom));
|
||||
}
|
||||
|
||||
void CAMLCodec::SetVideoContrast(const int contrast)
|
||||
@@ -2082,19 +2084,19 @@ void CAMLCodec::SetVideoContrast(const int contrast)
|
||||
// input contrast range is 0 to 100 with default of 50.
|
||||
// output contrast range is -255 to 255 with default of 0.
|
||||
int aml_contrast = (255 * (contrast - 50)) / 50;
|
||||
- aml_set_sysfs_int("/sys/class/video/contrast", aml_contrast);
|
||||
+ SysfsUtils::SetInt("/sys/class/video/contrast", aml_contrast);
|
||||
}
|
||||
void CAMLCodec::SetVideoBrightness(const int brightness)
|
||||
{
|
||||
// input brightness range is 0 to 100 with default of 50.
|
||||
// output brightness range is -127 to 127 with default of 0.
|
||||
int aml_brightness = (127 * (brightness - 50)) / 50;
|
||||
- aml_set_sysfs_int("/sys/class/video/brightness", aml_brightness);
|
||||
+ SysfsUtils::SetInt("/sys/class/video/brightness", aml_brightness);
|
||||
}
|
||||
void CAMLCodec::SetVideoSaturation(const int saturation)
|
||||
{
|
||||
// output saturation range is -127 to 127 with default of 127.
|
||||
- aml_set_sysfs_int("/sys/class/video/saturation", saturation);
|
||||
+ SysfsUtils::SetInt("/sys/class/video/saturation", saturation);
|
||||
}
|
||||
|
||||
void CAMLCodec::GetRenderFeatures(Features &renderFeatures)
|
||||
@@ -2110,7 +2112,7 @@ void CAMLCodec::GetRenderFeatures(Features &renderFeatures)
|
||||
void CAMLCodec::SetVideo3dMode(const int mode3d)
|
||||
{
|
||||
CLog::Log(LOGDEBUG, "CAMLCodec::SetVideo3dMode:mode3d(0x%x)", mode3d);
|
||||
- aml_set_sysfs_int("/sys/class/ppmgr/ppmgr_3d_mode", mode3d);
|
||||
+ SysfsUtils::SetInt("/sys/class/ppmgr/ppmgr_3d_mode", mode3d);
|
||||
}
|
||||
|
||||
std::string CAMLCodec::GetStereoMode()
|
||||
@@ -2313,9 +2315,9 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
|
||||
char video_axis[256] = {};
|
||||
sprintf(video_axis, "%d %d %d %d", (int)dst_rect.x1, (int)dst_rect.y1, (int)dst_rect.x2, (int)dst_rect.y2);
|
||||
|
||||
- aml_set_sysfs_str("/sys/class/video/axis", video_axis);
|
||||
+ SysfsUtils::SetString("/sys/class/video/axis", video_axis);
|
||||
// make sure we are in 'full stretch' so we can stretch
|
||||
- aml_set_sysfs_int("/sys/class/video/screen_mode", 1);
|
||||
+ SysfsUtils::SetInt("/sys/class/video/screen_mode", 1);
|
||||
|
||||
// we only get called once gui has changed to something
|
||||
// that would show video playback, so show it.
|
||||
diff --git a/xbmc/utils/AMLUtils.cpp b/xbmc/utils/AMLUtils.cpp
|
||||
index ac921db..c127c84 100644
|
||||
--- a/xbmc/utils/AMLUtils.cpp
|
||||
+++ b/xbmc/utils/AMLUtils.cpp
|
||||
@@ -28,77 +28,22 @@
|
||||
#include "AMLUtils.h"
|
||||
#include "utils/CPUInfo.h"
|
||||
#include "utils/log.h"
|
||||
+#include "utils/SysfsUtils.h"
|
||||
#include "utils/StringUtils.h"
|
||||
#include "utils/AMLUtils.h"
|
||||
#include "guilib/gui3d.h"
|
||||
|
||||
-int aml_set_sysfs_str(const char *path, const char *val)
|
||||
-{
|
||||
- int fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||
- if (fd >= 0)
|
||||
- {
|
||||
- write(fd, val, strlen(val));
|
||||
- close(fd);
|
||||
- return 0;
|
||||
- }
|
||||
- return -1;
|
||||
-}
|
||||
-
|
||||
-int aml_get_sysfs_str(const char *path, char *valstr, const int size)
|
||||
-{
|
||||
- int fd = open(path, O_RDONLY);
|
||||
- if (fd >= 0)
|
||||
- {
|
||||
- read(fd, valstr, size - 1);
|
||||
- valstr[strlen(valstr)] = '\0';
|
||||
- close(fd);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- sprintf(valstr, "%s", "fail");
|
||||
- return -1;
|
||||
-}
|
||||
-
|
||||
-int aml_set_sysfs_int(const char *path, const int val)
|
||||
-{
|
||||
- int fd = open(path, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||
- if (fd >= 0)
|
||||
- {
|
||||
- char bcmd[16];
|
||||
- sprintf(bcmd, "%d", val);
|
||||
- write(fd, bcmd, strlen(bcmd));
|
||||
- close(fd);
|
||||
- return 0;
|
||||
- }
|
||||
- return -1;
|
||||
-}
|
||||
-
|
||||
-int aml_get_sysfs_int(const char *path)
|
||||
-{
|
||||
- int val = -1;
|
||||
- int fd = open(path, O_RDONLY);
|
||||
- if (fd >= 0)
|
||||
- {
|
||||
- char bcmd[16];
|
||||
- read(fd, bcmd, sizeof(bcmd));
|
||||
- val = strtol(bcmd, NULL, 16);
|
||||
- close(fd);
|
||||
- }
|
||||
- return val;
|
||||
-}
|
||||
-
|
||||
bool aml_present()
|
||||
{
|
||||
static int has_aml = -1;
|
||||
if (has_aml == -1)
|
||||
{
|
||||
- int rtn = aml_get_sysfs_int("/sys/class/audiodsp/digital_raw");
|
||||
- if (rtn != -1)
|
||||
+ if (SysfsUtils::Has("/sys/class/audiodsp/digital_raw"))
|
||||
has_aml = 1;
|
||||
else
|
||||
has_aml = 0;
|
||||
if (has_aml)
|
||||
- CLog::Log(LOGNOTICE, "aml_present, rtn(%d)", rtn);
|
||||
+ CLog::Log(LOGNOTICE, "AML device detected");
|
||||
}
|
||||
return has_aml == 1;
|
||||
}
|
||||
@@ -108,10 +53,12 @@ bool aml_hw3d_present()
|
||||
static int has_hw3d = -1;
|
||||
if (has_hw3d == -1)
|
||||
{
|
||||
- if (aml_get_sysfs_int("/sys/class/ppmgr/ppmgr_3d_mode") != -1)
|
||||
+ if (SysfsUtils::Has("/sys/class/ppmgr/ppmgr_3d_mode"))
|
||||
has_hw3d = 1;
|
||||
else
|
||||
has_hw3d = 0;
|
||||
+ if (has_hw3d)
|
||||
+ CLog::Log(LOGNOTICE, "AML 3D support detected");
|
||||
}
|
||||
return has_hw3d == 1;
|
||||
}
|
||||
@@ -121,8 +68,8 @@ bool aml_wired_present()
|
||||
static int has_wired = -1;
|
||||
if (has_wired == -1)
|
||||
{
|
||||
- char test[64] = {0};
|
||||
- if (aml_get_sysfs_str("/sys/class/net/eth0/operstate", test, 63) != -1)
|
||||
+ std::string test;
|
||||
+ if (SysfsUtils::GetString("/sys/class/net/eth0/operstate", test) != -1)
|
||||
has_wired = 1;
|
||||
else
|
||||
has_wired = 0;
|
||||
@@ -161,18 +108,12 @@ void aml_permissions()
|
||||
|
||||
bool aml_support_hevc()
|
||||
{
|
||||
- char valstr[1024];
|
||||
- if(aml_get_sysfs_str("/sys/class/amstream/vcodec_profile", valstr, 1024) != 0)
|
||||
+ std::string valstr;
|
||||
+ if(SysfsUtils::GetString("/sys/class/amstream/vcodec_profile", valstr) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
- char* p = strstr(valstr, "hevc:");
|
||||
- if(p == NULL)
|
||||
- {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- return true;
|
||||
+ return (valstr.find("hevc:") != std::string::npos);
|
||||
}
|
||||
|
||||
enum AML_DEVICE_TYPE aml_get_device_type()
|
||||
@@ -216,7 +157,7 @@ void aml_cpufreq_min(bool limit)
|
||||
if (limit)
|
||||
cpufreq = 600000;
|
||||
|
||||
- aml_set_sysfs_int("/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq", cpufreq);
|
||||
+ SysfsUtils::SetInt("/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq", cpufreq);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -231,8 +172,8 @@ void aml_cpufreq_max(bool limit)
|
||||
if (limit)
|
||||
cpufreq = 800000;
|
||||
|
||||
- aml_set_sysfs_int("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", cpufreq);
|
||||
- aml_set_sysfs_str("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", "ondemand");
|
||||
+ SysfsUtils::SetInt("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", cpufreq);
|
||||
+ SysfsUtils::SetString("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", "ondemand");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +185,7 @@ void aml_set_audio_passthrough(bool passthrough)
|
||||
{
|
||||
// m1 uses 1, m3 and above uses 2
|
||||
int raw = aml_get_device_type() == AML_DEVICE_TYPE_M1 ? 1:2;
|
||||
- aml_set_sysfs_int("/sys/class/audiodsp/digital_raw", passthrough ? raw:0);
|
||||
+ SysfsUtils::SetInt("/sys/class/audiodsp/digital_raw", passthrough ? raw:0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,11 +255,11 @@ void aml_probe_hdmi_audio()
|
||||
|
||||
int aml_axis_value(AML_DISPLAY_AXIS_PARAM param)
|
||||
{
|
||||
- char axis[20] = {0};
|
||||
+ std::string axis;
|
||||
int value[8];
|
||||
|
||||
- aml_get_sysfs_str("/sys/class/display/axis", axis, 19);
|
||||
- sscanf(axis, "%d %d %d %d %d %d %d %d", &value[0], &value[1], &value[2], &value[3], &value[4], &value[5], &value[6], &value[7]);
|
||||
+ SysfsUtils::GetString("/sys/class/display/axis", axis);
|
||||
+ sscanf(axis.c_str(), "%d %d %d %d %d %d %d %d", &value[0], &value[1], &value[2], &value[3], &value[4], &value[5], &value[6], &value[7]);
|
||||
|
||||
return value[param];
|
||||
}
|
||||
diff --git a/xbmc/utils/AMLUtils.h b/xbmc/utils/AMLUtils.h
|
||||
index 208f9d3..6b0048a 100644
|
||||
--- a/xbmc/utils/AMLUtils.h
|
||||
+++ b/xbmc/utils/AMLUtils.h
|
||||
@@ -41,11 +41,6 @@ enum AML_DISPLAY_AXIS_PARAM
|
||||
AML_DISPLAY_AXIS_PARAM_HEIGHT
|
||||
};
|
||||
|
||||
-int aml_set_sysfs_str(const char *path, const char *val);
|
||||
-int aml_get_sysfs_str(const char *path, char *valstr, const int size);
|
||||
-int aml_set_sysfs_int(const char *path, const int val);
|
||||
-int aml_get_sysfs_int(const char *path);
|
||||
-
|
||||
bool aml_present();
|
||||
void aml_permissions();
|
||||
bool aml_hw3d_present();
|
||||
diff --git a/xbmc/utils/Makefile.in b/xbmc/utils/Makefile.in
|
||||
index e203447..2d89fcd 100644
|
||||
--- a/xbmc/utils/Makefile.in
|
||||
+++ b/xbmc/utils/Makefile.in
|
||||
@@ -79,6 +79,7 @@ SRCS += XMLUtils.cpp
|
||||
SRCS += Utf8Utils.cpp
|
||||
SRCS += XSLTUtils.cpp
|
||||
SRCS += ActorProtocol.cpp
|
||||
+SRCS += SysfsUtils.cpp
|
||||
|
||||
ifeq (@USE_OPENGLES@,1)
|
||||
SRCS += AMLUtils.cpp
|
||||
diff --git a/xbmc/utils/SysfsUtils.cpp b/xbmc/utils/SysfsUtils.cpp
|
||||
new file mode 100644
|
||||
index 0000000..ca62986
|
||||
--- /dev/null
|
||||
+++ b/xbmc/utils/SysfsUtils.cpp
|
||||
@@ -0,0 +1,104 @@
|
||||
+/*
|
||||
+ * 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 "SysfsUtils.h"
|
||||
+#include "utils/log.h"
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+int SysfsUtils::SetString(const std::string& path, const std::string& valstr)
|
||||
+{
|
||||
+ int fd = open(path.c_str(), O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||
+ if (fd >= 0)
|
||||
+ {
|
||||
+ write(fd, valstr.c_str(), valstr.size());
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ CLog::Log(LOGERROR, "%s: error writing %s",__FUNCTION__, path.c_str());
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+int SysfsUtils::GetString(const std::string& path, std::string& valstr)
|
||||
+{
|
||||
+ int len;
|
||||
+ char buf[256] = {0};
|
||||
+
|
||||
+ int fd = open(path.c_str(), O_RDONLY);
|
||||
+ if (fd >= 0)
|
||||
+ {
|
||||
+ valstr.clear();
|
||||
+ while ((len = read(fd, buf, 256)) > 0)
|
||||
+ valstr.append(buf, len);
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ CLog::Log(LOGERROR, "%s: error reading %s",__FUNCTION__, path.c_str());
|
||||
+ valstr = "fail";
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+int SysfsUtils::SetInt(const std::string& path, const int val)
|
||||
+{
|
||||
+ int fd = open(path.c_str(), O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||
+ if (fd >= 0)
|
||||
+ {
|
||||
+ char bcmd[16];
|
||||
+ sprintf(bcmd, "%d", val);
|
||||
+ write(fd, bcmd, strlen(bcmd));
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ CLog::Log(LOGERROR, "%s: error writing %s",__FUNCTION__, path.c_str());
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+int SysfsUtils::GetInt(const std::string& path, int& val)
|
||||
+{
|
||||
+ int fd = open(path.c_str(), O_RDONLY);
|
||||
+ if (fd >= 0)
|
||||
+ {
|
||||
+ char bcmd[16];
|
||||
+ read(fd, bcmd, sizeof(bcmd));
|
||||
+ val = strtol(bcmd, NULL, 16);
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ CLog::Log(LOGERROR, "%s: error reading %s",__FUNCTION__, path.c_str());
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+bool SysfsUtils::Has(const std::string &path)
|
||||
+{
|
||||
+ int fd = open(path.c_str(), O_RDONLY);
|
||||
+ if (fd >= 0)
|
||||
+ {
|
||||
+ close(fd);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
diff --git a/xbmc/utils/SysfsUtils.h b/xbmc/utils/SysfsUtils.h
|
||||
new file mode 100644
|
||||
index 0000000..fe038bf
|
||||
--- /dev/null
|
||||
+++ b/xbmc/utils/SysfsUtils.h
|
||||
@@ -0,0 +1,32 @@
|
||||
+#pragma once
|
||||
+/*
|
||||
+ * Copyright (C) 2011-2013 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>
|
||||
+
|
||||
+class SysfsUtils
|
||||
+{
|
||||
+public:
|
||||
+ static int SetString(const std::string& path, const std::string& valstr);
|
||||
+ static int GetString(const std::string& path, std::string& valstr);
|
||||
+ static int SetInt(const std::string& path, const int val);
|
||||
+ static int GetInt(const std::string& path, int& val);
|
||||
+ static bool Has(const std::string& path);
|
||||
+};
|
||||
diff --git a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp
|
||||
index 7064836..0cce3ea 100644
|
||||
--- a/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp
|
||||
+++ b/xbmc/windowing/egl/EGLNativeTypeAmlogic.cpp
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "guilib/gui3d.h"
|
||||
#include "utils/AMLUtils.h"
|
||||
#include "utils/StringUtils.h"
|
||||
+#include "utils/SysfsUtils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <linux/fb.h>
|
||||
@@ -49,13 +50,12 @@ CEGLNativeTypeAmlogic::~CEGLNativeTypeAmlogic()
|
||||
|
||||
bool CEGLNativeTypeAmlogic::CheckCompatibility()
|
||||
{
|
||||
- char name[256] = {0};
|
||||
+ std::string name;
|
||||
std::string modalias = "/sys/class/graphics/" + m_framebuffer_name + "/device/modalias";
|
||||
|
||||
- aml_get_sysfs_str(modalias.c_str(), name, 255);
|
||||
- CStdString strName = name;
|
||||
- StringUtils::Trim(strName);
|
||||
- if (strName == "platform:mesonfb")
|
||||
+ SysfsUtils::GetString(modalias, name);
|
||||
+ StringUtils::Trim(name);
|
||||
+ if (name == "platform:mesonfb")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -127,9 +127,9 @@ bool CEGLNativeTypeAmlogic::DestroyNativeWindow()
|
||||
|
||||
bool CEGLNativeTypeAmlogic::GetNativeResolution(RESOLUTION_INFO *res) const
|
||||
{
|
||||
- char mode[256] = {0};
|
||||
- aml_get_sysfs_str("/sys/class/display/mode", mode, 255);
|
||||
- return aml_mode_to_resolution(mode, res);
|
||||
+ std::string mode;
|
||||
+ SysfsUtils::GetString("/sys/class/display/mode", mode);
|
||||
+ return aml_mode_to_resolution(mode.c_str(), res);
|
||||
}
|
||||
|
||||
bool CEGLNativeTypeAmlogic::SetNativeResolution(const RESOLUTION_INFO &res)
|
||||
@@ -180,8 +180,8 @@ bool CEGLNativeTypeAmlogic::SetNativeResolution(const RESOLUTION_INFO &res)
|
||||
|
||||
bool CEGLNativeTypeAmlogic::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutions)
|
||||
{
|
||||
- char valstr[256] = {0};
|
||||
- aml_get_sysfs_str("/sys/class/amhdmitx/amhdmitx0/disp_cap", valstr, 255);
|
||||
+ std::string valstr;
|
||||
+ SysfsUtils::GetString("/sys/class/amhdmitx/amhdmitx0/disp_cap", valstr);
|
||||
std::vector<std::string> probe_str = StringUtils::Split(valstr, "\n");
|
||||
|
||||
resolutions.clear();
|
||||
@@ -210,7 +210,7 @@ bool CEGLNativeTypeAmlogic::GetPreferredResolution(RESOLUTION_INFO *res) const
|
||||
bool CEGLNativeTypeAmlogic::ShowWindow(bool show)
|
||||
{
|
||||
std::string blank_framebuffer = "/sys/class/graphics/" + m_framebuffer_name + "/blank";
|
||||
- aml_set_sysfs_int(blank_framebuffer.c_str(), show ? 0 : 1);
|
||||
+ SysfsUtils::SetInt(blank_framebuffer.c_str(), show ? 0 : 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ bool CEGLNativeTypeAmlogic::SetDisplayResolution(const char *resolution)
|
||||
{
|
||||
CStdString mode = resolution;
|
||||
// switch display resolution
|
||||
- aml_set_sysfs_str("/sys/class/display/mode", mode.c_str());
|
||||
+ SysfsUtils::SetString("/sys/class/display/mode", mode.c_str());
|
||||
SetupVideoScaling(mode.c_str());
|
||||
|
||||
return true;
|
||||
@@ -226,67 +226,67 @@ bool CEGLNativeTypeAmlogic::SetDisplayResolution(const char *resolution)
|
||||
|
||||
void CEGLNativeTypeAmlogic::SetupVideoScaling(const char *mode)
|
||||
{
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb0/blank", 1);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 0);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 0);
|
||||
- aml_set_sysfs_int("/sys/class/ppmgr/ppscaler", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb0/blank", 1);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb0/free_scale", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb1/free_scale", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/ppmgr/ppscaler", 0);
|
||||
|
||||
if (strstr(mode, "1080"))
|
||||
{
|
||||
- aml_set_sysfs_str("/sys/class/graphics/fb0/request2XScale", "8");
|
||||
- aml_set_sysfs_str("/sys/class/graphics/fb1/scale_axis", "1280 720 1920 1080");
|
||||
- aml_set_sysfs_str("/sys/class/graphics/fb1/scale", "0x10001");
|
||||
+ SysfsUtils::SetString("/sys/class/graphics/fb0/request2XScale", "8");
|
||||
+ SysfsUtils::SetString("/sys/class/graphics/fb1/scale_axis", "1280 720 1920 1080");
|
||||
+ SysfsUtils::SetString("/sys/class/graphics/fb1/scale", "0x10001");
|
||||
}
|
||||
else
|
||||
{
|
||||
- aml_set_sysfs_str("/sys/class/graphics/fb0/request2XScale", "16 1280 720");
|
||||
+ SysfsUtils::SetString("/sys/class/graphics/fb0/request2XScale", "16 1280 720");
|
||||
}
|
||||
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb0/blank", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb0/blank", 0);
|
||||
}
|
||||
|
||||
void CEGLNativeTypeAmlogic::EnableFreeScale()
|
||||
{
|
||||
// enable OSD free scale using frame buffer size of 720p
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 0);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 0);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb0/scale_width", 1280);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb0/scale_height", 720);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb1/scale_width", 1280);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb1/scale_height", 720);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb0/free_scale", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb1/free_scale", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb0/scale_width", 1280);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb0/scale_height", 720);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb1/scale_width", 1280);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb1/scale_height", 720);
|
||||
|
||||
// enable video free scale (scaling to 1920x1080 with frame buffer size 1280x720)
|
||||
- aml_set_sysfs_int("/sys/class/ppmgr/ppscaler", 0);
|
||||
- aml_set_sysfs_int("/sys/class/video/disable_video", 1);
|
||||
- aml_set_sysfs_int("/sys/class/ppmgr/ppscaler", 1);
|
||||
- aml_set_sysfs_str("/sys/class/ppmgr/ppscaler_rect", "0 0 1919 1079 0");
|
||||
- aml_set_sysfs_str("/sys/class/ppmgr/disp", "1280 720");
|
||||
+ SysfsUtils::SetInt("/sys/class/ppmgr/ppscaler", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/video/disable_video", 1);
|
||||
+ SysfsUtils::SetInt("/sys/class/ppmgr/ppscaler", 1);
|
||||
+ SysfsUtils::SetString("/sys/class/ppmgr/ppscaler_rect", "0 0 1919 1079 0");
|
||||
+ SysfsUtils::SetString("/sys/class/ppmgr/disp", "1280 720");
|
||||
//
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb0/scale_width", 1280);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb0/scale_height", 720);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb1/scale_width", 1280);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb1/scale_height", 720);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb0/scale_width", 1280);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb0/scale_height", 720);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb1/scale_width", 1280);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb1/scale_height", 720);
|
||||
//
|
||||
- aml_set_sysfs_int("/sys/class/video/disable_video", 2);
|
||||
- aml_set_sysfs_str("/sys/class/display/axis", "0 0 1279 719 0 0 0 0");
|
||||
- aml_set_sysfs_str("/sys/class/ppmgr/ppscaler_rect", "0 0 1279 719 1");
|
||||
+ SysfsUtils::SetInt("/sys/class/video/disable_video", 2);
|
||||
+ SysfsUtils::SetString("/sys/class/display/axis", "0 0 1279 719 0 0 0 0");
|
||||
+ SysfsUtils::SetString("/sys/class/ppmgr/ppscaler_rect", "0 0 1279 719 1");
|
||||
//
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 1);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 1);
|
||||
- aml_set_sysfs_str("/sys/class/graphics/fb0/free_scale_axis", "0 0 1279 719");
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb0/free_scale", 1);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb1/free_scale", 1);
|
||||
+ SysfsUtils::SetString("/sys/class/graphics/fb0/free_scale_axis", "0 0 1279 719");
|
||||
}
|
||||
|
||||
void CEGLNativeTypeAmlogic::DisableFreeScale()
|
||||
{
|
||||
// turn off frame buffer freescale
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 0);
|
||||
- aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 0);
|
||||
- aml_set_sysfs_str("/sys/class/graphics/fb0/free_scale_axis", "0 0 1279 719");
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb0/free_scale", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/graphics/fb1/free_scale", 0);
|
||||
+ SysfsUtils::SetString("/sys/class/graphics/fb0/free_scale_axis", "0 0 1279 719");
|
||||
|
||||
- aml_set_sysfs_int("/sys/class/ppmgr/ppscaler", 0);
|
||||
- aml_set_sysfs_int("/sys/class/video/disable_video", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/ppmgr/ppscaler", 0);
|
||||
+ SysfsUtils::SetInt("/sys/class/video/disable_video", 0);
|
||||
// now default video display to off
|
||||
- aml_set_sysfs_int("/sys/class/video/disable_video", 1);
|
||||
+ SysfsUtils::SetInt("/sys/class/video/disable_video", 1);
|
||||
|
||||
// revert display axis
|
||||
int fd0;
|
||||
@@ -297,9 +297,9 @@ void CEGLNativeTypeAmlogic::DisableFreeScale()
|
||||
struct fb_var_screeninfo vinfo;
|
||||
if (ioctl(fd0, FBIOGET_VSCREENINFO, &vinfo) == 0)
|
||||
{
|
||||
- char daxis_str[255] = {0};
|
||||
+ char daxis_str[256] = {0};
|
||||
sprintf(daxis_str, "%d %d %d %d 0 0 0 0", 0, 0, vinfo.xres-1, vinfo.yres-1);
|
||||
- aml_set_sysfs_str("/sys/class/display/axis", daxis_str);
|
||||
+ SysfsUtils::SetString("/sys/class/display/axis", daxis_str);
|
||||
}
|
||||
close(fd0);
|
||||
}
|
||||
diff --git a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp
|
||||
index 2b8180b..5bf5e06 100644
|
||||
--- a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp
|
||||
+++ b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "utils/log.h"
|
||||
#include "utils/RegExp.h"
|
||||
#include "utils/StringUtils.h"
|
||||
+#include "utils/SysfsUtils.h"
|
||||
#include "utils/Environment.h"
|
||||
#include "guilib/gui3d.h"
|
||||
#include "windowing/WindowingFactory.h"
|
||||
@@ -232,7 +233,7 @@ bool CEGLNativeTypeIMX::DestroyNativeWindow()
|
||||
bool CEGLNativeTypeIMX::GetNativeResolution(RESOLUTION_INFO *res) const
|
||||
{
|
||||
std::string mode;
|
||||
- get_sysfs_str("/sys/class/graphics/fb0/mode", mode);
|
||||
+ SysfsUtils::GetString("/sys/class/graphics/fb0/mode", mode);
|
||||
return ModeToResolution(mode, res);
|
||||
}
|
||||
|
||||
@@ -242,14 +243,14 @@ bool CEGLNativeTypeIMX::SetNativeResolution(const RESOLUTION_INFO &res)
|
||||
return false;
|
||||
|
||||
std::string mode;
|
||||
- get_sysfs_str("/sys/class/graphics/fb0/mode", mode);
|
||||
+ SysfsUtils::GetString("/sys/class/graphics/fb0/mode", mode);
|
||||
if (res.strId == mode)
|
||||
return false;
|
||||
|
||||
DestroyNativeWindow();
|
||||
DestroyNativeDisplay();
|
||||
|
||||
- set_sysfs_str("/sys/class/graphics/fb0/mode", res.strId);
|
||||
+ SysfsUtils::SetString("/sys/class/graphics/fb0/mode", res.strId);
|
||||
|
||||
CreateNativeDisplay();
|
||||
|
||||
@@ -267,7 +268,7 @@ bool CEGLNativeTypeIMX::ProbeResolutions(std::vector<RESOLUTION_INFO> &resolutio
|
||||
return false;
|
||||
|
||||
std::string valstr;
|
||||
- get_sysfs_str("/sys/class/graphics/fb0/modes", valstr);
|
||||
+ SysfsUtils::GetString("/sys/class/graphics/fb0/modes", valstr);
|
||||
std::vector<std::string> probe_str;
|
||||
probe_str = StringUtils::Split(valstr, "\n");
|
||||
|
||||
@@ -299,41 +300,6 @@ bool CEGLNativeTypeIMX::ShowWindow(bool show)
|
||||
return false;
|
||||
}
|
||||
|
||||
-int CEGLNativeTypeIMX::get_sysfs_str(std::string path, std::string& valstr) const
|
||||
-{
|
||||
- int len;
|
||||
- char buf[256] = {0};
|
||||
-
|
||||
- int fd = open(path.c_str(), O_RDONLY);
|
||||
- if (fd >= 0)
|
||||
- {
|
||||
- while ((len = read(fd, buf, 255)) > 0)
|
||||
- valstr.append(buf, len);
|
||||
- close(fd);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- CLog::Log(LOGERROR, "%s: error reading %s",__FUNCTION__, path.c_str());
|
||||
- valstr = "fail";
|
||||
- return -1;
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-int CEGLNativeTypeIMX::set_sysfs_str(std::string path, std::string val) const
|
||||
-{
|
||||
- int fd = open(path.c_str(), O_WRONLY);
|
||||
- if (fd >= 0)
|
||||
- {
|
||||
- val += '\n';
|
||||
- write(fd, val.c_str(), val.size());
|
||||
- close(fd);
|
||||
- return 0;
|
||||
- }
|
||||
- CLog::Log(LOGERROR, "%s: error writing %s",__FUNCTION__, path.c_str());
|
||||
- return -1;
|
||||
-}
|
||||
-
|
||||
bool CEGLNativeTypeIMX::ModeToResolution(std::string mode, RESOLUTION_INFO *res) const
|
||||
{
|
||||
if (!res)
|
||||
diff --git a/xbmc/windowing/egl/EGLNativeTypeIMX.h b/xbmc/windowing/egl/EGLNativeTypeIMX.h
|
||||
index d5e5739..0298cb5 100644
|
||||
--- a/xbmc/windowing/egl/EGLNativeTypeIMX.h
|
||||
+++ b/xbmc/windowing/egl/EGLNativeTypeIMX.h
|
||||
@@ -50,8 +50,6 @@ public:
|
||||
|
||||
protected:
|
||||
bool m_readonly;
|
||||
- int get_sysfs_str(std::string path, std::string& valstr) const;
|
||||
- int set_sysfs_str(std::string path, std::string val) const;
|
||||
bool ModeToResolution(std::string mode, RESOLUTION_INFO *res) const;
|
||||
|
||||
EGLNativeDisplayType m_display;
|
||||
--
|
||||
1.9.1
|
||||
|
@ -0,0 +1,25 @@
|
||||
From c1589961786033b47ab5f8f3f0cf6d9384460e12 Mon Sep 17 00:00:00 2001
|
||||
From: smallint <tahoma@gmx.de>
|
||||
Date: Mon, 19 Jan 2015 20:38:42 +0100
|
||||
Subject: [PATCH 3/3] [imx] Fixed mode change after SysfsUtils port
|
||||
|
||||
---
|
||||
xbmc/windowing/egl/EGLNativeTypeIMX.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp
|
||||
index 5bf5e06..cf2f706 100644
|
||||
--- a/xbmc/windowing/egl/EGLNativeTypeIMX.cpp
|
||||
+++ b/xbmc/windowing/egl/EGLNativeTypeIMX.cpp
|
||||
@@ -250,7 +250,7 @@ bool CEGLNativeTypeIMX::SetNativeResolution(const RESOLUTION_INFO &res)
|
||||
DestroyNativeWindow();
|
||||
DestroyNativeDisplay();
|
||||
|
||||
- SysfsUtils::SetString("/sys/class/graphics/fb0/mode", res.strId);
|
||||
+ SysfsUtils::SetString("/sys/class/graphics/fb0/mode", res.strId + "\n");
|
||||
|
||||
CreateNativeDisplay();
|
||||
|
||||
--
|
||||
1.9.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user