summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DisplayHardware
diff options
context:
space:
mode:
authorTatenda Chipeperekwa <tatendac@codeaurora.org>2014-09-22 16:57:24 -0700
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:22:24 -0600
commit8eaa19460dcaaead5987332580ac338e20af456b (patch)
treeef498521ce90acb1a10aeaad72cd4921ec8aa664 /services/surfaceflinger/DisplayHardware
parente8293118b93ff33ce6a686b6d7c500ae9adb2bc9 (diff)
downloadframeworks_native-8eaa19460dcaaead5987332580ac338e20af456b.zip
frameworks_native-8eaa19460dcaaead5987332580ac338e20af456b.tar.gz
frameworks_native-8eaa19460dcaaead5987332580ac338e20af456b.tar.bz2
SurfaceFlinger: Support get/set ActiveConfigs
This includes the following two changes squashed into one and retaining the change I182f41edbaf9226fc62d6d17ee964998cd9f21f7 sf: Fixes for resolution change in SurfaceFlinger 1. Use active config from HWC when querying display attributes When we query the display attributes we should use the active config as reported by HWC in cases where HWC version is 1.4. In all other cases we should revert to the default config, config 0, as the active config. 2. Set/update the display config if HWC config change was successful The new config should only be applied if HWC succeeded in changing the active config. This would otherwise cause failure or undefined behavior if the client sets an invalid/unsupported display config. 3. Set the active config at display creation time When a new display device is added update the active config by querying HWC. Change-Id: I182f41edbaf9226fc62d6d17ee964998cd9f21f7 sf: Initialize active config for non-virtual displays at boot time When a non-virtual display device is added at boot time, update the active config by querying HWC otherwise the default config (config 0) will be used. Change-Id: I90f42fa1d20ed6176c4be464a10ae69a2f6a6d55 Change-Id: I182f41edbaf9226fc62d6d17ee964998cd9f21f7
Diffstat (limited to 'services/surfaceflinger/DisplayHardware')
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp27
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.h3
2 files changed, 27 insertions, 3 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 2dad005..84c6af9 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -358,7 +358,12 @@ status_t HWComposer::queryDisplayProperties(int disp) {
return err;
}
- mDisplayData[disp].currentConfig = 0;
+ int currentConfig = getActiveConfig(disp);
+ if (currentConfig < 0 || currentConfig > static_cast<int>((numConfigs-1))) {
+ ALOGE("%s: Invalid display config! %d", __FUNCTION__, currentConfig);
+ currentConfig = 0;
+ }
+ mDisplayData[disp].currentConfig = currentConfig;
for (size_t c = 0; c < numConfigs; ++c) {
err = mHwc->getDisplayAttributes(mHwc, disp, configs[c],
DISPLAY_ATTRIBUTES, values);
@@ -797,15 +802,31 @@ status_t HWComposer::setPowerMode(int disp, int mode) {
status_t HWComposer::setActiveConfig(int disp, int mode) {
LOG_FATAL_IF(disp >= VIRTUAL_DISPLAY_ID_BASE);
DisplayData& dd(mDisplayData[disp]);
- dd.currentConfig = mode;
if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_4)) {
- return (status_t)mHwc->setActiveConfig(mHwc, disp, mode);
+ status_t status = static_cast<status_t>(
+ mHwc->setActiveConfig(mHwc, disp, mode));
+ if (status == NO_ERROR) {
+ dd.currentConfig = mode;
+ } else {
+ ALOGE("%s Failed to set new config (%d) for display (%d)",
+ __FUNCTION__, mode, disp);
+ }
+ return status;
} else {
LOG_FATAL_IF(mode != 0);
}
return NO_ERROR;
}
+int HWComposer::getActiveConfig(int disp) const {
+ LOG_FATAL_IF(disp >= VIRTUAL_DISPLAY_ID_BASE);
+ if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_4)) {
+ return mHwc->getActiveConfig(mHwc, disp);
+ } else {
+ return 0;
+ }
+}
+
void HWComposer::disconnectDisplay(int disp) {
LOG_ALWAYS_FATAL_IF(disp < 0 || disp == HWC_DISPLAY_PRIMARY);
DisplayData& dd(mDisplayData[disp]);
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index cc98b4c..814f6a3 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -103,6 +103,9 @@ public:
// set active config
status_t setActiveConfig(int disp, int mode);
+ // get active config
+ int getActiveConfig(int disp) const;
+
// reset state when an external, non-virtual display is disconnected
void disconnectDisplay(int disp);