Merge "Revert "Remove vr_wm service"" into oc-dev
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 5dad511..f84d86d 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -998,13 +998,8 @@
for_each_tid(show_wchan, "BLOCKED PROCESS WAIT-CHANNELS");
for_each_pid(show_showtime, "PROCESS TIMES (pid cmd user system iowait+percentage)");
- if (true) {
- // TODO: temporary disabled because /data/misc/bluetooth/logs/btsnoop_hci.log can be huge
- MYLOGD("Skipping /data/misc/bluetooth/logs");
- } else {
- /* Dump Bluetooth HCI logs */
- ds.AddDir("/data/misc/bluetooth/logs", true);
- }
+ /* Dump Bluetooth HCI logs */
+ ds.AddDir("/data/misc/bluetooth/logs", true);
if (!ds.do_early_screenshot_) {
MYLOGI("taking late screenshot\n");
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index e9d06d1..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=") <
@@ -1149,8 +1149,8 @@
// Opens the vdex files and assigns the input fd to in_vdex_wrapper_fd and the output fd to
// out_vdex_wrapper_fd. Returns true for success or false in case of errors.
bool open_vdex_files(const char* apk_path, const char* out_oat_path, int dexopt_needed,
- const char* instruction_set, bool is_public, bool profile_guided,
- int uid, bool is_secondary_dex, Dex2oatFileWrapper* in_vdex_wrapper_fd,
+ const char* instruction_set, bool is_public, int uid, bool is_secondary_dex,
+ Dex2oatFileWrapper* in_vdex_wrapper_fd,
Dex2oatFileWrapper* out_vdex_wrapper_fd) {
CHECK(in_vdex_wrapper_fd != nullptr);
CHECK(out_vdex_wrapper_fd != nullptr);
@@ -1160,9 +1160,7 @@
int dexopt_action = abs(dexopt_needed);
bool is_odex_location = dexopt_needed < 0;
std::string in_vdex_path_str;
- // Disable passing an input vdex when the compilation is profile-guided. The dexlayout
- // optimization in dex2oat is incompatible with it. b/35872504.
- if (dexopt_action != DEX2OAT_FROM_SCRATCH && !profile_guided) {
+ if (dexopt_action != DEX2OAT_FROM_SCRATCH) {
// Open the possibly existing vdex. If none exist, we pass -1 to dex2oat for input-vdex-fd.
const char* path = nullptr;
if (is_odex_location) {
@@ -1523,8 +1521,8 @@
// Open vdex files.
Dex2oatFileWrapper in_vdex_fd;
Dex2oatFileWrapper out_vdex_fd;
- if (!open_vdex_files(dex_path, out_oat_path, dexopt_needed, instruction_set, is_public,
- profile_guided, uid, is_secondary_dex, &in_vdex_fd, &out_vdex_fd)) {
+ if (!open_vdex_files(dex_path, out_oat_path, dexopt_needed, instruction_set, is_public, uid,
+ is_secondary_dex, &in_vdex_fd, &out_vdex_fd)) {
return -1;
}
diff --git a/cmds/lshal/Lshal.cpp b/cmds/lshal/Lshal.cpp
index 33bc43c..85d8938 100644
--- a/cmds/lshal/Lshal.cpp
+++ b/cmds/lshal/Lshal.cpp
@@ -163,6 +163,7 @@
return true;
}
+// Must process hwbinder services first, then passthrough services.
void Lshal::forEachTable(const std::function<void(Table &)> &f) {
f(mServicesTable);
f(mPassthroughRefTable);
@@ -243,6 +244,18 @@
}
void Lshal::dumpVintf() const {
+ mOut << "<!-- " << std::endl
+ << " This is a skeleton device manifest. Notes: " << std::endl
+ << " 1. android.hidl.*, android.frameworks.*, android.system.* are not included." << std::endl
+ << " 2. If a HAL is supported in both hwbinder and passthrough transport, " << std::endl
+ << " only hwbinder is shown." << std::endl
+ << " 3. It is likely that HALs in passthrough transport does not have" << std::endl
+ << " <interface> declared; users will have to write them by hand." << std::endl
+ << " 4. sepolicy version is set to 0.0. It is recommended that the entry" << std::endl
+ << " is removed from the manifest file and written by assemble_vintf" << std::endl
+ << " at build time." << std::endl
+ << "-->" << std::endl;
+
vintf::HalManifest manifest;
forEachTable([this, &manifest] (const Table &table) {
for (const TableEntry &entry : table) {
@@ -271,6 +284,8 @@
std::string instanceName =
&table == &mImplementationsTable ? "" : splittedFqInstanceName.second;
+ vintf::Version version{fqName.getPackageMajorVersion(),
+ fqName.getPackageMinorVersion()};
vintf::Transport transport;
vintf::Arch arch;
if (entry.transport == "hwbinder") {
@@ -296,34 +311,40 @@
continue;
}
- vintf::ManifestHal *hal = manifest.getAnyHal(fqName.package());
- if (hal == nullptr) {
- if (!manifest.add(vintf::ManifestHal{
+ bool done = false;
+ for (vintf::ManifestHal *hal : manifest.getHals(fqName.package())) {
+ if (hal->transport() != transport) {
+ if (transport != vintf::Transport::PASSTHROUGH) {
+ mErr << "Fatal: should not reach here. Generated result may be wrong."
+ << std::endl;
+ }
+ done = true;
+ break;
+ }
+ if (hal->hasVersion(version)) {
+ if (&table != &mImplementationsTable) {
+ hal->interfaces[interfaceName].name = interfaceName;
+ hal->interfaces[interfaceName].instances.insert(instanceName);
+ }
+ done = true;
+ break;
+ }
+ }
+ if (done) {
+ continue; // to next TableEntry
+ }
+ decltype(vintf::ManifestHal::interfaces) interfaces;
+ if (&table != &mImplementationsTable) {
+ interfaces[interfaceName].name = interfaceName;
+ interfaces[interfaceName].instances.insert(instanceName);
+ }
+ if (!manifest.add(vintf::ManifestHal{
.format = vintf::HalFormat::HIDL,
.name = fqName.package(),
- .transportArch = {transport, arch}
- })) {
- mErr << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl;
- continue;
- }
- hal = manifest.getAnyHal(fqName.package());
- }
- if (hal == nullptr) {
- mErr << "Warning: cannot get hal '" << fqInstanceName
- << "' after adding it" << std::endl;
- continue;
- }
- vintf::Version version{fqName.getPackageMajorVersion(), fqName.getPackageMinorVersion()};
- if (std::find(hal->versions.begin(), hal->versions.end(), version) == hal->versions.end()) {
- hal->versions.push_back(version);
- }
- if (&table != &mImplementationsTable) {
- auto it = hal->interfaces.find(interfaceName);
- if (it == hal->interfaces.end()) {
- hal->interfaces.insert({interfaceName, {interfaceName, {{instanceName}}}});
- } else {
- it->second.instances.insert(instanceName);
- }
+ .versions = {version},
+ .transportArch = {transport, arch},
+ .interfaces = interfaces})) {
+ mErr << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl;
}
}
});
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/buffer_hub_client.cpp b/libs/vr/libbufferhub/buffer_hub_client.cpp
index a1f952e..07c921f 100644
--- a/libs/vr/libbufferhub/buffer_hub_client.cpp
+++ b/libs/vr/libbufferhub/buffer_hub_client.cpp
@@ -216,8 +216,9 @@
event_fd(), width, height, format, producer_usage, consumer_usage,
metadata_size, slice_count);
+ // (b/37881101) Deprecate producer/consumer usage
auto status = InvokeRemoteMethod<BufferHubRPC::CreateBuffer>(
- width, height, format, producer_usage, consumer_usage, metadata_size,
+ width, height, format, (producer_usage | consumer_usage), metadata_size,
slice_count);
if (!status) {
ALOGE(
@@ -257,9 +258,10 @@
event_fd(), name.c_str(), user_id, group_id, width, height, format,
producer_usage, consumer_usage, meta_size_bytes, slice_count);
+ // (b/37881101) Deprecate producer/consumer usage
auto status = InvokeRemoteMethod<BufferHubRPC::CreatePersistentBuffer>(
- name, user_id, group_id, width, height, format, producer_usage,
- consumer_usage, meta_size_bytes, slice_count);
+ name, user_id, group_id, width, height, format,
+ (producer_usage | consumer_usage), meta_size_bytes, slice_count);
if (!status) {
ALOGE(
"BufferProducer::BufferProducer: Failed to create/get persistent "
@@ -295,8 +297,10 @@
const int format = HAL_PIXEL_FORMAT_BLOB;
const size_t meta_size_bytes = 0;
const size_t slice_count = 1;
+
+ // (b/37881101) Deprecate producer/consumer usage
auto status = InvokeRemoteMethod<BufferHubRPC::CreateBuffer>(
- width, height, format, producer_usage, consumer_usage, meta_size_bytes,
+ width, height, format, (producer_usage | consumer_usage), meta_size_bytes,
slice_count);
if (!status) {
ALOGE("BufferProducer::BufferProducer: Failed to create blob: %s",
@@ -333,9 +337,11 @@
const int format = HAL_PIXEL_FORMAT_BLOB;
const size_t meta_size_bytes = 0;
const size_t slice_count = 1;
+
+ // (b/37881101) Deprecate producer/consumer usage
auto status = InvokeRemoteMethod<BufferHubRPC::CreatePersistentBuffer>(
- name, user_id, group_id, width, height, format, producer_usage,
- consumer_usage, meta_size_bytes, slice_count);
+ name, user_id, group_id, width, height, format,
+ (producer_usage | consumer_usage), meta_size_bytes, slice_count);
if (!status) {
ALOGE(
"BufferProducer::BufferProducer: Failed to create persistent "
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..c6f0e1e 100644
--- a/libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h
+++ b/libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h
@@ -24,8 +24,7 @@
width_(buffer.width()),
height_(buffer.height()),
format_(buffer.format()),
- producer_usage_(buffer.producer_usage()),
- consumer_usage_(buffer.consumer_usage()) {
+ 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 +47,9 @@
for (const auto& fd : fds_)
fd_ints.push_back(fd.Get());
- 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_);
+ const int ret = buffer->Import(fd_ints.data(), fd_ints.size(),
+ opaque_ints_.data(), opaque_ints_.size(),
+ width_, height_, stride_, format_, usage_);
if (ret < 0)
return ret;
@@ -75,20 +73,18 @@
uint32_t width_;
uint32_t height_;
uint32_t format_;
- uint64_t producer_usage_;
- uint64_t consumer_usage_;
+ uint64_t usage_;
std::vector<int> opaque_ints_;
std::vector<FileHandleType> fds_;
void Clear() {
id_ = -1;
- stride_ = width_ = height_ = format_ = producer_usage_ = consumer_usage_ =
- 0;
+ stride_ = width_ = height_ = format_ = usage_ = 0;
}
PDX_SERIALIZABLE_MEMBERS(NativeBufferHandle<FileHandleType>, id_, stride_,
- width_, height_, format_, producer_usage_,
- consumer_usage_, opaque_ints_, fds_);
+ width_, height_, format_, usage_, opaque_ints_,
+ fds_);
NativeBufferHandle(const NativeBufferHandle&) = delete;
void operator=(const NativeBufferHandle&) = delete;
@@ -139,20 +135,14 @@
};
struct UsagePolicy {
- uint64_t producer_set_mask;
- uint64_t producer_clear_mask;
- uint64_t producer_deny_set_mask;
- uint64_t producer_deny_clear_mask;
- uint64_t consumer_set_mask;
- uint64_t consumer_clear_mask;
- uint64_t consumer_deny_set_mask;
- uint64_t consumer_deny_clear_mask;
+ uint64_t usage_set_mask;
+ uint64_t usage_clear_mask;
+ uint64_t usage_deny_set_mask;
+ uint64_t usage_deny_clear_mask;
private:
- PDX_SERIALIZABLE_MEMBERS(UsagePolicy, producer_set_mask, producer_clear_mask,
- producer_deny_set_mask, producer_deny_clear_mask,
- consumer_set_mask, consumer_clear_mask,
- consumer_deny_set_mask, consumer_deny_clear_mask);
+ PDX_SERIALIZABLE_MEMBERS(UsagePolicy, usage_set_mask, usage_clear_mask,
+ usage_deny_set_mask, usage_deny_clear_mask);
};
// BufferHub Service RPC interface. Defines the endpoints, op codes, and method
@@ -202,13 +192,13 @@
// Methods.
PDX_REMOTE_METHOD(CreateBuffer, kOpCreateBuffer,
void(uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage,
- size_t meta_size_bytes, size_t slice_count));
+ uint64_t usage, size_t meta_size_bytes,
+ size_t slice_count));
PDX_REMOTE_METHOD(CreatePersistentBuffer, kOpCreatePersistentBuffer,
void(const std::string& name, int user_id, int group_id,
uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage,
- size_t meta_size_bytes, size_t slice_count));
+ uint64_t usage, size_t meta_size_bytes,
+ size_t slice_count));
PDX_REMOTE_METHOD(GetPersistentBuffer, kOpGetPersistentBuffer,
void(const std::string& name));
PDX_REMOTE_METHOD(GetBuffer, kOpGetBuffer,
@@ -240,8 +230,8 @@
kOpProducerQueueAllocateBuffers,
std::vector<std::pair<LocalChannelHandle, size_t>>(
uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage,
- size_t slice_count, size_t buffer_count));
+ uint64_t usage, size_t slice_count,
+ size_t buffer_count));
PDX_REMOTE_METHOD(ProducerQueueDetachBuffer, kOpProducerQueueDetachBuffer,
void(size_t slot));
PDX_REMOTE_METHOD(ConsumerQueueImportBuffers, kOpConsumerQueueImportBuffers,
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/libbufferhubqueue/buffer_hub_queue_client.cpp b/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
index b431d2f..5b85069 100644
--- a/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
+++ b/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
@@ -317,7 +317,7 @@
}
ProducerQueue::ProducerQueue(size_t meta_size)
- : ProducerQueue(meta_size, 0, 0, 0, 0, 0, 0, 0, 0) {}
+ : ProducerQueue(meta_size, 0, 0, 0, 0) {}
ProducerQueue::ProducerQueue(LocalChannelHandle handle)
: BASE(std::move(handle)) {
@@ -329,22 +329,14 @@
}
}
-ProducerQueue::ProducerQueue(size_t meta_size, uint64_t producer_usage_set_mask,
- uint64_t producer_usage_clear_mask,
- uint64_t producer_usage_deny_set_mask,
- uint64_t producer_usage_deny_clear_mask,
- uint64_t consumer_usage_set_mask,
- uint64_t consumer_usage_clear_mask,
- uint64_t consumer_usage_deny_set_mask,
- uint64_t consumer_usage_deny_clear_mask)
+ProducerQueue::ProducerQueue(size_t meta_size, uint64_t usage_set_mask,
+ uint64_t usage_clear_mask,
+ uint64_t usage_deny_set_mask,
+ uint64_t usage_deny_clear_mask)
: BASE(BufferHubRPC::kClientPath) {
auto status = InvokeRemoteMethod<BufferHubRPC::CreateProducerQueue>(
- meta_size,
- UsagePolicy{producer_usage_set_mask, producer_usage_clear_mask,
- producer_usage_deny_set_mask, producer_usage_deny_clear_mask,
- consumer_usage_set_mask, consumer_usage_clear_mask,
- consumer_usage_deny_set_mask,
- consumer_usage_deny_clear_mask});
+ meta_size, UsagePolicy{usage_set_mask, usage_clear_mask,
+ usage_deny_set_mask, usage_deny_clear_mask});
if (!status) {
ALOGE("ProducerQueue::ProducerQueue: Failed to create producer queue: %s",
status.GetErrorMessage().c_str());
@@ -356,16 +348,8 @@
}
int ProducerQueue::AllocateBuffer(uint32_t width, uint32_t height,
- uint32_t format, uint32_t usage,
+ uint32_t format, uint64_t usage,
size_t slice_count, size_t* out_slot) {
- return AllocateBuffer(width, height, format, usage, usage, slice_count,
- out_slot);
-}
-
-int ProducerQueue::AllocateBuffer(uint32_t width, uint32_t height,
- uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage, size_t slice_count,
- size_t* out_slot) {
if (out_slot == nullptr) {
ALOGE("ProducerQueue::AllocateBuffer: Parameter out_slot cannot be null.");
return -EINVAL;
@@ -378,11 +362,9 @@
}
const size_t kBufferCount = 1U;
-
Status<std::vector<std::pair<LocalChannelHandle, size_t>>> status =
InvokeRemoteMethod<BufferHubRPC::ProducerQueueAllocateBuffers>(
- width, height, format, producer_usage, consumer_usage, slice_count,
- kBufferCount);
+ width, height, format, usage, slice_count, kBufferCount);
if (!status) {
ALOGE(
"ProducerQueue::AllocateBuffer failed to create producer buffer "
diff --git a/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h b/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h
index 6467c3c..1eafe76 100644
--- a/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h
+++ b/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h
@@ -279,22 +279,7 @@
uint32_t usage_deny_set_mask,
uint32_t usage_deny_clear_mask) {
return BASE::Create(sizeof(Meta), usage_set_mask, usage_clear_mask,
- usage_deny_set_mask, usage_deny_clear_mask,
- usage_set_mask, usage_clear_mask, usage_deny_set_mask,
- usage_deny_clear_mask);
- }
- template <typename Meta>
- static std::unique_ptr<ProducerQueue> Create(
- uint64_t producer_usage_set_mask, uint64_t producer_usage_clear_mask,
- uint64_t producer_usage_deny_set_mask,
- uint64_t producer_usage_deny_clear_mask, uint64_t consumer_usage_set_mask,
- uint64_t consumer_usage_clear_mask, uint64_t consumer_usage_deny_set_mask,
- uint64_t consumer_usage_deny_clear_mask) {
- return BASE::Create(sizeof(Meta), producer_usage_set_mask,
- producer_usage_clear_mask, producer_usage_deny_set_mask,
- producer_usage_deny_clear_mask, consumer_usage_set_mask,
- consumer_usage_clear_mask, consumer_usage_deny_set_mask,
- consumer_usage_deny_clear_mask);
+ usage_deny_set_mask, usage_deny_clear_mask);
}
// Import a |ProducerQueue| from a channel handle.
@@ -317,10 +302,7 @@
// Returns Zero on success and negative error code when buffer allocation
// fails.
int AllocateBuffer(uint32_t width, uint32_t height, uint32_t format,
- uint32_t usage, size_t slice_count, size_t* out_slot);
- int AllocateBuffer(uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage,
- size_t slice_count, size_t* out_slot);
+ uint64_t usage, size_t slice_count, size_t* out_slot);
// Add a producer buffer to populate the queue. Once added, a producer buffer
// is available to use (i.e. in |Gain|'ed mode).
@@ -345,14 +327,9 @@
// arguments as the constructors.
explicit ProducerQueue(size_t meta_size);
ProducerQueue(LocalChannelHandle handle);
- ProducerQueue(size_t meta_size, uint64_t producer_usage_set_mask,
- uint64_t producer_usage_clear_mask,
- uint64_t producer_usage_deny_set_mask,
- uint64_t producer_usage_deny_clear_mask,
- uint64_t consumer_usage_set_mask,
- uint64_t consumer_usage_clear_mask,
- uint64_t consumer_usage_deny_set_mask,
- uint64_t consumer_usage_deny_clear_mask);
+ ProducerQueue(size_t meta_size, uint64_t usage_set_mask,
+ uint64_t usage_clear_mask, uint64_t usage_deny_set_mask,
+ uint64_t usage_deny_clear_mask);
int OnBufferReady(std::shared_ptr<BufferHubBuffer> buf,
LocalHandle* release_fence) override;
diff --git a/libs/vr/libdisplay/display_manager_client_impl.cpp b/libs/vr/libdisplay/display_manager_client_impl.cpp
index 44b3c4b..941da23 100644
--- a/libs/vr/libdisplay/display_manager_client_impl.cpp
+++ b/libs/vr/libdisplay/display_manager_client_impl.cpp
@@ -32,10 +32,9 @@
}
std::unique_ptr<IonBuffer> DisplayManagerClient::SetupNamedBuffer(
- const std::string& name, size_t size, uint64_t producer_usage,
- uint64_t consumer_usage) {
+ const std::string& name, size_t size, uint64_t usage) {
auto status = InvokeRemoteMethod<DisplayManagerRPC::SetupNamedBuffer>(
- name, size, producer_usage, consumer_usage);
+ name, size, usage);
if (!status) {
ALOGE(
"DisplayManagerClient::SetupNamedBuffer: Failed to create the named "
diff --git a/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h b/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h
index b0a7d13..e09a440 100644
--- a/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h
+++ b/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h
@@ -19,8 +19,7 @@
std::unique_ptr<IonBuffer> SetupNamedBuffer(const std::string& name,
size_t size,
- uint64_t producer_usage,
- uint64_t consumer_usage);
+ uint64_t usage);
using Client::event_fd;
using Client::GetChannel;
diff --git a/libs/vr/libdisplay/include/private/dvr/display_rpc.h b/libs/vr/libdisplay/include/private/dvr/display_rpc.h
index 778032f..1fcfe03 100644
--- a/libs/vr/libdisplay/include/private/dvr/display_rpc.h
+++ b/libs/vr/libdisplay/include/private/dvr/display_rpc.h
@@ -272,9 +272,7 @@
int(const std::map<int, DisplaySurfaceAttributes>& updates));
PDX_REMOTE_METHOD(SetupNamedBuffer, kOpSetupNamedBuffer,
LocalNativeBufferHandle(const std::string& name,
- size_t size,
- uint64_t producer_usage,
- uint64_t consumer_usage));
+ size_t size, uint64_t usage));
};
struct ScreenshotData {
diff --git a/libs/vr/libdvr/display_manager_client.cpp b/libs/vr/libdvr/display_manager_client.cpp
index e469e3e..6830085 100644
--- a/libs/vr/libdvr/display_manager_client.cpp
+++ b/libs/vr/libdvr/display_manager_client.cpp
@@ -62,8 +62,8 @@
android_convertGralloc0To1Usage((uint32_t)gralloc_usage, &producer_usage,
&consumer_usage);
- auto ion_buffer = client->client->SetupNamedBuffer(name, size, producer_usage,
- consumer_usage);
+ auto ion_buffer = client->client->SetupNamedBuffer(
+ name, size, (producer_usage | consumer_usage));
if (ion_buffer) {
return CreateDvrBufferFromIonBuffer(std::move(ion_buffer));
}
diff --git a/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp b/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp
index caf20a5..6a02342 100644
--- a/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp
+++ b/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp
@@ -73,7 +73,7 @@
ASSERT_EQ(0, e3);
AHardwareBuffer* hardware_buffer3 = nullptr;
- int e4 = dvrBufferGetAHardwareBuffer(buffer2, &hardware_buffer3);
+ int e4 = dvrBufferGetAHardwareBuffer(buffer3, &hardware_buffer3);
ASSERT_EQ(0, e4);
ASSERT_NE(nullptr, hardware_buffer3);
diff --git a/libs/vr/libvrflinger/display_manager_service.cpp b/libs/vr/libvrflinger/display_manager_service.cpp
index 99f93bf..42ffaec 100644
--- a/libs/vr/libvrflinger/display_manager_service.cpp
+++ b/libs/vr/libvrflinger/display_manager_service.cpp
@@ -193,8 +193,7 @@
pdx::Status<BorrowedNativeBufferHandle>
DisplayManagerService::OnSetupNamedBuffer(pdx::Message& message,
const std::string& name, size_t size,
- uint64_t producer_usage,
- uint64_t consumer_usage) {
+ uint64_t usage) {
if (message.GetEffectiveUserId() != AID_ROOT &&
!IsTrustedUid(message.GetEffectiveUserId())) {
// Only trusted users can setup named buffers.
@@ -202,8 +201,7 @@
message.GetEffectiveUserId());
return {};
}
- return display_service_->SetupNamedBuffer(name, size, producer_usage,
- consumer_usage);
+ return display_service_->SetupNamedBuffer(name, size, usage);
}
void DisplayManagerService::OnDisplaySurfaceChange() {
diff --git a/libs/vr/libvrflinger/display_manager_service.h b/libs/vr/libvrflinger/display_manager_service.h
index 7b037de..b2417e5 100644
--- a/libs/vr/libvrflinger/display_manager_service.h
+++ b/libs/vr/libvrflinger/display_manager_service.h
@@ -56,7 +56,7 @@
pdx::Status<BorrowedNativeBufferHandle> OnSetupNamedBuffer(
pdx::Message& message, const std::string& name, size_t size,
- uint64_t producer_usage, uint64_t consumer_usage);
+ uint64_t usage);
// Called by the display service to indicate changes to display surfaces that
// the display manager should evaluate.
diff --git a/libs/vr/libvrflinger/display_service.cpp b/libs/vr/libvrflinger/display_service.cpp
index d3d50d0..2dc840e 100644
--- a/libs/vr/libvrflinger/display_service.cpp
+++ b/libs/vr/libvrflinger/display_service.cpp
@@ -327,13 +327,11 @@
}
pdx::Status<BorrowedNativeBufferHandle> DisplayService::SetupNamedBuffer(
- const std::string& name, size_t size, int producer_usage,
- int consumer_usage) {
+ const std::string& name, size_t size, int usage) {
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);
+ auto ion_buffer = std::make_unique<IonBuffer>(static_cast<int>(size), 1,
+ HAL_PIXEL_FORMAT_BLOB, usage);
named_buffer =
named_buffers_.insert(std::make_pair(name, std::move(ion_buffer)))
.first;
diff --git a/libs/vr/libvrflinger/display_service.h b/libs/vr/libvrflinger/display_service.h
index db89064..dd5cac9 100644
--- a/libs/vr/libvrflinger/display_service.h
+++ b/libs/vr/libvrflinger/display_service.h
@@ -40,8 +40,7 @@
void UpdateActiveDisplaySurfaces();
pdx::Status<BorrowedNativeBufferHandle> SetupNamedBuffer(
- const std::string& name, size_t size, int producer_usage,
- int consumer_usage);
+ const std::string& name, size_t size, int usage);
template <class A>
void ForEachDisplaySurface(A action) const {
diff --git a/libs/vr/libvrflinger/hardware_composer.cpp b/libs/vr/libvrflinger/hardware_composer.cpp
index 18ff4f5..bac9872 100644
--- a/libs/vr/libvrflinger/hardware_composer.cpp
+++ b/libs/vr/libvrflinger/hardware_composer.cpp
@@ -231,6 +231,8 @@
native_display_metrics_.width, native_display_metrics_.height, format,
usage);
+ hwc2_hidl_->resetCommands();
+
// Associate each Layer instance with a hardware composer layer.
for (auto layer : layers_) {
layer->Initialize(hwc2_hidl_.get(), &native_display_metrics_);
@@ -289,6 +291,8 @@
compositor_.Shutdown();
+ hwc2_hidl_->resetCommands();
+
// Trigger target-specific performance mode change.
property_set(kDvrPerformanceProperty, "idle");
}
@@ -427,6 +431,12 @@
layers_[i]->Prepare();
}
+ int32_t ret = Validate(HWC_DISPLAY_PRIMARY);
+ if (ret) {
+ ALOGE("HardwareComposer::Validate failed; ret=%d", ret);
+ return;
+ }
+
// Now that we have taken in a frame from the application, we have a chance
// to drop the frame before passing the frame along to HWC.
// If the display driver has become backed up, we detect it here and then
@@ -467,22 +477,6 @@
layers_[i]->GetCompositionType());
#endif
- int32_t ret = HWC2_ERROR_NONE;
-
- std::vector<Hwc2::IComposerClient::Rect> full_region(1);
- full_region[0].left = 0;
- full_region[0].top = 0;
- full_region[0].right = framebuffer_target_->width();
- full_region[0].bottom = framebuffer_target_->height();
-
- ALOGE_IF(ret, "Error setting client target : %d", ret);
-
- ret = Validate(HWC_DISPLAY_PRIMARY);
- if (ret) {
- ALOGE("HardwareComposer::Validate failed; ret=%d", ret);
- return;
- }
-
ret = Present(HWC_DISPLAY_PRIMARY);
if (ret) {
ALOGE("HardwareComposer::Present failed; ret=%d", ret);
@@ -912,6 +906,13 @@
frame_time_backlog_.clear();
DebugHudData::data.hwc_frame_stats.SkipFrame();
+ if (layer_config_changed) {
+ // If the layer config changed we need to validateDisplay() even if
+ // we're going to drop the frame, to flush the Composer object's
+ // internal command buffer and apply our layer changes.
+ Validate(HWC_DISPLAY_PRIMARY);
+ }
+
continue;
} else {
// Make the transition more obvious in systrace when the frame skip
@@ -923,8 +924,15 @@
error = SleepUntil(display_time_est - frame_time_estimate);
ALOGE_IF(error < 0, "HardwareComposer::PostThread: Failed to sleep: %s",
strerror(-error));
- if (error == kPostThreadInterrupted)
+ if (error == kPostThreadInterrupted) {
+ if (layer_config_changed) {
+ // If the layer config changed we need to validateDisplay() even if
+ // we're going to drop the frame, to flush the Composer object's
+ // internal command buffer and apply our layer changes.
+ Validate(HWC_DISPLAY_PRIMARY);
+ }
continue;
+ }
}
}
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index cd1d1b0..c5bbeee 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -1070,7 +1070,7 @@
for (sensors_event_t* i = event; i < event + 3; i++) {
*i = (sensors_event_t) {
.version = sizeof(sensors_event_t),
- .sensor = 0,
+ .sensor = SENSORS_HANDLE_BASE - 1, // sensor that never exists
.type = SENSOR_TYPE_ADDITIONAL_INFO,
.timestamp = timestamp++,
.additional_info = (additional_info_event_t) {
diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
index 262ab62..439adc4 100644
--- a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
+++ b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
@@ -212,6 +212,10 @@
}
}
+void Composer::resetCommands() {
+ mWriter.reset();
+}
+
uint32_t Composer::getMaxVirtualDisplayCount()
{
auto ret = mClient->getMaxVirtualDisplayCount();
diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.h b/services/surfaceflinger/DisplayHardware/ComposerHal.h
index 37b7766..68d6e6f 100644
--- a/services/surfaceflinger/DisplayHardware/ComposerHal.h
+++ b/services/surfaceflinger/DisplayHardware/ComposerHal.h
@@ -137,6 +137,10 @@
void registerCallback(const sp<IComposerCallback>& callback);
+ // Reset all pending commands in the command buffer. Useful if you want to
+ // skip a frame but have already queued some commands.
+ void resetCommands();
+
uint32_t getMaxVirtualDisplayCount();
bool isUsingVrComposer() const { return mIsUsingVrComposer; }
Error createVirtualDisplay(uint32_t width, uint32_t height,
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 406debf..d33d370 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1033,7 +1033,7 @@
// figure out if there is something below us
Region under;
bool finished = false;
- mFlinger->mDrawingState.layersSortedByZ.traverseInZOrder([&](Layer* layer) {
+ mFlinger->mDrawingState.traverseInZOrder([&](Layer* layer) {
if (finished || layer == static_cast<Layer const*>(this)) {
finished = true;
return;
@@ -2519,7 +2519,7 @@
}
bool Layer::detachChildren() {
- traverseInZOrder([this](Layer* child) {
+ traverseInZOrder(LayerVector::StateSet::Drawing, [this](Layer* child) {
if (child == this) {
return;
}
@@ -2553,20 +2553,26 @@
return mDrawingState.z;
}
-LayerVector Layer::makeTraversalList() {
- if (mDrawingState.zOrderRelatives.size() == 0) {
- return mDrawingChildren;
+LayerVector Layer::makeTraversalList(LayerVector::StateSet stateSet) {
+ LOG_ALWAYS_FATAL_IF(stateSet == LayerVector::StateSet::Invalid,
+ "makeTraversalList received invalid stateSet");
+ const bool useDrawing = stateSet == LayerVector::StateSet::Drawing;
+ const LayerVector& children = useDrawing ? mDrawingChildren : mCurrentChildren;
+ const State& state = useDrawing ? mDrawingState : mCurrentState;
+
+ if (state.zOrderRelatives.size() == 0) {
+ return children;
}
LayerVector traverse;
- for (const wp<Layer>& weakRelative : mDrawingState.zOrderRelatives) {
+ for (const wp<Layer>& weakRelative : state.zOrderRelatives) {
sp<Layer> strongRelative = weakRelative.promote();
if (strongRelative != nullptr) {
traverse.add(strongRelative);
}
}
- for (const sp<Layer>& child : mDrawingChildren) {
+ for (const sp<Layer>& child : children) {
traverse.add(child);
}
@@ -2576,8 +2582,8 @@
/**
* Negatively signed relatives are before 'this' in Z-order.
*/
-void Layer::traverseInZOrder(const std::function<void(Layer*)>& exec) {
- LayerVector list = makeTraversalList();
+void Layer::traverseInZOrder(LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor) {
+ LayerVector list = makeTraversalList(stateSet);
size_t i = 0;
for (; i < list.size(); i++) {
@@ -2585,20 +2591,21 @@
if (relative->getZ() >= 0) {
break;
}
- relative->traverseInZOrder(exec);
+ relative->traverseInZOrder(stateSet, visitor);
}
- exec(this);
+ visitor(this);
for (; i < list.size(); i++) {
const auto& relative = list[i];
- relative->traverseInZOrder(exec);
+ relative->traverseInZOrder(stateSet, visitor);
}
}
/**
* Positively signed relatives are before 'this' in reverse Z-order.
*/
-void Layer::traverseInReverseZOrder(const std::function<void(Layer*)>& exec) {
- LayerVector list = makeTraversalList();
+void Layer::traverseInReverseZOrder(LayerVector::StateSet stateSet,
+ const LayerVector::Visitor& visitor) {
+ LayerVector list = makeTraversalList(stateSet);
int32_t i = 0;
for (i = list.size()-1; i>=0; i--) {
@@ -2606,12 +2613,12 @@
if (relative->getZ() < 0) {
break;
}
- relative->traverseInReverseZOrder(exec);
+ relative->traverseInReverseZOrder(stateSet, visitor);
}
- exec(this);
+ visitor(this);
for (; i>=0; i--) {
const auto& relative = list[i];
- relative->traverseInReverseZOrder(exec);
+ relative->traverseInReverseZOrder(stateSet, visitor);
}
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index a5224ec..9f45435 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -476,8 +476,9 @@
uint8_t getAlpha() const;
#endif
- void traverseInReverseZOrder(const std::function<void(Layer*)>& exec);
- void traverseInZOrder(const std::function<void(Layer*)>& exec);
+ void traverseInReverseZOrder(LayerVector::StateSet stateSet,
+ const LayerVector::Visitor& visitor);
+ void traverseInZOrder(LayerVector::StateSet stateSet, const LayerVector::Visitor& visitor);
void addChild(const sp<Layer>& layer);
// Returns index if removed, or negative value otherwise
@@ -557,7 +558,7 @@
void setParent(const sp<Layer>& layer);
- LayerVector makeTraversalList();
+ LayerVector makeTraversalList(LayerVector::StateSet stateSet);
void addZOrderRelative(const wp<Layer>& relative);
void removeZOrderRelative(const wp<Layer>& relative);
diff --git a/services/surfaceflinger/LayerVector.cpp b/services/surfaceflinger/LayerVector.cpp
index 90e6395..2233e78 100644
--- a/services/surfaceflinger/LayerVector.cpp
+++ b/services/surfaceflinger/LayerVector.cpp
@@ -18,9 +18,14 @@
#include "Layer.h"
namespace android {
+
+LayerVector::LayerVector() = default;
+
LayerVector::LayerVector(const LayerVector& rhs) : SortedVector<sp<Layer>>(rhs) {
}
+LayerVector::~LayerVector() = default;
+
int LayerVector::do_compare(const void* lhs, const void* rhs) const
{
// sort layers per layer-stack, then by z-order and finally by sequence
@@ -40,23 +45,27 @@
return l->sequence - r->sequence;
}
-void LayerVector::traverseInZOrder(const std::function<void(Layer*)>& consume) const {
+void LayerVector::traverseInZOrder(StateSet stateSet, const Visitor& visitor) const {
for (size_t i = 0; i < size(); i++) {
const auto& layer = (*this)[i];
- if (layer->getDrawingState().zOrderRelativeOf != nullptr) {
+ auto& state = (stateSet == StateSet::Current) ? layer->getCurrentState()
+ : layer->getDrawingState();
+ if (state.zOrderRelativeOf != nullptr) {
continue;
}
- layer->traverseInZOrder(consume);
+ layer->traverseInZOrder(stateSet, visitor);
}
}
-void LayerVector::traverseInReverseZOrder(const std::function<void(Layer*)>& consume) const {
+void LayerVector::traverseInReverseZOrder(StateSet stateSet, const Visitor& visitor) const {
for (auto i = static_cast<int64_t>(size()) - 1; i >= 0; i--) {
const auto& layer = (*this)[i];
- if (layer->getDrawingState().zOrderRelativeOf != nullptr) {
+ auto& state = (stateSet == StateSet::Current) ? layer->getCurrentState()
+ : layer->getDrawingState();
+ if (state.zOrderRelativeOf != nullptr) {
continue;
}
- layer->traverseInReverseZOrder(consume);
+ layer->traverseInReverseZOrder(stateSet, visitor);
}
}
} // namespace android
diff --git a/services/surfaceflinger/LayerVector.h b/services/surfaceflinger/LayerVector.h
index 7dfa4a0..a9adb41 100644
--- a/services/surfaceflinger/LayerVector.h
+++ b/services/surfaceflinger/LayerVector.h
@@ -32,13 +32,22 @@
*/
class LayerVector : public SortedVector<sp<Layer>> {
public:
- LayerVector() = default;
+ LayerVector();
LayerVector(const LayerVector& rhs);
+ ~LayerVector() override;
+
+ enum class StateSet {
+ Invalid,
+ Current,
+ Drawing,
+ };
+
// Sorts layer by layer-stack, Z order, and finally creation order (sequence).
int do_compare(const void* lhs, const void* rhs) const override;
- void traverseInReverseZOrder(const std::function<void(Layer*)>& consume) const;
- void traverseInZOrder(const std::function<void(Layer*)>& consume) const;
+ using Visitor = std::function<void(Layer*)>;
+ void traverseInReverseZOrder(StateSet stateSet, const Visitor& visitor) const;
+ void traverseInZOrder(StateSet stateSet, const Visitor& visitor) const;
};
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 9cd1214..3e30ebd 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -548,12 +548,15 @@
mSFEventThread = new EventThread(sfVsyncSrc, *this, true);
mEventQueue.setEventThread(mSFEventThread);
- // set SFEventThread to SCHED_FIFO to minimize jitter
+ // set EventThread and SFEventThread to SCHED_FIFO to minimize jitter
struct sched_param param = {0};
param.sched_priority = 2;
if (sched_setscheduler(mSFEventThread->getTid(), SCHED_FIFO, ¶m) != 0) {
ALOGE("Couldn't set SCHED_FIFO for SFEventThread");
}
+ if (sched_setscheduler(mEventThread->getTid(), SCHED_FIFO, ¶m) != 0) {
+ ALOGE("Couldn't set SCHED_FIFO for EventThread");
+ }
// Get a RenderEngine for the given display / config (can't fail)
mRenderEngine = RenderEngine::create(mEGLDisplay,
@@ -4195,7 +4198,7 @@
if (state.z < minLayerZ || state.z > maxLayerZ) {
continue;
}
- layer->traverseInZOrder([&](Layer* layer) {
+ layer->traverseInZOrder(LayerVector::StateSet::Drawing, [&](Layer* layer) {
if (!layer->isVisible()) {
return;
}
@@ -4243,7 +4246,7 @@
(state.z < minLayerZ || state.z > maxLayerZ)) {
continue;
}
- layer->traverseInZOrder([&](Layer *layer) {
+ layer->traverseInZOrder(LayerVector::StateSet::Drawing, [&](Layer *layer) {
secureLayerIsVisible = secureLayerIsVisible || (layer->isVisible() &&
layer->isSecure());
});
@@ -4391,7 +4394,7 @@
const Layer::State& state(layer->getDrawingState());
if (layer->getLayerStack() == hw->getLayerStack() && state.z >= minLayerZ &&
state.z <= maxLayerZ) {
- layer->traverseInZOrder([&](Layer* layer) {
+ layer->traverseInZOrder(LayerVector::StateSet::Drawing, [&](Layer* layer) {
ALOGE("%c index=%zu, name=%s, layerStack=%d, z=%d, visible=%d, flags=%x, alpha=%.3f",
layer->isVisible() ? '+' : '-',
i, layer->getName().string(), layer->getLayerStack(), state.z,
@@ -4405,12 +4408,12 @@
// ---------------------------------------------------------------------------
-void SurfaceFlinger::State::traverseInZOrder(const std::function<void(Layer*)>& consume) const {
- layersSortedByZ.traverseInZOrder(consume);
+void SurfaceFlinger::State::traverseInZOrder(const LayerVector::Visitor& visitor) const {
+ layersSortedByZ.traverseInZOrder(stateSet, visitor);
}
-void SurfaceFlinger::State::traverseInReverseZOrder(const std::function<void(Layer*)>& consume) const {
- layersSortedByZ.traverseInReverseZOrder(consume);
+void SurfaceFlinger::State::traverseInReverseZOrder(const LayerVector::Visitor& visitor) const {
+ layersSortedByZ.traverseInReverseZOrder(stateSet, visitor);
}
}; // namespace android
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index c01f701..1bc689d 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -238,11 +238,21 @@
class State {
public:
+ explicit State(LayerVector::StateSet set) : stateSet(set) {}
+ State& operator=(const State& other) {
+ // We explicitly don't copy stateSet so that, e.g., mDrawingState
+ // always uses the Drawing StateSet.
+ layersSortedByZ = other.layersSortedByZ;
+ displays = other.displays;
+ return *this;
+ }
+
+ const LayerVector::StateSet stateSet = LayerVector::StateSet::Invalid;
LayerVector layersSortedByZ;
DefaultKeyedVector< wp<IBinder>, DisplayDeviceState> displays;
- void traverseInZOrder(const std::function<void(Layer*)>& consume) const;
- void traverseInReverseZOrder(const std::function<void(Layer*)>& consume) const;
+ void traverseInZOrder(const LayerVector::Visitor& visitor) const;
+ void traverseInReverseZOrder(const LayerVector::Visitor& visitor) const;
};
/* ------------------------------------------------------------------------
@@ -577,7 +587,7 @@
// access must be protected by mStateLock
mutable Mutex mStateLock;
- State mCurrentState;
+ State mCurrentState{LayerVector::StateSet::Current};
volatile int32_t mTransactionFlags;
Condition mTransactionCV;
bool mTransactionPending;
@@ -617,7 +627,7 @@
// Can only accessed from the main thread, these members
// don't need synchronization
- State mDrawingState;
+ State mDrawingState{LayerVector::StateSet::Drawing};
bool mVisibleRegionsDirty;
#ifndef USE_HWC2
bool mHwWorkListDirty;
diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
index 02923ae..7070b97 100644
--- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
+++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
@@ -520,13 +520,15 @@
mSFEventThread = new EventThread(sfVsyncSrc, *this, true);
mEventQueue.setEventThread(mSFEventThread);
- // set SFEventThread to SCHED_FIFO to minimize jitter
+ // set EventThread and SFEventThread to SCHED_FIFO to minimize jitter
struct sched_param param = {0};
param.sched_priority = 2;
if (sched_setscheduler(mSFEventThread->getTid(), SCHED_FIFO, ¶m) != 0) {
ALOGE("Couldn't set SCHED_FIFO for SFEventThread");
}
-
+ if (sched_setscheduler(mEventThread->getTid(), SCHED_FIFO, ¶m) != 0) {
+ ALOGE("Couldn't set SCHED_FIFO for EventThread");
+ }
// Initialize the H/W composer object. There may or may not be an
// actual hardware composer underneath.
@@ -3808,7 +3810,7 @@
if (state.z < minLayerZ || state.z > maxLayerZ) {
continue;
}
- layer->traverseInZOrder([&](Layer* layer) {
+ layer->traverseInZOrder(LayerVector::StateSet::Drawing, [&](Layer* layer) {
if (!layer->isVisible()) {
return;
}
@@ -3858,7 +3860,7 @@
(state.z < minLayerZ || state.z > maxLayerZ)) {
continue;
}
- layer->traverseInZOrder([&](Layer *layer) {
+ layer->traverseInZOrder(LayerVector::StateSet::Drawing, [&](Layer *layer) {
secureLayerIsVisible = secureLayerIsVisible || (layer->isVisible() &&
layer->isSecure());
});
@@ -3997,7 +3999,7 @@
const Layer::State& state(layer->getDrawingState());
if (layer->getLayerStack() == hw->getLayerStack() && state.z >= minLayerZ &&
state.z <= maxLayerZ) {
- layer->traverseInZOrder([&](Layer* layer) {
+ layer->traverseInZOrder(LayerVector::StateSet::Drawing, [&](Layer* layer) {
ALOGE("%c index=%zu, name=%s, layerStack=%d, z=%d, visible=%d, flags=%x, alpha=%x",
layer->isVisible() ? '+' : '-',
i, layer->getName().string(), layer->getLayerStack(), state.z,
@@ -4011,12 +4013,12 @@
// ---------------------------------------------------------------------------
-void SurfaceFlinger::State::traverseInZOrder(const std::function<void(Layer*)>& consume) const {
- layersSortedByZ.traverseInZOrder(consume);
+void SurfaceFlinger::State::traverseInZOrder(const LayerVector::Visitor& visitor) const {
+ layersSortedByZ.traverseInZOrder(stateSet, visitor);
}
-void SurfaceFlinger::State::traverseInReverseZOrder(const std::function<void(Layer*)>& consume) const {
- layersSortedByZ.traverseInReverseZOrder(consume);
+void SurfaceFlinger::State::traverseInReverseZOrder(const LayerVector::Visitor& visitor) const {
+ layersSortedByZ.traverseInReverseZOrder(stateSet, visitor);
}
}; // namespace android
diff --git a/services/surfaceflinger/SurfaceInterceptor.cpp b/services/surfaceflinger/SurfaceInterceptor.cpp
index 026fe80..db489b2 100644
--- a/services/surfaceflinger/SurfaceInterceptor.cpp
+++ b/services/surfaceflinger/SurfaceInterceptor.cpp
@@ -80,7 +80,7 @@
void SurfaceInterceptor::saveExistingSurfacesLocked(const SortedVector<sp<Layer>>& layers) {
ATRACE_CALL();
for (const auto& l : layers) {
- l->traverseInZOrder([this](Layer* layer) {
+ l->traverseInZOrder(LayerVector::StateSet::Drawing, [this](Layer* layer) {
addSurfaceCreationLocked(createTraceIncrementLocked(), layer);
addInitialSurfaceStateLocked(createTraceIncrementLocked(), layer);
});
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index 5474fda..1b17e55 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -977,4 +977,35 @@
}
}
+TEST_F(ChildLayerTest, Bug36858924) {
+ // Destroy the child layer
+ mChild.clear();
+
+ // Now recreate it as hidden
+ mChild = mComposerClient->createSurface(String8("Child surface"), 10, 10,
+ PIXEL_FORMAT_RGBA_8888, ISurfaceComposerClient::eHidden,
+ mFGSurfaceControl.get());
+
+ // Show the child layer in a deferred transaction
+ SurfaceComposerClient::openGlobalTransaction();
+ mChild->deferTransactionUntil(mFGSurfaceControl->getHandle(),
+ mFGSurfaceControl->getSurface()->getNextFrameNumber());
+ mChild->show();
+ SurfaceComposerClient::closeGlobalTransaction(true);
+
+ // Render the foreground surface a few times
+ //
+ // Prior to the bugfix for b/36858924, this would usually hang while trying to fill the third
+ // frame because SurfaceFlinger would never process the deferred transaction and would therefore
+ // never acquire/release the first buffer
+ ALOGI("Filling 1");
+ fillSurfaceRGBA8(mFGSurfaceControl, 0, 255, 0);
+ ALOGI("Filling 2");
+ fillSurfaceRGBA8(mFGSurfaceControl, 0, 0, 255);
+ ALOGI("Filling 3");
+ fillSurfaceRGBA8(mFGSurfaceControl, 255, 0, 0);
+ ALOGI("Filling 4");
+ fillSurfaceRGBA8(mFGSurfaceControl, 0, 255, 0);
+}
+
}
diff --git a/services/vr/bufferhubd/buffer_hub.cpp b/services/vr/bufferhubd/buffer_hub.cpp
index 4b1a522..8093b6b 100644
--- a/services/vr/bufferhubd/buffer_hub.cpp
+++ b/services/vr/bufferhubd/buffer_hub.cpp
@@ -53,7 +53,7 @@
stream << " ";
stream << std::setw(6) << "Format";
stream << " ";
- stream << std::setw(21) << "Usage";
+ stream << std::setw(11) << "Usage";
stream << " ";
stream << "Name";
stream << std::endl;
@@ -80,9 +80,7 @@
stream << std::setw(6) << info.format;
stream << " ";
stream << "0x" << std::hex << std::setfill('0');
- stream << std::setw(8) << info.producer_usage;
- stream << "0x";
- stream << std::setw(8) << info.consumer_usage;
+ stream << std::setw(8) << info.usage;
stream << std::dec << std::setfill(' ');
stream << " ";
stream << info.name;
@@ -140,10 +138,6 @@
stream << " UsageClearMask";
stream << " UsageDenySetMask";
stream << " UsageDenyClearMask";
- stream << " UsageSetMask";
- stream << " UsageClearMask";
- stream << " UsageDenySetMask";
- stream << " UsageDenyClearMask";
stream << " ";
stream << std::endl;
@@ -157,28 +151,16 @@
stream << std::right << std::setw(12) << info.consumer_count;
stream << std::setw(5) << std::setfill(' ') << "0x";
stream << std::hex << std::setfill('0');
- stream << std::setw(8) << info.usage_policy.producer_set_mask;
+ stream << std::setw(8) << info.usage_policy.usage_set_mask;
stream << std::setw(7) << std::setfill(' ') << "0x";
stream << std::hex << std::setfill('0');
- stream << std::setw(8) << info.usage_policy.producer_clear_mask;
+ stream << std::setw(8) << info.usage_policy.usage_clear_mask;
stream << std::setw(9) << std::setfill(' ') << "0x";
stream << std::hex << std::setfill('0');
- stream << std::setw(8) << info.usage_policy.producer_deny_set_mask;
+ stream << std::setw(8) << info.usage_policy.usage_deny_set_mask;
stream << std::setw(11) << std::setfill(' ') << "0x";
stream << std::hex << std::setfill('0');
- stream << std::setw(8) << info.usage_policy.producer_deny_clear_mask;
- stream << std::setw(5) << std::setfill(' ') << "0x";
- stream << std::hex << std::setfill('0');
- stream << std::setw(8) << info.usage_policy.consumer_set_mask;
- stream << std::setw(7) << std::setfill(' ') << "0x";
- stream << std::hex << std::setfill('0');
- stream << std::setw(8) << info.usage_policy.consumer_clear_mask;
- stream << std::setw(9) << std::setfill(' ') << "0x";
- stream << std::hex << std::setfill('0');
- stream << std::setw(8) << info.usage_policy.consumer_deny_set_mask;
- stream << std::setw(11) << std::setfill(' ') << "0x";
- stream << std::hex << std::setfill('0');
- stream << std::setw(8) << info.usage_policy.consumer_deny_clear_mask;
+ stream << std::setw(8) << info.usage_policy.usage_deny_clear_mask;
stream << std::hex << std::setfill('0');
stream << std::endl;
}
@@ -259,18 +241,16 @@
Status<void> BufferHubService::OnCreateBuffer(Message& message, uint32_t width,
uint32_t height, uint32_t format,
- uint64_t producer_usage,
- uint64_t consumer_usage,
+ uint64_t usage,
size_t meta_size_bytes,
size_t slice_count) {
// Use the producer channel id as the global buffer id.
const int buffer_id = message.GetChannelId();
ALOGD_IF(TRACE,
"BufferHubService::OnCreateBuffer: buffer_id=%d width=%u height=%u "
- "format=%u producer_usage=%" PRIx64 " consumer_usage=%" PRIx64
- " meta_size_bytes=%zu slice_count=%zu",
- buffer_id, width, height, format, producer_usage, consumer_usage,
- meta_size_bytes, slice_count);
+ "format=%u usage=%" PRIx64 " meta_size_bytes=%zu slice_count=%zu",
+ buffer_id, width, height, format, usage, meta_size_bytes,
+ slice_count);
// See if this channel is already attached to a buffer.
if (const auto channel = message.GetChannel<BufferHubChannel>()) {
@@ -280,8 +260,7 @@
}
auto status = ProducerChannel::Create(this, buffer_id, width, height, format,
- producer_usage, consumer_usage,
- meta_size_bytes, slice_count);
+ usage, meta_size_bytes, slice_count);
if (status) {
message.SetChannel(status.take());
return {};
@@ -294,16 +273,15 @@
Status<void> BufferHubService::OnCreatePersistentBuffer(
Message& message, const std::string& name, int user_id, int group_id,
- uint32_t width, uint32_t height, uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage, size_t meta_size_bytes, size_t slice_count) {
+ uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
+ size_t meta_size_bytes, size_t slice_count) {
const int channel_id = message.GetChannelId();
ALOGD_IF(TRACE,
"BufferHubService::OnCreatePersistentBuffer: channel_id=%d name=%s "
"user_id=%d group_id=%d width=%u height=%u format=%u "
- "producer_usage=%" PRIx64 " consumer_usage=%" PRIx64
- " meta_size_bytes=%zu slice_count=%zu",
+ "usage=%" PRIx64 " meta_size_bytes=%zu slice_count=%zu",
channel_id, name.c_str(), user_id, group_id, width, height, format,
- producer_usage, consumer_usage, meta_size_bytes, slice_count);
+ usage, meta_size_bytes, slice_count);
// See if this channel is already attached to a buffer.
if (const auto channel = message.GetChannel<BufferHubChannel>()) {
@@ -324,9 +302,8 @@
"not have permission to access named buffer: name=%s euid=%d egid=%d",
name.c_str(), euid, euid);
return ErrorStatus(EPERM);
- } else if (!buffer->CheckParameters(width, height, format, producer_usage,
- consumer_usage, meta_size_bytes,
- slice_count)) {
+ } else if (!buffer->CheckParameters(width, height, format, usage,
+ meta_size_bytes, slice_count)) {
ALOGE(
"BufferHubService::OnCreatePersistentBuffer: Requested an existing "
"buffer with different parameters: name=%s",
@@ -344,9 +321,9 @@
return {};
}
} else {
- auto status = ProducerChannel::Create(
- this, channel_id, width, height, format, producer_usage, consumer_usage,
- meta_size_bytes, slice_count);
+ auto status =
+ ProducerChannel::Create(this, channel_id, width, height, format, usage,
+ meta_size_bytes, slice_count);
if (!status) {
ALOGE("BufferHubService::OnCreateBuffer: Failed to create producer!!");
return status.error_status();
diff --git a/services/vr/bufferhubd/buffer_hub.h b/services/vr/bufferhubd/buffer_hub.h
index 4cb1eb9..817b01e 100644
--- a/services/vr/bufferhubd/buffer_hub.h
+++ b/services/vr/bufferhubd/buffer_hub.h
@@ -51,18 +51,16 @@
uint32_t width = 0;
uint32_t height = 0;
uint32_t format = 0;
- uint64_t producer_usage = 0;
- uint64_t consumer_usage = 0;
+ uint64_t usage = 0;
size_t slice_count = 0;
std::string name;
// Data filed for producer queue.
size_t capacity = 0;
- UsagePolicy usage_policy{0, 0, 0, 0, 0, 0, 0, 0};
+ UsagePolicy usage_policy{0, 0, 0, 0};
BufferInfo(int id, size_t consumer_count, uint32_t width, uint32_t height,
- uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage, size_t slice_count,
+ uint32_t format, uint64_t usage, size_t slice_count,
const std::string& name)
: id(id),
type(kProducerType),
@@ -70,8 +68,7 @@
width(width),
height(height),
format(format),
- producer_usage(producer_usage),
- consumer_usage(consumer_usage),
+ usage(usage),
slice_count(slice_count),
name(name) {}
@@ -159,16 +156,16 @@
std::unordered_map<std::string, std::shared_ptr<ProducerChannel>>
named_buffers_;
- pdx::Status<void> OnCreateBuffer(pdx::Message& message, uint32_t width, uint32_t height,
- uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage, size_t meta_size_bytes,
- size_t slice_count);
- pdx::Status<void> OnCreatePersistentBuffer(pdx::Message& message, const std::string& name,
- int user_id, int group_id, uint32_t width,
- uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage,
- size_t meta_size_bytes, size_t slice_count);
- pdx::Status<void> OnGetPersistentBuffer(pdx::Message& message, const std::string& name);
+ pdx::Status<void> OnCreateBuffer(pdx::Message& message, uint32_t width,
+ uint32_t height, uint32_t format,
+ uint64_t usage, size_t meta_size_bytes,
+ size_t slice_count);
+ pdx::Status<void> OnCreatePersistentBuffer(
+ pdx::Message& message, const std::string& name, int user_id, int group_id,
+ uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
+ size_t meta_size_bytes, size_t slice_count);
+ pdx::Status<void> OnGetPersistentBuffer(pdx::Message& message,
+ const std::string& name);
pdx::Status<QueueInfo> OnCreateProducerQueue(pdx::Message& message,
size_t meta_size_bytes,
const UsagePolicy& usage_policy);
diff --git a/services/vr/bufferhubd/producer_channel.cpp b/services/vr/bufferhubd/producer_channel.cpp
index c946a8d..e452d04 100644
--- a/services/vr/bufferhubd/producer_channel.cpp
+++ b/services/vr/bufferhubd/producer_channel.cpp
@@ -26,8 +26,7 @@
ProducerChannel::ProducerChannel(BufferHubService* service, int channel_id,
uint32_t width, uint32_t height,
- uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage,
+ uint32_t format, uint64_t usage,
size_t meta_size_bytes, size_t slice_count,
int* error)
: BufferHubChannel(service, channel_id, channel_id, kProducerType),
@@ -37,8 +36,7 @@
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, usage);
if (ret < 0) {
ALOGE("ProducerChannel::ProducerChannel: Failed to allocate buffer: %s",
strerror(-ret));
@@ -53,12 +51,12 @@
Status<std::shared_ptr<ProducerChannel>> ProducerChannel::Create(
BufferHubService* service, int channel_id, uint32_t width, uint32_t height,
- uint32_t format, uint64_t producer_usage, uint64_t consumer_usage,
- size_t meta_size_bytes, size_t slice_count) {
+ uint32_t format, uint64_t usage, size_t meta_size_bytes,
+ size_t slice_count) {
int error;
- std::shared_ptr<ProducerChannel> producer(new ProducerChannel(
- service, channel_id, width, height, format, producer_usage,
- consumer_usage, meta_size_bytes, slice_count, &error));
+ std::shared_ptr<ProducerChannel> producer(
+ new ProducerChannel(service, channel_id, width, height, format, usage,
+ meta_size_bytes, slice_count, &error));
if (error < 0)
return ErrorStatus(-error);
else
@@ -76,8 +74,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_.size(), name_);
+ slices_[0].usage(), slices_.size(), name_);
}
void ProducerChannel::HandleImpulse(Message& message) {
@@ -369,15 +366,12 @@
// Returns true if the given parameters match the underlying buffer parameters.
bool ProducerChannel::CheckParameters(uint32_t width, uint32_t height,
- uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage,
+ uint32_t format, uint64_t usage,
size_t meta_size_bytes,
size_t slice_count) {
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].format() == format && slices_[0].usage() == usage;
}
} // namespace dvr
diff --git a/services/vr/bufferhubd/producer_channel.h b/services/vr/bufferhubd/producer_channel.h
index f04c8a5..6de619d 100644
--- a/services/vr/bufferhubd/producer_channel.h
+++ b/services/vr/bufferhubd/producer_channel.h
@@ -32,8 +32,8 @@
static pdx::Status<std::shared_ptr<ProducerChannel>> Create(
BufferHubService* service, int channel_id, uint32_t width,
- uint32_t height, uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage, size_t meta_size_bytes, size_t slice_count);
+ uint32_t height, uint32_t format, uint64_t usage, size_t meta_size_bytes,
+ size_t slice_count);
~ProducerChannel() override;
@@ -62,8 +62,8 @@
bool CheckAccess(int euid, int egid);
bool CheckParameters(uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage,
- size_t meta_size_bytes, size_t slice_count);
+ uint64_t usage, size_t meta_size_bytes,
+ size_t slice_count);
pdx::Status<void> OnProducerMakePersistent(Message& message,
const std::string& name,
@@ -95,9 +95,8 @@
std::string name_;
ProducerChannel(BufferHubService* service, int channel, uint32_t width,
- uint32_t height, uint32_t format, uint64_t producer_usage,
- uint64_t consumer_usage, size_t meta_size_bytes,
- size_t slice_count, int* error);
+ uint32_t height, uint32_t format, uint64_t usage,
+ size_t meta_size_bytes, size_t slice_count, int* error);
pdx::Status<void> OnProducerPost(
Message& message, LocalFence acquire_fence,
diff --git a/services/vr/bufferhubd/producer_queue_channel.cpp b/services/vr/bufferhubd/producer_queue_channel.cpp
index dc2a47e..bd8eed8 100644
--- a/services/vr/bufferhubd/producer_queue_channel.cpp
+++ b/services/vr/bufferhubd/producer_queue_channel.cpp
@@ -34,19 +34,14 @@
const UsagePolicy& usage_policy) {
// Configuration between |usage_deny_set_mask| and |usage_deny_clear_mask|
// should be mutually exclusive.
- if ((usage_policy.producer_deny_set_mask &
- usage_policy.producer_deny_clear_mask) ||
- (usage_policy.consumer_deny_set_mask &
- usage_policy.consumer_deny_clear_mask)) {
+ if ((usage_policy.usage_deny_set_mask &
+ usage_policy.usage_deny_clear_mask)) {
ALOGE(
"BufferHubService::OnCreateProducerQueue: illegal usage mask "
- "configuration: producer_deny_set_mask=%" PRIx64
- " producer_deny_clear_mask=%" PRIx64 " consumer_deny_set_mask=%" PRIx64
- " consumer_deny_clear_mask=%" PRIx64,
- usage_policy.producer_deny_set_mask,
- usage_policy.producer_deny_clear_mask,
- usage_policy.consumer_deny_set_mask,
- usage_policy.consumer_deny_clear_mask);
+ "configuration: usage_deny_set_mask=%" PRIx64
+ " usage_deny_clear_mask=%" PRIx64,
+ usage_policy.usage_deny_set_mask,
+ usage_policy.usage_deny_clear_mask);
return ErrorStatus(EINVAL);
}
@@ -134,8 +129,7 @@
Status<std::vector<std::pair<RemoteChannelHandle, size_t>>>
ProducerQueueChannel::OnProducerQueueAllocateBuffers(
Message& message, uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage, size_t slice_count,
- size_t buffer_count) {
+ uint64_t usage, size_t slice_count, size_t buffer_count) {
ATRACE_NAME("ProducerQueueChannel::OnProducerQueueAllocateBuffers");
ALOGD_IF(TRACE,
"ProducerQueueChannel::OnProducerQueueAllocateBuffers: "
@@ -145,58 +139,32 @@
std::vector<std::pair<RemoteChannelHandle, size_t>> buffer_handles;
// Deny buffer allocation violating preset rules.
- if (producer_usage & usage_policy_.producer_deny_set_mask) {
+ if (usage & usage_policy_.usage_deny_set_mask) {
ALOGE(
- "ProducerQueueChannel::OnProducerQueueAllocateBuffers: producer_usage: "
- "%" PRIx64
- " is not permitted. Violating producer_deny_set_mask, the following "
- "bits shall not be set: %" PRIx64 ".",
- producer_usage, usage_policy_.producer_deny_set_mask);
+ "ProducerQueueChannel::OnProducerQueueAllocateBuffers: usage: %" PRIx64
+ " is not permitted. Violating usage_deny_set_mask, the following bits "
+ "shall not be set: %" PRIx64 ".",
+ usage, usage_policy_.usage_deny_set_mask);
return ErrorStatus(EINVAL);
}
- if (consumer_usage & usage_policy_.consumer_deny_set_mask) {
+ if (~usage & usage_policy_.usage_deny_clear_mask) {
ALOGE(
- "ProducerQueueChannel::OnProducerQueueAllocateBuffers: consumer_usage: "
- "%" PRIx64
- " is not permitted. Violating consumer_deny_set_mask, the following "
- "bits shall not be set: %" PRIx64 ".",
- consumer_usage, usage_policy_.consumer_deny_set_mask);
- return ErrorStatus(EINVAL);
- }
-
- if (~producer_usage & usage_policy_.producer_deny_clear_mask) {
- ALOGE(
- "ProducerQueueChannel::OnProducerQueueAllocateBuffers: producer_usage: "
- "%" PRIx64
- " is not permitted. Violating producer_deny_clear_mask, the following "
+ "ProducerQueueChannel::OnProducerQueueAllocateBuffers: usage: %" PRIx64
+ " is not permitted. Violating usage_deny_clear_mask, the following "
"bits must be set: %" PRIx64 ".",
- producer_usage, usage_policy_.producer_deny_clear_mask);
+ usage, usage_policy_.usage_deny_clear_mask);
return ErrorStatus(EINVAL);
}
- if (~consumer_usage & usage_policy_.consumer_deny_clear_mask) {
- ALOGE(
- "ProducerQueueChannel::OnProducerQueueAllocateBuffers: consumer_usage: "
- "%" PRIx64
- " is not permitted. Violating consumer_deny_clear_mask, the following "
- "bits must be set: %" PRIx64 ".",
- consumer_usage, usage_policy_.consumer_deny_clear_mask);
- return ErrorStatus(EINVAL);
- }
- // Force set mask and clear mask. Note that |usage_policy_.X_set_mask_| takes
- // precedence and will overwrite |usage_policy_.X_clear_mask|.
- uint64_t effective_producer_usage =
- (producer_usage & ~usage_policy_.producer_clear_mask) |
- usage_policy_.producer_set_mask;
- uint64_t effective_consumer_usage =
- (consumer_usage & ~usage_policy_.consumer_clear_mask) |
- usage_policy_.consumer_set_mask;
+ // Force set mask and clear mask. Note that |usage_policy_.usage_set_mask_|
+ // takes precedence and will overwrite |usage_policy_.usage_clear_mask|.
+ uint64_t effective_usage =
+ (usage & ~usage_policy_.usage_clear_mask) | usage_policy_.usage_set_mask;
for (size_t i = 0; i < buffer_count; i++) {
- auto status =
- AllocateBuffer(message, width, height, format, effective_producer_usage,
- effective_consumer_usage, slice_count);
+ auto status = AllocateBuffer(message, width, height, format,
+ effective_usage, slice_count);
if (!status) {
ALOGE(
"ProducerQueueChannel::OnProducerQueueAllocateBuffers: Failed to "
@@ -212,9 +180,7 @@
Status<std::pair<RemoteChannelHandle, size_t>>
ProducerQueueChannel::AllocateBuffer(Message& message, uint32_t width,
uint32_t height, uint32_t format,
- uint64_t producer_usage,
- uint64_t consumer_usage,
- size_t slice_count) {
+ uint64_t usage, size_t slice_count) {
ATRACE_NAME("ProducerQueueChannel::AllocateBuffer");
ALOGD_IF(TRACE,
"ProducerQueueChannel::AllocateBuffer: producer_channel_id=%d",
@@ -239,15 +205,13 @@
ALOGD_IF(TRACE,
"ProducerQueueChannel::AllocateBuffer: buffer_id=%d width=%u "
- "height=%u format=%u producer_usage=%" PRIx64
- " consumer_usage=%" PRIx64 " slice_count=%zu",
- buffer_id, width, height, format, producer_usage, consumer_usage,
- slice_count);
+ "height=%u format=%u usage=%" PRIx64 " slice_count=%zu",
+ buffer_id, width, height, format, usage, slice_count);
auto buffer_handle = status.take();
- auto producer_channel_status = ProducerChannel::Create(
- service(), buffer_id, width, height, format, producer_usage,
- consumer_usage, meta_size_bytes_, slice_count);
+ auto producer_channel_status =
+ ProducerChannel::Create(service(), buffer_id, width, height, format,
+ usage, meta_size_bytes_, slice_count);
if (!producer_channel_status) {
ALOGE(
"ProducerQueueChannel::AllocateBuffer: Failed to create producer "
diff --git a/services/vr/bufferhubd/producer_queue_channel.h b/services/vr/bufferhubd/producer_queue_channel.h
index 09b0243..13c9ddc 100644
--- a/services/vr/bufferhubd/producer_queue_channel.h
+++ b/services/vr/bufferhubd/producer_queue_channel.h
@@ -35,8 +35,7 @@
pdx::Status<std::vector<std::pair<pdx::RemoteChannelHandle, size_t>>>
OnProducerQueueAllocateBuffers(pdx::Message& message, uint32_t width,
uint32_t height, uint32_t format,
- uint64_t producer_usage,
- uint64_t consumer_usage, size_t slice_count,
+ uint64_t usage, size_t slice_count,
size_t buffer_count);
// Detach a BufferHubProducer indicated by |slot|. Note that the buffer must
@@ -59,7 +58,7 @@
// allocated buffer.
pdx::Status<std::pair<pdx::RemoteChannelHandle, size_t>> AllocateBuffer(
pdx::Message& message, uint32_t width, uint32_t height, uint32_t format,
- uint64_t producer_usage, uint64_t consumer_usage, size_t slice_count);
+ uint64_t usage, size_t slice_count);
// Size of the meta data associated with all the buffers allocated from the
// queue. Now we assume the metadata size is immutable once the queue is