Change the variable name "buffer_state_bit" into "client_state_mask".
Reasons:
1. This variable is not refering to a property of the buffer. It refers
to a client of the buffer.
2. The original "buffer_state_bit" of a producer/consumer is actually
the client state bit mask for both buffer_state and fence_state in
shared memory. Thus, "buffer_state_bit" does not make sense for the
fence state.
3. In the future, Every clients takes up two bits in the buffer_state.
For simpler bit manipulation, there will be a future change making the
client_state_bits two bits as well. Please refer to ag/5236978 for an
early look at the future bit manipulation. Thus, this change replaces
"bit" with "mask".
Test: build
Bug: 112007999
Change-Id: I72f59ab9491bd2f135da068f578195fbf5e6c2b6
diff --git a/services/vr/bufferhubd/buffer_node.cpp b/services/vr/bufferhubd/buffer_node.cpp
index bedec6f..f8ec59d 100644
--- a/services/vr/bufferhubd/buffer_node.cpp
+++ b/services/vr/bufferhubd/buffer_node.cpp
@@ -43,12 +43,12 @@
uint64_t BufferNode::AddNewActiveClientsBitToMask() {
uint64_t current_active_clients_bit_mask = GetActiveClientsBitMask();
- uint64_t buffer_state_bit = 0ULL;
+ uint64_t client_state_mask = 0ULL;
uint64_t updated_active_clients_bit_mask = 0ULL;
do {
- buffer_state_bit =
+ client_state_mask =
BufferHubDefs::FindNextClearedBit(current_active_clients_bit_mask);
- if (buffer_state_bit == 0ULL) {
+ if (client_state_mask == 0ULL) {
ALOGE(
"BufferNode::AddNewActiveClientsBitToMask: reached the maximum "
"mumber of channels per buffer node: 32.");
@@ -56,11 +56,11 @@
return 0ULL;
}
updated_active_clients_bit_mask =
- current_active_clients_bit_mask | buffer_state_bit;
+ current_active_clients_bit_mask | client_state_mask;
} while (!(active_clients_bit_mask_->compare_exchange_weak(
current_active_clients_bit_mask, updated_active_clients_bit_mask,
std::memory_order_acq_rel, std::memory_order_acquire)));
- return buffer_state_bit;
+ return client_state_mask;
}
void BufferNode::RemoveClientsBitFromMask(const uint64_t& value) {