diff options
author | Joshua Duong <joshuaduong@google.com> | 2024-02-13 18:38:23 +0000 |
---|---|---|
committer | Joshua Duong <joshuaduong@google.com> | 2024-02-13 18:39:17 +0000 |
commit | 92df735b5e394a4ebb74fbbaf410c3a564a35e9d (patch) | |
tree | 95d6fd3c289efe91619c254bcfdb6718c21441dc | |
parent | 529b6cbd8b26dd86001f9701f4f0576d933f1796 (diff) | |
download | goldfish-opengl-92df735b5e394a4ebb74fbbaf410c3a564a35e9d.tar.gz |
Fix gcar boot.
rcSetDisplayColorBuffer has concurrency issues when there's multiple
displays. So put it inside the post() function to protect it.
Bug: 324295392
Test: Boot gcar image. Emulator should not crash.
Change-Id: I2e1c4930751498eb95ab1f3d80393ba05c2af3f0
-rw-r--r-- | system/hwc3/HostFrameComposer.cpp | 15 | ||||
-rw-r--r-- | system/hwc3/HostFrameComposer.h | 3 |
2 files changed, 8 insertions, 10 deletions
diff --git a/system/hwc3/HostFrameComposer.cpp b/system/hwc3/HostFrameComposer.cpp index d440b880..8f232dcc 100644 --- a/system/hwc3/HostFrameComposer.cpp +++ b/system/hwc3/HostFrameComposer.cpp @@ -524,10 +524,7 @@ HWC3::Error HostFrameComposer::presentDisplay( *outDisplayFence = std::move(flushCompleteFence); } else { - rcEnc->rcSetDisplayColorBuffer( - rcEnc, displayInfo.hostDisplayId, - hostCon->grallocHelper()->getHostHandle(displayClientTarget.getBuffer())); - post(hostCon, rcEnc, displayClientTarget.getBuffer()); + post(hostCon, rcEnc, displayInfo.hostDisplayId, displayClientTarget.getBuffer()); *outDisplayFence = std::move(fence); } } @@ -696,10 +693,7 @@ HWC3::Error HostFrameComposer::presentDisplay( displayId, compositionResult->getDrmBuffer(), displayClientTargetFence); *outDisplayFence = std::move(flushFence); } else { - rcEnc->rcSetDisplayColorBuffer( - rcEnc, displayInfo.hostDisplayId, - hostCon->grallocHelper()->getHostHandle(displayClientTarget.getBuffer())); - post(hostCon, rcEnc, displayClientTarget.getBuffer()); + post(hostCon, rcEnc, displayInfo.hostDisplayId, displayClientTarget.getBuffer()); *outDisplayFence = std::move(displayClientTargetFence); } ALOGV("%s fallback to post, returns outRetireFence %d", __FUNCTION__, @@ -712,10 +706,13 @@ HWC3::Error HostFrameComposer::presentDisplay( } void HostFrameComposer::post(HostConnection* hostCon, ExtendedRCEncoderContext* rcEnc, - buffer_handle_t h) { + uint32_t hostDisplayId, buffer_handle_t h) { assert(cb && "native_handle_t::from(h) failed"); hostCon->lock(); + rcEnc->rcSetDisplayColorBuffer( + rcEnc, hostDisplayId, + hostCon->grallocHelper()->getHostHandle(h)); rcEnc->rcFBPost(rcEnc, hostCon->grallocHelper()->getHostHandle(h)); hostCon->flush(); hostCon->unlock(); diff --git a/system/hwc3/HostFrameComposer.h b/system/hwc3/HostFrameComposer.h index e90f7cfd..2cd9854a 100644 --- a/system/hwc3/HostFrameComposer.h +++ b/system/hwc3/HostFrameComposer.h @@ -74,7 +74,8 @@ class HostFrameComposer : public FrameComposer { private: HWC3::Error createHostComposerDisplayInfo(Display* display, uint32_t hostDisplayId); - void post(HostConnection* hostCon, ExtendedRCEncoderContext* rcEnc, buffer_handle_t h); + void post(HostConnection* hostCon, ExtendedRCEncoderContext* rcEnc, uint32_t hostDisplayId, + buffer_handle_t h); bool mIsMinigbm = false; |