Loading services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp +41 −26 Original line number Diff line number Diff line Loading @@ -233,7 +233,14 @@ AidlComposer::AidlComposer(const std::string& serviceName) { addReader(translate<Display>(kSingleReaderKey)); // TODO(b/262041682): When using new API to clear buffer slots, don't allocate this buffer. // If unable to read interface version, then become backwards compatible. int32_t version = 1; const auto status = mAidlComposerClient->getInterfaceVersion(&version); if (!status.isOk()) { ALOGE("getInterfaceVersion for AidlComposer constructor failed %s", status.getDescription().c_str()); } if (version == 1) { mClearSlotBuffer = sp<GraphicBuffer>::make(1, 1, PIXEL_FORMAT_RGBX_8888, GraphicBuffer::USAGE_HW_COMPOSER | GraphicBuffer::USAGE_SW_READ_OFTEN | Loading @@ -243,6 +250,7 @@ AidlComposer::AidlComposer(const std::string& serviceName) { LOG_ALWAYS_FATAL("Failed to allocate a buffer for clearing layer buffer slots"); return; } } ALOGI("Loaded AIDL composer3 HAL service"); } Loading Loading @@ -835,14 +843,20 @@ 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 slots is tricky... // 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) { writer->get().setLayerBufferSlotsToClear(translate<int64_t>(display), translate<int64_t>(layer), slotsToClear); } else { 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. if (slot != activeBufferSlot) { writer->get().setLayerBufferWithNewCommand(translate<int64_t>(display), translate<int64_t>(layer), slot, mClearSlotBuffer->handle, /*fence*/ -1); mClearSlotBuffer->handle, /*fence*/ -1); } } // Since we clear buffers by setting them to a placeholder buffer, we want to make Loading @@ -854,6 +868,7 @@ Error AidlComposer::setLayerBufferSlotsToClear(Display display, Layer layer, // The active buffer is still cached in // its slot and doesn't need a fence. /*buffer*/ nullptr, /*fence*/ -1); } } else { error = Error::BAD_DISPLAY; } Loading Loading
services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp +41 −26 Original line number Diff line number Diff line Loading @@ -233,7 +233,14 @@ AidlComposer::AidlComposer(const std::string& serviceName) { addReader(translate<Display>(kSingleReaderKey)); // TODO(b/262041682): When using new API to clear buffer slots, don't allocate this buffer. // If unable to read interface version, then become backwards compatible. int32_t version = 1; const auto status = mAidlComposerClient->getInterfaceVersion(&version); if (!status.isOk()) { ALOGE("getInterfaceVersion for AidlComposer constructor failed %s", status.getDescription().c_str()); } if (version == 1) { mClearSlotBuffer = sp<GraphicBuffer>::make(1, 1, PIXEL_FORMAT_RGBX_8888, GraphicBuffer::USAGE_HW_COMPOSER | GraphicBuffer::USAGE_SW_READ_OFTEN | Loading @@ -243,6 +250,7 @@ AidlComposer::AidlComposer(const std::string& serviceName) { LOG_ALWAYS_FATAL("Failed to allocate a buffer for clearing layer buffer slots"); return; } } ALOGI("Loaded AIDL composer3 HAL service"); } Loading Loading @@ -835,14 +843,20 @@ 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 slots is tricky... // 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) { writer->get().setLayerBufferSlotsToClear(translate<int64_t>(display), translate<int64_t>(layer), slotsToClear); } else { 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. if (slot != activeBufferSlot) { writer->get().setLayerBufferWithNewCommand(translate<int64_t>(display), translate<int64_t>(layer), slot, mClearSlotBuffer->handle, /*fence*/ -1); mClearSlotBuffer->handle, /*fence*/ -1); } } // Since we clear buffers by setting them to a placeholder buffer, we want to make Loading @@ -854,6 +868,7 @@ Error AidlComposer::setLayerBufferSlotsToClear(Display display, Layer layer, // The active buffer is still cached in // its slot and doesn't need a fence. /*buffer*/ nullptr, /*fence*/ -1); } } else { error = Error::BAD_DISPLAY; } Loading