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/libs/vr/libbufferhub/consumer_buffer.cpp b/libs/vr/libbufferhub/consumer_buffer.cpp
index c9d8554..a91e842 100644
--- a/libs/vr/libbufferhub/consumer_buffer.cpp
+++ b/libs/vr/libbufferhub/consumer_buffer.cpp
@@ -39,10 +39,10 @@
// The buffer is can be acquired iff: 1) producer bit is set; 2) consumer bit
// is not set.
uint64_t buffer_state = buffer_state_->load();
- if (!BufferHubDefs::IsBufferPosted(buffer_state, buffer_state_bit())) {
+ if (!BufferHubDefs::IsBufferPosted(buffer_state, client_state_mask())) {
ALOGE("ConsumerBuffer::LocalAcquire: not posted, id=%d state=%" PRIx64
- " buffer_state_bit=%" PRIx64 ".",
- id(), buffer_state, buffer_state_bit());
+ " client_state_mask=%" PRIx64 ".",
+ id(), buffer_state, client_state_mask());
return -EBUSY;
}
@@ -64,7 +64,7 @@
}
// Set the consumer bit unique to this consumer.
- BufferHubDefs::ModifyBufferState(buffer_state_, 0ULL, buffer_state_bit());
+ BufferHubDefs::ModifyBufferState(buffer_state_, 0ULL, client_state_mask());
return 0;
}