summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2019-02-05 03:46:22 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-02-05 03:46:22 +0000
commit55980bfbc6e245903b5f529eea3846aa182eb3ef (patch)
treef77b2b79bd1f491a297d8217e248f32c21e77051
parent6dbc3f6c686adbcbb4eff28aec2f2018664e261b (diff)
parentef49ca627968427123538addce33bbdf1ff05518 (diff)
Merge "Move BufferHubBase::Lock and ::Unlock from public function to private helper."
-rw-r--r--libs/vr/libbufferhub/include/private/dvr/buffer_hub_base.h20
-rw-r--r--libs/vr/libvrflinger/tests/vrflinger_test.cpp8
2 files changed, 14 insertions, 14 deletions
diff --git a/libs/vr/libbufferhub/include/private/dvr/buffer_hub_base.h b/libs/vr/libbufferhub/include/private/dvr/buffer_hub_base.h
index b6027e69ab..fa39d081e1 100644
--- a/libs/vr/libbufferhub/include/private/dvr/buffer_hub_base.h
+++ b/libs/vr/libbufferhub/include/private/dvr/buffer_hub_base.h
@@ -21,16 +21,6 @@ class BufferHubBase : public pdx::Client {
// a file descriptor for the new channel or a negative error code.
Status<LocalChannelHandle> CreateConsumer();
- // Locks the area specified by (x, y, width, height) for a specific usage. If
- // the usage is software then |addr| will be updated to point to the address
- // of the buffer in virtual memory. The caller should only access/modify the
- // pixels in the specified area. anything else is undefined behavior.
- int Lock(int usage, int x, int y, int width, int height, void** addr);
-
- // Must be called after Lock() when the caller has finished changing the
- // buffer.
- int Unlock();
-
// Gets a blob buffer that was created with ProducerBuffer::CreateBlob.
// Locking and Unlocking is handled internally. There's no need to Unlock
// after calling this method.
@@ -128,6 +118,16 @@ class BufferHubBase : public pdx::Client {
int UpdateSharedFence(const LocalHandle& new_fence,
const LocalHandle& shared_fence);
+ // Locks the area specified by (x, y, width, height) for a specific usage. If
+ // the usage is software then |addr| will be updated to point to the address
+ // of the buffer in virtual memory. The caller should only access/modify the
+ // pixels in the specified area. anything else is undefined behavior.
+ int Lock(int usage, int x, int y, int width, int height, void** addr);
+
+ // Must be called after Lock() when the caller has finished changing the
+ // buffer.
+ int Unlock();
+
// IonBuffer that is shared between bufferhubd, producer, and consumers.
size_t metadata_buf_size_{0};
size_t user_metadata_size_{0};
diff --git a/libs/vr/libvrflinger/tests/vrflinger_test.cpp b/libs/vr/libvrflinger/tests/vrflinger_test.cpp
index 0eb7fec3c4..7075e88267 100644
--- a/libs/vr/libvrflinger/tests/vrflinger_test.cpp
+++ b/libs/vr/libvrflinger/tests/vrflinger_test.cpp
@@ -205,9 +205,9 @@ TEST(VrFlingerTest, ActivateDeactivate) {
ASSERT_EQ(buffer.get()->height(), metrics.get().display_height);
void* raw_buf = nullptr;
- ASSERT_GE(buffer.get()->Lock(AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN,
- /*x=*/0, /*y=*/0, buffer.get()->width(),
- buffer.get()->height(), &raw_buf),
+ ASSERT_GE(buffer.get()->buffer()->Lock(
+ AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN, /*x=*/0, /*y=*/0,
+ buffer.get()->width(), buffer.get()->height(), &raw_buf),
0);
ASSERT_NE(raw_buf, nullptr);
uint32_t* pixels = static_cast<uint32_t*>(raw_buf);
@@ -216,7 +216,7 @@ TEST(VrFlingerTest, ActivateDeactivate) {
pixels[i] = 0x0000ff00;
}
- ASSERT_GE(buffer.get()->Unlock(), 0);
+ ASSERT_GE(buffer.get()->buffer()->Unlock(), 0);
ASSERT_GE(buffer.get()->Post(/*ready_fence=*/pdx::LocalHandle()), 0);