Loading services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp +17 −13 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include "AidlComposerHal.h" #include <SurfaceFlingerProperties.h> #include <android-base/file.h> #include <android/binder_ibinder_platform.h> #include <android/binder_manager.h> Loading Loading @@ -249,7 +250,9 @@ AidlComposer::AidlComposer(const std::string& serviceName) { ALOGE("getInterfaceVersion for AidlComposer constructor failed %s", status.getDescription().c_str()); } if (version == 1) { mSupportsBufferSlotsToClear = version > 1; if (!mSupportsBufferSlotsToClear) { if (sysprop::clear_slots_with_set_layer_buffer(false)) { mClearSlotBuffer = sp<GraphicBuffer>::make(1, 1, PIXEL_FORMAT_RGBX_8888, GraphicBuffer::USAGE_HW_COMPOSER | GraphicBuffer::USAGE_SW_READ_OFTEN | Loading @@ -260,6 +263,7 @@ AidlComposer::AidlComposer(const std::string& serviceName) { return; } } } ALOGI("Loaded AIDL composer3 HAL service"); } Loading Loading @@ -844,12 +848,12 @@ Error AidlComposer::setLayerBufferSlotsToClear(Display display, Layer layer, Error error = Error::NONE; mMutex.lock_shared(); if (auto writer = getWriter(display)) { // Backwards compatible way of clearing buffer is to set the layer buffer with a placeholder // buffer, using the slot that needs to cleared... tricky. if (mClearSlotBuffer == nullptr) { if (mSupportsBufferSlotsToClear) { writer->get().setLayerBufferSlotsToClear(translate<int64_t>(display), translate<int64_t>(layer), slotsToClear); } else { // Backwards compatible way of clearing buffer slots is to set the layer buffer with a // placeholder buffer, using the slot that needs to cleared... tricky. } else if (mClearSlotBuffer != nullptr) { for (uint32_t slot : slotsToClear) { // Don't clear the active buffer slot because we need to restore the active buffer // after clearing the requested buffer slots with a placeholder buffer. Loading services/surfaceflinger/DisplayHardware/AidlComposerHal.h +2 −0 Original line number Diff line number Diff line Loading @@ -284,6 +284,8 @@ private: // threading annotations. ftl::SharedMutex mMutex; // Whether or not explicitly clearing buffer slots is supported. bool mSupportsBufferSlotsToClear; // Buffer slots for layers are cleared by setting the slot buffer to this buffer. sp<GraphicBuffer> mClearSlotBuffer; Loading services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -24,12 +24,14 @@ #include "HidlComposerHal.h" #include <SurfaceFlingerProperties.h> #include <android/binder_manager.h> #include <composer-command-buffer/2.2/ComposerCommandBuffer.h> #include <hidl/HidlTransportSupport.h> #include <hidl/HidlTransportUtils.h> #include <log/log.h> #include <utils/Trace.h> #include "HWC2.h" #include "Hal.h" Loading Loading @@ -189,6 +191,9 @@ std::vector<To> translate(const hidl_vec<From>& in) { } sp<GraphicBuffer> allocateClearSlotBuffer() { if (!sysprop::clear_slots_with_set_layer_buffer(false)) { return nullptr; } sp<GraphicBuffer> buffer = sp<GraphicBuffer>::make(1, 1, PIXEL_FORMAT_RGBX_8888, GraphicBuffer::USAGE_HW_COMPOSER | GraphicBuffer::USAGE_SW_READ_OFTEN | Loading Loading @@ -246,7 +251,7 @@ HidlComposer::HidlComposer(const std::string& serviceName) LOG_ALWAYS_FATAL("failed to create composer client"); } if (!mClearSlotBuffer) { if (!mClearSlotBuffer && sysprop::clear_slots_with_set_layer_buffer(false)) { LOG_ALWAYS_FATAL("Failed to allocate a buffer for clearing layer buffer slots"); return; } Loading Loading @@ -716,6 +721,10 @@ Error HidlComposer::setLayerBufferSlotsToClear(Display display, Layer layer, if (slotsToClear.empty()) { return Error::NONE; } // This can be null when the HAL hasn't explicitly enabled this feature. if (mClearSlotBuffer == nullptr) { return Error::NONE; } // Backwards compatible way of clearing buffer is to set the layer buffer with a placeholder // buffer, using the slot that needs to cleared... tricky. for (uint32_t slot : slotsToClear) { Loading services/surfaceflinger/SurfaceFlingerProperties.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -375,5 +375,9 @@ bool ignore_hdr_camera_layers(bool defaultValue) { return SurfaceFlingerProperties::ignore_hdr_camera_layers().value_or(defaultValue); } bool clear_slots_with_set_layer_buffer(bool defaultValue) { return SurfaceFlingerProperties::clear_slots_with_set_layer_buffer().value_or(defaultValue); } } // namespace sysprop } // namespace android services/surfaceflinger/SurfaceFlingerProperties.h +2 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,8 @@ bool enable_sdr_dimming(bool defaultValue); bool ignore_hdr_camera_layers(bool defaultValue); bool clear_slots_with_set_layer_buffer(bool defaultValue); } // namespace sysprop } // namespace android #endif // SURFACEFLINGERPROPERTIES_H_ Loading
services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp +17 −13 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include "AidlComposerHal.h" #include <SurfaceFlingerProperties.h> #include <android-base/file.h> #include <android/binder_ibinder_platform.h> #include <android/binder_manager.h> Loading Loading @@ -249,7 +250,9 @@ AidlComposer::AidlComposer(const std::string& serviceName) { ALOGE("getInterfaceVersion for AidlComposer constructor failed %s", status.getDescription().c_str()); } if (version == 1) { mSupportsBufferSlotsToClear = version > 1; if (!mSupportsBufferSlotsToClear) { if (sysprop::clear_slots_with_set_layer_buffer(false)) { mClearSlotBuffer = sp<GraphicBuffer>::make(1, 1, PIXEL_FORMAT_RGBX_8888, GraphicBuffer::USAGE_HW_COMPOSER | GraphicBuffer::USAGE_SW_READ_OFTEN | Loading @@ -260,6 +263,7 @@ AidlComposer::AidlComposer(const std::string& serviceName) { return; } } } ALOGI("Loaded AIDL composer3 HAL service"); } Loading Loading @@ -844,12 +848,12 @@ Error AidlComposer::setLayerBufferSlotsToClear(Display display, Layer layer, Error error = Error::NONE; mMutex.lock_shared(); if (auto writer = getWriter(display)) { // Backwards compatible way of clearing buffer is to set the layer buffer with a placeholder // buffer, using the slot that needs to cleared... tricky. if (mClearSlotBuffer == nullptr) { if (mSupportsBufferSlotsToClear) { writer->get().setLayerBufferSlotsToClear(translate<int64_t>(display), translate<int64_t>(layer), slotsToClear); } else { // Backwards compatible way of clearing buffer slots is to set the layer buffer with a // placeholder buffer, using the slot that needs to cleared... tricky. } else if (mClearSlotBuffer != nullptr) { for (uint32_t slot : slotsToClear) { // Don't clear the active buffer slot because we need to restore the active buffer // after clearing the requested buffer slots with a placeholder buffer. Loading
services/surfaceflinger/DisplayHardware/AidlComposerHal.h +2 −0 Original line number Diff line number Diff line Loading @@ -284,6 +284,8 @@ private: // threading annotations. ftl::SharedMutex mMutex; // Whether or not explicitly clearing buffer slots is supported. bool mSupportsBufferSlotsToClear; // Buffer slots for layers are cleared by setting the slot buffer to this buffer. sp<GraphicBuffer> mClearSlotBuffer; Loading
services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -24,12 +24,14 @@ #include "HidlComposerHal.h" #include <SurfaceFlingerProperties.h> #include <android/binder_manager.h> #include <composer-command-buffer/2.2/ComposerCommandBuffer.h> #include <hidl/HidlTransportSupport.h> #include <hidl/HidlTransportUtils.h> #include <log/log.h> #include <utils/Trace.h> #include "HWC2.h" #include "Hal.h" Loading Loading @@ -189,6 +191,9 @@ std::vector<To> translate(const hidl_vec<From>& in) { } sp<GraphicBuffer> allocateClearSlotBuffer() { if (!sysprop::clear_slots_with_set_layer_buffer(false)) { return nullptr; } sp<GraphicBuffer> buffer = sp<GraphicBuffer>::make(1, 1, PIXEL_FORMAT_RGBX_8888, GraphicBuffer::USAGE_HW_COMPOSER | GraphicBuffer::USAGE_SW_READ_OFTEN | Loading Loading @@ -246,7 +251,7 @@ HidlComposer::HidlComposer(const std::string& serviceName) LOG_ALWAYS_FATAL("failed to create composer client"); } if (!mClearSlotBuffer) { if (!mClearSlotBuffer && sysprop::clear_slots_with_set_layer_buffer(false)) { LOG_ALWAYS_FATAL("Failed to allocate a buffer for clearing layer buffer slots"); return; } Loading Loading @@ -716,6 +721,10 @@ Error HidlComposer::setLayerBufferSlotsToClear(Display display, Layer layer, if (slotsToClear.empty()) { return Error::NONE; } // This can be null when the HAL hasn't explicitly enabled this feature. if (mClearSlotBuffer == nullptr) { return Error::NONE; } // Backwards compatible way of clearing buffer is to set the layer buffer with a placeholder // buffer, using the slot that needs to cleared... tricky. for (uint32_t slot : slotsToClear) { Loading
services/surfaceflinger/SurfaceFlingerProperties.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -375,5 +375,9 @@ bool ignore_hdr_camera_layers(bool defaultValue) { return SurfaceFlingerProperties::ignore_hdr_camera_layers().value_or(defaultValue); } bool clear_slots_with_set_layer_buffer(bool defaultValue) { return SurfaceFlingerProperties::clear_slots_with_set_layer_buffer().value_or(defaultValue); } } // namespace sysprop } // namespace android
services/surfaceflinger/SurfaceFlingerProperties.h +2 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,8 @@ bool enable_sdr_dimming(bool defaultValue); bool ignore_hdr_camera_layers(bool defaultValue); bool clear_slots_with_set_layer_buffer(bool defaultValue); } // namespace sysprop } // namespace android #endif // SURFACEFLINGERPROPERTIES_H_