diff options
| author | 2019-01-07 17:14:02 -0800 | |
|---|---|---|
| committer | 2019-01-08 01:26:59 +0000 | |
| commit | ec97b76db1eda00fae7041ddb9f46f01b830071b (patch) | |
| tree | 7cfaf29228deacd6a5be7e79cc2fdfe0140588f9 /libs/ui/BufferHubBuffer.cpp | |
| parent | 30f231caa70687ffda713ea16613a9a3fd0110fc (diff) | |
Post to all existing and non-existing clients of the buffer in BufferHubBuffer
Fix: 122483970
Test: AHardwareBufferTest BufferHub_test BufferHubServer_test VtsHalBufferHubV1_0TargetTest
Change-Id: Ia0d3119c34fb68573747948f38ecc3477c65fcd5
Diffstat (limited to 'libs/ui/BufferHubBuffer.cpp')
| -rw-r--r-- | libs/ui/BufferHubBuffer.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/libs/ui/BufferHubBuffer.cpp b/libs/ui/BufferHubBuffer.cpp index 0582e1afe7..11849608ba 100644 --- a/libs/ui/BufferHubBuffer.cpp +++ b/libs/ui/BufferHubBuffer.cpp @@ -64,7 +64,6 @@ static constexpr char kBufferHubClientPath[] = "system/buffer_hub/client"; using BufferHubDefs::AnyClientAcquired; using BufferHubDefs::AnyClientGained; -using BufferHubDefs::AnyClientPosted; using BufferHubDefs::IsClientAcquired; using BufferHubDefs::IsClientGained; using BufferHubDefs::IsClientPosted; @@ -226,8 +225,7 @@ int BufferHubBuffer::Gain() { int BufferHubBuffer::Post() { uint32_t current_buffer_state = buffer_state_->load(std::memory_order_acquire); - uint32_t current_active_clients_bit_mask = 0U; - uint32_t updated_buffer_state = 0U; + uint32_t updated_buffer_state = (~mClientStateMask) & kHighBitsMask; do { if (!IsClientGained(current_buffer_state, mClientStateMask)) { ALOGE("%s: Cannot post a buffer that is not gained by this client. buffer_id=%d " @@ -236,9 +234,7 @@ int BufferHubBuffer::Post() { return -EBUSY; } // Set the producer client buffer state to released, other clients' buffer state to posted. - current_active_clients_bit_mask = active_clients_bit_mask_->load(std::memory_order_acquire); - updated_buffer_state = - current_active_clients_bit_mask & (~mClientStateMask) & kHighBitsMask; + // Post to all existing and non-existing clients. } while (!buffer_state_->compare_exchange_weak(current_buffer_state, updated_buffer_state, std::memory_order_acq_rel, std::memory_order_acquire)); |