diff options
Diffstat (limited to 'services/surfaceflinger/DisplayHardware/HWComposer.cpp')
-rw-r--r-- | services/surfaceflinger/DisplayHardware/HWComposer.cpp | 64 |
1 files changed, 56 insertions, 8 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 0859149..a43597a 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -36,6 +36,9 @@ #include <hardware/hardware.h> #include <hardware/hwcomposer.h> +#ifdef QTI_BSP +#include <hardware/display_defs.h> +#endif #include <android/configuration.h> @@ -190,6 +193,11 @@ HWComposer::HWComposer( // we don't have VSYNC support, we need to fake it mVSyncThread = new VSyncThread(*this); } + + mDimComp = 0; + if (mHwc) { + mHwc->query(mHwc, HWC_BACKGROUND_LAYER_SUPPORTED, &mDimComp); + } } HWComposer::~HWComposer() { @@ -368,7 +376,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); @@ -701,13 +714,14 @@ status_t HWComposer::prepare() { disp.hasFbComp = false; disp.hasOvComp = false; if (disp.list) { - for (size_t i=0 ; i<disp.list->numHwLayers ; i++) { - hwc_layer_1_t& l = disp.list->hwLayers[i]; + for (size_t j=0 ; j<disp.list->numHwLayers ; j++) { + hwc_layer_1_t& l = disp.list->hwLayers[j]; //ALOGD("prepare: %d, type=%d, handle=%p", // i, l.compositionType, l.handle); - if (l.flags & HWC_SKIP_LAYER) { + if ((i == DisplayDevice::DISPLAY_PRIMARY) && + l.flags & HWC_SKIP_LAYER) { l.compositionType = HWC_FRAMEBUFFER; } if (l.compositionType == HWC_FRAMEBUFFER) { @@ -716,6 +730,9 @@ status_t HWComposer::prepare() { if (l.compositionType == HWC_OVERLAY) { disp.hasOvComp = true; } + if (isCompositionTypeBlit(l.compositionType)) { + disp.hasFbComp = true; + } if (l.compositionType == HWC_CURSOR_OVERLAY) { disp.hasOvComp = true; } @@ -816,15 +833,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]); @@ -977,6 +1010,17 @@ public: } } } + virtual void setAnimating(bool animating) { + if (animating) { +#ifdef QTI_BSP + getLayer()->flags |= HWC_SCREENSHOT_ANIMATOR_LAYER; +#endif + } else { +#ifdef QTI_BSP + getLayer()->flags &= ~HWC_SCREENSHOT_ANIMATOR_LAYER; +#endif + } + } virtual void setDefaultState() { hwc_layer_1_t* const l = getLayer(); l->compositionType = HWC_FRAMEBUFFER; @@ -998,6 +1042,10 @@ public: getLayer()->flags &= ~HWC_SKIP_LAYER; } } + virtual void setDim() { + setSkip(false); + getLayer()->flags |= 0x80000000; + } virtual void setIsCursorLayerHint(bool isCursor) { if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_4)) { if (isCursor) { @@ -1233,7 +1281,7 @@ void HWComposer::dump(String8& result) const { if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_3)) { result.appendFormat( " %9s | %08" PRIxPTR " | %04x | %04x | %02x | %04x | %-11s |%7.1f,%7.1f,%7.1f,%7.1f |%5d,%5d,%5d,%5d | %s\n", - compositionTypeName[type], + (isCompositionTypeBlit(l.compositionType)) ? "HWC_BLIT" : compositionTypeName[type], intptr_t(l.handle), l.hints, l.flags, l.transform, l.blending, formatStr.string(), l.sourceCropf.left, l.sourceCropf.top, l.sourceCropf.right, l.sourceCropf.bottom, l.displayFrame.left, l.displayFrame.top, l.displayFrame.right, l.displayFrame.bottom, @@ -1241,7 +1289,7 @@ void HWComposer::dump(String8& result) const { } else { result.appendFormat( " %9s | %08" PRIxPTR " | %04x | %04x | %02x | %04x | %-11s |%7d,%7d,%7d,%7d |%5d,%5d,%5d,%5d | %s\n", - compositionTypeName[type], + (isCompositionTypeBlit(l.compositionType)) ? "HWC_BLIT" : compositionTypeName[type], intptr_t(l.handle), l.hints, l.flags, l.transform, l.blending, formatStr.string(), l.sourceCrop.left, l.sourceCrop.top, l.sourceCrop.right, l.sourceCrop.bottom, l.displayFrame.left, l.displayFrame.top, l.displayFrame.right, l.displayFrame.bottom, |