Merge "Revert "Disable input-vdex when doing speed-profile."" into oc-dev
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 7a7325f..3710e6b 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -321,11 +321,11 @@
bool have_dex2oat_compiler_filter_flag;
if (skip_compilation) {
- strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=verify-none");
+ strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=extract");
have_dex2oat_compiler_filter_flag = true;
have_dex2oat_relocation_skip_flag = true;
} else if (vm_safe_mode) {
- strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=interpret-only");
+ strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=quicken");
have_dex2oat_compiler_filter_flag = true;
} else if (compiler_filter != nullptr &&
strlen(compiler_filter) + strlen("--compiler-filter=") <
diff --git a/include/gui/BufferQueueConsumer.h b/include/gui/BufferQueueConsumer.h
index 1e22d28..b383056 100644
--- a/include/gui/BufferQueueConsumer.h
+++ b/include/gui/BufferQueueConsumer.h
@@ -129,6 +129,12 @@
// enumerated in gralloc.h, e.g. GRALLOC_USAGE_HW_RENDER; the default is 0.
virtual status_t setConsumerUsageBits(uint32_t usage);
+ // setConsumerIsProtected will turn on an internal bit that indicates whether
+ // the consumer can handle protected gralloc buffers (i.e. with
+ // GRALLOC_USAGE_PROTECTED set). IGraphicBufferProducer can query this
+ // capability using NATIVE_WINDOW_CONSUMER_IS_PROTECTED.
+ virtual status_t setConsumerIsProtected(bool isProtected);
+
// setTransformHint bakes in rotation to buffers so overlays can be used.
// The values are enumerated in window.h, e.g.
// NATIVE_WINDOW_TRANSFORM_ROT_90. The default is 0 (no transform).
diff --git a/include/gui/BufferQueueCore.h b/include/gui/BufferQueueCore.h
index cfe716f..dd8b992 100644
--- a/include/gui/BufferQueueCore.h
+++ b/include/gui/BufferQueueCore.h
@@ -172,6 +172,10 @@
// GraphicBuffers.
uint32_t mConsumerUsageBits;
+ // mConsumerIsProtected indicates the consumer is ready to handle protected
+ // buffer.
+ bool mConsumerIsProtected;
+
// mConnectedApi indicates the producer API that is currently connected
// to this BufferQueue. It defaults to NO_CONNECTED_API, and gets updated
// by the connect and disconnect methods.
diff --git a/include/gui/IGraphicBufferConsumer.h b/include/gui/IGraphicBufferConsumer.h
index 63254ed..57cce16 100644
--- a/include/gui/IGraphicBufferConsumer.h
+++ b/include/gui/IGraphicBufferConsumer.h
@@ -243,6 +243,12 @@
// Return of a value other than NO_ERROR means an unknown error has occurred.
virtual status_t setConsumerUsageBits(uint32_t usage) = 0;
+ // setConsumerIsProtected will turn on an internal bit that indicates whether
+ // the consumer can handle protected gralloc buffers (i.e. with
+ // GRALLOC_USAGE_PROTECTED set). IGraphicBufferProducer can query this
+ // capability using NATIVE_WINDOW_CONSUMER_IS_PROTECTED.
+ virtual status_t setConsumerIsProtected(bool isProtected) = 0;
+
// setTransformHint bakes in rotation to buffers so overlays can be used. The values are
// enumerated in window.h, e.g. NATIVE_WINDOW_TRANSFORM_ROT_90. The default is 0
// (no transform).
diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp
index cd8e696..5e5de44 100644
--- a/libs/gui/BufferQueueConsumer.cpp
+++ b/libs/gui/BufferQueueConsumer.cpp
@@ -709,6 +709,14 @@
return NO_ERROR;
}
+status_t BufferQueueConsumer::setConsumerIsProtected(bool isProtected) {
+ ATRACE_CALL();
+ BQ_LOGV("setConsumerIsProtected: %s", isProtected ? "true" : "false");
+ Mutex::Autolock lock(mCore->mMutex);
+ mCore->mConsumerIsProtected = isProtected;
+ return NO_ERROR;
+}
+
status_t BufferQueueConsumer::setTransformHint(uint32_t hint) {
ATRACE_CALL();
BQ_LOGV("setTransformHint: %#x", hint);
diff --git a/libs/gui/BufferQueueCore.cpp b/libs/gui/BufferQueueCore.cpp
index cd94253..cfb25e0 100644
--- a/libs/gui/BufferQueueCore.cpp
+++ b/libs/gui/BufferQueueCore.cpp
@@ -59,6 +59,7 @@
mConsumerName(getUniqueName()),
mConsumerListener(),
mConsumerUsageBits(0),
+ mConsumerIsProtected(false),
mConnectedApi(NO_CONNECTED_API),
mLinkedToDeath(),
mConnectedProducerListener(),
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index cddb1fd..8159aef 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -1105,6 +1105,9 @@
value = static_cast<int32_t>(mCore->mBufferAge);
}
break;
+ case NATIVE_WINDOW_CONSUMER_IS_PROTECTED:
+ value = static_cast<int32_t>(mCore->mConsumerIsProtected);
+ break;
default:
return BAD_VALUE;
}
diff --git a/libs/gui/IGraphicBufferConsumer.cpp b/libs/gui/IGraphicBufferConsumer.cpp
index 568c318..a573bee 100644
--- a/libs/gui/IGraphicBufferConsumer.cpp
+++ b/libs/gui/IGraphicBufferConsumer.cpp
@@ -46,6 +46,7 @@
SET_DEFAULT_BUFFER_FORMAT,
SET_DEFAULT_BUFFER_DATA_SPACE,
SET_CONSUMER_USAGE_BITS,
+ SET_CONSUMER_IS_PROTECTED,
SET_TRANSFORM_HINT,
GET_SIDEBAND_STREAM,
GET_OCCUPANCY_HISTORY,
@@ -136,6 +137,11 @@
return callRemote<Signature>(Tag::SET_CONSUMER_USAGE_BITS, usage);
}
+ status_t setConsumerIsProtected(bool isProtected) override {
+ using Signature = decltype(&IGraphicBufferConsumer::setConsumerIsProtected);
+ return callRemote<Signature>(Tag::SET_CONSUMER_IS_PROTECTED, isProtected);
+ }
+
status_t setTransformHint(uint32_t hint) override {
using Signature = decltype(&IGraphicBufferConsumer::setTransformHint);
return callRemote<Signature>(Tag::SET_TRANSFORM_HINT, hint);
@@ -204,6 +210,8 @@
return callLocal(data, reply, &IGraphicBufferConsumer::setDefaultBufferDataSpace);
case Tag::SET_CONSUMER_USAGE_BITS:
return callLocal(data, reply, &IGraphicBufferConsumer::setConsumerUsageBits);
+ case Tag::SET_CONSUMER_IS_PROTECTED:
+ return callLocal(data, reply, &IGraphicBufferConsumer::setConsumerIsProtected);
case Tag::SET_TRANSFORM_HINT:
return callLocal(data, reply, &IGraphicBufferConsumer::setTransformHint);
case Tag::GET_SIDEBAND_STREAM:
diff --git a/libs/nativewindow/include/system/window.h b/libs/nativewindow/include/system/window.h
index fb67a51..45110c4 100644
--- a/libs/nativewindow/include/system/window.h
+++ b/libs/nativewindow/include/system/window.h
@@ -192,6 +192,12 @@
* present info, 0 if it won't.
*/
NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_PRESENT = 18,
+
+ /*
+ * The consumer end is capable of handling protected buffers, i.e. buffer
+ * with GRALLOC_USAGE_PROTECTED usage bits on.
+ */
+ NATIVE_WINDOW_CONSUMER_IS_PROTECTED = 19,
};
/* Valid operations for the (*perform)() hook.
diff --git a/libs/vr/libbufferhub/Android.bp b/libs/vr/libbufferhub/Android.bp
index 68b9c81..452bad0 100644
--- a/libs/vr/libbufferhub/Android.bp
+++ b/libs/vr/libbufferhub/Android.bp
@@ -25,7 +25,6 @@
staticLibraries = [
"libdvrcommon",
"libpdx_default_transport",
- "libgrallocusage",
]
sharedLibraries = [
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 c772ed3..dbd4110 100644
--- a/libs/vr/libbufferhub/include/private/dvr/buffer_hub_client.h
+++ b/libs/vr/libbufferhub/include/private/dvr/buffer_hub_client.h
@@ -113,8 +113,10 @@
uint32_t format() const { return slices_[0].format(); }
uint32_t usage() const { return slices_[0].usage(); }
uint32_t layer_count() const { return slices_[0].layer_count(); }
- uint64_t producer_usage() const { return slices_[0].producer_usage(); }
- uint64_t consumer_usage() const { return slices_[0].consumer_usage(); }
+
+ // TODO(b/37881101) Clean up producer/consumer usage.
+ uint64_t producer_usage() const { return slices_[0].usage(); }
+ uint64_t consumer_usage() const { return slices_[0].usage(); }
protected:
explicit BufferHubBuffer(LocalChannelHandle channel);
diff --git a/libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h b/libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h
index b6302f1..02e9f27 100644
--- a/libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h
+++ b/libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h
@@ -24,8 +24,8 @@
width_(buffer.width()),
height_(buffer.height()),
format_(buffer.format()),
- producer_usage_(buffer.producer_usage()),
- consumer_usage_(buffer.consumer_usage()) {
+ producer_usage_(buffer.usage()),
+ consumer_usage_(buffer.usage()) {
// Populate the fd and int vectors: native_handle->data[] is an array of fds
// followed by an array of opaque ints.
const int fd_count = buffer.handle()->numFds;
@@ -48,10 +48,11 @@
for (const auto& fd : fds_)
fd_ints.push_back(fd.Get());
+ // TODO(b/37881101) Get rid of producer/consumer usage.
const int ret =
buffer->Import(fd_ints.data(), fd_ints.size(), opaque_ints_.data(),
opaque_ints_.size(), width_, height_, stride_, format_,
- producer_usage_, consumer_usage_);
+ (producer_usage_ | consumer_usage_));
if (ret < 0)
return ret;
diff --git a/libs/vr/libbufferhub/include/private/dvr/ion_buffer.h b/libs/vr/libbufferhub/include/private/dvr/ion_buffer.h
index e167a17..72c8d81 100644
--- a/libs/vr/libbufferhub/include/private/dvr/ion_buffer.h
+++ b/libs/vr/libbufferhub/include/private/dvr/ion_buffer.h
@@ -12,20 +12,12 @@
class IonBuffer {
public:
IonBuffer();
- IonBuffer(uint32_t width, uint32_t height, uint32_t format, uint32_t usage);
- IonBuffer(uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage);
+ IonBuffer(uint32_t width, uint32_t height, uint32_t format, uint64_t usage);
IonBuffer(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint32_t usage);
- IonBuffer(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage);
+ uint32_t stride, uint32_t format, uint64_t usage);
IonBuffer(buffer_handle_t handle, uint32_t width, uint32_t height,
uint32_t layer_count, uint32_t stride, uint32_t layer_stride,
- uint32_t format, uint32_t usage);
- IonBuffer(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t layer_count, uint32_t stride, uint32_t layer_stride,
- uint32_t format, uint64_t producer_usage, uint64_t consumer_usage);
+ uint32_t format, uint64_t usage);
~IonBuffer();
IonBuffer(IonBuffer&& other);
@@ -39,36 +31,25 @@
// previous native handle if necessary. Returns 0 on success or a negative
// errno code otherwise. If allocation fails the previous native handle is
// left intact.
- int Alloc(uint32_t width, uint32_t height, uint32_t format, uint32_t usage);
- int Alloc(uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage);
+ int Alloc(uint32_t width, uint32_t height, uint32_t format, uint64_t usage);
// Resets the underlying native handle and parameters, freeing the previous
// native handle if necessary.
void Reset(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint32_t usage);
- void Reset(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage);
+ uint32_t stride, uint32_t format, uint64_t usage);
// Like Reset but also registers the native handle, which is necessary for
// native handles received over IPC. Returns 0 on success or a negative errno
// code otherwise. If import fails the previous native handle is left intact.
int Import(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint32_t usage);
- int Import(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage);
+ uint32_t stride, uint32_t format, uint64_t usage);
// Like Reset but imports a native handle from raw fd and int arrays. Returns
// 0 on success or a negative errno code otherwise. If import fails the
// previous native handle is left intact.
int Import(const int* fd_array, int fd_count, const int* int_array,
int int_count, uint32_t width, uint32_t height, uint32_t stride,
- uint32_t format, uint32_t usage);
- int Import(const int* fd_array, int fd_count, const int* int_array,
- int int_count, uint32_t width, uint32_t height, uint32_t stride,
- uint32_t format, uint64_t producer_usage, uint64_t consumer_usage);
+ uint32_t format, uint64_t usage);
// Duplicates the native handle underlying |other| and then imports it. This
// is useful for creating multiple, independent views of the same Ion/Gralloc
@@ -95,19 +76,13 @@
uint32_t format() const {
return buffer_.get() ? buffer_->getPixelFormat() : 0;
}
- uint64_t producer_usage() const { return producer_usage_; }
- uint64_t consumer_usage() const { return consumer_usage_; }
- uint32_t usage() const { return buffer_.get() ? buffer_->getUsage() : 0; }
+ uint64_t usage() const {
+ return buffer_.get() ? static_cast<uint64_t>(buffer_->getUsage()) : 0;
+ }
private:
sp<GraphicBuffer> buffer_;
- // GraphicBuffer doesn't expose these separately. Keep these values cached for
- // BufferHub to check policy against. Clients that import these buffers won't
- // get the full picture, which is okay.
- uint64_t producer_usage_;
- uint64_t consumer_usage_;
-
IonBuffer(const IonBuffer&) = delete;
void operator=(const IonBuffer&) = delete;
};
diff --git a/libs/vr/libbufferhub/ion_buffer.cpp b/libs/vr/libbufferhub/ion_buffer.cpp
index 0a6996e..716ab42 100644
--- a/libs/vr/libbufferhub/ion_buffer.cpp
+++ b/libs/vr/libbufferhub/ion_buffer.cpp
@@ -2,7 +2,6 @@
#include <log/log.h>
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-#include <grallocusage/GrallocUsageConversion.h>
#include <utils/Trace.h>
#include <mutex>
@@ -19,39 +18,26 @@
IonBuffer::IonBuffer() : IonBuffer(nullptr, 0, 0, 0, 0, 0, 0, 0) {}
IonBuffer::IonBuffer(uint32_t width, uint32_t height, uint32_t format,
- uint32_t usage)
- : IonBuffer(width, height, format, usage, usage) {}
-
-IonBuffer::IonBuffer(uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage)
+ uint64_t usage)
: IonBuffer() {
- Alloc(width, height, format, producer_usage, consumer_usage);
+ Alloc(width, height, format, usage);
}
IonBuffer::IonBuffer(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint32_t usage)
+ uint32_t stride, uint32_t format, uint64_t usage)
: IonBuffer(handle, width, height, 1, stride, 0, format, usage) {}
IonBuffer::IonBuffer(buffer_handle_t handle, uint32_t width, uint32_t height,
uint32_t layer_count, uint32_t stride,
- uint32_t layer_stride, uint32_t format, uint32_t usage)
- : IonBuffer(handle, width, height, layer_count, stride, layer_stride,
- format, usage, usage) {}
-
-IonBuffer::IonBuffer(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t layer_count, uint32_t stride,
- uint32_t layer_stride, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage)
+ uint32_t layer_stride, uint32_t format, uint64_t usage)
: buffer_(nullptr) {
ALOGD_IF(TRACE,
"IonBuffer::IonBuffer: handle=%p width=%u height=%u layer_count=%u "
- "stride=%u layer stride=%u format=%u producer_usage=%" PRIx64
- " consumer_usage=%" PRIx64,
+ "stride=%u layer stride=%u format=%u usage=%" PRIx64,
handle, width, height, layer_count, stride, layer_stride, format,
- producer_usage, consumer_usage);
+ usage);
if (handle != 0) {
- Import(handle, width, height, stride, format, producer_usage,
- consumer_usage);
+ Import(handle, width, height, stride, format, usage);
}
}
@@ -82,105 +68,64 @@
if (buffer_.get()) {
// GraphicBuffer unregisters and cleans up the handle if needed
buffer_ = nullptr;
- producer_usage_ = 0;
- consumer_usage_ = 0;
}
}
int IonBuffer::Alloc(uint32_t width, uint32_t height, uint32_t format,
- uint32_t usage) {
- return Alloc(width, height, format, usage, usage);
-}
+ uint64_t usage) {
+ ALOGD_IF(TRACE,
+ "IonBuffer::Alloc: width=%u height=%u format=%u usage=%" PRIx64,
+ width, height, format, usage);
-int IonBuffer::Alloc(uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage) {
- ALOGD_IF(
- TRACE,
- "IonBuffer::Alloc: width=%u height=%u format=%u producer_usage=%" PRIx64
- " consumer_usage=%" PRIx64,
- width, height, format, producer_usage, consumer_usage);
-
- // TODO: forget about split producer/consumer usage
sp<GraphicBuffer> buffer = new GraphicBuffer(
- width, height, format, kDefaultGraphicBufferLayerCount,
- android_convertGralloc1To0Usage(producer_usage, consumer_usage));
+ width, height, format, kDefaultGraphicBufferLayerCount, usage);
if (buffer->initCheck() != OK) {
ALOGE("IonBuffer::Aloc: Failed to allocate buffer");
return -EINVAL;
} else {
buffer_ = buffer;
- producer_usage_ = producer_usage;
- consumer_usage_ = consumer_usage;
return 0;
}
}
void IonBuffer::Reset(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint32_t usage) {
- Reset(handle, width, height, stride, format, usage, usage);
-}
-
-void IonBuffer::Reset(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage) {
+ uint32_t stride, uint32_t format, uint64_t usage) {
ALOGD_IF(TRACE,
"IonBuffer::Reset: handle=%p width=%u height=%u stride=%u format=%u "
- "producer_usage=%" PRIx64 " consumer_usage=%" PRIx64,
- handle, width, height, stride, format, producer_usage,
- consumer_usage);
- Import(handle, width, height, stride, format, producer_usage, consumer_usage);
+ "usage=%" PRIx64,
+ handle, width, height, stride, format, usage);
+ Import(handle, width, height, stride, format, usage);
}
int IonBuffer::Import(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint32_t usage) {
- return Import(handle, width, height, stride, format, usage, usage);
-}
-
-int IonBuffer::Import(buffer_handle_t handle, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage) {
+ uint32_t stride, uint32_t format, uint64_t usage) {
ATRACE_NAME("IonBuffer::Import1");
ALOGD_IF(
TRACE,
"IonBuffer::Import: handle=%p width=%u height=%u stride=%u format=%u "
- "producer_usage=%" PRIx64 " consumer_usage=%" PRIx64,
- handle, width, height, stride, format, producer_usage, consumer_usage);
+ "usage=%" PRIx64,
+ handle, width, height, stride, format, usage);
FreeHandle();
- sp<GraphicBuffer> buffer =
- new GraphicBuffer(handle, GraphicBuffer::TAKE_UNREGISTERED_HANDLE, width,
- height, format, kDefaultGraphicBufferLayerCount,
- static_cast<uint64_t>(android_convertGralloc1To0Usage(
- producer_usage, consumer_usage)),
- stride);
+ sp<GraphicBuffer> buffer = new GraphicBuffer(
+ handle, GraphicBuffer::TAKE_UNREGISTERED_HANDLE, width, height, format,
+ kDefaultGraphicBufferLayerCount, usage, stride);
if (buffer->initCheck() != OK) {
ALOGE("IonBuffer::Import: Failed to import buffer");
return -EINVAL;
} else {
buffer_ = buffer;
- producer_usage_ = producer_usage;
- consumer_usage_ = consumer_usage;
return 0;
}
}
int IonBuffer::Import(const int* fd_array, int fd_count, const int* int_array,
int int_count, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint32_t usage) {
- return Import(fd_array, fd_count, int_array, int_count, width, height, stride,
- format, usage, usage);
-}
-
-int IonBuffer::Import(const int* fd_array, int fd_count, const int* int_array,
- int int_count, uint32_t width, uint32_t height,
- uint32_t stride, uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage) {
+ uint32_t stride, uint32_t format, uint64_t usage) {
ATRACE_NAME("IonBuffer::Import2");
ALOGD_IF(TRACE,
"IonBuffer::Import: fd_count=%d int_count=%d width=%u height=%u "
- "stride=%u format=%u producer_usage=%" PRIx64
- " consumer_usage=%" PRIx64,
- fd_count, int_count, width, height, stride, format, producer_usage,
- consumer_usage);
+ "stride=%u format=%u usage=%" PRIx64,
+ fd_count, int_count, width, height, stride, format, usage);
if (fd_count < 0 || int_count < 0) {
ALOGE("IonBuffer::Import: invalid arguments.");
@@ -198,8 +143,7 @@
memcpy(handle->data, fd_array, sizeof(int) * fd_count);
memcpy(handle->data + fd_count, int_array, sizeof(int) * int_count);
- const int ret = Import(handle, width, height, stride, format, producer_usage,
- consumer_usage);
+ const int ret = Import(handle, width, height, stride, format, usage);
if (ret < 0) {
ALOGE("IonBuffer::Import: failed to import raw native handle: %s",
strerror(-ret));
@@ -236,7 +180,7 @@
const int ret =
Import(handle, other->width(), other->height(), other->stride(),
- other->format(), other->producer_usage(), other->consumer_usage());
+ other->format(), other->usage());
if (ret < 0) {
ALOGE("IonBuffer::Duplicate: Failed to import duplicate native handle: %s",
strerror(-ret));
diff --git a/libs/vr/libvrflinger/display_service.cpp b/libs/vr/libvrflinger/display_service.cpp
index d3d50d0..097edce 100644
--- a/libs/vr/libvrflinger/display_service.cpp
+++ b/libs/vr/libvrflinger/display_service.cpp
@@ -332,8 +332,8 @@
auto named_buffer = named_buffers_.find(name);
if (named_buffer == named_buffers_.end()) {
auto ion_buffer = std::make_unique<IonBuffer>(
- static_cast<int>(size), 1, HAL_PIXEL_FORMAT_BLOB, producer_usage,
- consumer_usage);
+ static_cast<int>(size), 1, HAL_PIXEL_FORMAT_BLOB,
+ (producer_usage | consumer_usage));
named_buffer =
named_buffers_.insert(std::make_pair(name, std::move(ion_buffer)))
.first;
diff --git a/services/vr/bufferhubd/producer_channel.cpp b/services/vr/bufferhubd/producer_channel.cpp
index c946a8d..c4b1319 100644
--- a/services/vr/bufferhubd/producer_channel.cpp
+++ b/services/vr/bufferhubd/producer_channel.cpp
@@ -37,8 +37,8 @@
meta_size_bytes_(meta_size_bytes),
meta_(meta_size_bytes ? new uint8_t[meta_size_bytes] : nullptr) {
for (auto& ion_buffer : slices_) {
- const int ret =
- ion_buffer.Alloc(width, height, format, producer_usage, consumer_usage);
+ const int ret = ion_buffer.Alloc(width, height, format,
+ (producer_usage | consumer_usage));
if (ret < 0) {
ALOGE("ProducerChannel::ProducerChannel: Failed to allocate buffer: %s",
strerror(-ret));
@@ -76,7 +76,7 @@
BufferHubChannel::BufferInfo ProducerChannel::GetBufferInfo() const {
return BufferInfo(buffer_id(), consumer_channels_.size(), slices_[0].width(),
slices_[0].height(), slices_[0].format(),
- slices_[0].producer_usage(), slices_[0].consumer_usage(),
+ slices_[0].usage(), slices_[0].usage(),
slices_.size(), name_);
}
@@ -376,8 +376,7 @@
return slices_.size() == slice_count && meta_size_bytes == meta_size_bytes_ &&
slices_[0].width() == width && slices_[0].height() == height &&
slices_[0].format() == format &&
- slices_[0].producer_usage() == producer_usage &&
- slices_[0].consumer_usage() == consumer_usage;
+ slices_[0].usage() == (producer_usage | consumer_usage);
}
} // namespace dvr