diff options
| author | Pierre-Hugues Husson <phh@phh.me> | 2020-05-25 10:12:24 +0000 |
|---|---|---|
| committer | LuK1337 <priv.luk@gmail.com> | 2020-05-26 14:58:47 +0200 |
| commit | 470dde656e0ee547f78ac403a6f959e1438c2158 (patch) | |
| tree | 688a770dfdcdec888c9f6996741447cd7c4ba286 | |
| parent | 69a8520c33d4de477f9579e53bb67398c73c4f0d (diff) | |
| download | android_frameworks_native-470dde656e0ee547f78ac403a6f959e1438c2158.tar.gz android_frameworks_native-470dde656e0ee547f78ac403a6f959e1438c2158.tar.bz2 android_frameworks_native-470dde656e0ee547f78ac403a6f959e1438c2158.zip | |
surfaceflinger: Add support for extension lib
* Supports changed z fod order
* Supports changed fod usage bits
TheScarastic: Adapt to extension lib
Co-authored-by: TheScarastic <warabhishek@gmail.com>
Change-Id: Id95aa73e06b4223a6b4f05c69fa2fc494f9a97b1
5 files changed, 86 insertions, 2 deletions
diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp index f35a4fd49..062f927eb 100644 --- a/services/surfaceflinger/BufferQueueLayer.cpp +++ b/services/surfaceflinger/BufferQueueLayer.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "BufferQueueLayer" #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include <compositionengine/Display.h> +#include <compositionengine/FodExtension.h> #include <compositionengine/Layer.h> #include <compositionengine/OutputLayer.h> #include <compositionengine/impl/LayerCompositionState.h> @@ -560,11 +561,19 @@ status_t BufferQueueLayer::setDefaultBufferProperties(uint32_t w, uint32_t h, Pi return BAD_VALUE; } + uint32_t usageBits = 0; + + if (mName == FOD_LAYER_NAME) { + usageBits = getFodUsageBits(usageBits, false); + } else if (mName == FOD_TOUCHED_LAYER_NAME) { + usageBits = getFodUsageBits(usageBits, true); + } + mFormat = format; setDefaultBufferSize(w, h); mConsumer->setDefaultBufferFormat(format); - mConsumer->setConsumerUsageBits(getEffectiveUsage(0)); + mConsumer->setConsumerUsageBits(getEffectiveUsage(usageBits)); return NO_ERROR; } diff --git a/services/surfaceflinger/CompositionEngine/Android.bp b/services/surfaceflinger/CompositionEngine/Android.bp index 6f076ad11..fd1c369d8 100644 --- a/services/surfaceflinger/CompositionEngine/Android.bp +++ b/services/surfaceflinger/CompositionEngine/Android.bp @@ -45,6 +45,7 @@ cc_library { "src/DisplayColorProfile.cpp", "src/DisplaySurface.cpp", "src/DumpHelpers.cpp", + "src/FodExtension.cpp", "src/HwcBufferCache.cpp", "src/Layer.cpp", "src/LayerCompositionState.cpp", @@ -56,6 +57,15 @@ cc_library { ], local_include_dirs: ["include"], export_include_dirs: ["include"], + product_variables: { + lineage: { + target_surfaceflinger_fod_lib: { + cflags: ["-DTARGET_PROVIDES_FOD_LIB"], + whole_static_libs: ["%s"], + }, + }, + }, + } cc_library { diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/FodExtension.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/FodExtension.h new file mode 100644 index 000000000..816a05950 --- /dev/null +++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/FodExtension.h @@ -0,0 +1,28 @@ +/* + * Copyright 2020 The LineageOS Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <stdint.h> + +#ifndef __FOD_EXTENSION__H__ +#define __FOD_EXTENSION__H__ + +#define FOD_LAYER_NAME "Fingerprint on display#0" +#define FOD_TOUCHED_LAYER_NAME "Fingerprint on display.touched#0" + +extern uint32_t getFodZOrder(uint32_t z, bool touched); +extern uint32_t getFodUsageBits(uint32_t usageBits, bool touched); + +#endif /* __FOD_EXTENSION__H__ */ diff --git a/services/surfaceflinger/CompositionEngine/src/FodExtension.cpp b/services/surfaceflinger/CompositionEngine/src/FodExtension.cpp new file mode 100644 index 000000000..780db4b92 --- /dev/null +++ b/services/surfaceflinger/CompositionEngine/src/FodExtension.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2020 The LineageOS Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TARGET_PROVIDES_FOD_LIB +#include <compositionengine/FodExtension.h> + +uint32_t getFodZOrder(uint32_t z, bool touched) { + (void) touched; + return z; +} + +uint32_t getFodUsageBits(uint32_t usageBits, bool touched) { + (void) touched; + return usageBits; +} +#endif diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp index 5ce72b087..985b598f1 100644 --- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp @@ -16,6 +16,7 @@ #include <android-base/stringprintf.h> #include <compositionengine/CompositionEngine.h> +#include <compositionengine/FodExtension.h> #include <compositionengine/Layer.h> #include <compositionengine/LayerFE.h> #include <compositionengine/Output.h> @@ -335,7 +336,14 @@ void OutputLayer::writeStateToHWC(bool includeGeometry) const { static_cast<int32_t>(error)); } - if (auto error = hwcLayer->setZOrder(mState.z); error != HWC2::Error::None) { + uint32_t z = mState.z; + if (strcmp(mLayerFE->getDebugName(), FOD_LAYER_NAME) == 0) { + z = getFodZOrder(z, false); + } else if (strcmp(mLayerFE->getDebugName(), FOD_TOUCHED_LAYER_NAME) == 0) { + z = getFodZOrder(z, true); + } + + if (auto error = hwcLayer->setZOrder(z); error != HWC2::Error::None) { ALOGE("[%s] Failed to set Z %u: %s (%d)", mLayerFE->getDebugName(), mState.z, to_string(error).c_str(), static_cast<int32_t>(error)); } |
