summaryrefslogtreecommitdiff
path: root/vulkan/libvulkan/api.cpp
diff options
context:
space:
mode:
author Lloyd Pique <lpique@google.com> 2021-05-07 14:36:58 -0700
committer Lloyd Pique <lpique@google.com> 2021-05-18 00:09:59 +0000
commit1b33fc3f481bafa0b85310cdd3aa8a0a7c5ed0bd (patch)
tree0d84a284e7f3414b5cac665fa25e2b4bd159a7c9 /vulkan/libvulkan/api.cpp
parent0eac63ff4b156a3f48ef6a8c7e9aed7d8049ba12 (diff)
SF: Clean up HWC2::Layer ownership
Changes the HWC2::Display::createLayer() call to return a shared_ptr instead of a bare pointer. Also if the HWC2::Display is disconnected, instead of directly destroying the HWC2::Layers associated with the display, a new call is made to clear the display information from the layer. For safety, checks are added to take an early out if the display information isn't set for any call where it is used. The CompositionEngine code was already creating a shared_ptr for the createLayer call, and expecting the pointer to be valid until it released it via destroyLayer. However a hotplug disconnect could leave the CompositionEngine code holding an invalid pointer until the next display refresh, and it could lead to bad memory accesses if the pointer was dereferenced. CompositionEngine itself did not do so -- it released its ownership of the layer (and the associated display) without accessing them. This seems to have only affected "dumpsys SurfaceFlinger", if it happened to be executed after the disconnect, and before another refresh, and only because it tried to print out the HWC layer id. Bug: 181061001 Test: libsurfaceflinger_unittest Test: libcompositionengine_test Test: dumpsys SurfaceFlinger # after hotplug event Change-Id: I508d6aa8ef7a6af848dd54198408d5f311175070 Merged-In: I508d6aa8ef7a6af848dd54198408d5f311175070
Diffstat (limited to 'vulkan/libvulkan/api.cpp')
0 files changed, 0 insertions, 0 deletions