Proper fix for vr_wm: the hwc_callback function is no longer called
Another change removed the call to GetBufferFromHandle but didn't
delete it and an alternate implementation is used. This replicates
the change into the second implementation and removes the original one
Bug: None
Test: Tested in dev branch; built in master
Change-Id: I2bdb38c7b692e30cf1b5e41476ecdd062b5d5d69
diff --git a/services/vr/vr_window_manager/composer/impl/vr_hwc.cpp b/services/vr/vr_window_manager/composer/impl/vr_hwc.cpp
index d7d0e5b..9642224 100644
--- a/services/vr/vr_window_manager/composer/impl/vr_hwc.cpp
+++ b/services/vr/vr_window_manager/composer/impl/vr_hwc.cpp
@@ -48,6 +48,11 @@
int32_t format = 0;
GraphicBufferMapper& mapper = GraphicBufferMapper::get();
+ if (mapper.registerBuffer(handle) != OK) {
+ ALOGE("Failed to register buffer");
+ return nullptr;
+ }
+
if (mapper.getDimensions(handle, &width, &height) ||
mapper.getStride(handle, &stride) ||
mapper.getFormat(handle, &format) ||
@@ -64,10 +69,6 @@
sp<GraphicBuffer> buffer = new GraphicBuffer(
width, height, format, layer_count, producer_usage, consumer_usage,
stride, native_handle_clone(handle), true);
- if (mapper.registerBuffer(buffer.get()) != OK) {
- ALOGE("Failed to register buffer");
- return nullptr;
- }
return buffer;
}
diff --git a/services/vr/vr_window_manager/hwc_callback.cpp b/services/vr/vr_window_manager/hwc_callback.cpp
index b29d175..d3cd38c 100644
--- a/services/vr/vr_window_manager/hwc_callback.cpp
+++ b/services/vr/vr_window_manager/hwc_callback.cpp
@@ -11,37 +11,6 @@
namespace {
-sp<GraphicBuffer> GetBufferFromHandle(const native_handle_t* handle) {
- GraphicBufferMapper& mapper = GraphicBufferMapper::get();
- if (mapper.registerBuffer(handle) != OK) {
- ALOGE("Failed to register buffer");
- return nullptr;
- }
-
- uint32_t width = 0, height = 0, stride = 0, layer_count = 1;
- uint64_t producer_usage = 0, consumer_usage = 0;
- int32_t format = 0;
-
- if (mapper.getDimensions(handle, &width, &height) ||
- mapper.getStride(handle, &stride) ||
- mapper.getFormat(handle, &format) ||
- mapper.getProducerUsage(handle, &producer_usage) ||
- mapper.getConsumerUsage(handle, &consumer_usage)) {
- ALOGE("Failed to read handle properties");
- return nullptr;
- }
-
- // This will only succeed if gralloc has GRALLOC1_CAPABILITY_LAYERED_BUFFERS
- // capability. Otherwise assume a count of 1.
- mapper.getLayerCount(handle, &layer_count);
-
- sp<GraphicBuffer> buffer = new GraphicBuffer(
- width, height, format, layer_count, producer_usage, consumer_usage,
- stride, native_handle_clone(handle), true);
-
- return buffer;
-}
-
HwcCallback::FrameStatus GetFrameStatus(const HwcCallback::Frame& frame) {
for (const auto& layer : frame.layers()) {
// If there is no fence it means the buffer is already finished.