diff options
| author | 2018-12-15 22:31:34 +0000 | |
|---|---|---|
| committer | 2018-12-15 22:31:34 +0000 | |
| commit | dac84c12fcd90a770630666d56881f6ada419116 (patch) | |
| tree | 6ac558a33a278db5f781a3312134af390aec3d6f /libs/ui/BufferHubBuffer.cpp | |
| parent | 9dc9121d335212fb2e9c42250a6992aaa5de3cd5 (diff) | |
| parent | a99f9114d15add6bf1d67264e2a60a73e13009fe (diff) | |
Merge "Change atomics in ashmem from uint64_t to uint32_t"
Diffstat (limited to 'libs/ui/BufferHubBuffer.cpp')
| -rw-r--r-- | libs/ui/BufferHubBuffer.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/libs/ui/BufferHubBuffer.cpp b/libs/ui/BufferHubBuffer.cpp index 1464e48367..5bc113f4b2 100644 --- a/libs/ui/BufferHubBuffer.cpp +++ b/libs/ui/BufferHubBuffer.cpp @@ -191,22 +191,22 @@ int BufferHubBuffer::ImportGraphicBuffer() { mClientStateMask = bufferTraits.client_state_mask(); // TODO(b/112012161) Set up shared fences. - ALOGD("BufferHubBuffer::ImportGraphicBuffer: id=%d, buffer_state=%" PRIx64 ".", id(), + ALOGD("BufferHubBuffer::ImportGraphicBuffer: id=%d, buffer_state=%" PRIx32 ".", id(), buffer_state_->load(std::memory_order_acquire)); return 0; } int BufferHubBuffer::Gain() { - uint64_t current_buffer_state = buffer_state_->load(std::memory_order_acquire); + uint32_t current_buffer_state = buffer_state_->load(std::memory_order_acquire); if (IsClientGained(current_buffer_state, mClientStateMask)) { - ALOGV("%s: Buffer is already gained by this client %" PRIx64 ".", __FUNCTION__, + ALOGV("%s: Buffer is already gained by this client %" PRIx32 ".", __FUNCTION__, mClientStateMask); return 0; } do { if (AnyClientGained(current_buffer_state & (~mClientStateMask)) || AnyClientAcquired(current_buffer_state)) { - ALOGE("%s: Buffer is in use, id=%d mClientStateMask=%" PRIx64 " state=%" PRIx64 ".", + ALOGE("%s: Buffer is in use, id=%d mClientStateMask=%" PRIx32 " state=%" PRIx32 ".", __FUNCTION__, mId, mClientStateMask, current_buffer_state); return -EBUSY; } @@ -220,13 +220,13 @@ int BufferHubBuffer::Gain() { } int BufferHubBuffer::Post() { - uint64_t current_buffer_state = buffer_state_->load(std::memory_order_acquire); - uint64_t current_active_clients_bit_mask = 0ULL; - uint64_t updated_buffer_state = 0ULL; + 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; do { if (!IsClientGained(current_buffer_state, mClientStateMask)) { ALOGE("%s: Cannot post a buffer that is not gained by this client. buffer_id=%d " - "mClientStateMask=%" PRIx64 " state=%" PRIx64 ".", + "mClientStateMask=%" PRIx32 " state=%" PRIx32 ".", __FUNCTION__, mId, mClientStateMask, current_buffer_state); return -EBUSY; } @@ -242,17 +242,17 @@ int BufferHubBuffer::Post() { } int BufferHubBuffer::Acquire() { - uint64_t current_buffer_state = buffer_state_->load(std::memory_order_acquire); + uint32_t current_buffer_state = buffer_state_->load(std::memory_order_acquire); if (IsClientAcquired(current_buffer_state, mClientStateMask)) { - ALOGV("%s: Buffer is already acquired by this client %" PRIx64 ".", __FUNCTION__, + ALOGV("%s: Buffer is already acquired by this client %" PRIx32 ".", __FUNCTION__, mClientStateMask); return 0; } - uint64_t updated_buffer_state = 0ULL; + uint32_t updated_buffer_state = 0U; do { if (!IsClientPosted(current_buffer_state, mClientStateMask)) { ALOGE("%s: Cannot acquire a buffer that is not in posted state. buffer_id=%d " - "mClientStateMask=%" PRIx64 " state=%" PRIx64 ".", + "mClientStateMask=%" PRIx32 " state=%" PRIx32 ".", __FUNCTION__, mId, mClientStateMask, current_buffer_state); return -EBUSY; } @@ -266,13 +266,13 @@ int BufferHubBuffer::Acquire() { } int BufferHubBuffer::Release() { - uint64_t current_buffer_state = buffer_state_->load(std::memory_order_acquire); + uint32_t current_buffer_state = buffer_state_->load(std::memory_order_acquire); if (IsClientReleased(current_buffer_state, mClientStateMask)) { - ALOGV("%s: Buffer is already released by this client %" PRIx64 ".", __FUNCTION__, + ALOGV("%s: Buffer is already released by this client %" PRIx32 ".", __FUNCTION__, mClientStateMask); return 0; } - uint64_t updated_buffer_state = 0ULL; + uint32_t updated_buffer_state = 0U; do { updated_buffer_state = current_buffer_state & (~mClientStateMask); } while (!buffer_state_->compare_exchange_weak(current_buffer_state, updated_buffer_state, |