diff options
author | Wiwit Rifa'i <wiwitrifai@google.com> | 2022-01-20 16:46:32 +0800 |
---|---|---|
committer | Wiwit Rifa'i <wiwitrifai@google.com> | 2022-01-21 04:01:35 +0000 |
commit | a1e4c2594dba5a9108ce8dae7d257f742bdc812f (patch) | |
tree | 64d625fd0f3faa6c2d600108bde9f6ac074a86e3 /libhwc2.1/libresource/ExynosResourceManager.cpp | |
parent | ca14fd522f8cf02766bee9180b40069d0ad16adc (diff) |
libhwc2.1: add scenario check for camera preview
This will prevent HWC for using G2D if there's a camera ouput buffer.
Test: manual
Bug: 215185822
Change-Id: I4f61f3801b40384cdc4c62fdeae9a4de9f038b47
Diffstat (limited to 'libhwc2.1/libresource/ExynosResourceManager.cpp')
-rw-r--r-- | libhwc2.1/libresource/ExynosResourceManager.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libhwc2.1/libresource/ExynosResourceManager.cpp b/libhwc2.1/libresource/ExynosResourceManager.cpp index 4a40022..d939493 100644 --- a/libhwc2.1/libresource/ExynosResourceManager.cpp +++ b/libhwc2.1/libresource/ExynosResourceManager.cpp @@ -380,6 +380,33 @@ int32_t ExynosResourceManager::doAllocDstBufs(uint32_t Xres, uint32_t Yres) return ret; } +int32_t ExynosResourceManager::checkScenario(ExynosDisplay __unused *display) { + uint32_t prevResourceReserved = mResourceReserved; + mResourceReserved = 0x0; + /* Check whether camera preview is running */ + ExynosDisplay *exynosDisplay = NULL; + for (uint32_t i = 0; i < mDevice->mDisplays.size(); i++) { + exynosDisplay = mDevice->mDisplays[i]; + if ((exynosDisplay != NULL) && (exynosDisplay->mPlugState == true)) { + for (uint32_t i = 0; i < exynosDisplay->mLayers.size(); i++) { + ExynosLayer *layer = exynosDisplay->mLayers[i]; + VendorGraphicBufferMeta gmeta(layer->mLayerBuffer); + if ((layer->mLayerBuffer != NULL) && + (gmeta.producer_usage & BufferUsage::CAMERA_OUTPUT)) { + mResourceReserved |= (MPP_LOGICAL_G2D_YUV | MPP_LOGICAL_G2D_RGB); + break; + } + } + } + } + + if (prevResourceReserved != mResourceReserved) { + mDevice->setGeometryChanged(GEOMETRY_DEVICE_SCENARIO_CHANGED); + } + + return NO_ERROR; +} + /** * @param * display * @return int |