Merge "Fix query management in GpuProfiler" into oc-dev
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 63afdcd..facb189 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -67,14 +67,6 @@
return unique_fd(-1);
}
-static const char* parse_null(const char* arg) {
- if (strcmp(arg, "!") == 0) {
- return nullptr;
- } else {
- return arg;
- }
-}
-
static bool clear_profile(const std::string& profile) {
unique_fd ufd(open(profile.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC));
if (ufd.get() < 0) {
@@ -1863,20 +1855,5 @@
return return_value_oat && return_value_art;
}
-int dexopt(const char* const params[DEXOPT_PARAM_COUNT]) {
- return dexopt(params[0], // apk_path
- atoi(params[1]), // uid
- params[2], // pkgname
- params[3], // instruction_set
- atoi(params[4]), // dexopt_needed
- params[5], // oat_dir
- atoi(params[6]), // dexopt_flags
- params[7], // compiler_filter
- parse_null(params[8]), // volume_uuid
- parse_null(params[9]), // shared_libraries
- parse_null(params[10])); // se_info
- static_assert(DEXOPT_PARAM_COUNT == 11U, "Unexpected dexopt param count");
-}
-
} // namespace installd
} // namespace android
diff --git a/cmds/installd/dexopt.h b/cmds/installd/dexopt.h
index 88144b7..355adb1 100644
--- a/cmds/installd/dexopt.h
+++ b/cmds/installd/dexopt.h
@@ -62,12 +62,6 @@
int dexopt_needed, const char* oat_dir, int dexopt_flags, const char* compiler_filter,
const char* volume_uuid, const char* shared_libraries, const char* se_info);
-static constexpr size_t DEXOPT_PARAM_COUNT = 11U;
-static_assert(DEXOPT_PARAM_COUNT == 11U, "Unexpected dexopt param size");
-
-// Helper for the above, converting arguments.
-int dexopt(const char* const params[DEXOPT_PARAM_COUNT]);
-
} // namespace installd
} // namespace android
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp
index e8e6b56..78eadf2 100644
--- a/cmds/installd/otapreopt.cpp
+++ b/cmds/installd/otapreopt.cpp
@@ -16,6 +16,7 @@
#include <algorithm>
#include <inttypes.h>
+#include <limits>
#include <random>
#include <regex>
#include <selinux/android.h>
@@ -40,6 +41,7 @@
#include "dexopt.h"
#include "file_parsing.h"
#include "globals.h"
+#include "installd_constants.h"
#include "installd_deps.h" // Need to fill in requirements of commands.
#include "otapreopt_utils.h"
#include "system_properties.h"
@@ -145,6 +147,20 @@
private:
+ struct Parameters {
+ const char *apk_path;
+ uid_t uid;
+ const char *pkgName;
+ const char *instruction_set;
+ int dexopt_needed;
+ const char* oat_dir;
+ int dexopt_flags;
+ const char* compiler_filter;
+ const char* volume_uuid;
+ const char* shared_libraries;
+ const char* se_info;
+ };
+
bool ReadSystemProperties() {
static constexpr const char* kPropertyFiles[] = {
"/default.prop", "/system/build.prop"
@@ -246,15 +262,23 @@
return true;
}
- bool ReadArguments(int argc ATTRIBUTE_UNUSED, char** argv) {
- // Expected command line:
- // target-slot dexopt {DEXOPT_PARAMETERS}
- // The DEXOPT_PARAMETERS are passed on to dexopt(), so we expect DEXOPT_PARAM_COUNT
- // of them. We store them in package_parameters_ (size checks are done when
- // parsing the special parameters and when copying into package_parameters_.
+ bool ParseUInt(const char* in, uint32_t* out) {
+ char* end;
+ long long int result = strtoll(in, &end, 0);
+ if (in == end || *end != '\0') {
+ return false;
+ }
+ if (result < std::numeric_limits<uint32_t>::min() ||
+ std::numeric_limits<uint32_t>::max() < result) {
+ return false;
+ }
+ *out = static_cast<uint32_t>(result);
+ return true;
+ }
- static_assert(DEXOPT_PARAM_COUNT == ARRAY_SIZE(package_parameters_),
- "Unexpected dexopt param count");
+ bool ReadArguments(int argc, char** argv) {
+ // Expected command line:
+ // target-slot [version] dexopt {DEXOPT_PARAMETERS}
const char* target_slot_arg = argv[1];
if (target_slot_arg == nullptr) {
@@ -268,28 +292,230 @@
return false;
}
- // Check for "dexopt" next.
+ // Check for version or "dexopt" next.
+ if (argv[2] == nullptr) {
+ LOG(ERROR) << "Missing parameters";
+ return false;
+ }
+
+ if (std::string("dexopt").compare(argv[2]) == 0) {
+ // This is version 1 (N) or pre-versioning version 2.
+ constexpr int kV2ArgCount = 1 // "otapreopt"
+ + 1 // slot
+ + 1 // "dexopt"
+ + 1 // apk_path
+ + 1 // uid
+ + 1 // pkg
+ + 1 // isa
+ + 1 // dexopt_needed
+ + 1 // oat_dir
+ + 1 // dexopt_flags
+ + 1 // filter
+ + 1 // volume
+ + 1 // libs
+ + 1 // seinfo
+ + 1; // null
+ if (argc == kV2ArgCount) {
+ return ReadArgumentsV2(argc, argv, false);
+ } else {
+ return ReadArgumentsV1(argc, argv);
+ }
+ }
+
+ uint32_t version;
+ if (!ParseUInt(argv[2], &version)) {
+ LOG(ERROR) << "Could not parse version: " << argv[2];
+ return false;
+ }
+
+ switch (version) {
+ case 2:
+ return ReadArgumentsV2(argc, argv, true);
+
+ default:
+ LOG(ERROR) << "Unsupported version " << version;
+ return false;
+ }
+ }
+
+ bool ReadArgumentsV2(int argc ATTRIBUTE_UNUSED, char** argv, bool versioned) {
+ size_t dexopt_index = versioned ? 3 : 2;
+
+ // Check for "dexopt".
+ if (argv[dexopt_index] == nullptr) {
+ LOG(ERROR) << "Missing parameters";
+ return false;
+ }
+ if (std::string("dexopt").compare(argv[dexopt_index]) != 0) {
+ LOG(ERROR) << "Expected \"dexopt\"";
+ return false;
+ }
+
+ size_t param_index = 0;
+ for (;; ++param_index) {
+ const char* param = argv[dexopt_index + 1 + param_index];
+ if (param == nullptr) {
+ break;
+ }
+
+ switch (param_index) {
+ case 0:
+ package_parameters_.apk_path = param;
+ break;
+
+ case 1:
+ package_parameters_.uid = atoi(param);
+ break;
+
+ case 2:
+ package_parameters_.pkgName = param;
+ break;
+
+ case 3:
+ package_parameters_.instruction_set = param;
+ break;
+
+ case 4:
+ package_parameters_.dexopt_needed = atoi(param);
+ break;
+
+ case 5:
+ package_parameters_.oat_dir = param;
+ break;
+
+ case 6:
+ package_parameters_.dexopt_flags = atoi(param);
+ break;
+
+ case 7:
+ package_parameters_.compiler_filter = param;
+ break;
+
+ case 8:
+ package_parameters_.volume_uuid = ParseNull(param);
+ break;
+
+ case 9:
+ package_parameters_.shared_libraries = ParseNull(param);
+ break;
+
+ case 10:
+ package_parameters_.se_info = ParseNull(param);
+ break;
+
+ default:
+ LOG(ERROR) << "Too many arguments, got " << param;
+ return false;
+ }
+ }
+
+ if (param_index != 11) {
+ LOG(ERROR) << "Not enough parameters";
+ return false;
+ }
+
+ return true;
+ }
+
+ static int ReplaceMask(int input, int old_mask, int new_mask) {
+ return (input & old_mask) != 0 ? new_mask : 0;
+ }
+
+ bool ReadArgumentsV1(int argc ATTRIBUTE_UNUSED, char** argv) {
+ // Check for "dexopt".
if (argv[2] == nullptr) {
LOG(ERROR) << "Missing parameters";
return false;
}
if (std::string("dexopt").compare(argv[2]) != 0) {
- LOG(ERROR) << "Second parameter not dexopt: " << argv[2];
+ LOG(ERROR) << "Expected \"dexopt\"";
return false;
}
- // Copy the rest into package_parameters_, but be careful about over- and underflow.
- size_t index = 0;
- while (index < DEXOPT_PARAM_COUNT &&
- argv[index + 3] != nullptr) {
- package_parameters_[index] = argv[index + 3];
- index++;
+ size_t param_index = 0;
+ for (;; ++param_index) {
+ const char* param = argv[3 + param_index];
+ if (param == nullptr) {
+ break;
+ }
+
+ switch (param_index) {
+ case 0:
+ package_parameters_.apk_path = param;
+ break;
+
+ case 1:
+ package_parameters_.uid = atoi(param);
+ break;
+
+ case 2:
+ package_parameters_.pkgName = param;
+ break;
+
+ case 3:
+ package_parameters_.instruction_set = param;
+ break;
+
+ case 4: {
+ // Version 1 had:
+ // DEXOPT_DEX2OAT_NEEDED = 1
+ // DEXOPT_PATCHOAT_NEEDED = 2
+ // DEXOPT_SELF_PATCHOAT_NEEDED = 3
+ // We will simply use DEX2OAT_FROM_SCRATCH.
+ package_parameters_.dexopt_needed = DEX2OAT_FROM_SCRATCH;
+ break;
+ }
+
+ case 5:
+ package_parameters_.oat_dir = param;
+ break;
+
+ case 6: {
+ // Version 1 had:
+ constexpr int OLD_DEXOPT_PUBLIC = 1 << 1;
+ constexpr int OLD_DEXOPT_SAFEMODE = 1 << 2;
+ constexpr int OLD_DEXOPT_DEBUGGABLE = 1 << 3;
+ constexpr int OLD_DEXOPT_BOOTCOMPLETE = 1 << 4;
+ constexpr int OLD_DEXOPT_PROFILE_GUIDED = 1 << 5;
+ constexpr int OLD_DEXOPT_OTA = 1 << 6;
+ int input = atoi(param);
+ package_parameters_.dexopt_flags =
+ ReplaceMask(input, OLD_DEXOPT_PUBLIC, DEXOPT_PUBLIC) |
+ ReplaceMask(input, OLD_DEXOPT_SAFEMODE, DEXOPT_SAFEMODE) |
+ ReplaceMask(input, OLD_DEXOPT_DEBUGGABLE, DEXOPT_DEBUGGABLE) |
+ ReplaceMask(input, OLD_DEXOPT_BOOTCOMPLETE, DEXOPT_BOOTCOMPLETE) |
+ ReplaceMask(input, OLD_DEXOPT_PROFILE_GUIDED, DEXOPT_PROFILE_GUIDED) |
+ ReplaceMask(input, OLD_DEXOPT_OTA, 0);
+ break;
+ }
+
+ case 7:
+ package_parameters_.compiler_filter = param;
+ break;
+
+ case 8:
+ package_parameters_.volume_uuid = ParseNull(param);
+ break;
+
+ case 9:
+ package_parameters_.shared_libraries = ParseNull(param);
+ break;
+
+ default:
+ LOG(ERROR) << "Too many arguments, got " << param;
+ return false;
+ }
}
- if (index != ARRAY_SIZE(package_parameters_) || argv[index + 3] != nullptr) {
- LOG(ERROR) << "Wrong number of parameters";
+
+ if (param_index != 10) {
+ LOG(ERROR) << "Not enough parameters";
return false;
}
+ // Set se_info to null. It is only relevant for secondary dex files, which we won't
+ // receive from a v1 A side.
+ package_parameters_.se_info = nullptr;
+
return true;
}
@@ -306,11 +532,11 @@
// Ensure that we have the right boot image. The first time any app is
// compiled, we'll try to generate it.
bool PrepareBootImage(bool force) const {
- if (package_parameters_[kISAIndex] == nullptr) {
+ if (package_parameters_.instruction_set == nullptr) {
LOG(ERROR) << "Instruction set missing.";
return false;
}
- const char* isa = package_parameters_[kISAIndex];
+ const char* isa = package_parameters_.instruction_set;
// Check whether the file exists where expected.
std::string dalvik_cache = GetOTADataDirectory() + "/" + DALVIK_CACHE;
@@ -536,14 +762,12 @@
// (This is ugly as it's the only thing where we need to understand the contents
// of package_parameters_, but it beats postponing the decision or using the call-
// backs to do weird things.)
- constexpr size_t kApkPathIndex = 0;
- CHECK_GT(DEXOPT_PARAM_COUNT, kApkPathIndex);
- CHECK(package_parameters_[kApkPathIndex] != nullptr);
- if (StartsWith(package_parameters_[kApkPathIndex], android_root_.c_str())) {
- const char* last_slash = strrchr(package_parameters_[kApkPathIndex], '/');
+ const char* apk_path = package_parameters_.apk_path;
+ CHECK(apk_path != nullptr);
+ if (StartsWith(apk_path, android_root_.c_str())) {
+ const char* last_slash = strrchr(apk_path, '/');
if (last_slash != nullptr) {
- std::string path(package_parameters_[kApkPathIndex],
- last_slash - package_parameters_[kApkPathIndex] + 1);
+ std::string path(apk_path, last_slash - apk_path + 1);
CHECK(EndsWith(path, "/"));
path = path + "oat";
if (access(path.c_str(), F_OK) == 0) {
@@ -557,9 +781,8 @@
// partition will not be available and fail to build. This is problematic, as
// this tool will wipe the OTA artifact cache and try again (for robustness after
// a failed OTA with remaining cache artifacts).
- if (access(package_parameters_[kApkPathIndex], F_OK) != 0) {
- LOG(WARNING) << "Skipping preopt of non-existing package "
- << package_parameters_[kApkPathIndex];
+ if (access(apk_path, F_OK) != 0) {
+ LOG(WARNING) << "Skipping preopt of non-existing package " << apk_path;
return true;
}
@@ -571,7 +794,17 @@
return 0;
}
- int dexopt_result = dexopt(package_parameters_);
+ int dexopt_result = dexopt(package_parameters_.apk_path,
+ package_parameters_.uid,
+ package_parameters_.pkgName,
+ package_parameters_.instruction_set,
+ package_parameters_.dexopt_needed,
+ package_parameters_.oat_dir,
+ package_parameters_.dexopt_flags,
+ package_parameters_.compiler_filter,
+ package_parameters_.volume_uuid,
+ package_parameters_.shared_libraries,
+ package_parameters_.se_info);
if (dexopt_result == 0) {
return 0;
}
@@ -590,7 +823,17 @@
}
LOG(WARNING) << "Original dexopt failed, re-trying after boot image was regenerated.";
- return dexopt(package_parameters_);
+ return dexopt(package_parameters_.apk_path,
+ package_parameters_.uid,
+ package_parameters_.pkgName,
+ package_parameters_.instruction_set,
+ package_parameters_.dexopt_needed,
+ package_parameters_.oat_dir,
+ package_parameters_.dexopt_flags,
+ package_parameters_.compiler_filter,
+ package_parameters_.volume_uuid,
+ package_parameters_.shared_libraries,
+ package_parameters_.se_info);
}
////////////////////////////////////
@@ -720,7 +963,7 @@
std::string boot_classpath_;
std::string asec_mountpoint_;
- const char* package_parameters_[DEXOPT_PARAM_COUNT];
+ Parameters package_parameters_;
// Store environment values we need to set.
std::vector<std::string> environ_;
diff --git a/cmds/installd/otapreopt_chroot.cpp b/cmds/installd/otapreopt_chroot.cpp
index cec8f68..2030997 100644
--- a/cmds/installd/otapreopt_chroot.cpp
+++ b/cmds/installd/otapreopt_chroot.cpp
@@ -27,7 +27,6 @@
#include "installd_constants.h"
#include "otapreopt_utils.h"
-#include "dexopt.h"
#ifndef LOG_TAG
#define LOG_TAG "otapreopt"
@@ -137,44 +136,18 @@
// Now go on and run otapreopt.
- // Incoming: cmd + status-fd + target-slot + "dexopt" + dexopt-params + null
- // Outgoing: cmd + target-slot + "dexopt" + dexopt-params + null
- constexpr size_t kInArguments = 1 // Binary name.
- + 1 // status file descriptor.
- + 1 // target-slot.
- + 1 // "dexopt."
- + DEXOPT_PARAM_COUNT // dexopt parameters.
- + 1; // null termination.
- constexpr size_t kOutArguments = 1 // Binary name.
- + 1 // target-slot.
- + 1 // "dexopt."
- + DEXOPT_PARAM_COUNT // dexopt parameters.
- + 1; // null termination.
- const char* argv[kOutArguments];
- if (static_cast<size_t>(argc) != kInArguments - 1 /* null termination */) {
- LOG(ERROR) << "Unexpected argument size "
- << argc
- << " vs "
- << (kInArguments - 1);
- for (size_t i = 0; i < static_cast<size_t>(argc); ++i) {
- if (arg[i] == nullptr) {
- LOG(ERROR) << "(null)";
- } else {
- LOG(ERROR) << "\"" << arg[i] << "\"";
- }
- }
- exit(206);
- }
+ // Incoming: cmd + status-fd + target-slot + cmd... + null | Incoming | = argc + 1
+ // Outgoing: cmd + target-slot + cmd... + null | Outgoing | = argc
+ const char** argv = new const char*[argc];
+
argv[0] = "/system/bin/otapreopt";
// The first parameter is the status file descriptor, skip.
-
- for (size_t i = 1; i <= kOutArguments - 2 /* cmd + null */; ++i) {
- argv[i] = arg[i + 1];
+ for (size_t i = 2; i <= static_cast<size_t>(argc); ++i) {
+ argv[i - 1] = arg[i];
}
- argv[kOutArguments - 1] = nullptr;
- execv(argv[0], (char * const *)argv);
+ execv(argv[0], static_cast<char * const *>(const_cast<char**>(argv)));
PLOG(ERROR) << "execv(OTAPREOPT) failed.";
exit(99);
}
diff --git a/libs/nativewindow/AHardwareBuffer.cpp b/libs/nativewindow/AHardwareBuffer.cpp
index 5812831..35b76c7 100644
--- a/libs/nativewindow/AHardwareBuffer.cpp
+++ b/libs/nativewindow/AHardwareBuffer.cpp
@@ -16,7 +16,7 @@
#define LOG_TAG "AHardwareBuffer"
-#include <android/hardware_buffer.h>
+#include <vndk/hardware_buffer.h>
#include <errno.h>
#include <sys/socket.h>
@@ -261,7 +261,12 @@
return NO_ERROR;
}
-const struct native_handle* AHardwareBuffer_getNativeHandle(
+
+// ----------------------------------------------------------------------------
+// VNDK functions
+// ----------------------------------------------------------------------------
+
+const native_handle_t* AHardwareBuffer_getNativeHandle(
const AHardwareBuffer* buffer) {
if (!buffer) return nullptr;
const GraphicBuffer* gbuffer = AHardwareBuffer_to_GraphicBuffer(buffer);
diff --git a/libs/nativewindow/include/android/hardware_buffer.h b/libs/nativewindow/include/android/hardware_buffer.h
index e5b6853..02838d4 100644
--- a/libs/nativewindow/include/android/hardware_buffer.h
+++ b/libs/nativewindow/include/android/hardware_buffer.h
@@ -252,12 +252,6 @@
*/
int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd, AHardwareBuffer** outBuffer);
-// ----------------------------------------------------------------------------
-// Everything below here is part of the public NDK API, but is intended only
-// for use by device-specific graphics drivers.
-struct native_handle;
-const struct native_handle* AHardwareBuffer_getNativeHandle(const AHardwareBuffer* buffer);
-
__END_DECLS
#endif // ANDROID_HARDWARE_BUFFER_H
diff --git a/libs/nativewindow/include/vndk/hardware_buffer.h b/libs/nativewindow/include/vndk/hardware_buffer.h
new file mode 100644
index 0000000..dc2dcbe
--- /dev/null
+++ b/libs/nativewindow/include/vndk/hardware_buffer.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_VNDK_NATIVEWINDOW_AHARDWAREBUFFER_H
+#define ANDROID_VNDK_NATIVEWINDOW_AHARDWAREBUFFER_H
+
+// vndk is a superset of the NDK
+#include <android/hardware_buffer.h>
+
+#include <cutils/native_handle.h>
+
+__BEGIN_DECLS
+
+const native_handle_t* AHardwareBuffer_getNativeHandle(const AHardwareBuffer* buffer);
+
+__END_DECLS
+
+#endif /* ANDROID_VNDK_NATIVEWINDOW_AHARDWAREBUFFER_H */
diff --git a/libs/nativewindow/libnativewindow.map.txt b/libs/nativewindow/libnativewindow.map.txt
index b29c888..b1d1a72 100644
--- a/libs/nativewindow/libnativewindow.map.txt
+++ b/libs/nativewindow/libnativewindow.map.txt
@@ -4,7 +4,6 @@
AHardwareBuffer_allocate;
AHardwareBuffer_describe;
AHardwareBuffer_fromHardwareBuffer;
- AHardwareBuffer_getNativeHandle;
AHardwareBuffer_lock;
AHardwareBuffer_recvHandleFromUnixSocket;
AHardwareBuffer_release;
diff --git a/libs/nativewindow/tests/c_compatibility.c b/libs/nativewindow/tests/c_compatibility.c
index a0dfdf9..befd88f 100644
--- a/libs/nativewindow/tests/c_compatibility.c
+++ b/libs/nativewindow/tests/c_compatibility.c
@@ -16,6 +16,7 @@
#include <android/hardware_buffer.h>
#include <android/native_window.h>
+#include <vndk/hardware_buffer.h>
#include <vndk/window.h>
// this checks that all these headers are C-compatible
diff --git a/libs/vr/libdvr/display_manager_client.cpp b/libs/vr/libdvr/display_manager_client.cpp
index 8d84f7b..64c7f16 100644
--- a/libs/vr/libdvr/display_manager_client.cpp
+++ b/libs/vr/libdvr/display_manager_client.cpp
@@ -1,6 +1,7 @@
#include "include/dvr/display_manager_client.h"
#include <dvr/dvr_buffer.h>
+#include <private/android/AHardwareBufferHelpers.h>
#include <private/dvr/buffer_hub_client.h>
#include <private/dvr/display_manager_client_impl.h>
@@ -44,10 +45,11 @@
DvrBuffer* dvrDisplayManagerSetupNamedBuffer(DvrDisplayManagerClient* client,
const char* name, size_t size,
- uint64_t producer_usage,
- uint64_t consumer_usage) {
- // TODO(hendrikw): When we move to gralloc1, pass both producer_usage and
- // consumer_usage down.
+ uint64_t usage0, uint64_t usage1) {
+ uint64_t producer_usage = 0;
+ uint64_t consumer_usage = 0;
+ android::AHardwareBuffer_convertToGrallocUsageBits(
+ &producer_usage, &consumer_usage, usage0, usage1);
auto ion_buffer = client->client->SetupNamedBuffer(name, size, producer_usage,
consumer_usage);
if (ion_buffer) {
diff --git a/libs/vr/libdvr/dvr_api.cpp b/libs/vr/libdvr/dvr_api.cpp
index 5dc4a1b..c4634b1 100644
--- a/libs/vr/libdvr/dvr_api.cpp
+++ b/libs/vr/libdvr/dvr_api.cpp
@@ -53,14 +53,18 @@
dvr_api->write_buffer_post = dvrWriteBufferPost;
dvr_api->write_buffer_gain = dvrWriteBufferGain;
dvr_api->write_buffer_gain_async = dvrWriteBufferGainAsync;
+ dvr_api->write_buffer_get_native_handle = dvrWriteBufferGetNativeHandle;
dvr_api->read_buffer_destroy = dvrReadBufferDestroy;
dvr_api->read_buffer_get_ahardwarebuffer = dvrReadBufferGetAHardwareBuffer;
dvr_api->read_buffer_acquire = dvrReadBufferAcquire;
dvr_api->read_buffer_release = dvrReadBufferRelease;
dvr_api->read_buffer_release_async = dvrReadBufferReleaseAsync;
+ dvr_api->read_buffer_get_native_handle = dvrReadBufferGetNativeHandle;
+
dvr_api->buffer_destroy = dvrBufferDestroy;
dvr_api->buffer_get_ahardwarebuffer = dvrBufferGetAHardwareBuffer;
+ dvr_api->buffer_get_native_handle = dvrBufferGetNativeHandle;
// dvr_buffer_queue.h
dvr_api->write_buffer_queue_destroy = dvrWriteBufferQueueDestroy;
diff --git a/libs/vr/libdvr/dvr_buffer.cpp b/libs/vr/libdvr/dvr_buffer.cpp
index 0942b3d..e7fdb91 100644
--- a/libs/vr/libdvr/dvr_buffer.cpp
+++ b/libs/vr/libdvr/dvr_buffer.cpp
@@ -136,4 +136,18 @@
return 0;
}
+const struct native_handle* dvrWriteBufferGetNativeHandle(
+ DvrWriteBuffer* write_buffer) {
+ return write_buffer->write_buffer->native_handle();
+}
+
+const struct native_handle* dvrReadBufferGetNativeHandle(
+ DvrReadBuffer* read_buffer) {
+ return read_buffer->read_buffer->native_handle();
+}
+
+const struct native_handle* dvrBufferGetNativeHandle(DvrBuffer* buffer) {
+ return buffer->buffer->handle();
+}
+
} // extern "C"
diff --git a/libs/vr/libdvr/include/dvr/display_manager_client.h b/libs/vr/libdvr/include/dvr/display_manager_client.h
index 4e1f227..8cd948c 100644
--- a/libs/vr/libdvr/include/dvr/display_manager_client.h
+++ b/libs/vr/libdvr/include/dvr/display_manager_client.h
@@ -22,8 +22,7 @@
DvrBuffer* dvrDisplayManagerSetupNamedBuffer(DvrDisplayManagerClient* client,
const char* name, size_t size,
- uint64_t producer_usage,
- uint64_t consumer_usage);
+ uint64_t usage0, uint64_t usage1);
// Return an event fd for checking if there was an event on the server
// Note that the only event which will be flagged is POLLIN. You must use
diff --git a/libs/vr/libdvr/include/dvr/dvr_api.h b/libs/vr/libdvr/include/dvr/dvr_api.h
index a69433d..56f937b 100644
--- a/libs/vr/libdvr/include/dvr/dvr_api.h
+++ b/libs/vr/libdvr/include/dvr/dvr_api.h
@@ -38,6 +38,8 @@
typedef struct DvrSurface DvrSurface;
+struct native_handle;
+
// display_manager_client.h
typedef int (*DvrDisplayManagerClientGetSurfaceListPtr)(
DvrDisplayManagerClient* client,
@@ -46,7 +48,7 @@
DvrDisplayManagerClientSurfaceList* surface_list);
typedef DvrBuffer* (*DvrDisplayManagerSetupNamedBufferPtr)(
DvrDisplayManagerClient* client, const char* name, size_t size,
- uint64_t producer_usage, uint64_t consumer_usage);
+ uint64_t usage0, uint64_t usage1);
typedef size_t (*DvrDisplayManagerClientSurfaceListGetSizePtr)(
DvrDisplayManagerClientSurfaceList* surface_list);
typedef int (*DvrDisplayManagerClientSurfaceListGetSurfaceIdPtr)(
@@ -70,6 +72,8 @@
typedef int (*DvrWriteBufferGainPtr)(DvrWriteBuffer* client,
int* release_fence_fd);
typedef int (*DvrWriteBufferGainAsyncPtr)(DvrWriteBuffer* client);
+typedef const struct native_handle* (*DvrWriteBufferGetNativeHandle)(
+ DvrWriteBuffer* write_buffer);
typedef void (*DvrReadBufferDestroyPtr)(DvrReadBuffer* client);
typedef int (*DvrReadBufferGetAHardwareBufferPtr)(
@@ -80,9 +84,14 @@
typedef int (*DvrReadBufferReleasePtr)(DvrReadBuffer* client,
int release_fence_fd);
typedef int (*DvrReadBufferReleaseAsyncPtr)(DvrReadBuffer* client);
+typedef const struct native_handle* (*DvrReadBufferGetNativeHandle)(
+ DvrReadBuffer* read_buffer);
+
typedef void (*DvrBufferDestroy)(DvrBuffer* buffer);
typedef int (*DvrBufferGetAHardwareBuffer)(DvrBuffer* buffer,
AHardwareBuffer** hardware_buffer);
+typedef const struct native_handle* (*DvrBufferGetNativeHandle)(
+ DvrBuffer* buffer);
// dvr_buffer_queue.h
typedef void (*DvrWriteBufferQueueDestroyPtr)(DvrWriteBufferQueue* write_queue);
@@ -238,6 +247,7 @@
DvrWriteBufferPostPtr write_buffer_post;
DvrWriteBufferGainPtr write_buffer_gain;
DvrWriteBufferGainAsyncPtr write_buffer_gain_async;
+ DvrWriteBufferGetNativeHandle write_buffer_get_native_handle;
// Read buffer
DvrReadBufferDestroyPtr read_buffer_destroy;
@@ -245,8 +255,12 @@
DvrReadBufferAcquirePtr read_buffer_acquire;
DvrReadBufferReleasePtr read_buffer_release;
DvrReadBufferReleaseAsyncPtr read_buffer_release_async;
+ DvrReadBufferGetNativeHandle read_buffer_get_native_handle;
+
+ // Buffer
DvrBufferDestroy buffer_destroy;
DvrBufferGetAHardwareBuffer buffer_get_ahardwarebuffer;
+ DvrBufferGetNativeHandle buffer_get_native_handle;
// Write buffer queue
DvrWriteBufferQueueDestroyPtr write_buffer_queue_destroy;
diff --git a/libs/vr/libdvr/include/dvr/dvr_buffer.h b/libs/vr/libdvr/include/dvr/dvr_buffer.h
index 6c9c4d3..b2cf0d7 100644
--- a/libs/vr/libdvr/include/dvr/dvr_buffer.h
+++ b/libs/vr/libdvr/include/dvr/dvr_buffer.h
@@ -13,6 +13,7 @@
typedef struct DvrReadBuffer DvrReadBuffer;
typedef struct DvrBuffer DvrBuffer;
typedef struct AHardwareBuffer AHardwareBuffer;
+struct native_handle;
// Write buffer
void dvrWriteBufferDestroy(DvrWriteBuffer* write_buffer);
@@ -23,6 +24,8 @@
const void* meta, size_t meta_size_bytes);
int dvrWriteBufferGain(DvrWriteBuffer* write_buffer, int* release_fence_fd);
int dvrWriteBufferGainAsync(DvrWriteBuffer* write_buffer);
+const struct native_handle* dvrWriteBufferGetNativeHandle(
+ DvrWriteBuffer* write_buffer);
// Read buffer
void dvrReadBufferDestroy(DvrReadBuffer* read_buffer);
@@ -33,11 +36,14 @@
void* meta, size_t meta_size_bytes);
int dvrReadBufferRelease(DvrReadBuffer* read_buffer, int release_fence_fd);
int dvrReadBufferReleaseAsync(DvrReadBuffer* read_buffer);
+const struct native_handle* dvrReadBufferGetNativeHandle(
+ DvrReadBuffer* read_buffer);
// Buffer
void dvrBufferDestroy(DvrBuffer* buffer);
int dvrBufferGetAHardwareBuffer(DvrBuffer* buffer,
AHardwareBuffer** hardware_buffer);
+const struct native_handle* dvrBufferGetNativeHandle(DvrBuffer* buffer);
#ifdef __cplusplus
} // extern "C"
diff --git a/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp b/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp
index cd3285f..52531a9 100644
--- a/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp
+++ b/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp
@@ -116,6 +116,34 @@
dvrBufferDestroy(buffer2);
}
+TEST_F(DvrNamedBufferTest, TestNamedBufferUsage) {
+ const char* buffer_name = "buffer_usage";
+
+ // Set usage0 to AHARDWAREBUFFER_USAGE0_VIDEO_ENCODE. We use this because
+ // internally AHARDWAREBUFFER_USAGE0_VIDEO_ENCODE is converted to
+ // GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, and these two values are different.
+ // If all is good, when we get the AHardwareBuffer, it should be converted
+ // back to AHARDWAREBUFFER_USAGE0_VIDEO_ENCODE.
+ const int64_t usage0 = AHARDWAREBUFFER_USAGE0_VIDEO_ENCODE;
+
+ DvrBuffer* setup_buffer =
+ dvrDisplayManagerSetupNamedBuffer(client_, buffer_name, 10, usage0, 0);
+ ASSERT_NE(nullptr, setup_buffer);
+
+ AHardwareBuffer* hardware_buffer = nullptr;
+ int e2 = dvrBufferGetAHardwareBuffer(setup_buffer, &hardware_buffer);
+ ASSERT_EQ(0, e2);
+ ASSERT_NE(nullptr, hardware_buffer);
+
+ AHardwareBuffer_Desc desc = {};
+ AHardwareBuffer_describe(hardware_buffer, &desc);
+
+ ASSERT_EQ(desc.usage0, AHARDWAREBUFFER_USAGE0_VIDEO_ENCODE);
+
+ dvrBufferDestroy(setup_buffer);
+}
+
+
} // namespace
} // namespace dvr
diff --git a/libs/vr/libvrflinger/display_service.cpp b/libs/vr/libvrflinger/display_service.cpp
index 5cdb3bb..971345b 100644
--- a/libs/vr/libvrflinger/display_service.cpp
+++ b/libs/vr/libvrflinger/display_service.cpp
@@ -208,17 +208,17 @@
// We should always have a red distortion.
LOG_FATAL_IF(view_params.distortion_coefficients_r.empty());
- red_distortion = std::make_shared<PolynomialRadialDistortion>(0.0f,
- view_params.distortion_coefficients_r);
+ red_distortion = std::make_shared<PolynomialRadialDistortion>(
+ 0.0f, view_params.distortion_coefficients_r);
if (!view_params.distortion_coefficients_g.empty()) {
- green_distortion = std::make_shared<PolynomialRadialDistortion>(0.0f,
- view_params.distortion_coefficients_g);
+ green_distortion = std::make_shared<PolynomialRadialDistortion>(
+ 0.0f, view_params.distortion_coefficients_g);
}
if (!view_params.distortion_coefficients_b.empty()) {
- blue_distortion = std::make_shared<PolynomialRadialDistortion>(0.0f,
- view_params.distortion_coefficients_b);
+ blue_distortion = std::make_shared<PolynomialRadialDistortion>(
+ 0.0f, view_params.distortion_coefficients_b);
}
HeadMountMetrics::EyeOrientation left_orientation =
@@ -331,11 +331,9 @@
int consumer_usage) {
auto named_buffer = named_buffers_.find(name);
if (named_buffer == named_buffers_.end()) {
- // TODO(hendrikw): Update BufferProducer to take producer_usage and
- // consumer_usage flags.
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/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 0807d1f..9de15d0 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -223,6 +223,10 @@
(__eglMustCastToProperFunctionPointerType)&eglGetFrameTimestampsANDROID },
{ "eglGetFrameTimestampSupportedANDROID",
(__eglMustCastToProperFunctionPointerType)&eglGetFrameTimestampSupportedANDROID },
+
+ // EGL_ANDROID_native_fence_sync
+ { "eglDupNativeFenceFDANDROID",
+ (__eglMustCastToProperFunctionPointerType)&eglDupNativeFenceFDANDROID },
};
/*
@@ -232,8 +236,7 @@
#define FILTER_EXTENSIONS(procname) \
(!strcmp((procname), "eglSetBlobCacheFuncsANDROID") || \
!strcmp((procname), "eglHibernateProcessIMG") || \
- !strcmp((procname), "eglAwakenProcessIMG") || \
- !strcmp((procname), "eglDupNativeFenceFDANDROID"))
+ !strcmp((procname), "eglAwakenProcessIMG"))
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 5e5efb7..d044f37 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2617,6 +2617,21 @@
const auto& p = getParent();
if (p != nullptr) {
t = p->getTransform();
+
+ // If the parent is not using NATIVE_WINDOW_SCALING_MODE_FREEZE (e.g.
+ // it isFixedSize) then there may be additional scaling not accounted
+ // for in the transform. We need to mirror this scaling in child surfaces
+ // or we will break the contract where WM can treat child surfaces as
+ // pixels in the parent surface.
+ if (p->isFixedSize()) {
+ float sx = p->getDrawingState().active.w /
+ static_cast<float>(p->mActiveBuffer->getWidth());
+ float sy = p->getDrawingState().active.h /
+ static_cast<float>(p->mActiveBuffer->getHeight());
+ Transform extraParentScaling;
+ extraParentScaling.set(sx, 0, 0, sy);
+ t = t * extraParentScaling;
+ }
}
return t * getDrawingState().active.transform;
}
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index 441fc7e..7a8b4ab 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -909,4 +909,36 @@
}
}
+TEST_F(ChildLayerTest, ChildrenInheritNonTransformScalingFromParent) {
+ SurfaceComposerClient::openGlobalTransaction();
+ mChild->show();
+ mChild->setPosition(0, 0);
+ mFGSurfaceControl->setPosition(0, 0);
+ SurfaceComposerClient::closeGlobalTransaction(true);
+
+ {
+ ScreenCapture::captureScreen(&mCapture);
+ // We've positioned the child in the top left.
+ mCapture->expectChildColor(0, 0);
+ // But it's only 10x10.
+ mCapture->expectFGColor(10, 10);
+ }
+
+ SurfaceComposerClient::openGlobalTransaction();
+ mFGSurfaceControl->setOverrideScalingMode(NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW);
+ // We cause scaling by 2.
+ mFGSurfaceControl->setSize(128, 128);
+ SurfaceComposerClient::closeGlobalTransaction();
+
+ {
+ ScreenCapture::captureScreen(&mCapture);
+ // We've positioned the child in the top left.
+ mCapture->expectChildColor(0, 0);
+ mCapture->expectChildColor(10, 10);
+ mCapture->expectChildColor(19, 19);
+ // And now it should be scaled all the way to 20x20
+ mCapture->expectFGColor(20, 20);
+ }
+}
+
}
diff --git a/services/vr/hardware_composer/Android.bp b/services/vr/hardware_composer/Android.bp
index b94d333..25bb30b 100644
--- a/services/vr/hardware_composer/Android.bp
+++ b/services/vr/hardware_composer/Android.bp
@@ -1,3 +1,51 @@
+cc_library_shared {
+ name: "libvr_hwc-hal",
+
+ srcs: [
+ "impl/vr_hwc.cpp",
+ "impl/vr_composer_client.cpp",
+ ],
+
+ static_libs: [
+ "libhwcomposer-client",
+ "libdisplay",
+ "libbufferhubqueue",
+ "libbufferhub",
+ "libpdx_default_transport",
+ ],
+
+ shared_libs: [
+ "android.frameworks.vr.composer@1.0",
+ "android.hardware.graphics.composer@2.1",
+ "libbase",
+ "libcutils",
+ "libfmq",
+ "libhardware",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libsync",
+ "libui",
+ "libutils",
+ ],
+
+ export_static_lib_headers: [
+ "libhwcomposer-client",
+ ],
+
+ export_shared_lib_headers: [
+ "android.frameworks.vr.composer@1.0",
+ "android.hardware.graphics.composer@2.1",
+ ],
+
+ export_include_dirs: ["."],
+
+ cflags: [
+ "-DLOG_TAG=\"vr_hwc\"",
+ ],
+
+}
+
cc_library_static {
name: "libvr_hwc-binder",
srcs: [
@@ -12,11 +60,12 @@
export_aidl_headers: true,
},
export_include_dirs: ["aidl"],
+
shared_libs: [
"libbinder",
"libui",
"libutils",
- "libvrhwc",
+ "libvr_hwc-hal",
],
}
@@ -34,10 +83,10 @@
"liblog",
"libui",
"libutils",
- "libvrhwc",
+ "libvr_hwc-hal",
],
export_shared_lib_headers: [
- "libvrhwc",
+ "libvr_hwc-hal",
],
cflags: [
"-DLOG_TAG=\"vr_hwc\"",
@@ -65,7 +114,7 @@
"libhwbinder",
"libui",
"libutils",
- "libvrhwc",
+ "libvr_hwc-hal",
],
cflags: [
"-DLOG_TAG=\"vr_hwc\"",
diff --git a/services/vr/vr_window_manager/composer/impl/vr_composer_client.cpp b/services/vr/hardware_composer/impl/vr_composer_client.cpp
similarity index 97%
rename from services/vr/vr_window_manager/composer/impl/vr_composer_client.cpp
rename to services/vr/hardware_composer/impl/vr_composer_client.cpp
index e0bdf1c..ae54e56 100644
--- a/services/vr/vr_window_manager/composer/impl/vr_composer_client.cpp
+++ b/services/vr/hardware_composer/impl/vr_composer_client.cpp
@@ -19,8 +19,8 @@
#include <hardware/gralloc1.h>
#include <log/log.h>
-#include "vr_hwc.h"
-#include "vr_composer_client.h"
+#include "impl/vr_hwc.h"
+#include "impl/vr_composer_client.h"
namespace android {
namespace dvr {
diff --git a/services/vr/vr_window_manager/composer/impl/vr_composer_client.h b/services/vr/hardware_composer/impl/vr_composer_client.h
similarity index 90%
rename from services/vr/vr_window_manager/composer/impl/vr_composer_client.h
rename to services/vr/hardware_composer/impl/vr_composer_client.h
index 8d601ab..1236be9 100644
--- a/services/vr/vr_window_manager/composer/impl/vr_composer_client.h
+++ b/services/vr/hardware_composer/impl/vr_composer_client.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_COMPOSER_CLIENT_H_
-#define VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_COMPOSER_CLIENT_H_
+#ifndef ANDROID_DVR_HARDWARE_COMPOSER_IMPL_VR_COMPOSER_CLIENT_H
+#define ANDROID_DVR_HARDWARE_COMPOSER_IMPL_VR_COMPOSER_CLIENT_H
#include <android/frameworks/vr/composer/1.0/IVrComposerClient.h>
#include <ComposerClient.h>
@@ -68,4 +68,4 @@
} // namespace dvr
} // namespace android
-#endif // VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_COMPOSER_CLIENT_H_
+#endif // ANDROID_DVR_HARDWARE_COMPOSER_IMPL_VR_COMPOSER_CLIENT_H
diff --git a/services/vr/vr_window_manager/composer/impl/vr_hwc.cpp b/services/vr/hardware_composer/impl/vr_hwc.cpp
similarity index 99%
rename from services/vr/vr_window_manager/composer/impl/vr_hwc.cpp
rename to services/vr/hardware_composer/impl/vr_hwc.cpp
index f5d88f2..29983a7 100644
--- a/services/vr/vr_window_manager/composer/impl/vr_hwc.cpp
+++ b/services/vr/hardware_composer/impl/vr_hwc.cpp
@@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "vr_hwc.h"
+#include "impl/vr_hwc.h"
+#include <private/dvr/display_client.h>
#include <ui/Fence.h>
#include <mutex>
-#include <private/dvr/display_client.h>
-
#include "vr_composer_client.h"
using namespace android::hardware::graphics::common::V1_0;
diff --git a/services/vr/vr_window_manager/composer/impl/vr_hwc.h b/services/vr/hardware_composer/impl/vr_hwc.h
similarity index 98%
rename from services/vr/vr_window_manager/composer/impl/vr_hwc.h
rename to services/vr/hardware_composer/impl/vr_hwc.h
index 609d925..df04208 100644
--- a/services/vr/vr_window_manager/composer/impl/vr_hwc.h
+++ b/services/vr/hardware_composer/impl/vr_hwc.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_HWC_H_
-#define VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_HWC_H_
+#ifndef ANDROID_DVR_HARDWARE_COMPOSER_IMPL_VR_HWC_H
+#define ANDROID_DVR_HARDWARE_COMPOSER_IMPL_VR_HWC_H
#include <android-base/unique_fd.h>
#include <android/frameworks/vr/composer/1.0/IVrComposerClient.h>
@@ -319,4 +319,4 @@
} // namespace dvr
} // namespace android
-#endif // VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_HWC_H_
+#endif // ANDROID_DVR_HARDWARE_COMPOSER_IMPL_VR_HWC_H
diff --git a/services/vr/vr_window_manager/Android.bp b/services/vr/vr_window_manager/Android.bp
index 669426b..d7ddba1 100644
--- a/services/vr/vr_window_manager/Android.bp
+++ b/services/vr/vr_window_manager/Android.bp
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-subdirs = [ "composer", ]
-
native_src = [
"application.cpp",
"controller_mesh.cpp",
@@ -49,7 +47,6 @@
shared_libs = [
"android.frameworks.vr.composer@1.0",
"android.hardware.graphics.composer@2.1",
- "libvrhwc",
"libbase",
"libbinder",
"libinput",
@@ -66,6 +63,7 @@
"libhidlbase",
"libhidltransport",
"liblog",
+ "libvr_hwc-hal",
]
cc_binary {
diff --git a/services/vr/vr_window_manager/composer/Android.bp b/services/vr/vr_window_manager/composer/Android.bp
deleted file mode 100644
index 1998749..0000000
--- a/services/vr/vr_window_manager/composer/Android.bp
+++ /dev/null
@@ -1,47 +0,0 @@
-cc_library_shared {
- name: "libvrhwc",
-
- srcs: [
- "impl/vr_composer_view.cpp",
- "impl/vr_hwc.cpp",
- "impl/vr_composer_client.cpp",
- ],
-
- static_libs: [
- "libhwcomposer-client",
- "libdisplay",
- "libbufferhubqueue",
- "libbufferhub",
- "libpdx_default_transport",
- ],
-
- shared_libs: [
- "android.frameworks.vr.composer@1.0",
- "android.hardware.graphics.composer@2.1",
- "libbase",
- "libcutils",
- "libfmq",
- "libhardware",
- "libhidlbase",
- "libhidltransport",
- "liblog",
- "libsync",
- "libui",
- "libutils",
- ],
-
- export_static_lib_headers: [
- "libhwcomposer-client",
- ],
-
- export_shared_lib_headers: [
- "android.frameworks.vr.composer@1.0",
- "android.hardware.graphics.composer@2.1",
- ],
-
- export_include_dirs: ["."],
-
- cflags: [
- "-DLOG_TAG=\"vrhwc\"",
- ],
-}
diff --git a/services/vr/vr_window_manager/composer/impl/vr_composer_view.cpp b/services/vr/vr_window_manager/composer/impl/vr_composer_view.cpp
deleted file mode 100644
index 299e8f1..0000000
--- a/services/vr/vr_window_manager/composer/impl/vr_composer_view.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "vr_composer_view.h"
-
-namespace android {
-namespace dvr {
-
-VrComposerView::VrComposerView(
- std::unique_ptr<VrComposerView::Callback> callback)
- : composer_view_(nullptr), callback_(std::move(callback)) {}
-
-VrComposerView::~VrComposerView() {
- composer_view_->UnregisterObserver(this);
-}
-
-void VrComposerView::Initialize(ComposerView* composer_view) {
- composer_view_ = composer_view;
- composer_view_->RegisterObserver(this);
-}
-
-base::unique_fd VrComposerView::OnNewFrame(const ComposerView::Frame& frame) {
- std::lock_guard<std::mutex> guard(mutex_);
- if (!callback_.get())
- return base::unique_fd();
-
- return callback_->OnNewFrame(frame);
-}
-
-} // namespace dvr
-} // namespace android
diff --git a/services/vr/vr_window_manager/composer/impl/vr_composer_view.h b/services/vr/vr_window_manager/composer/impl/vr_composer_view.h
deleted file mode 100644
index 8c5ee1f..0000000
--- a/services/vr/vr_window_manager/composer/impl/vr_composer_view.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_COMPOSER_VIEW_H_
-#define VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_COMPOSER_VIEW_H_
-
-#include <memory>
-
-#include "vr_hwc.h"
-
-namespace android {
-namespace dvr {
-
-class VrComposerView : public ComposerView::Observer {
- public:
- class Callback {
- public:
- virtual ~Callback() = default;
- virtual base::unique_fd OnNewFrame(const ComposerView::Frame& frame) = 0;
- };
-
- VrComposerView(std::unique_ptr<Callback> callback);
- ~VrComposerView() override;
-
- void Initialize(ComposerView* composer_view);
-
- // ComposerView::Observer
- base::unique_fd OnNewFrame(const ComposerView::Frame& frame) override;
-
- private:
- ComposerView* composer_view_;
- std::unique_ptr<Callback> callback_;
- std::mutex mutex_;
-};
-
-} // namespace dvr
-} // namespace android
-
-#endif // VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_COMPOSER_VIEW_H_
diff --git a/services/vr/vr_window_manager/composer_view/Android.bp_disable b/services/vr/vr_window_manager/composer_view/Android.bp_disable
deleted file mode 100644
index 1658154..0000000
--- a/services/vr/vr_window_manager/composer_view/Android.bp_disable
+++ /dev/null
@@ -1,29 +0,0 @@
-cc_binary {
- name: "vr_composer_view",
-
- srcs: ["vr_composer_view.cpp"],
-
- static_libs: [
- "libhwcomposer-client",
- ],
-
- shared_libs: [
- "android.dvr.composer@1.0",
- "android.hardware.graphics.composer@2.1",
- "libbase",
- "libbinder",
- "libhardware",
- "libhwbinder",
- "liblog",
- "libutils",
- "libvrhwc",
- ],
-
- cflags: [
- "-DLOG_TAG=\"vr_composer_view\"",
- ],
-
- init_rc: [
- "vr_composer_view.rc",
- ],
-}
diff --git a/services/vr/vr_window_manager/composer_view/vr_composer_view.cpp b/services/vr/vr_window_manager/composer_view/vr_composer_view.cpp
deleted file mode 100644
index 54dff3d..0000000
--- a/services/vr/vr_window_manager/composer_view/vr_composer_view.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <binder/ProcessState.h>
-#include <hwbinder/IPCThreadState.h>
-#include <impl/vr_composer_view.h>
-#include <impl/vr_hwc.h>
-
-using namespace android;
-using namespace android::dvr;
-
-int main(int, char**) {
- android::ProcessState::self()->startThreadPool();
-
- const char instance[] = "vr_hwcomposer";
- sp<IComposer> service = HIDL_FETCH_IComposer(instance);
- LOG_ALWAYS_FATAL_IF(!service.get(), "Failed to get service");
- LOG_ALWAYS_FATAL_IF(service->isRemote(), "Service is remote");
-
- LOG_ALWAYS_FATAL_IF(service->registerAsService(instance) != ::android::OK,
- "Failed to register service");
-
- sp<IVrComposerView> composer_view = HIDL_FETCH_IVrComposerView(
- "DaydreamDisplay");
- LOG_ALWAYS_FATAL_IF(!composer_view.get(),
- "Failed to get vr_composer_view service");
- LOG_ALWAYS_FATAL_IF(composer_view->isRemote(),
- "vr_composer_view service is remote");
-
- composer_view->registerAsService("DaydreamDisplay");
-
- GetVrComposerViewFromIVrComposerView(composer_view.get())->Initialize(
- GetComposerViewFromIComposer(service.get()));
-
- android::hardware::ProcessState::self()->startThreadPool();
- android::hardware::IPCThreadState::self()->joinThreadPool();
-
- return 0;
-}
diff --git a/services/vr/vr_window_manager/composer_view/vr_composer_view.rc b/services/vr/vr_window_manager/composer_view/vr_composer_view.rc
deleted file mode 100644
index bd9982b..0000000
--- a/services/vr/vr_window_manager/composer_view/vr_composer_view.rc
+++ /dev/null
@@ -1,5 +0,0 @@
-service vr_composer_view /system/bin/vr_composer_view
- class core
- user system
- group system graphics
- writepid /dev/cpuset/system/tasks
diff --git a/services/vr/vr_window_manager/hwc_callback.h b/services/vr/vr_window_manager/hwc_callback.h
index 4269430..259c4ac 100644
--- a/services/vr/vr_window_manager/hwc_callback.h
+++ b/services/vr/vr_window_manager/hwc_callback.h
@@ -3,15 +3,13 @@
#include <android/dvr/BnVrComposerCallback.h>
#include <android-base/unique_fd.h>
+#include <impl/vr_hwc.h>
#include <deque>
#include <functional>
#include <mutex>
#include <vector>
-#include "impl/vr_composer_view.h"
-#include "impl/vr_hwc.h"
-
namespace android {
class Fence;
diff --git a/services/vr/vr_window_manager/surface_flinger_view.cpp b/services/vr/vr_window_manager/surface_flinger_view.cpp
index aef23a1..b41de03 100644
--- a/services/vr/vr_window_manager/surface_flinger_view.cpp
+++ b/services/vr/vr_window_manager/surface_flinger_view.cpp
@@ -2,7 +2,6 @@
#include <android/dvr/IVrComposer.h>
#include <binder/IServiceManager.h>
-#include <impl/vr_composer_view.h>
#include <private/dvr/native_buffer.h>
#include "hwc_callback.h"
diff --git a/services/vr/vr_window_manager/vr_window_manager.cpp b/services/vr/vr_window_manager/vr_window_manager.cpp
index 9d7afe3..dd2cba7 100644
--- a/services/vr/vr_window_manager/vr_window_manager.cpp
+++ b/services/vr/vr_window_manager/vr_window_manager.cpp
@@ -2,7 +2,6 @@
#include <binder/IServiceManager.h>
#include <binder/ProcessState.h>
#include <hwbinder/IPCThreadState.h>
-#include <impl/vr_composer_view.h>
#include <impl/vr_hwc.h>
#include "shell_view.h"