diff options
-rw-r--r-- | data/etc/android.hardware.sensor.ambient_temperature.xml | 36 | ||||
-rw-r--r-- | data/etc/android.hardware.sensor.relative_humidity.xml | 36 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayHardware/HWComposer.cpp | 21 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayHardware/HWComposer.h | 1 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayUtils.cpp | 13 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayUtils.h | 1 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 15 |
7 files changed, 117 insertions, 6 deletions
diff --git a/data/etc/android.hardware.sensor.ambient_temperature.xml b/data/etc/android.hardware.sensor.ambient_temperature.xml new file mode 100644 index 0000000..ffb105d --- /dev/null +++ b/data/etc/android.hardware.sensor.ambient_temperature.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + +Copyright (c) 2014, The Linux Foundation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--> + +<!-- Feature for devices with an ambient temperature sensor. --> +<permissions> + <feature name="android.hardware.sensor.ambient_temperature" /> +</permissions> diff --git a/data/etc/android.hardware.sensor.relative_humidity.xml b/data/etc/android.hardware.sensor.relative_humidity.xml new file mode 100644 index 0000000..0710079 --- /dev/null +++ b/data/etc/android.hardware.sensor.relative_humidity.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + +Copyright (c) 2014, The Linux Foundation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--> + +<!-- Feature for devices with relative humidity sensor. --> +<permissions> + <feature name="android.hardware.sensor.relative_humidity" /> +</permissions> diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index c57dd5f..b60687f 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 <exhwcomposer_defs.h> +#endif #include <android/configuration.h> @@ -711,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) { @@ -1006,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; diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h index 862288f..9bdb7de 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.h +++ b/services/surfaceflinger/DisplayHardware/HWComposer.h @@ -181,6 +181,7 @@ public: virtual void setAcquireFenceFd(int fenceFd) = 0; virtual void setPlaneAlpha(uint8_t alpha) = 0; virtual void onDisplayed() = 0; + virtual void setAnimating(bool animating)= 0; }; /* diff --git a/services/surfaceflinger/DisplayUtils.cpp b/services/surfaceflinger/DisplayUtils.cpp index 1f4c21c..0555232 100644 --- a/services/surfaceflinger/DisplayUtils.cpp +++ b/services/surfaceflinger/DisplayUtils.cpp @@ -44,6 +44,7 @@ #include <ExLayer.h> #include <DisplayHardware/ExHWComposer.h> #include <DisplayHardware/ExVirtualDisplaySurface.h> +#include <gralloc_priv.h> #endif #include <dlfcn.h> #include <cutils/properties.h> @@ -169,5 +170,17 @@ bool DisplayUtils::createV4L2BasedVirtualDisplay(HWComposer* hwc, int32_t &hwcDi return false; } +bool DisplayUtils::canAllocateHwcDisplayIdForVDS(int usage) { + // on AOSP builds with QTI_BSP disabled, we should allocate hwc display id for virtual display + int flag_mask = 0xffffffff; + +#if QTI_BSP + // Reserve hardware acceleration for WFD use-case + flag_mask = GRALLOC_USAGE_PRIVATE_WFD; +#endif + + return (usage & flag_mask); +} + }; // namespace android diff --git a/services/surfaceflinger/DisplayUtils.h b/services/surfaceflinger/DisplayUtils.h index cdf2b67..bb3d16b 100644 --- a/services/surfaceflinger/DisplayUtils.h +++ b/services/surfaceflinger/DisplayUtils.h @@ -61,6 +61,7 @@ class DisplayUtils { sp<IGraphicBufferProducer> &producer, sp<IGraphicBufferProducer> bqProducer, sp<IGraphicBufferConsumer> bqConsumer, String8 currentStateDisplayName, bool currentStateIsSecure, int currentStateType); + bool canAllocateHwcDisplayIdForVDS(int usage); DisplayUtils(); private: static DisplayUtils* sDisplayUtils; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 429231c..4051b38 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1478,6 +1478,7 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) if (state.surface != NULL) { int width = 0; + DisplayUtils* displayUtils = DisplayUtils::getInstance(); int status = state.surface->query( NATIVE_WINDOW_WIDTH, &width); ALOGE_IF(status != NO_ERROR, @@ -1490,11 +1491,19 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) if (MAX_VIRTUAL_DISPLAY_DIMENSION == 0 || (width <= MAX_VIRTUAL_DISPLAY_DIMENSION && height <= MAX_VIRTUAL_DISPLAY_DIMENSION)) { - hwcDisplayId = allocateHwcDisplayId(state.type); + int usage = 0; + status = state.surface->query( + NATIVE_WINDOW_CONSUMER_USAGE_BITS, &usage); + ALOGW_IF(status != NO_ERROR, + "Unable to query usage (%d)", status); + if ( (status == NO_ERROR) && + displayUtils->canAllocateHwcDisplayIdForVDS(usage)) { + hwcDisplayId = allocateHwcDisplayId(state.type); + } } - DisplayUtils::getInstance()->initVDSInstance(mHwc, hwcDisplayId, - state.surface, dispSurface, producer, bqProducer, bqConsumer, + displayUtils->initVDSInstance(mHwc, hwcDisplayId, state.surface, + dispSurface, producer, bqProducer, bqConsumer, state.displayName, state.isSecure, state.type); } |