Add additional accessors to IonBuffer and BufferHubBuffer.
- Add accessor to underlying GraphicBuffer in IonBuffer.
- Add const accessors to underlying IonBuffer(s) in BufferHubBuffer.
Bug: 36401174
Test: bufferhub_tests; buffer_hub_queue-test
Change-Id: I24a6c19b141bb50ffa06e861a4533e10d55b5b20
diff --git a/libs/vr/libbufferhub/include/private/dvr/buffer_hub_client.h b/libs/vr/libbufferhub/include/private/dvr/buffer_hub_client.h
index aacc385..dfeed50 100644
--- a/libs/vr/libbufferhub/include/private/dvr/buffer_hub_client.h
+++ b/libs/vr/libbufferhub/include/private/dvr/buffer_hub_client.h
@@ -94,9 +94,12 @@
}
IonBuffer* buffer() { return &slices_[0]; }
+ const IonBuffer* buffer() const { return &slices_[0]; }
+
// If index is greater than or equal to slice_count(), the result is
// undefined.
IonBuffer* slice(size_t index) { return &slices_[index]; }
+ const IonBuffer* slice(size_t index) const { return &slices_[index]; }
int slice_count() const { return static_cast<int>(slices_.size()); }
int id() const { return id_; }
@@ -171,9 +174,8 @@
int Post(const LocalHandle& ready_fence) {
return Post(ready_fence, nullptr, 0);
}
- template <
- typename Meta,
- typename = typename std::enable_if<!std::is_void<Meta>::value>::type>
+ template <typename Meta, typename = typename std::enable_if<
+ !std::is_void<Meta>::value>::type>
int Post(const LocalHandle& ready_fence, const Meta& meta) {
return Post(ready_fence, &meta, sizeof(meta));
}