summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Mortimer <sam@mortimer.me.uk>2018-01-12 21:28:33 -0800
committerSam Mortimer <sam@mortimer.me.uk>2018-02-04 20:20:58 +0000
commit3c78b9ed89ed44b9125b5726065fc9f9c2489c0d (patch)
tree793f6317c47c81d96944012298f831a9f008db20
parentcb059b60a85bc22bf2353dbdb1c1faf2dffdd915 (diff)
downloadhardware_lineage_livedisplay-staging/lineage-15.1.tar.gz
hardware_lineage_livedisplay-staging/lineage-15.1.tar.bz2
hardware_lineage_livedisplay-staging/lineage-15.1.zip
livedisplay: Support sysfs only display modesstaging/lineage-15.1lineage-15.1
*) If SDM does not provide any display modes and yet sysfs options are available, allow them to be used and create a "standard" mode that is all sysfs based modes turned off. *) Known deficiency: the sysfs modes are still not accessible if SDM is not available. This will be addressed later (possibly by moving sysfs mode handling to lineagehw). Change-Id: If80134362db0d359aaacb6b1916dc99e41af1892
-rw-r--r--impl/SDM.cpp32
-rw-r--r--impl/SDM.h4
2 files changed, 26 insertions, 10 deletions
diff --git a/impl/SDM.cpp b/impl/SDM.cpp
index 1e60f63..6fc6733 100644
--- a/impl/SDM.cpp
+++ b/impl/SDM.cpp
@@ -234,12 +234,17 @@ int32_t SDM::getColorBalance() {
return value;
}
-uint32_t SDM::getNumDisplayModes() {
+uint32_t SDM::getNumSDMDisplayModes() {
uint32_t flags = 0;
int32_t count = 0;
if (disp_api_get_num_display_modes(mHandle, 0, 0, &count, &flags)) {
count = 0;
}
+ return count;
+}
+
+uint32_t SDM::getNumDisplayModes() {
+ int32_t count = getNumSDMDisplayModes();
if (getLocalSRGBMode() != nullptr) {
count++;
}
@@ -258,13 +263,8 @@ status_t SDM::getDisplayModes(List<sp<DisplayMode>>& profiles) {
sp<DisplayMode> srgb = getLocalSRGBMode();
sp<DisplayMode> dci_p3 = getLocalDCIP3Mode();
- uint32_t sdm_count = count;
- if (srgb != nullptr) {
- sdm_count--;
- }
- if (dci_p3 != nullptr) {
- sdm_count--;
- }
+
+ uint32_t sdm_count = getNumSDMDisplayModes();
struct sdm_mode {
int32_t id;
@@ -292,6 +292,13 @@ status_t SDM::getDisplayModes(List<sp<DisplayMode>>& profiles) {
}
delete[] tmp;
+ if (sdm_count == 0) {
+ const sp<DisplayMode> m = new DisplayMode(STANDARD_NODE_ID, "standard", 8);
+ m->privFlags = PRIV_MODE_FLAG_SYSFS;
+ m->privData.setTo("");
+ profiles.push_back(m);
+ }
+
if (srgb != nullptr) {
profiles.push_back(srgb);
}
@@ -399,8 +406,13 @@ status_t SDM::setModeState(sp<DisplayMode> mode, bool state) {
int32_t id = 0;
if (mode->privFlags == PRIV_MODE_FLAG_SYSFS) {
- ALOGV("sysfs node: %s state=%d", mode->privData.string(), state);
- return Utils::writeInt(mode->privData.string(), state ? 1 : 0);
+ if (mode->id != STANDARD_NODE_ID) {
+ ALOGV("sysfs node: %s state=%d", mode->privData.string(), state);
+ return Utils::writeInt(mode->privData.string(), state ? 1 : 0);
+ } else {
+ // NOOP
+ return OK;
+ }
} else if (mode->privFlags == PRIV_MODE_FLAG_SDM) {
if (state) {
return disp_api_set_active_display_mode(mHandle, 0, mode->id, 0);
diff --git a/impl/SDM.h b/impl/SDM.h
index f0d3ebe..f6db039 100644
--- a/impl/SDM.h
+++ b/impl/SDM.h
@@ -13,6 +13,9 @@
#define FOSS_OFF "foss:off"
#define FOSS_STATUS "foss:status"
+// For use when only sysfs modes are available
+#define STANDARD_NODE_ID 600
+
#define SRGB_NODE "/sys/class/graphics/fb0/srgb"
#define SRGB_NODE_ID 601
@@ -99,6 +102,7 @@ class SDM : public LiveDisplayBackend {
status_t setModeState(sp<DisplayMode> mode, bool state);
status_t saveInitialDisplayMode();
uint32_t getNumDisplayModes();
+ uint32_t getNumSDMDisplayModes();
int64_t mHandle;
bool mCachedFOSSStatus;