Merge "Fix the compiler error for the ternary operator, caused by Eigen rebase."
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 8f2dee1..14eff03 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -1284,7 +1284,7 @@
fflush(stdout);
int outFd = STDOUT_FILENO;
if (g_outputFile) {
- outFd = open(g_outputFile, O_WRONLY | O_CREAT, 0644);
+ outFd = open(g_outputFile, O_WRONLY | O_CREAT | O_TRUNC, 0644);
}
if (outFd == -1) {
printf("Failed to open '%s', err=%d", g_outputFile, errno);
diff --git a/cmds/bugreportz/readme.md b/cmds/bugreportz/readme.md
index 2697f09..eb0d898 100644
--- a/cmds/bugreportz/readme.md
+++ b/cmds/bugreportz/readme.md
@@ -17,3 +17,4 @@
- `OK:<path_to_bugreport_file>` in case of success.
- `FAIL:<error message>` in case of failure.
+
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 349bbed..1cf00f5 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -960,7 +960,7 @@
{"ps", "-A", "-T", "-Z", "-O", "pri,nice,rtprio,sched,pcy"});
RunCommand("LIBRANK", {"librank"}, CommandOptions::AS_ROOT);
- RunCommand("HARDWARE HALS", {"lshal"});
+ RunCommand("HARDWARE HALS", {"lshal"}, CommandOptions::AS_ROOT);
RunCommand("PRINTENV", {"printenv"});
RunCommand("NETSTAT", {"netstat", "-nW"});
@@ -1059,7 +1059,7 @@
#endif
DumpFile("INTERRUPTS (2)", "/proc/interrupts");
- print_properties();
+ RunCommand("SYSTEM PROPERTIES", {"getprop"});
RunCommand("VOLD DUMP", {"vdc", "dump"});
RunCommand("SECURE CONTAINERS", {"vdc", "asec", "list"});
@@ -1128,7 +1128,7 @@
printf("== Running Application Activities\n");
printf("========================================================\n");
- RunDumpsys("APP ACTIVITIES", {"activity", "all"});
+ RunDumpsys("APP ACTIVITIES", {"activity", "-v", "all"});
printf("========================================================\n");
printf("== Running Application Services\n");
@@ -1161,7 +1161,7 @@
printf("== Board\n");
printf("========================================================\n");
- ::android::sp<IDumpstateDevice> dumpstate_device(IDumpstateDevice::getService("dumpstate"));
+ ::android::sp<IDumpstateDevice> dumpstate_device(IDumpstateDevice::getService());
if (dumpstate_device == nullptr) {
MYLOGE("No IDumpstateDevice implementation\n");
return;
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index d988429..7fcb980 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -363,9 +363,6 @@
int dump_files(const std::string& title, const char* dir, bool (*skip)(const char* path),
int (*dump_from_fd)(const char* title, const char* path, int fd));
-/* prints all the system properties */
-void print_properties();
-
/** opens a socket and returns its file descriptor */
int open_socket(const char *service);
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index baa6458..4655d33 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -710,40 +710,6 @@
RunCommand(title, dumpsys, options);
}
-size_t num_props = 0;
-static char* props[2000];
-
-static void print_prop(const char *key, const char *name, void *user) {
- (void) user;
- if (num_props < sizeof(props) / sizeof(props[0])) {
- char buf[PROPERTY_KEY_MAX + PROPERTY_VALUE_MAX + 10];
- snprintf(buf, sizeof(buf), "[%s]: [%s]\n", key, name);
- props[num_props++] = strdup(buf);
- }
-}
-
-static int compare_prop(const void *a, const void *b) {
- return strcmp(*(char * const *) a, *(char * const *) b);
-}
-
-/* prints all the system properties */
-void print_properties() {
- const char* title = "SYSTEM PROPERTIES";
- DurationReporter duration_reporter(title);
- printf("------ %s ------\n", title);
- if (PropertiesHelper::IsDryRun()) return;
- size_t i;
- num_props = 0;
- property_list(print_prop, NULL);
- qsort(&props, num_props, sizeof(props[0]), compare_prop);
-
- for (i = 0; i < num_props; ++i) {
- fputs(props[i], stdout);
- free(props[i]);
- }
- printf("\n");
-}
-
int open_socket(const char *service) {
int s = android_get_control_socket(service);
if (s < 0) {
diff --git a/cmds/lshal/Android.bp b/cmds/lshal/Android.bp
index 5aab35a..39e0ba3 100644
--- a/cmds/lshal/Android.bp
+++ b/cmds/lshal/Android.bp
@@ -18,8 +18,10 @@
"libbase",
"libutils",
"libhidlbase",
- "android.hidl.manager@1.0",
"libhidltransport",
+ "libhidl-gen-utils",
+ "libvintf",
+ "android.hidl.manager@1.0",
],
srcs: [
"Lshal.cpp"
diff --git a/cmds/lshal/Lshal.cpp b/cmds/lshal/Lshal.cpp
index 6fd9b21..9e60461 100644
--- a/cmds/lshal/Lshal.cpp
+++ b/cmds/lshal/Lshal.cpp
@@ -28,6 +28,9 @@
#include <android-base/parseint.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <hidl/ServiceManagement.h>
+#include <hidl-util/FQName.h>
+#include <vintf/HalManifest.h>
+#include <vintf/parse_xml.h>
#include "Timeout.h"
@@ -58,12 +61,13 @@
return os.str();
}
-static std::pair<hidl_string, hidl_string> split(const hidl_string &s, char c) {
+template<typename String>
+static std::pair<String, String> splitFirst(const String &s, char c) {
const char *pos = strchr(s.c_str(), c);
if (pos == nullptr) {
return {s, {}};
}
- return {hidl_string(s.c_str(), pos - s.c_str()), hidl_string(pos + 1)};
+ return {String(s.c_str(), pos - s.c_str()), String(pos + 1)};
}
static std::vector<std::string> split(const std::string &s, char c) {
@@ -81,6 +85,14 @@
return components;
}
+static void replaceAll(std::string *s, char from, char to) {
+ for (size_t i = 0; i < s->size(); ++i) {
+ if (s->at(i) == from) {
+ s->at(i) = to;
+ }
+ }
+}
+
std::string getCmdline(pid_t pid) {
std::ifstream ifs("/proc/" + std::to_string(pid) + "/cmdline");
std::string cmdline;
@@ -147,22 +159,37 @@
return true;
}
+void Lshal::forEachTable(const std::function<void(Table &)> &f) {
+ for (const Table &table : {mServicesTable, mPassthroughRefTable, mImplementationsTable}) {
+ f(const_cast<Table &>(table));
+ }
+}
+void Lshal::forEachTable(const std::function<void(const Table &)> &f) const {
+ for (const Table &table : {mServicesTable, mPassthroughRefTable, mImplementationsTable}) {
+ f(table);
+ }
+}
+
void Lshal::postprocess() {
- if (mSortColumn) {
- std::sort(mTable.begin(), mTable.end(), mSortColumn);
- }
- for (TableEntry &entry : mTable) {
- entry.serverCmdline = getCmdline(entry.serverPid);
- removeDeadProcesses(&entry.clientPids);
- for (auto pid : entry.clientPids) {
- entry.clientCmdlines.push_back(this->getCmdline(pid));
+ forEachTable([this](Table &table) {
+ if (mSortColumn) {
+ std::sort(table.begin(), table.end(), mSortColumn);
}
- }
+ for (TableEntry &entry : table) {
+ entry.serverCmdline = getCmdline(entry.serverPid);
+ removeDeadProcesses(&entry.clientPids);
+ for (auto pid : entry.clientPids) {
+ entry.clientCmdlines.push_back(this->getCmdline(pid));
+ }
+ }
+ });
}
void Lshal::printLine(
const std::string &interfaceName,
- const std::string &transport, const std::string &server,
+ const std::string &transport,
+ const std::string &arch,
+ const std::string &server,
const std::string &serverCmdline,
const std::string &address, const std::string &clients,
const std::string &clientCmdlines) const {
@@ -170,6 +197,8 @@
mOut << std::setw(80) << interfaceName << "\t";
if (mSelectedColumns & ENABLE_TRANSPORT)
mOut << std::setw(10) << transport << "\t";
+ if (mSelectedColumns & ENABLE_ARCH)
+ mOut << std::setw(5) << arch << "\t";
if (mSelectedColumns & ENABLE_SERVER_PID) {
if (mEnableCmdlines) {
mOut << std::setw(15) << serverCmdline << "\t";
@@ -189,38 +218,192 @@
mOut << std::endl;
}
-void Lshal::dump() const {
- mOut << "All services:" << std::endl;
- mOut << std::left;
- printLine("Interface", "Transport", "Server", "Server CMD", "PTR", "Clients", "Clients CMD");
- for (const auto &entry : mTable) {
- printLine(entry.interfaceName,
- entry.transport,
- entry.serverPid == NO_PID ? "N/A" : std::to_string(entry.serverPid),
- entry.serverCmdline,
- entry.serverObjectAddress == NO_PTR ? "N/A" : toHexString(entry.serverObjectAddress),
- join(entry.clientPids, " "),
- join(entry.clientCmdlines, ";"));
+void Lshal::dumpVintf() const {
+ vintf::HalManifest manifest;
+ forEachTable([this, &manifest] (const Table &table) {
+ for (const TableEntry &entry : table) {
+
+ std::string fqInstanceName = entry.interfaceName;
+
+ if (&table == &mImplementationsTable) {
+ // Quick hack to work around *'s
+ replaceAll(&fqInstanceName, '*', 'D');
+ }
+ auto splittedFqInstanceName = splitFirst(fqInstanceName, '/');
+ FQName fqName(splittedFqInstanceName.first);
+ if (!fqName.isValid()) {
+ mErr << "Warning: '" << splittedFqInstanceName.first
+ << "' is not a valid FQName." << std::endl;
+ continue;
+ }
+ // Strip out system libs.
+ // TODO(b/34772739): might want to add other framework HAL packages
+ if (fqName.inPackage("android.hidl")) {
+ continue;
+ }
+ std::string interfaceName =
+ &table == &mImplementationsTable ? "" : fqName.name();
+ std::string instanceName =
+ &table == &mImplementationsTable ? "" : splittedFqInstanceName.second;
+
+ vintf::Transport transport;
+ if (entry.transport == "hwbinder") {
+ transport = vintf::Transport::HWBINDER;
+ } else if (entry.transport == "passthrough") {
+ transport = vintf::Transport::PASSTHROUGH;
+ } else {
+ mErr << "Warning: '" << entry.transport << "' is not a valid transport." << std::endl;
+ continue;
+ }
+
+ vintf::ManifestHal *hal = manifest.getHal(fqName.package());
+ if (hal == nullptr) {
+ if (!manifest.add(vintf::ManifestHal{
+ .format = vintf::HalFormat::HIDL,
+ .name = fqName.package(),
+ .impl = {.implLevel = vintf::ImplLevel::GENERIC, .impl = ""},
+ .transport = transport
+ })) {
+ mErr << "Warning: cannot add hal '" << fqInstanceName << "'" << std::endl;
+ continue;
+ }
+ hal = manifest.getHal(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);
+ }
+ }
+ }
+ });
+ mOut << vintf::gHalManifestConverter(manifest);
+}
+
+static const std::string &getArchString(Architecture arch) {
+ static const std::string sStr64 = "64";
+ static const std::string sStr32 = "32";
+ static const std::string sStrBoth = "32+64";
+ static const std::string sStrUnknown = "";
+ switch (arch) {
+ case ARCH64:
+ return sStr64;
+ case ARCH32:
+ return sStr32;
+ case ARCH_BOTH:
+ return sStrBoth;
+ case ARCH_UNKNOWN: // fall through
+ default:
+ return sStrUnknown;
}
}
-void Lshal::putEntry(TableEntry &&entry) {
- mTable.push_back(std::forward<TableEntry>(entry));
+static Architecture fromBaseArchitecture(::android::hidl::base::V1_0::DebugInfo::Architecture a) {
+ switch (a) {
+ case ::android::hidl::base::V1_0::DebugInfo::Architecture::IS_64BIT:
+ return ARCH64;
+ case ::android::hidl::base::V1_0::DebugInfo::Architecture::IS_32BIT:
+ return ARCH32;
+ case ::android::hidl::base::V1_0::DebugInfo::Architecture::UNKNOWN: // fallthrough
+ default:
+ return ARCH_UNKNOWN;
+ }
+}
+
+void Lshal::dumpTable() {
+ mServicesTable.description =
+ "All binderized services (registered services through hwservicemanager)";
+ mPassthroughRefTable.description =
+ "All interfaces that getService() has ever return as a passthrough interface;\n"
+ "PIDs / processes shown below might be inaccurate because the process\n"
+ "might have relinquished the interface or might have died.\n"
+ "The Server / Server CMD column can be ignored.\n"
+ "The Clients / Clients CMD column shows all process that have ever dlopen'ed \n"
+ "the library and successfully fetched the passthrough implementation.";
+ mImplementationsTable.description =
+ "All available passthrough implementations (all -impl.so files)";
+ forEachTable([this] (const Table &table) {
+ mOut << table.description << std::endl;
+ mOut << std::left;
+ printLine("Interface", "Transport", "Arch", "Server", "Server CMD",
+ "PTR", "Clients", "Clients CMD");
+ for (const auto &entry : table) {
+ printLine(entry.interfaceName,
+ entry.transport,
+ getArchString(entry.arch),
+ entry.serverPid == NO_PID ? "N/A" : std::to_string(entry.serverPid),
+ entry.serverCmdline,
+ entry.serverObjectAddress == NO_PTR ? "N/A" : toHexString(entry.serverObjectAddress),
+ join(entry.clientPids, " "),
+ join(entry.clientCmdlines, ";"));
+ }
+ mOut << std::endl;
+ });
+
+}
+
+void Lshal::dump() {
+ if (mVintf) {
+ dumpVintf();
+ if (!!mFileOutput) {
+ mFileOutput.buf().close();
+ delete &mFileOutput.buf();
+ mFileOutput = nullptr;
+ }
+ mOut = std::cout;
+ } else {
+ dumpTable();
+ }
+}
+
+void Lshal::putEntry(TableEntrySource source, TableEntry &&entry) {
+ Table *table = nullptr;
+ switch (source) {
+ case HWSERVICEMANAGER_LIST :
+ table = &mServicesTable; break;
+ case PTSERVICEMANAGER_REG_CLIENT :
+ table = &mPassthroughRefTable; break;
+ case LIST_DLLIB :
+ table = &mImplementationsTable; break;
+ default:
+ mErr << "Error: Unknown source of entry " << source << std::endl;
+ }
+ if (table) {
+ table->entries.push_back(std::forward<TableEntry>(entry));
+ }
}
Status Lshal::fetchAllLibraries(const sp<IServiceManager> &manager) {
using namespace ::android::hardware;
using namespace ::android::hidl::manager::V1_0;
using namespace ::android::hidl::base::V1_0;
- auto ret = timeoutIPC(manager, &IServiceManager::list, [&] (const auto &fqInstanceNames) {
- for (const auto &fqInstanceName : fqInstanceNames) {
- putEntry({
- .interfaceName = fqInstanceName,
+ auto ret = timeoutIPC(manager, &IServiceManager::debugDump, [&] (const auto &infos) {
+ std::map<std::string, TableEntry> entries;
+ for (const auto &info : infos) {
+ std::string interfaceName = std::string{info.interfaceName.c_str()} + "/" +
+ std::string{info.instanceName.c_str()};
+ entries.emplace(interfaceName, TableEntry{
+ .interfaceName = interfaceName,
.transport = "passthrough",
.serverPid = NO_PID,
.serverObjectAddress = NO_PTR,
- .clientPids = {}
- });
+ .clientPids = {},
+ .arch = ARCH_UNKNOWN
+ }).first->second.arch |= fromBaseArchitecture(info.arch);
+ }
+ for (auto &&pair : entries) {
+ putEntry(LIST_DLLIB, std::move(pair.second));
}
});
if (!ret.isOk()) {
@@ -233,18 +416,20 @@
Status Lshal::fetchPassthrough(const sp<IServiceManager> &manager) {
using namespace ::android::hardware;
+ using namespace ::android::hardware::details;
using namespace ::android::hidl::manager::V1_0;
using namespace ::android::hidl::base::V1_0;
auto ret = timeoutIPC(manager, &IServiceManager::debugDump, [&] (const auto &infos) {
for (const auto &info : infos) {
- putEntry({
+ putEntry(PTSERVICEMANAGER_REG_CLIENT, {
.interfaceName =
std::string{info.interfaceName.c_str()} + "/" +
std::string{info.instanceName.c_str()},
.transport = "passthrough",
.serverPid = info.clientPids.size() == 1 ? info.clientPids[0] : NO_PID,
.serverObjectAddress = NO_PTR,
- .clientPids = info.clientPids
+ .clientPids = info.clientPids,
+ .arch = fromBaseArchitecture(info.arch)
});
}
});
@@ -262,79 +447,85 @@
using namespace ::android::hidl::manager::V1_0;
using namespace ::android::hidl::base::V1_0;
const std::string mode = "hwbinder";
- Status status = OK;
- auto listRet = timeoutIPC(manager, &IServiceManager::list, [&] (const auto &fqInstanceNames) {
- // server pid, .ptr value of binder object, child pids
- std::map<std::string, DebugInfo> allDebugInfos;
- std::map<pid_t, std::map<uint64_t, Pids>> allPids;
- for (const auto &fqInstanceName : fqInstanceNames) {
- const auto pair = split(fqInstanceName, '/');
- const auto &serviceName = pair.first;
- const auto &instanceName = pair.second;
- auto getRet = timeoutIPC(manager, &IServiceManager::get, serviceName, instanceName);
- if (!getRet.isOk()) {
- mErr << "Warning: Skipping \"" << fqInstanceName << "\": "
- << "cannot be fetched from service manager:"
- << getRet.description() << std::endl;
- status |= DUMP_BINDERIZED_ERROR;
- continue;
- }
- sp<IBase> service = getRet;
- if (service == nullptr) {
- mErr << "Warning: Skipping \"" << fqInstanceName << "\": "
- << "cannot be fetched from service manager (null)";
- status |= DUMP_BINDERIZED_ERROR;
- continue;
- }
- auto debugRet = timeoutIPC(service, &IBase::getDebugInfo, [&] (const auto &debugInfo) {
- allDebugInfos[fqInstanceName] = debugInfo;
- if (debugInfo.pid >= 0) {
- allPids[static_cast<pid_t>(debugInfo.pid)].clear();
- }
- });
- if (!debugRet.isOk()) {
- mErr << "Warning: Skipping \"" << fqInstanceName << "\": "
- << "debugging information cannot be retrieved:"
- << debugRet.description() << std::endl;
- status |= DUMP_BINDERIZED_ERROR;
- }
- }
- for (auto &pair : allPids) {
- pid_t serverPid = pair.first;
- if (!getReferencedPids(serverPid, &allPids[serverPid])) {
- mErr << "Warning: no information for PID " << serverPid
- << ", are you root?" << std::endl;
- status |= DUMP_BINDERIZED_ERROR;
- }
- }
- for (const auto &fqInstanceName : fqInstanceNames) {
- auto it = allDebugInfos.find(fqInstanceName);
- if (it == allDebugInfos.end()) {
- putEntry({
- .interfaceName = fqInstanceName,
- .transport = mode,
- .serverPid = NO_PID,
- .serverObjectAddress = NO_PTR,
- .clientPids = {}
- });
- continue;
- }
- const DebugInfo &info = it->second;
- putEntry({
- .interfaceName = fqInstanceName,
- .transport = mode,
- .serverPid = info.pid,
- .serverObjectAddress = info.ptr,
- .clientPids = info.pid == NO_PID || info.ptr == NO_PTR
- ? Pids{} : allPids[info.pid][info.ptr]
- });
- }
+ hidl_vec<hidl_string> fqInstanceNames;
+ // copying out for timeoutIPC
+ auto listRet = timeoutIPC(manager, &IServiceManager::list, [&] (const auto &names) {
+ fqInstanceNames = names;
});
if (!listRet.isOk()) {
mErr << "Error: Failed to list services for " << mode << ": "
<< listRet.description() << std::endl;
- status |= DUMP_BINDERIZED_ERROR;
+ return DUMP_BINDERIZED_ERROR;
+ }
+
+ Status status = OK;
+ // server pid, .ptr value of binder object, child pids
+ std::map<std::string, DebugInfo> allDebugInfos;
+ std::map<pid_t, std::map<uint64_t, Pids>> allPids;
+ for (const auto &fqInstanceName : fqInstanceNames) {
+ const auto pair = splitFirst(fqInstanceName, '/');
+ const auto &serviceName = pair.first;
+ const auto &instanceName = pair.second;
+ auto getRet = timeoutIPC(manager, &IServiceManager::get, serviceName, instanceName);
+ if (!getRet.isOk()) {
+ mErr << "Warning: Skipping \"" << fqInstanceName << "\": "
+ << "cannot be fetched from service manager:"
+ << getRet.description() << std::endl;
+ status |= DUMP_BINDERIZED_ERROR;
+ continue;
+ }
+ sp<IBase> service = getRet;
+ if (service == nullptr) {
+ mErr << "Warning: Skipping \"" << fqInstanceName << "\": "
+ << "cannot be fetched from service manager (null)";
+ status |= DUMP_BINDERIZED_ERROR;
+ continue;
+ }
+ auto debugRet = timeoutIPC(service, &IBase::getDebugInfo, [&] (const auto &debugInfo) {
+ allDebugInfos[fqInstanceName] = debugInfo;
+ if (debugInfo.pid >= 0) {
+ allPids[static_cast<pid_t>(debugInfo.pid)].clear();
+ }
+ });
+ if (!debugRet.isOk()) {
+ mErr << "Warning: Skipping \"" << fqInstanceName << "\": "
+ << "debugging information cannot be retrieved:"
+ << debugRet.description() << std::endl;
+ status |= DUMP_BINDERIZED_ERROR;
+ }
+ }
+ for (auto &pair : allPids) {
+ pid_t serverPid = pair.first;
+ if (!getReferencedPids(serverPid, &allPids[serverPid])) {
+ mErr << "Warning: no information for PID " << serverPid
+ << ", are you root?" << std::endl;
+ status |= DUMP_BINDERIZED_ERROR;
+ }
+ }
+ for (const auto &fqInstanceName : fqInstanceNames) {
+ auto it = allDebugInfos.find(fqInstanceName);
+ if (it == allDebugInfos.end()) {
+ putEntry(HWSERVICEMANAGER_LIST, {
+ .interfaceName = fqInstanceName,
+ .transport = mode,
+ .serverPid = NO_PID,
+ .serverObjectAddress = NO_PTR,
+ .clientPids = {},
+ .arch = ARCH_UNKNOWN
+ });
+ continue;
+ }
+ const DebugInfo &info = it->second;
+ putEntry(HWSERVICEMANAGER_LIST, {
+ .interfaceName = fqInstanceName,
+ .transport = mode,
+ .serverPid = info.pid,
+ .serverObjectAddress = info.ptr,
+ .clientPids = info.pid == NO_PID || info.ptr == NO_PTR
+ ? Pids{} : allPids[info.pid][info.ptr],
+ .arch = fromBaseArchitecture(info.arch),
+ });
}
return status;
}
@@ -364,13 +555,14 @@
void Lshal::usage() const {
mErr
<< "usage: lshal" << std::endl
- << " Dump all hals with default ordering and columns [-itpc]." << std::endl
- << " lshal [--interface|-i] [--transport|-t]" << std::endl
+ << " Dump all hals with default ordering and columns [-ipc]." << std::endl
+ << " lshal [--interface|-i] [--transport|-t] [-r|--arch]" << std::endl
<< " [--pid|-p] [--address|-a] [--clients|-c] [--cmdline|-m]" << std::endl
- << " [--sort={interface|i|pid|p}]" << std::endl
+ << " [--sort={interface|i|pid|p}] [--init-vintf[=path]]" << std::endl
<< " -i, --interface: print the interface name column" << std::endl
<< " -n, --instance: print the instance name column" << std::endl
<< " -t, --transport: print the transport mode column" << std::endl
+ << " -r, --arch: print if the HAL is in 64-bit or 32-bit" << std::endl
<< " -p, --pid: print the server PID, or server cmdline if -m is set" << std::endl
<< " -a, --address: print the server object address column" << std::endl
<< " -c, --clients: print the client PIDs, or client cmdlines if -m is set"
@@ -378,6 +570,8 @@
<< " -m, --cmdline: print cmdline instead of PIDs" << std::endl
<< " --sort=i, --sort=interface: sort by interface name" << std::endl
<< " --sort=p, --sort=pid: sort by server pid" << std::endl
+ << " --init-vintf=path: form a skeleton HAL manifest to specified file " << std::endl
+ << " (stdout if no file specified)" << std::endl
<< " lshal [-h|--help]" << std::endl
<< " -h, --help: show this help information." << std::endl;
}
@@ -388,6 +582,7 @@
{"help", no_argument, 0, 'h' },
{"interface", no_argument, 0, 'i' },
{"transport", no_argument, 0, 't' },
+ {"arch", no_argument, 0, 'r' },
{"pid", no_argument, 0, 'p' },
{"address", no_argument, 0, 'a' },
{"clients", no_argument, 0, 'c' },
@@ -395,6 +590,7 @@
// long options without short alternatives
{"sort", required_argument, 0, 's' },
+ {"init-vintf",optional_argument, 0, 'v' },
{ 0, 0, 0, 0 }
};
@@ -403,7 +599,7 @@
optind = 1;
for (;;) {
// using getopt_long in case we want to add other options in the future
- c = getopt_long(argc, argv, "hitpacm", longOptions, &optionIndex);
+ c = getopt_long(argc, argv, "hitrpacm", longOptions, &optionIndex);
if (c == -1) {
break;
}
@@ -420,6 +616,17 @@
}
break;
}
+ case 'v': {
+ if (optarg) {
+ mFileOutput = new std::ofstream{optarg};
+ mOut = mFileOutput;
+ if (!mFileOutput.buf().is_open()) {
+ mErr << "Could not open file '" << optarg << "'." << std::endl;
+ return IO_ERROR;
+ }
+ }
+ mVintf = true;
+ }
case 'i': {
mSelectedColumns |= ENABLE_INTERFACE_NAME;
break;
@@ -428,6 +635,10 @@
mSelectedColumns |= ENABLE_TRANSPORT;
break;
}
+ case 'r': {
+ mSelectedColumns |= ENABLE_ARCH;
+ break;
+ }
case 'p': {
mSelectedColumns |= ENABLE_SERVER_PID;
break;
@@ -452,8 +663,7 @@
}
if (mSelectedColumns == 0) {
- mSelectedColumns = ENABLE_INTERFACE_NAME
- | ENABLE_TRANSPORT | ENABLE_SERVER_PID | ENABLE_CLIENT_PIDS;
+ mSelectedColumns = ENABLE_INTERFACE_NAME | ENABLE_SERVER_PID | ENABLE_CLIENT_PIDS;
}
return OK;
}
diff --git a/cmds/lshal/Lshal.h b/cmds/lshal/Lshal.h
index ead99dc..c9c6660 100644
--- a/cmds/lshal/Lshal.h
+++ b/cmds/lshal/Lshal.h
@@ -19,12 +19,13 @@
#include <stdint.h>
-#include <iostream>
+#include <fstream>
#include <string>
#include <vector>
#include <android/hidl/manager/1.0/IServiceManager.h>
+#include "NullableOStream.h"
#include "TableEntry.h"
namespace android {
@@ -38,6 +39,7 @@
DUMP_BINDERIZED_ERROR = 1 << 3,
DUMP_PASSTHROUGH_ERROR = 1 << 4,
DUMP_ALL_LIBS_ERROR = 1 << 5,
+ IO_ERROR = 1 << 6,
};
using Status = unsigned int;
@@ -49,17 +51,21 @@
Status parseArgs(int argc, char **argv);
Status fetch();
void postprocess();
- void dump() const;
+ void dump();
void usage() const;
- void putEntry(TableEntry &&entry);
+ void putEntry(TableEntrySource source, TableEntry &&entry);
Status fetchPassthrough(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
Status fetchBinderized(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
Status fetchAllLibraries(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
bool getReferencedPids(
pid_t serverPid, std::map<uint64_t, Pids> *objects) const;
+ void dumpTable();
+ void dumpVintf() const;
void printLine(
const std::string &interfaceName,
- const std::string &transport, const std::string &server,
+ const std::string &transport,
+ const std::string &arch,
+ const std::string &server,
const std::string &serverCmdline,
const std::string &address, const std::string &clients,
const std::string &clientCmdlines) const ;
@@ -68,14 +74,21 @@
// Call getCmdline on all pid in pids. If it returns empty string, the process might
// have died, and the pid is removed from pids.
void removeDeadProcesses(Pids *pids);
+ void forEachTable(const std::function<void(Table &)> &f);
+ void forEachTable(const std::function<void(const Table &)> &f) const;
- Table mTable{};
- std::ostream &mErr = std::cerr;
- std::ostream &mOut = std::cout;
+ Table mServicesTable{};
+ Table mPassthroughRefTable{};
+ Table mImplementationsTable{};
+
+ NullableOStream<std::ostream> mErr = std::cerr;
+ NullableOStream<std::ostream> mOut = std::cout;
+ NullableOStream<std::ofstream> mFileOutput = nullptr;
TableEntryCompare mSortColumn = nullptr;
TableEntrySelect mSelectedColumns = 0;
// If true, cmdlines will be printed instead of pid.
- bool mEnableCmdlines;
+ bool mEnableCmdlines = false;
+ bool mVintf = false;
// If an entry does not exist, need to ask /proc/{pid}/cmdline to get it.
// If an entry exist but is an empty string, process might have died.
// If an entry exist and not empty, it contains the cached content of /proc/{pid}/cmdline.
diff --git a/cmds/lshal/NullableOStream.h b/cmds/lshal/NullableOStream.h
new file mode 100644
index 0000000..ab37a04
--- /dev/null
+++ b/cmds/lshal/NullableOStream.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2016 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 FRAMEWORK_NATIVE_CMDS_LSHAL_NULLABLE_O_STREAM_H_
+#define FRAMEWORK_NATIVE_CMDS_LSHAL_NULLABLE_O_STREAM_H_
+
+#include <iostream>
+
+namespace android {
+namespace lshal {
+
+template<typename S>
+class NullableOStream {
+public:
+ NullableOStream(S &os) : mOs(&os) {}
+ NullableOStream(S *os) : mOs(os) {}
+ NullableOStream &operator=(S &os) {
+ mOs = &os;
+ return *this;
+ }
+ NullableOStream &operator=(S *os) {
+ mOs = os;
+ return *this;
+ }
+ template<typename Other>
+ NullableOStream &operator=(const NullableOStream<Other> &other) {
+ mOs = other.mOs;
+ return *this;
+ }
+
+ const NullableOStream &operator<<(std::ostream& (*pf)(std::ostream&)) const {
+ if (mOs) {
+ (*mOs) << pf;
+ }
+ return *this;
+ }
+ template<typename T>
+ const NullableOStream &operator<<(const T &rhs) const {
+ if (mOs) {
+ (*mOs) << rhs;
+ }
+ return *this;
+ }
+ S& buf() const {
+ return *mOs;
+ }
+ operator bool() const {
+ return mOs != nullptr;
+ }
+private:
+ template<typename>
+ friend class NullableOStream;
+
+ S *mOs = nullptr;
+};
+
+} // namespace lshal
+} // namespace android
+
+#endif // FRAMEWORK_NATIVE_CMDS_LSHAL_NULLABLE_O_STREAM_H_
diff --git a/cmds/lshal/TableEntry.h b/cmds/lshal/TableEntry.h
index 4ec3a0c..2407b42 100644
--- a/cmds/lshal/TableEntry.h
+++ b/cmds/lshal/TableEntry.h
@@ -28,6 +28,21 @@
using Pids = std::vector<int32_t>;
+enum : unsigned int {
+ HWSERVICEMANAGER_LIST, // through defaultServiceManager()->list()
+ PTSERVICEMANAGER_REG_CLIENT, // through registerPassthroughClient
+ LIST_DLLIB, // through listing dynamic libraries
+};
+using TableEntrySource = unsigned int;
+
+enum : unsigned int {
+ ARCH_UNKNOWN = 0,
+ ARCH64 = 1 << 0,
+ ARCH32 = 1 << 1,
+ ARCH_BOTH = ARCH32 | ARCH64
+};
+using Architecture = unsigned int;
+
struct TableEntry {
std::string interfaceName;
std::string transport;
@@ -36,6 +51,7 @@
uint64_t serverObjectAddress;
Pids clientPids;
std::vector<std::string> clientCmdlines;
+ Architecture arch;
static bool sortByInterfaceName(const TableEntry &a, const TableEntry &b) {
return a.interfaceName < b.interfaceName;
@@ -45,7 +61,17 @@
};
};
-using Table = std::vector<TableEntry>;
+struct Table {
+ using Entries = std::vector<TableEntry>;
+ std::string description;
+ Entries entries;
+
+ Entries::iterator begin() { return entries.begin(); }
+ Entries::const_iterator begin() const { return entries.begin(); }
+ Entries::iterator end() { return entries.end(); }
+ Entries::const_iterator end() const { return entries.end(); }
+};
+
using TableEntryCompare = std::function<bool(const TableEntry &, const TableEntry &)>;
enum : unsigned int {
@@ -53,7 +79,8 @@
ENABLE_TRANSPORT = 1 << 1,
ENABLE_SERVER_PID = 1 << 2,
ENABLE_SERVER_ADDR = 1 << 3,
- ENABLE_CLIENT_PIDS = 1 << 4
+ ENABLE_CLIENT_PIDS = 1 << 4,
+ ENABLE_ARCH = 1 << 5
};
using TableEntrySelect = unsigned int;
diff --git a/cmds/surfacereplayer/replayer/Android.mk b/cmds/surfacereplayer/replayer/Android.mk
index 9f06033..1dd926c 100644
--- a/cmds/surfacereplayer/replayer/Android.mk
+++ b/cmds/surfacereplayer/replayer/Android.mk
@@ -42,6 +42,7 @@
libutils \
libprotobuf-cpp-lite \
libbase \
+ libnativewindow \
LOCAL_STATIC_LIBRARIES := \
libtrace_proto \
diff --git a/cmds/surfacereplayer/replayer/Replayer.cpp b/cmds/surfacereplayer/replayer/Replayer.cpp
index a49da37..35b63ec 100644
--- a/cmds/surfacereplayer/replayer/Replayer.cpp
+++ b/cmds/surfacereplayer/replayer/Replayer.cpp
@@ -22,8 +22,6 @@
#include <android-base/file.h>
-#include <binder/IMemory.h>
-
#include <gui/BufferQueue.h>
#include <gui/ISurfaceComposer.h>
#include <gui/Surface.h>
diff --git a/cmds/surfacereplayer/replayer/Replayer.h b/cmds/surfacereplayer/replayer/Replayer.h
index f757fc3..f36c9fd 100644
--- a/cmds/surfacereplayer/replayer/Replayer.h
+++ b/cmds/surfacereplayer/replayer/Replayer.h
@@ -29,6 +29,7 @@
#include <utils/Errors.h>
#include <utils/StrongPointer.h>
+#include <stdatomic.h>
#include <condition_variable>
#include <memory>
#include <mutex>
diff --git a/docs/Doxyfile b/docs/Doxyfile
index 3ea453f..bb0ca32 100644
--- a/docs/Doxyfile
+++ b/docs/Doxyfile
@@ -14,90 +14,90 @@
# Project related configuration options
#---------------------------------------------------------------------------
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
# http://www.gnu.org/software/libiconv for the list of possible encodings.
DOXYFILE_ENCODING = UTF-8
-# The PROJECT_NAME tag is a single word (or sequence of words) that should
-# identify the project. Note that if you do not use Doxywizard you need
+# The PROJECT_NAME tag is a single word (or sequence of words) that should
+# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = "NDK API"
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER =
+PROJECT_NUMBER =
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
# a quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF = ""
-# With the PROJECT_LOGO tag one can specify an logo or icon that is
-# included in the documentation. The maximum height of the logo should not
-# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
# Doxygen will copy the logo to the output directory.
PROJECT_LOGO = logo.png
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
-OUTPUT_DIRECTORY =
+OUTPUT_DIRECTORY =
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
# otherwise cause performance problems for the file system.
CREATE_SUBDIRS = NO
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
OUTPUT_LANGUAGE = English
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
# Set to NO to disable this.
BRIEF_MEMBER_DESC = YES
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
REPEAT_BRIEF = YES
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
# "represents" "a" "an" "the"
ABBREVIATE_BRIEF = "The $name class" \
@@ -112,256 +112,256 @@
an \
the
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
# description.
ALWAYS_DETAILED_SEC = NO
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
INLINE_INHERITED_MEMB = NO
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = NO
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip. Note that you specify absolute paths here, but also
-# relative paths, which will be relative from the directory where doxygen is
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip. Note that you specify absolute paths here, but also
+# relative paths, which will be relative from the directory where doxygen is
# started.
-STRIP_FROM_PATH =
+STRIP_FROM_PATH =
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
# are normally passed to the compiler using the -I flag.
-STRIP_FROM_INC_PATH =
+STRIP_FROM_INC_PATH =
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful if your file system
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = NO
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
# (thus requiring an explicit @brief command for a brief description.)
JAVADOC_AUTOBRIEF = NO
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
# an explicit \brief command for a brief description.)
QT_AUTOBRIEF = NO
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
# description. Set this tag to YES if you prefer the old behaviour instead.
MULTILINE_CPP_IS_BRIEF = NO
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
# re-implements.
INHERIT_DOCS = YES
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
# be part of the file/class/namespace that contains it.
SEPARATE_MEMBER_PAGES = NO
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 4
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
-ALIASES =
+ALIASES =
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding
-# "class=itcl::class" will allow you to use the command class in the
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding
+# "class=itcl::class" will allow you to use the command class in the
# itcl::class meaning.
-TCL_SUBST =
+TCL_SUBST =
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = YES
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
# scopes will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
# Fortran.
OPTIMIZE_FOR_FORTRAN = NO
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
# VHDL.
OPTIMIZE_OUTPUT_VHDL = NO
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given
-# extension. Doxygen has a built-in mapping, but you can override or extend it
-# using this tag. The format is ext=language, where ext is a file extension,
-# and language is one of the parsers supported by doxygen: IDL, Java,
-# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
-# C++. For instance to make doxygen treat .inc files as Fortran files (default
-# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
-# that for custom extensions you also need to set FILE_PATTERNS otherwise the
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension,
+# and language is one of the parsers supported by doxygen: IDL, Java,
+# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
+# C++. For instance to make doxygen treat .inc files as Fortran files (default
+# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
+# that for custom extensions you also need to set FILE_PATTERNS otherwise the
# files are not read by doxygen.
-EXTENSION_MAPPING =
+EXTENSION_MAPPING =
-# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
-# comments according to the Markdown format, which allows for more readable
-# documentation. See http://daringfireball.net/projects/markdown/ for details.
-# The output of markdown processing is further processed by doxygen, so you
-# can mix doxygen, HTML, and XML commands with Markdown formatting.
+# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
+# comments according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you
+# can mix doxygen, HTML, and XML commands with Markdown formatting.
# Disable only in case of backward compatibilities issues.
MARKDOWN_SUPPORT = YES
-# When enabled doxygen tries to link words that correspond to documented classes,
-# or namespaces to their corresponding documentation. Such a link can be
-# prevented in individual cases by by putting a % sign in front of the word or
+# When enabled doxygen tries to link words that correspond to documented classes,
+# or namespaces to their corresponding documentation. Such a link can be
+# prevented in individual cases by by putting a % sign in front of the word or
# globally by setting AUTOLINK_SUPPORT to NO.
AUTOLINK_SUPPORT = YES
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also makes the inheritance and collaboration
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also makes the inheritance and collaboration
# diagrams that involve STL classes more complete and accurate.
BUILTIN_STL_SUPPORT = NO
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
CPP_CLI_SUPPORT = NO
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
# instead of private inheritance when no explicit protection keyword is present.
SIP_SUPPORT = NO
-# For Microsoft's IDL there are propget and propput attributes to indicate
-# getter and setter methods for a property. Setting this option to YES (the
-# default) will make doxygen replace the get and set methods by a property in
-# the documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES (the
+# default) will make doxygen replace the get and set methods by a property in
+# the documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
# methods anyway, you should set this option to NO.
IDL_PROPERTY_SUPPORT = YES
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
DISTRIBUTE_GROUP_DOC = NO
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
# the \nosubgrouping command.
SUBGROUPING = YES
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
-# unions are shown inside the group in which they are included (e.g. using
-# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
# section (for LaTeX and RTF).
INLINE_GROUPED_CLASSES = NO
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
-# unions with only public data fields will be shown inline in the documentation
-# of the scope in which they are defined (i.e. file, namespace, or group
-# documentation), provided this scope is documented. If set to NO (the default),
-# structs, classes, and unions are shown on a separate page (for HTML and Man
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
+# unions with only public data fields will be shown inline in the documentation
+# of the scope in which they are defined (i.e. file, namespace, or group
+# documentation), provided this scope is documented. If set to NO (the default),
+# structs, classes, and unions are shown on a separate page (for HTML and Man
# pages) or section (for LaTeX and RTF).
INLINE_SIMPLE_STRUCTS = NO
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
TYPEDEF_HIDES_STRUCT = NO
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penalty.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will roughly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penalty.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will roughly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols.
SYMBOL_CACHE_SIZE = 0
-# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
-# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
-# their name and scope. Since this can be an expensive process and often the
-# same symbol appear multiple times in the code, doxygen keeps a cache of
-# pre-resolved symbols. If the cache is too small doxygen will become slower.
-# If the cache is too large, memory is wasted. The cache size is given by this
-# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
+# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
+# their name and scope. Since this can be an expensive process and often the
+# same symbol appear multiple times in the code, doxygen keeps a cache of
+# pre-resolved symbols. If the cache is too small doxygen will become slower.
+# If the cache is too large, memory is wasted. The cache size is given by this
+# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols.
LOOKUP_CACHE_SIZE = 0
@@ -370,329 +370,329 @@
# Build related configuration options
#---------------------------------------------------------------------------
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = YES
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
-# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
# scope will be included in the documentation.
EXTRACT_PACKAGE = NO
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = NO
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
EXTRACT_LOCAL_CLASSES = YES
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.
EXTRACT_LOCAL_METHODS = NO
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
# anonymous namespaces are hidden.
EXTRACT_ANON_NSPACES = NO
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
# documentation.
HIDE_FRIEND_COMPOUNDS = NO
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
# function's detailed documentation block.
HIDE_IN_BODY_DOCS = NO
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
CASE_SENSE_NAMES = NO
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = YES
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
# rather than with sharp brackets.
FORCE_LOCAL_INCLUDES = NO
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
INLINE_INFO = YES
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
# declaration order.
SORT_BRIEF_DOCS = NO
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
-# will sort the (brief and detailed) documentation of class members so that
-# constructors and destructors are listed first. If set to NO (the default)
-# the constructors will appear in the respective orders defined by
-# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
-# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
SORT_MEMBERS_CTORS_1ST = NO
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
# the group names will appear in their defined order.
SORT_GROUP_NAMES = NO
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
# alphabetical list.
SORT_BY_SCOPE_NAME = NO
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
-# do proper type resolution of all parameters of a function it will reject a
-# match between the prototype and the implementation of a member function even
-# if there is only one candidate or it is obvious which candidate to choose
-# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
# will still accept a match between prototype and implementation in such cases.
STRICT_PROTO_MATCHING = NO
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
# commands in the documentation.
GENERATE_TODOLIST = YES
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
# commands in the documentation.
GENERATE_TESTLIST = YES
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
# commands in the documentation.
GENERATE_BUGLIST = YES
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
# \deprecated commands in the documentation.
GENERATE_DEPRECATEDLIST= YES
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if section-label ... \endif
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if section-label ... \endif
# and \cond section-label ... \endcond blocks.
-ENABLED_SECTIONS =
+ENABLED_SECTIONS =
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or macro consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and macros in the
-# documentation can be controlled using \showinitializer or \hideinitializer
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
# command in the documentation regardless of this setting.
MAX_INITIALIZER_LINES = 26
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
# Folder Tree View (if specified). The default is YES.
SHOW_FILES = YES
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page. This will remove the Namespaces entry from the Quick Index
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page. This will remove the Namespaces entry from the Quick Index
# and from the Folder Tree View (if specified). The default is YES.
SHOW_NAMESPACES = YES
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
# is used as the file version. See the manual for examples.
-FILE_VERSION_FILTER =
+FILE_VERSION_FILTER =
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. To create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option.
-# You can optionally specify a file name after the option, if omitted
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
# DoxygenLayout.xml will be used as the name of the layout file.
-LAYOUT_FILE =
+LAYOUT_FILE =
-# The CITE_BIB_FILES tag can be used to specify one or more bib files
-# containing the references data. This must be a list of .bib files. The
-# .bib extension is automatically appended if omitted. Using this command
-# requires the bibtex tool to be installed. See also
-# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
-# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
-# feature you need bibtex and perl available in the search path. Do not use
+# The CITE_BIB_FILES tag can be used to specify one or more bib files
+# containing the references data. This must be a list of .bib files. The
+# .bib extension is automatically appended if omitted. Using this command
+# requires the bibtex tool to be installed. See also
+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
+# feature you need bibtex and perl available in the search path. Do not use
# file names with spaces, bibtex cannot handle them.
-CITE_BIB_FILES =
+CITE_BIB_FILES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
-# The QUIET tag can be used to turn on/off the messages that are generated
+# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
QUIET = NO
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
# NO is used.
WARNINGS = YES
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
# automatically be disabled.
WARN_IF_UNDOCUMENTED = YES
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
# don't exist or using markup commands wrongly.
WARN_IF_DOC_ERROR = YES
-# The WARN_NO_PARAMDOC option can be enabled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
# documentation.
WARN_NO_PARAMDOC = NO
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
# be obtained via FILE_VERSION_FILTER)
WARN_FORMAT = "$file:$line: $text"
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
# to stderr.
-WARN_LOGFILE =
+WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = ../include/android ../../av/include/ndk ../../av/include/camera/ndk
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
# the list of possible encodings.
INPUT_ENCODING = UTF-8
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
-# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
# *.f90 *.f *.for *.vhd *.vhdl
FILE_PATTERNS = *.c \
@@ -730,159 +730,159 @@
*.vhd \
*.vhdl
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
RECURSIVE = YES
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-# Note that relative paths are relative to the directory from which doxygen is
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+# Note that relative paths are relative to the directory from which doxygen is
# run.
-EXCLUDE =
+EXCLUDE =
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
# from the input.
EXCLUDE_SYMLINKS = NO
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*
-EXCLUDE_PATTERNS =
+EXCLUDE_PATTERNS =
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
-EXCLUDE_SYMBOLS =
+EXCLUDE_SYMBOLS =
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
# the \include command).
-EXAMPLE_PATH =
+EXAMPLE_PATH =
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.
EXAMPLE_PATTERNS = *
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
# Possible values are YES and NO. If left blank NO is used.
EXAMPLE_RECURSIVE = NO
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
# the \image command).
-IMAGE_PATH =
+IMAGE_PATH =
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
# ignored.
-INPUT_FILTER =
+INPUT_FILTER =
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty or if
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty or if
# non of the patterns match the file name, INPUT_FILTER is applied.
-FILTER_PATTERNS =
+FILTER_PATTERNS =
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
# files to browse (i.e. when SOURCE_BROWSER is set to YES).
FILTER_SOURCE_FILES = NO
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
-# and it is also possible to disable source filtering for a specific pattern
-# using *.ext= (so without naming a filter). This option only has effect when
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
# FILTER_SOURCE_FILES is enabled.
-FILTER_SOURCE_PATTERNS =
+FILTER_SOURCE_PATTERNS =
-# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
-# is part of the input, its contents will be placed on the main page (index.html).
-# This can be useful if you have a project on for instance GitHub and want reuse
+# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page (index.html).
+# This can be useful if you have a project on for instance GitHub and want reuse
# the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
# VERBATIM_HEADERS is set to NO.
SOURCE_BROWSER = NO
-# Setting the INLINE_SOURCES tag to YES will include the body
+# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
INLINE_SOURCES = NO
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C, C++ and Fortran comments will always remain visible.
STRIP_CODE_COMMENTS = NO
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
# functions referencing it will be listed.
REFERENCED_BY_RELATION = NO
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
# called/used by that function will be listed.
REFERENCES_RELATION = NO
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
# link to the source code. Otherwise they will link to the documentation.
REFERENCES_LINK_SOURCE = YES
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
# will need version 4.8.6 or higher.
USE_HTAGS = NO
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = NO
@@ -891,170 +891,170 @@
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
ALPHABETICAL_INDEX = NO
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 5
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
-IGNORE_PREFIX =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
GENERATE_HTML = YES
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
HTML_OUTPUT = $(HTML_OUTPUT)
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
# doxygen will generate files with .html extension.
HTML_FILE_EXTENSION = .html
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header. Note that when using a custom header you are responsible
-# for the proper inclusion of any scripts and style sheets that doxygen
-# needs, which is dependent on the configuration options used.
-# It is advised to generate a default header using "doxygen -w html
-# header.html footer.html stylesheet.css YourConfigFile" and then modify
-# that header. Note that the header is subject to change so you typically
-# have to redo this when upgrading to a newer version of doxygen or when
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header. Note that when using a custom header you are responsible
+# for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is advised to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when
# changing the value of configuration settings such as GENERATE_TREEVIEW!
HTML_HEADER = $(HTML_HEADER)
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER = $(HTML_FOOTER)
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If left blank doxygen will
-# generate a default style sheet. Note that it is recommended to use
-# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If left blank doxygen will
+# generate a default style sheet. Note that it is recommended to use
+# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
# tag will in the future become obsolete.
-HTML_STYLESHEET =
+HTML_STYLESHEET =
-# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
-# user-defined cascading style sheet that is included after the standard
-# style sheets created by doxygen. Using this option one can overrule
-# certain style aspects. This is preferred over using HTML_STYLESHEET
-# since it does not replace the standard style sheet and is therefor more
-# robust against future updates. Doxygen will copy the style sheet file to
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
+# user-defined cascading style sheet that is included after the standard
+# style sheets created by doxygen. Using this option one can overrule
+# certain style aspects. This is preferred over using HTML_STYLESHEET
+# since it does not replace the standard style sheet and is therefor more
+# robust against future updates. Doxygen will copy the style sheet file to
# the output directory.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
# the files will be copied as-is; there are no commands or markers available.
-HTML_EXTRA_FILES =
+HTML_EXTRA_FILES =
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
-# Doxygen will adjust the colors in the style sheet and background images
-# according to this color. Hue is specified as an angle on a colorwheel,
-# see http://en.wikipedia.org/wiki/Hue for more information.
-# For instance the value 0 represents red, 60 is yellow, 120 is green,
-# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the style sheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
# The allowed range is 0 to 359.
HTML_COLORSTYLE_HUE = 220
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
-# the colors in the HTML output. For a value of 0 the output will use
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
# grayscales only. A value of 255 will produce the most vivid colors.
HTML_COLORSTYLE_SAT = 0
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
-# the luminance component of the colors in the HTML output. Values below
-# 100 gradually make the output lighter, whereas values above 100 make
-# the output darker. The value divided by 100 is the actual gamma applied,
-# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
# and 100 does not change the gamma.
HTML_COLORSTYLE_GAMMA = 80
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
# this to NO can help when comparing the output of multiple runs.
HTML_TIMESTAMP = YES
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
# page has loaded.
HTML_DYNAMIC_SECTIONS = NO
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
-# entries shown in the various tree structured indices initially; the user
-# can expand and collapse entries dynamically later on. Doxygen will expand
-# the tree to such a level that at most the specified number of entries are
-# visible (unless a fully collapsed tree already exceeds this amount).
-# So setting the number of entries 1 will produce a full collapsed tree by
-# default. 0 is a special value representing an infinite number of entries
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
+# entries shown in the various tree structured indices initially; the user
+# can expand and collapse entries dynamically later on. Doxygen will expand
+# the tree to such a level that at most the specified number of entries are
+# visible (unless a fully collapsed tree already exceeds this amount).
+# So setting the number of entries 1 will produce a full collapsed tree by
+# default. 0 is a special value representing an infinite number of entries
# and will result in a full expanded tree by default.
HTML_INDEX_NUM_ENTRIES = 100
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
# for more information.
GENERATE_DOCSET = NO
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
# can be grouped.
DOCSET_FEEDNAME = "Doxygen generated docs"
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
# will append .docset to the name.
DOCSET_BUNDLE_ID = org.doxygen.Project
-# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
-# identify the documentation publisher. This should be a reverse domain-name
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
+# identify the documentation publisher. This should be a reverse domain-name
# style string, e.g. com.mycompany.MyDocSet.documentation.
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
@@ -1063,361 +1063,361 @@
DOCSET_PUBLISHER_NAME = Publisher
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
# written to the html output directory.
-CHM_FILE =
+CHM_FILE =
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
# the HTML help compiler on the generated index.hhp.
-HHC_LOCATION =
+HHC_LOCATION =
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
GENERATE_CHI = NO
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
# content.
-CHM_INDEX_ENCODING =
+CHM_INDEX_ENCODING =
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
# normal table of contents (NO) in the .chm file.
BINARY_TOC = NO
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
# to the contents of the HTML help documentation and to the tree view.
TOC_EXPAND = NO
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
-# that can be used as input for Qt's qhelpgenerator to generate a
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
# Qt Compressed Help (.qch) of the generated HTML documentation.
GENERATE_QHP = NO
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
# The path specified is relative to the HTML output folder.
-QCH_FILE =
+QCH_FILE =
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#namespace
QHP_NAMESPACE = org.doxygen.Project
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#virtual-folders
QHP_VIRTUAL_FOLDER = doc
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
-# add. For more information please see
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
# http://doc.trolltech.com/qthelpproject.html#custom-filters
-QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_NAME =
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
# Qt Help Project / Custom Filters</a>.
-QHP_CUST_FILTER_ATTRS =
+QHP_CUST_FILTER_ATTRS =
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
# Qt Help Project / Filter Attributes</a>.
-QHP_SECT_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
# .qhp file.
-QHG_LOCATION =
+QHG_LOCATION =
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
# the help appears.
GENERATE_ECLIPSEHELP = NO
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
# this name.
ECLIPSE_DOC_ID = org.doxygen.Project
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
-# at top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it. Since the tabs have the same information as the
-# navigation tree you can set this option to NO if you already set
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
+# at top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it. Since the tabs have the same information as the
+# navigation tree you can set this option to NO if you already set
# GENERATE_TREEVIEW to YES.
DISABLE_INDEX = YES
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-# Since the tree basically has the same information as the tab index you
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+# Since the tree basically has the same information as the tab index you
# could consider to set DISABLE_INDEX to NO when enabling this option.
GENERATE_TREEVIEW = NO
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
-# (range [0,1..20]) that doxygen will group on one line in the generated HTML
-# documentation. Note that a value of 0 will completely suppress the enum
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
# values from appearing in the overview section.
ENUM_VALUES_PER_LINE = 4
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
TREEVIEW_WIDTH = 250
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
# links to external symbols imported via tag files in a separate window.
EXT_LINKS_IN_WINDOW = NO
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
# to force them to be regenerated.
FORMULA_FONTSIZE = 10
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are
-# not supported properly for IE 6.0, but are supported on all modern browsers.
-# Note that when changing this option you need to delete any form_*.png files
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
# in the HTML output before the changes have effect.
FORMULA_TRANSPARENT = YES
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
-# (see http://www.mathjax.org) which uses client side Javascript for the
-# rendering instead of using prerendered bitmaps. Use this if you do not
-# have LaTeX installed or if you want to formulas look prettier in the HTML
-# output. When enabled you may also need to install MathJax separately and
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you may also need to install MathJax separately and
# configure the path to it using the MATHJAX_RELPATH option.
USE_MATHJAX = NO
-# When MathJax is enabled you can set the default output format to be used for
-# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
-# SVG. The default value is HTML-CSS, which is slower, but has the best
+# When MathJax is enabled you can set the default output format to be used for
+# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
+# SVG. The default value is HTML-CSS, which is slower, but has the best
# compatibility.
MATHJAX_FORMAT = HTML-CSS
-# When MathJax is enabled you need to specify the location relative to the
-# HTML output directory using the MATHJAX_RELPATH option. The destination
-# directory should contain the MathJax.js script. For instance, if the mathjax
-# directory is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to
-# the MathJax Content Delivery Network so you can quickly see the result without
-# installing MathJax. However, it is strongly recommended to install a local
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to
+# the MathJax Content Delivery Network so you can quickly see the result without
+# installing MathJax. However, it is strongly recommended to install a local
# copy of MathJax from http://www.mathjax.org before deployment.
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
-# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
+# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
# names that should be enabled during MathJax rendering.
-MATHJAX_EXTENSIONS =
+MATHJAX_EXTENSIONS =
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box
-# for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using
-# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
-# (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
SEARCHENGINE = NO
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using Javascript.
-# There are two flavours of web server based search depending on the
-# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
-# searching and an index file used by the script. When EXTERNAL_SEARCH is
-# enabled the indexing and searching needs to be provided by external tools.
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript.
+# There are two flavours of web server based search depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools.
# See the manual for details.
SERVER_BASED_SEARCH = NO
-# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
-# script for searching. Instead the search results are written to an XML file
-# which needs to be processed by an external indexer. Doxygen will invoke an
-# external search engine pointed to by the SEARCHENGINE_URL option to obtain
-# the search results. Doxygen ships with an example indexer (doxyindexer) and
-# search engine (doxysearch.cgi) which are based on the open source search engine
+# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain
+# the search results. Doxygen ships with an example indexer (doxyindexer) and
+# search engine (doxysearch.cgi) which are based on the open source search engine
# library Xapian. See the manual for configuration details.
EXTERNAL_SEARCH = NO
-# The SEARCHENGINE_URL should point to a search engine hosted by a web server
-# which will returned the search results when EXTERNAL_SEARCH is enabled.
-# Doxygen ships with an example search engine (doxysearch) which is based on
-# the open source search engine library Xapian. See the manual for configuration
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will returned the search results when EXTERNAL_SEARCH is enabled.
+# Doxygen ships with an example search engine (doxysearch) which is based on
+# the open source search engine library Xapian. See the manual for configuration
# details.
-SEARCHENGINE_URL =
+SEARCHENGINE_URL =
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
-# search data is written to a file for indexing by an external tool. With the
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
# SEARCHDATA_FILE tag the name of this file can be specified.
SEARCHDATA_FILE = searchdata.xml
-# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the
-# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
-# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
# projects and redirect the results back to the right project.
-EXTERNAL_SEARCH_ID =
+EXTERNAL_SEARCH_ID =
-# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
-# projects other than the one defined by this configuration file, but that are
-# all added to the same external search index. Each project needs to have a
-# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id
-# of to a relative location where the documentation can be found.
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id
+# of to a relative location where the documentation can be found.
# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ...
-EXTRA_SEARCH_MAPPINGS =
+EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
GENERATE_LATEX = NO
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `latex' will be used as the default path.
LATEX_OUTPUT = latex
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
# Makefile that is written to the output directory.
LATEX_CMD_NAME = latex
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
# default command name.
MAKEINDEX_CMD_NAME = makeindex
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_LATEX = NO
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, letter, legal and
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, letter, legal and
# executive. If left blank a4wide will be used.
PAPER_TYPE = a4
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
-EXTRA_PACKAGES =
+EXTRA_PACKAGES =
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
# standard header. Notice: only use this tag if you know what you are doing!
-LATEX_HEADER =
+LATEX_HEADER =
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
-# the generated latex document. The footer should contain everything after
-# the last chapter. If it is left blank doxygen will generate a
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
# standard footer. Notice: only use this tag if you know what you are doing!
-LATEX_FOOTER =
+LATEX_FOOTER =
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
# This makes the output suitable for online browsing using a pdf viewer.
PDF_HYPERLINKS = YES
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
# higher quality PDF documentation.
USE_PDFLATEX = YES
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
# This option is also used when generating formulas in HTML.
LATEX_BATCHMODE = NO
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
# in the output.
LATEX_HIDE_INDICES = NO
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include
-# source code with syntax highlighting in the LaTeX output.
-# Note that which sources are shown also depends on other settings
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
# such as SOURCE_BROWSER.
LATEX_SOURCE_CODE = NO
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
# http://en.wikipedia.org/wiki/BibTeX for more info.
LATEX_BIB_STYLE = plain
@@ -1426,68 +1426,68 @@
# configuration options related to the RTF output
#---------------------------------------------------------------------------
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
# other RTF readers or editors.
GENERATE_RTF = NO
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `rtf' will be used as the default path.
RTF_OUTPUT = rtf
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_RTF = NO
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
# Note: wordpad (write) and others do not support links.
RTF_HYPERLINKS = NO
-# Load style sheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
+# Load style sheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
-RTF_STYLESHEET_FILE =
+RTF_STYLESHEET_FILE =
-# Set optional variables used in the generation of an rtf document.
+# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
-RTF_EXTENSIONS_FILE =
+RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
GENERATE_MAN = NO
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `man' will be used as the default path.
MAN_OUTPUT = man
-# The MAN_EXTENSION tag determines the extension that is added to
+# The MAN_EXTENSION tag determines the extension that is added to
# the generated man pages (default is the subroutine's section .3)
MAN_EXTENSION = .3
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
# would be unable to find the correct page. The default is NO.
MAN_LINKS = NO
@@ -1496,33 +1496,33 @@
# configuration options related to the XML output
#---------------------------------------------------------------------------
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
# the code including all documentation.
GENERATE_XML = NO
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `xml' will be used as the default path.
XML_OUTPUT = xml
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
# syntax of the XML files.
-XML_SCHEMA =
+XML_SCHEMA =
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
# syntax of the XML files.
-XML_DTD =
+XML_DTD =
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
# enabling this will significantly increase the size of the XML output.
XML_PROGRAMLISTING = YES
@@ -1531,10 +1531,10 @@
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
# and incomplete at the moment.
GENERATE_AUTOGEN_DEF = NO
@@ -1543,97 +1543,97 @@
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
# moment.
GENERATE_PERLMOD = NO
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
# to generate PDF and DVI output from the Perl module output.
PERLMOD_LATEX = NO
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
# and Perl will parse it just the same.
PERLMOD_PRETTY = YES
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
# Makefile don't overwrite each other's variables.
-PERLMOD_MAKEVAR_PREFIX =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
# files.
-ENABLE_PREPROCESSING = YES
+ENABLE_PREPROCESSING = NO
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = NO
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = NO
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# pointed to by INCLUDE_PATH will be searched when a #include is found.
SEARCH_INCLUDES = YES
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
# the preprocessor.
-INCLUDE_PATH =
+INCLUDE_PATH =
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
# be used.
-INCLUDE_FILE_PATTERNS =
+INCLUDE_FILE_PATTERNS =
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
-PREDEFINED =
+PREDEFINED =
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition that
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition that
# overrules the definition found in the source code.
-EXPAND_AS_DEFINED =
+EXPAND_AS_DEFINED =
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all references to function-like macros
-# that are alone on a line, have an all uppercase name, and do not end with a
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
# semicolon, because these will confuse the parser if not removed.
SKIP_FUNCTION_MACROS = YES
@@ -1642,37 +1642,37 @@
# Configuration::additions related to external references
#---------------------------------------------------------------------------
-# The TAGFILES option can be used to specify one or more tagfiles. For each
-# tag file the location of the external documentation should be added. The
-# format of a tag file without this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths
-# or URLs. Note that each tag file must have a unique name (where the name does
-# NOT include the path). If a tag file is not located in the directory in which
+# The TAGFILES option can be used to specify one or more tagfiles. For each
+# tag file the location of the external documentation should be added. The
+# format of a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths
+# or URLs. Note that each tag file must have a unique name (where the name does
+# NOT include the path). If a tag file is not located in the directory in which
# doxygen is run, you must also specify the path to the tagfile here.
-TAGFILES =
+TAGFILES =
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
-GENERATE_TAGFILE =
+GENERATE_TAGFILE =
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
# will be listed.
ALLEXTERNALS = NO
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
# be listed.
EXTERNAL_GROUPS = YES
-# The PERL_PATH should be the absolute path and name of the perl script
+# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
PERL_PATH = /usr/bin/perl
@@ -1681,222 +1681,222 @@
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option also works with HAVE_DOT disabled, but it is recommended to
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option also works with HAVE_DOT disabled, but it is recommended to
# install and use dot, since it yields more powerful graphs.
CLASS_DIAGRAMS = NO
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
-MSCGEN_PATH =
+MSCGEN_PATH =
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
# or is not a class.
HIDE_UNDOC_RELATIONS = YES
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = NO
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
-# allowed to run in parallel. When set to 0 (the default) doxygen will
-# base this on the number of processors available in the system. You can set it
-# explicitly to a value larger than 0 to get control over the balance
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
# between CPU load and processing speed.
DOT_NUM_THREADS = 0
-# By default doxygen will use the Helvetica font for all dot files that
-# doxygen generates. When you want a differently looking font you can specify
-# the font name using DOT_FONTNAME. You need to make sure dot is able to find
-# the font, which can be done by putting it in a standard location or by setting
-# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
+# By default doxygen will use the Helvetica font for all dot files that
+# doxygen generates. When you want a differently looking font you can specify
+# the font name using DOT_FONTNAME. You need to make sure dot is able to find
+# the font, which can be done by putting it in a standard location or by setting
+# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
# directory containing the font.
DOT_FONTNAME = Helvetica
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.
DOT_FONTSIZE = 10
-# By default doxygen will tell dot to use the Helvetica font.
-# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
+# By default doxygen will tell dot to use the Helvetica font.
+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
# set the path where dot can find it.
-DOT_FONTPATH =
+DOT_FONTPATH =
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
# CLASS_DIAGRAMS tag to NO.
CLASS_GRAPH = YES
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
# class references variables) of the class with other documented classes.
COLLABORATION_GRAPH = YES
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for groups, showing the direct groups dependencies
GROUP_GRAPHS = YES
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
# Language.
UML_LOOK = NO
-# If the UML_LOOK tag is enabled, the fields and methods are shown inside
-# the class node. If there are many fields or methods and many nodes the
-# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
-# threshold limits the number of items for each type to make the size more
-# managable. Set this to 0 for no limit. Note that the threshold may be
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside
+# the class node. If there are many fields or methods and many nodes the
+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
+# threshold limits the number of items for each type to make the size more
+# managable. Set this to 0 for no limit. Note that the threshold may be
# exceeded by 50% before the limit is enforced.
UML_LIMIT_NUM_FIELDS = 10
-# If set to YES, the inheritance and collaboration graphs will show the
+# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = NO
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
# other documented files.
INCLUDE_GRAPH = YES
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
# indirectly include this file.
INCLUDED_BY_GRAPH = YES
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
# for selected functions only using the \callgraph command.
CALL_GRAPH = NO
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
# graphs for selected functions only using the \callergraph command.
CALLER_GRAPH = NO
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will generate a graphical hierarchy of all classes instead of a textual one.
GRAPHICAL_HIERARCHY = YES
-# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
+# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
# relations between the files in the directories.
DIRECTORY_GRAPH = YES
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are svg, png, jpg, or gif.
-# If left blank png will be used. If you choose svg you need to set
-# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used. If you choose svg you need to set
+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
# visible in IE 9+ (other browsers do not have this requirement).
DOT_IMAGE_FORMAT = png
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-# Note that this requires a modern browser other than Internet Explorer.
-# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
-# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+# Note that this requires a modern browser other than Internet Explorer.
+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
# visible. Older versions of IE do not have SVG support.
INTERACTIVE_SVG = NO
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
-DOT_PATH =
+DOT_PATH =
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
# \dotfile command).
-DOTFILE_DIRS =
+DOTFILE_DIRS =
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
# \mscfile command).
-MSCFILE_DIRS =
+MSCFILE_DIRS =
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
DOT_GRAPH_MAX_NODES = 50
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
MAX_DOT_GRAPH_DEPTH = 0
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
# a graph (i.e. they become hard to read).
DOT_TRANSPARENT = NO
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
# support this, this feature is disabled by default.
DOT_MULTI_TARGETS = NO
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
GENERATE_LEGEND = YES
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES
diff --git a/include/android/multinetwork.h b/include/android/multinetwork.h
index be01518..97892f8 100644
--- a/include/android/multinetwork.h
+++ b/include/android/multinetwork.h
@@ -56,12 +56,10 @@
/**
* Set the network to be used by the given socket file descriptor.
*
- * To clear a previous socket binding invoke with NETWORK_UNSPECIFIED.
+ * To clear a previous socket binding, invoke with NETWORK_UNSPECIFIED.
*
- * This is the equivalent of:
+ * This is the equivalent of: [android.net.Network#bindSocket()](https://developer.android.com/reference/android/net/Network.html#bindSocket(java.net.Socket))
*
- * [ android.net.Network#bindSocket() ]
- * https://developer.android.com/reference/android/net/Network.html#bindSocket(java.net.Socket)
*/
int android_setsocknetwork(net_handle_t network, int fd);
@@ -75,12 +73,10 @@
* resolutions will fail. This is by design so an application doesn't
* accidentally use sockets it thinks are still bound to a particular network.
*
- * To clear a previous process binding invoke with NETWORK_UNSPECIFIED.
+ * To clear a previous process binding, invoke with NETWORK_UNSPECIFIED.
*
- * This is the equivalent of:
+ * This is the equivalent of: [android.net.ConnectivityManager#setProcessDefaultNetwork()](https://developer.android.com/reference/android/net/ConnectivityManager.html#setProcessDefaultNetwork(android.net.Network))
*
- * [ android.net.ConnectivityManager#setProcessDefaultNetwork() ]
- * https://developer.android.com/reference/android/net/ConnectivityManager.html#setProcessDefaultNetwork(android.net.Network)
*/
int android_setprocnetwork(net_handle_t network);
@@ -96,10 +92,8 @@
* - either |node| or |service| may be NULL, but not both
* - |res| must not be NULL
*
- * This is the equivalent of:
+ * This is the equivalent of: [android.net.Network#getAllByName()](https://developer.android.com/reference/android/net/Network.html#getAllByName(java.lang.String))
*
- * [ android.net.Network#getAllByName() ]
- * https://developer.android.com/reference/android/net/Network.html#getAllByName(java.lang.String)
*/
int android_getaddrinfofornetwork(net_handle_t network,
const char *node, const char *service,
diff --git a/include/android/sensor.h b/include/android/sensor.h
index 4a00818..a5e5c05 100644
--- a/include/android/sensor.h
+++ b/include/android/sensor.h
@@ -56,6 +56,7 @@
extern "C" {
#endif
+typedef struct AHardwareBuffer AHardwareBuffer;
/**
* Sensor types.
@@ -144,6 +145,30 @@
AREPORTING_MODE_SPECIAL_TRIGGER = 3
};
+/**
+ * Sensor Direct Report Rates.
+ */
+enum {
+ /** stopped */
+ ASENSOR_DIRECT_RATE_STOP = 0,
+ /** nominal 50Hz */
+ ASENSOR_DIRECT_RATE_NORMAL = 1,
+ /** nominal 200Hz */
+ ASENSOR_DIRECT_RATE_FAST = 2,
+ /** nominal 800Hz */
+ ASENSOR_DIRECT_RATE_VERY_FAST = 3
+};
+
+/**
+ * Sensor Direct Channel Type.
+ */
+enum {
+ /** shared memory created by ASharedMemory_create */
+ ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY = 1,
+ /** AHardwareBuffer */
+ ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER = 2
+};
+
/*
* A few useful constants
*/
@@ -391,6 +416,97 @@
*/
int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue);
+#if __ANDROID_API__ >= __ANDROID_API_O__
+/**
+ * Create direct channel based on shared memory
+ *
+ * Create a direct channel of {@link ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY} to be used
+ * for configuring sensor direct report.
+ *
+ * \param manager the {@link ASensorManager} instance obtained from
+ * {@link ASensorManager_getInstanceForPackage}.
+ * \param fd file descriptor representing a shared memory created by
+ * {@link ASharedMemory_create}
+ * \param size size to be used, must be less or equal to size of shared memory.
+ *
+ * \return a positive integer as a channel id to be used in
+ * {@link ASensorManager_destroyDirectChannel} and
+ * {@link ASensorManager_configureDirectReport}, or value less or equal to 0 for failures.
+ */
+int ASensorManager_createSharedMemoryDirectChannel(ASensorManager* manager, int fd, size_t size);
+
+/**
+ * Create direct channel based on AHardwareBuffer
+ *
+ * Create a direct channel of {@link ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER} type to be used
+ * for configuring sensor direct report.
+ *
+ * \param manager the {@link ASensorManager} instance obtained from
+ * {@link ASensorManager_getInstanceForPackage}.
+ * \param buffer {@link AHardwareBuffer} instance created by {@link AHardwareBuffer_allocate}.
+ * \param size the intended size to be used, must be less or equal to size of buffer.
+ *
+ * \return a positive integer as a channel id to be used in
+ * {@link ASensorManager_destroyDirectChannel} and
+ * {@link ASensorManager_configureDirectReport}, or value less or equal to 0 for failures.
+ */
+int ASensorManager_createHardwareBufferDirectChannel(
+ ASensorManager* manager, AHardwareBuffer const * buffer, size_t size);
+
+/**
+ * Destroy a direct channel
+ *
+ * Destroy a direct channel previously created using {@link ASensorManager_createDirectChannel}.
+ * The buffer used for creating direct channel does not get destroyed with
+ * {@link ASensorManager_destroy} and has to be close or released separately.
+ *
+ * \param manager the {@link ASensorManager} instance obtained from
+ * {@link ASensorManager_getInstanceForPackage}.
+ * \param channelId channel id (a positive integer) returned from
+ * {@link ASensorManager_createSharedMemoryDirectChannel} or
+ * {@link ASensorManager_createHardwareBufferDirectChannel}.
+ */
+void ASensorManager_destroyDirectChannel(ASensorManager* manager, int channelId);
+
+/**
+ * Configure direct report on channel
+ *
+ * Configure sensor direct report on a direct channel: set rate to value other than
+ * {@link ASENSOR_DIRECT_RATE_STOP} so that sensor event can be directly
+ * written into the shared memory region used for creating the buffer; set rate to
+ * {@link ASENSOR_DIRECT_RATE_STOP} will stop the sensor direct report.
+ *
+ * To stop all active sensor direct report configured to a channel, set sensor to NULL and rate to
+ * {@link ASENSOR_DIRECT_RATE_STOP}.
+ *
+ * In order to successfully configure a direct report, the sensor has to support the specified rate
+ * and the channel type, which can be checked by {@link ASensor_getHighestDirectReportRateLevel} and
+ * {@link ASensor_isDirectChannelTypeSupported}, respectively.
+ *
+ * Example:
+ * \code{.cpp}
+ * ASensorManager *manager = ...;
+ * ASensor *sensor = ...;
+ * int channelId = ...;
+ *
+ * ASensorManager_configureDirectReport(
+ * manager, sensor, channel_id, ASENSOR_DIRECT_RATE_FAST);
+ * \endcode
+ *
+ * \param manager the {@link ASensorManager} instance obtained from
+ * {@link ASensorManager_getInstanceForPackage}.
+ * \param sensor a {@link ASensor} to denote which sensor to be operate. It can be NULL if rate
+ * is {@link ASENSOR_DIRECT_RATE_STOP}, denoting stopping of all active sensor
+ * direct report.
+ * \param channelId channel id (a positive integer) returned from
+ * {@link ASensorManager_createSharedMemoryDirectChannel} or
+ * {@link ASensorManager_createHardwareBufferDirectChannel}.
+ *
+ * \return 0 for success or negative integer for failure.
+ */
+int ASensorManager_configureDirectReport(
+ ASensorManager* manager, ASensor const* sensor, int channelId, int rate);
+#endif
/*****************************************************************************/
@@ -502,6 +618,29 @@
bool ASensor_isWakeUpSensor(ASensor const* sensor);
#endif /* __ANDROID_API__ >= 21 */
+#if __ANDROID_API__ >= __ANDROID_API_O__
+/**
+ * Test if sensor supports a certain type of direct channel.
+ *
+ * \param sensor a {@link ASensor} to denote the sensor to be checked.
+ * \param channelType Channel type constant, either
+ * {@ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY}
+ * or {@link ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER}.
+ * \returns true if sensor supports the specified direct channel type.
+ */
+bool ASensor_isDirectChannelTypeSupported(ASensor const* sensor, int channelType);
+/**
+ * Get the highest direct rate level that a sensor support.
+ *
+ * \param sensor a {@link ASensor} to denote the sensor to be checked.
+ *
+ * \return a ASENSOR_DIRECT_RATE_... enum denoting the highest rate level supported by the sensor.
+ * If return value is {@link ASENSOR_DIRECT_RATE_STOP}, it means the sensor
+ * does not support direct report.
+ */
+int ASensor_getHighestDirectReportRateLevel(ASensor const* sensor);
+#endif
+
#ifdef __cplusplus
};
#endif
diff --git a/include/android/sharedmem.h b/include/android/sharedmem.h
new file mode 100644
index 0000000..8f8a931
--- /dev/null
+++ b/include/android/sharedmem.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 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.
+ */
+
+/**
+ * @addtogroup Memory
+ * @{
+ */
+
+/**
+ * @file sharedmem.h
+ */
+
+#ifndef ANDROID_SHARED_MEMORY_H
+#define ANDROID_SHARED_MEMORY_H
+
+#include <stddef.h>
+
+/******************************************************************
+ *
+ * IMPORTANT NOTICE:
+ *
+ * This file is part of Android's set of stable system headers
+ * exposed by the Android NDK (Native Development Kit).
+ *
+ * Third-party source AND binary code relies on the definitions
+ * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
+ *
+ * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
+ * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
+ * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
+ * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
+ */
+
+/**
+ * Structures and functions for a shared memory buffer that can be shared across process.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if __ANDROID_API__ >= __ANDROID_API_O__
+
+/**
+ * Create a shared memory region.
+ *
+ * Create shared memory region and returns an file descriptor. The resulting file descriptor can be
+ * mmap'ed to process memory space with PROT_READ | PROT_WRITE | PROT_EXEC. Access to shared memory
+ * region can be restricted with {@link ASharedMemory_setProt}.
+ *
+ * Use close() to release the shared memory region.
+ *
+ * \param name an optional name.
+ * \param size size of the shared memory region
+ * \return file descriptor that denotes the shared memory; error code on failure.
+ */
+int ASharedMemory_create(const char *name, size_t size);
+
+/**
+ * Get the size of the shared memory region.
+ *
+ * \param fd file descriptor of the shared memory region
+ * \return size in bytes; 0 if fd is not a valid shared memory file descriptor.
+ */
+size_t ASharedMemory_getSize(int fd);
+
+/**
+ * Restrict access of shared memory region.
+ *
+ * This function restricts access of a shared memory region. Access can only be removed. The effect
+ * applies globally to all file descriptors in all processes across the system that refer to this
+ * shared memory region. Existing memory mapped regions are not affected.
+ *
+ * It is a common use case to create a shared memory region, map it read/write locally to intialize
+ * content, and then send the shared memory to another process with read only access. Code example
+ * as below (error handling ommited).
+ *
+ * \code{.c}
+ * int fd = ASharedMemory_create("memory", 128);
+ *
+ * // By default it has PROT_READ | PROT_WRITE | PROT_EXEC.
+ * char *buffer = (char *) mmap(NULL, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ *
+ * strcpy(buffer, "This is an example."); // trivially initialize content
+ *
+ * // limit access to read only
+ * ASharedMemory_setProt(fd, PROT_READ);
+ *
+ * // share fd with another process here and the other process can only map with PROT_READ.
+ * \endcode
+ *
+ * \param fd file descriptor of the shared memory region.
+ * \param prot any bitwise-or'ed combination of PROT_READ, PROT_WRITE, PROT_EXEC denoting
+ * updated access. Note access can only be removed, but not added back.
+ * \return 0 for success, error code on failure.
+ */
+int ASharedMemory_setProt(int fd, int prot);
+
+#endif
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // ANDROID_SHARED_MEMORY_H
+
+/** @} */
diff --git a/include/android/trace.h b/include/android/trace.h
index 6cdcfeb..d3b1fb6 100644
--- a/include/android/trace.h
+++ b/include/android/trace.h
@@ -14,6 +14,13 @@
* limitations under the License.
*/
+/**
+ * @file trace.h
+ * @brief Writes trace events to the system trace buffer.
+ *
+ * These trace events can be collected and visualized using the Systrace tool.
+ * For information about using the Systrace tool, read <a href="https://developer.android.com/studio/profile/systrace.html">Analyzing UI Performance with Systrace</a>.
+ */
#ifndef ANDROID_NATIVE_TRACE_H
#define ANDROID_NATIVE_TRACE_H
diff --git a/include/binder/HalToken.h b/include/binder/HalToken.h
new file mode 100644
index 0000000..ce97c78
--- /dev/null
+++ b/include/binder/HalToken.h
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 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_HALTOKEN_H
+#define ANDROID_HALTOKEN_H
+
+#include <binder/Parcel.h>
+#include <hidl/HidlSupport.h>
+
+/**
+ * Hybrid Interfaces
+ * =================
+ *
+ * A hybrid interface is a binder interface that
+ * 1. is implemented both traditionally and as a wrapper around a hidl
+ * interface, and allows querying whether the underlying instance comes from
+ * a hidl interface or not; and
+ * 2. allows efficient calls to a hidl interface (if the underlying instance
+ * comes from a hidl interface) by automatically creating the wrapper in the
+ * process that calls it.
+ *
+ * Terminology:
+ * - `HalToken`: The type for a "token" of a hidl interface. This is defined to
+ * be compatible with `ITokenManager.hal`.
+ * - `HInterface`: The base type for a hidl interface. Currently, it is defined
+ * as `::android::hidl::base::V1_0::IBase`.
+ * - `HALINTERFACE`: The hidl interface that will be sent through binders.
+ * - `INTERFACE`: The binder interface that will be the wrapper of
+ * `HALINTERFACE`. `INTERFACE` is supposed to be somewhat similar to
+ * `HALINTERFACE`.
+ *
+ * To demonstrate how this is done, here is an example. Suppose `INTERFACE` is
+ * `IFoo` and `HALINTERFACE` is `HFoo`. The required steps are:
+ * 1. Use DECLARE_HYBRID_META_INTERFACE instead of DECLARE_META_INTERFACE in the
+ * definition of `IFoo`. The usage is
+ * DECLARE_HYBRID_META_INTERFACE(IFoo, HFoo)
+ * inside the body of `IFoo`.
+ * 2. Create a converter class that derives from
+ * `H2BConverter<HFoo, IFoo, BnFoo>`. Let us call this `H2BFoo`.
+ * 3. Add the following constructor in `H2BFoo` that call the corresponding
+ * constructors in `H2BConverter`:
+ * H2BFoo(const sp<HalInterface>& base) : CBase(base) {}
+ * Note: `CBase = H2BConverter<HFoo, IFoo, BnFoo>` and `HalInterface = HFoo`
+ * are member typedefs of `H2BConverter<HFoo, IFoo, BnFoo>`, so the above
+ * line can be copied into `H2BFoo`.
+ * 4. Implement `IFoo` in `H2BFoo` on top of `HFoo`. `H2BConverter` provides a
+ * protected `mBase` of type `sp<HFoo>` that can be used to access the `HFoo`
+ * instance. (There is also a public function named `getHalInterface()` that
+ * returns `mBase`.)
+ * 5. Create a hardware proxy class that derives from
+ * `HpInterface<BpFoo, H2BFoo>`. Name this class `HpFoo`. (This name cannot
+ * deviate. See step 8 below.)
+ * 6. Add the following constructor to `HpFoo`:
+ * HpFoo(const sp<IBinder>& base): PBase(base) {}
+ * Note: `PBase` a member typedef of `HpInterface<BpFoo, H2BFoo>` that is
+ * equal to `HpInterface<BpFoo, H2BFoo>` itself, so the above line can be
+ * copied verbatim into `HpFoo`.
+ * 7. Delegate all functions in `HpFoo` that come from `IFoo` except
+ * `getHalInterface` to the protected member `mBase`,
+ * which is defined in `HpInterface<BpFoo, H2BFoo>` (hence in `HpFoo`) with
+ * type `IFoo`. (There is also a public function named `getBaseInterface()`
+ * that returns `mBase`.)
+ * 8. Replace the existing `IMPLEMENT_META_INTERFACE` for INTERFACE by
+ * `IMPLEMENT_HYBRID_META_INTERFACE`. Note that this macro relies on the
+ * exact naming of `HpFoo`, where `Foo` comes from the interface name `IFoo`.
+ * An example usage is
+ * IMPLEMENT_HYBRID_META_INTERFACE(IFoo, HFoo, "example.interface.foo");
+ *
+ * `GETTOKEN` Template Argument
+ * ============================
+ *
+ * Following the instructions above, `H2BConverter` and `HpInterface` would use
+ * `transact()` to send over tokens, with `code` (the first argument of
+ * `transact()`) equal to a 4-byte value of '_GTK'. If this value clashes with
+ * other values already in use in the `Bp` class, it can be changed by supplying
+ * the last optional template argument to `H2BConverter` and `HpInterface`.
+ *
+ */
+
+namespace android {
+
+typedef uint64_t HalToken;
+typedef ::android::hidl::base::V1_0::IBase HInterface;
+
+sp<HInterface> retrieveHalInterface(const HalToken& token);
+bool createHalToken(const sp<HInterface>& interface, HalToken* token);
+bool deleteHalToken(const HalToken& token);
+
+template <
+ typename HINTERFACE,
+ typename INTERFACE,
+ typename BNINTERFACE,
+ uint32_t GETTOKEN = '_GTK'>
+class H2BConverter : public BNINTERFACE {
+public:
+ typedef H2BConverter<HINTERFACE, INTERFACE, BNINTERFACE, GETTOKEN> CBase; // Converter Base
+ typedef INTERFACE BaseInterface;
+ typedef HINTERFACE HalInterface;
+ static constexpr uint32_t GET_HAL_TOKEN = GETTOKEN;
+
+ H2BConverter(const sp<HalInterface>& base) : mBase(base) {}
+ virtual status_t onTransact(uint32_t code,
+ const Parcel& data, Parcel* reply, uint32_t flags = 0);
+ sp<HalInterface> getHalInterface() override { return mBase; }
+ HalInterface* getBaseInterface() { return mBase.get(); }
+
+protected:
+ sp<HalInterface> mBase;
+};
+
+template <
+ typename BPINTERFACE,
+ typename CONVERTER,
+ uint32_t GETTOKEN = '_GTK'>
+class HpInterface : public CONVERTER::BaseInterface {
+public:
+ typedef HpInterface<BPINTERFACE, CONVERTER, GETTOKEN> PBase; // Proxy Base
+ typedef typename CONVERTER::BaseInterface BaseInterface;
+ typedef typename CONVERTER::HalInterface HalInterface;
+ static constexpr uint32_t GET_HAL_TOKEN = GETTOKEN;
+
+ explicit HpInterface(const sp<IBinder>& impl);
+ sp<HalInterface> getHalInterface() override { return mHal; }
+ BaseInterface* getBaseInterface() { return mBase.get(); }
+
+protected:
+ sp<IBinder> mImpl;
+ sp<BaseInterface> mBase;
+ sp<HalInterface> mHal;
+ IBinder* onAsBinder() override { return mImpl.get(); }
+};
+
+// ----------------------------------------------------------------------
+
+#define DECLARE_HYBRID_META_INTERFACE(INTERFACE, HAL) \
+ static const ::android::String16 descriptor; \
+ static ::android::sp<I##INTERFACE> asInterface( \
+ const ::android::sp<::android::IBinder>& obj); \
+ virtual const ::android::String16& getInterfaceDescriptor() const; \
+ I##INTERFACE(); \
+ virtual ~I##INTERFACE(); \
+ virtual sp<HAL> getHalInterface(); \
+
+
+#define IMPLEMENT_HYBRID_META_INTERFACE(INTERFACE, HAL, NAME) \
+ const ::android::String16 I##INTERFACE::descriptor(NAME); \
+ const ::android::String16& \
+ I##INTERFACE::getInterfaceDescriptor() const { \
+ return I##INTERFACE::descriptor; \
+ } \
+ ::android::sp<I##INTERFACE> I##INTERFACE::asInterface( \
+ const ::android::sp<::android::IBinder>& obj) \
+ { \
+ ::android::sp<I##INTERFACE> intr; \
+ if (obj != NULL) { \
+ intr = static_cast<I##INTERFACE*>( \
+ obj->queryLocalInterface( \
+ I##INTERFACE::descriptor).get()); \
+ if (intr == NULL) { \
+ intr = new Hp##INTERFACE(obj); \
+ } \
+ } \
+ return intr; \
+ } \
+ I##INTERFACE::I##INTERFACE() { } \
+ I##INTERFACE::~I##INTERFACE() { } \
+ sp<HAL> I##INTERFACE::getHalInterface() { return nullptr; } \
+
+// ----------------------------------------------------------------------
+
+template <
+ typename HINTERFACE,
+ typename INTERFACE,
+ typename BNINTERFACE,
+ uint32_t GETTOKEN>
+status_t H2BConverter<HINTERFACE, INTERFACE, BNINTERFACE, GETTOKEN>::
+ onTransact(
+ uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) {
+ if (code == GET_HAL_TOKEN) {
+ HalToken token;
+ bool result;
+ result = createHalToken(mBase, &token);
+ if (!result) {
+ ALOGE("H2BConverter: Failed to create HAL token.");
+ }
+ reply->writeBool(result);
+ reply->writeUint64(token);
+ return NO_ERROR;
+ }
+ return BNINTERFACE::onTransact(code, data, reply, flags);
+}
+
+template <typename BPINTERFACE, typename CONVERTER, uint32_t GETTOKEN>
+HpInterface<BPINTERFACE, CONVERTER, GETTOKEN>::HpInterface(
+ const sp<IBinder>& impl) : mImpl(impl) {
+ Parcel data, reply;
+ data.writeInterfaceToken(BaseInterface::getInterfaceDescriptor());
+ if (impl->transact(GET_HAL_TOKEN, data, &reply) == NO_ERROR) {
+ bool tokenCreated = reply.readBool();
+ HalToken token = reply.readUint64();
+ if (!tokenCreated) {
+ ALOGE("HpInterface: Sender failed to create HAL token.");
+ mBase = new BPINTERFACE(impl);
+ } else {
+ sp<HInterface> hInterface = retrieveHalInterface(token);
+ deleteHalToken(token);
+ if (hInterface != nullptr) {
+ mHal = static_cast<HalInterface*>(hInterface.get());
+ mBase = new CONVERTER(mHal);
+ } else {
+ ALOGE("HpInterface: Cannot retrieve HAL interface from token.");
+ mBase = new BPINTERFACE(impl);
+ }
+ }
+ } else {
+ mBase = new BPINTERFACE(impl);
+ }
+}
+
+// ----------------------------------------------------------------------
+
+}; // namespace android
+
+#endif // ANDROID_HALTOKEN_H
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index a3c2bfa..cfc68c6 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -155,6 +155,9 @@
nsecs_t* outDisplayPresentTime, nsecs_t* outDisplayRetireTime,
nsecs_t* outDequeueReadyTime, nsecs_t* outReleaseTime);
+ status_t getWideColorSupport(bool* supported);
+ status_t getHdrSupport(bool* supported);
+
status_t getUniqueId(uint64_t* outId) const;
protected:
@@ -215,6 +218,8 @@
int dispatchEnableFrameTimestamps(va_list args);
int dispatchGetCompositorTiming(va_list args);
int dispatchGetFrameTimestamps(va_list args);
+ int dispatchGetWideColorSupport(va_list args);
+ int dispatchGetHdrSupport(va_list args);
protected:
virtual int dequeueBuffer(ANativeWindowBuffer** buffer, int* fenceFd);
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
index 8302160..1e8cf76 100644
--- a/include/gui/SurfaceComposerClient.h
+++ b/include/gui/SurfaceComposerClient.h
@@ -21,7 +21,6 @@
#include <sys/types.h>
#include <binder/IBinder.h>
-#include <binder/IMemory.h>
#include <utils/RefBase.h>
#include <utils/Singleton.h>
@@ -148,7 +147,7 @@
status_t setTransparentRegionHint(const sp<IBinder>& id, const Region& transparent);
status_t setLayer(const sp<IBinder>& id, int32_t layer);
status_t setAlpha(const sp<IBinder>& id, float alpha=1.0f);
- status_t setMatrix(const sp<IBinder>& id, float dsdx, float dtdx, float dsdy, float dtdy);
+ status_t setMatrix(const sp<IBinder>& id, float dsdx, float dtdx, float dtdy, float dsdy);
status_t setPosition(const sp<IBinder>& id, float x, float y);
status_t setSize(const sp<IBinder>& id, uint32_t w, uint32_t h);
status_t setCrop(const sp<IBinder>& id, const Rect& crop);
@@ -156,8 +155,11 @@
status_t setLayerStack(const sp<IBinder>& id, uint32_t layerStack);
status_t deferTransactionUntil(const sp<IBinder>& id,
const sp<IBinder>& handle, uint64_t frameNumber);
+ status_t deferTransactionUntil(const sp<IBinder>& id,
+ const sp<Surface>& handle, uint64_t frameNumber);
status_t reparentChildren(const sp<IBinder>& id,
const sp<IBinder>& newParentHandle);
+ status_t detachChildren(const sp<IBinder>& id);
status_t setOverrideScalingMode(const sp<IBinder>& id,
int32_t overrideScalingMode);
status_t setGeometryAppliesWithResize(const sp<IBinder>& id);
diff --git a/include/gui/SurfaceControl.h b/include/gui/SurfaceControl.h
index 54c8fa9..8ee35bc 100644
--- a/include/gui/SurfaceControl.h
+++ b/include/gui/SurfaceControl.h
@@ -69,7 +69,7 @@
status_t setFlags(uint32_t flags, uint32_t mask);
status_t setTransparentRegionHint(const Region& transparent);
status_t setAlpha(float alpha=1.0f);
- status_t setMatrix(float dsdx, float dtdx, float dsdy, float dtdy);
+ status_t setMatrix(float dsdx, float dtdx, float dtdy, float dsdy);
status_t setCrop(const Rect& crop);
status_t setFinalCrop(const Rect& crop);
@@ -80,11 +80,31 @@
status_t setGeometryAppliesWithResize();
// Defers applying any changes made in this transaction until the Layer
- // identified by handle reaches the given frameNumber
+ // identified by handle reaches the given frameNumber. If the Layer identified
+ // by handle is removed, then we will apply this transaction regardless of
+ // what frame number has been reached.
status_t deferTransactionUntil(const sp<IBinder>& handle, uint64_t frameNumber);
+
+ // A variant of deferTransactionUntil which identifies the Layer we wait for by
+ // Surface instead of Handle. Useful for clients which may not have the
+ // SurfaceControl for some of their Surfaces. Otherwise behaves identically.
+ status_t deferTransactionUntil(const sp<Surface>& barrier, uint64_t frameNumber);
+
// Reparents all children of this layer to the new parent handle.
status_t reparentChildren(const sp<IBinder>& newParentHandle);
+ // Detaches all child surfaces (and their children recursively)
+ // from their SurfaceControl.
+ // The child SurfaceControl's will not throw exceptions or return errors,
+ // but transactions will have no effect.
+ // The child surfaces will continue to follow their parent surfaces,
+ // and remain eligible for rendering, but their relative state will be
+ // frozen. We use this in the WindowManager, in app shutdown/relaunch
+ // scenarios, where the app would otherwise clean up its child Surfaces.
+ // Sometimes the WindowManager needs to extend their lifetime slightly
+ // in order to perform an exit animation or prevent flicker.
+ status_t detachChildren();
+
// Set an override scaling mode as documented in <system/window.h>
// the override scaling mode will take precedence over any client
// specified scaling mode. -1 will clear the override scaling mode.
diff --git a/include/media/cas/CasAPI.h b/include/media/cas/CasAPI.h
new file mode 100644
index 0000000..0e88019
--- /dev/null
+++ b/include/media/cas/CasAPI.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 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 CAS_API_H_
+#define CAS_API_H_
+
+#include <vector>
+#include <utils/String8.h>
+
+// Loadable CasPlugin shared libraries should define the entry points
+// as shown below:
+//
+// extern "C" {
+// extern android::CasFactory *createCasFactory();
+// extern android::DescramblerFactory *createDescramblerFactory();
+// }
+
+namespace android {
+
+struct CasPlugin;
+
+struct CasPluginDescriptor {
+ int32_t CA_system_id;
+ String8 name;
+};
+
+typedef std::vector<uint8_t> CasData;
+typedef std::vector<uint8_t> CasSessionId;
+typedef std::vector<uint8_t> CasEmm;
+typedef std::vector<uint8_t> CasEcm;
+typedef void (*CasPluginCallback)(
+ void *appData,
+ int32_t event,
+ int32_t arg,
+ uint8_t *data,
+ size_t size);
+
+struct CasFactory {
+ CasFactory() {}
+ virtual ~CasFactory() {}
+
+ // Determine if the plugin can handle the CA scheme identified by CA_system_id.
+ virtual bool isSystemIdSupported(
+ int32_t CA_system_id) const = 0;
+
+ // Get a list of the CA schemes supported by the plugin.
+ virtual status_t queryPlugins(
+ std::vector<CasPluginDescriptor> *descriptors) const = 0;
+
+ // Construct a new instance of a CasPlugin given a CA_system_id
+ virtual status_t createPlugin(
+ int32_t CA_system_id,
+ uint64_t appData,
+ CasPluginCallback callback,
+ CasPlugin **plugin) = 0;
+
+private:
+ CasFactory(const CasFactory &);
+ CasFactory &operator=(const CasFactory &); /* NOLINT */
+};
+
+struct CasPlugin {
+ CasPlugin() {}
+ virtual ~CasPlugin() {}
+
+ // Provide the CA private data from a CA_descriptor in the conditional
+ // access table to a CasPlugin.
+ virtual status_t setPrivateData(
+ const CasData &privateData) = 0;
+
+ // Open a session for descrambling a program. The session will receive the
+ // ECM stream corresponding to the CA_PID for the program.
+ virtual status_t openSession(
+ uint16_t program_number,
+ CasSessionId *sessionId) = 0;
+
+ // Open a session for descrambling an elementary stream inside a program.
+ // The session will receive the ECM stream corresponding to the CA_PID for
+ // the stream.
+ virtual status_t openSession(
+ uint16_t program_number,
+ uint16_t elementary_PID,
+ CasSessionId *sessionId) = 0;
+
+ // Close a previously opened session.
+ virtual status_t closeSession(
+ const CasSessionId &sessionId) = 0;
+
+ // Provide the CA private data from a CA_descriptor in the program map
+ // table to a CasPlugin.
+ virtual status_t setSessionPrivateData(
+ const CasSessionId &sessionId,
+ const CasData &privateData) = 0;
+
+ // Process an ECM from the ECM stream for this session’s elementary stream.
+ virtual status_t processEcm(
+ const CasSessionId &sessionId,
+ const CasEcm &ecm) = 0;
+
+ // Process an in-band EMM from the EMM stream.
+ virtual status_t processEmm(
+ const CasEmm &emm) = 0;
+
+ // Deliver an event to the CasPlugin. The format of the event is specific
+ // to the CA scheme and is opaque to the framework.
+ virtual status_t sendEvent(
+ int32_t event,
+ int32_t arg,
+ const CasData &eventData) = 0;
+
+ // Native implementation of the MediaCas Java API provision method.
+ virtual status_t provision(
+ const String8 &provisionString) = 0;
+
+ // Native implementation of the MediaCas Java API refreshEntitlements method
+ virtual status_t refreshEntitlements(
+ int32_t refreshType,
+ const CasData &refreshData) = 0;
+
+private:
+ CasPlugin(const CasPlugin &);
+ CasPlugin &operator=(const CasPlugin &); /* NOLINT */
+};
+
+extern "C" {
+ extern android::CasFactory *createCasFactory();
+}
+
+} // namespace android
+
+#endif // CAS_API_H_
diff --git a/include/media/cas/DescramblerAPI.h b/include/media/cas/DescramblerAPI.h
new file mode 100644
index 0000000..0a51952
--- /dev/null
+++ b/include/media/cas/DescramblerAPI.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 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 DESCRAMBLER_API_H_
+#define DESCRAMBLER_API_H_
+
+#include <media/stagefright/MediaErrors.h>
+#include <media/cas/CasAPI.h>
+
+namespace android {
+
+struct AString;
+struct DescramblerPlugin;
+
+struct DescramblerFactory {
+ DescramblerFactory() {}
+ virtual ~DescramblerFactory() {}
+
+ // Determine if the plugin can handle the CA scheme identified by CA_system_id.
+ virtual bool isSystemIdSupported(
+ int32_t CA_system_id) const = 0;
+
+ // Construct a new instance of a DescramblerPlugin given a CA_system_id
+ virtual status_t createPlugin(
+ int32_t CA_system_id, DescramblerPlugin **plugin) = 0;
+
+private:
+ DescramblerFactory(const DescramblerFactory &);
+ DescramblerFactory &operator=(const DescramblerFactory &);
+};
+
+struct DescramblerPlugin {
+ enum ScramblingControl {
+ kScrambling_Unscrambled = 0,
+ kScrambling_Reserved = 1,
+ kScrambling_EvenKey = 2,
+ kScrambling_OddKey = 3,
+ };
+
+ struct SubSample {
+ uint32_t mNumBytesOfClearData;
+ uint32_t mNumBytesOfEncryptedData;
+ };
+
+ DescramblerPlugin() {}
+ virtual ~DescramblerPlugin() {}
+
+ // If this method returns false, a non-secure decoder will be used to
+ // decode the data after decryption. The decrypt API below will have
+ // to support insecure decryption of the data (secure = false) for
+ // media data of the given mime type.
+ virtual bool requiresSecureDecoderComponent(const char *mime) const = 0;
+
+ // A MediaCas session may be associated with a MediaCrypto session. The
+ // associated MediaCas session is used to load decryption keys
+ // into the crypto/cas plugin. The keys are then referenced by key-id
+ // in the 'key' parameter to the decrypt() method.
+ // Should return NO_ERROR on success, ERROR_DRM_SESSION_NOT_OPENED if
+ // the session is not opened and a code from MediaErrors.h otherwise.
+ virtual status_t setMediaCasSession(const CasSessionId& sessionId) = 0;
+
+ // If the error returned falls into the range
+ // ERROR_DRM_VENDOR_MIN..ERROR_DRM_VENDOR_MAX, errorDetailMsg should be
+ // filled in with an appropriate string.
+ // At the java level these special errors will then trigger a
+ // MediaCodec.CryptoException that gives clients access to both
+ // the error code and the errorDetailMsg.
+ // Returns a non-negative result to indicate the number of bytes written
+ // to the dstPtr, or a negative result to indicate an error.
+ virtual ssize_t descramble(
+ bool secure,
+ ScramblingControl scramblingControl,
+ size_t numSubSamples,
+ const SubSample *subSamples,
+ const void *srcPtr,
+ int32_t srcOffset,
+ void *dstPtr,
+ int32_t dstOffset,
+ AString *errorDetailMsg) = 0;
+
+private:
+ DescramblerPlugin(const DescramblerPlugin &);
+ DescramblerPlugin &operator=(const DescramblerPlugin &);
+};
+
+} // namespace android
+
+extern "C" {
+ extern android::DescramblerFactory *createDescramblerFactory();
+}
+
+#endif // DESCRAMBLER_API_H_
diff --git a/include/private/binder/Static.h b/include/private/binder/Static.h
index d104646..3d10456 100644
--- a/include/private/binder/Static.h
+++ b/include/private/binder/Static.h
@@ -20,7 +20,6 @@
#include <utils/threads.h>
#include <binder/IBinder.h>
-#include <binder/IMemory.h>
#include <binder/ProcessState.h>
#include <binder/IPermissionController.h>
#include <binder/IServiceManager.h>
diff --git a/include/private/gui/LayerState.h b/include/private/gui/LayerState.h
index 2a1801b..20f51a5 100644
--- a/include/private/gui/LayerState.h
+++ b/include/private/gui/LayerState.h
@@ -24,6 +24,7 @@
#include <ui/Region.h>
#include <ui/Rect.h>
+#include <gui/IGraphicBufferProducer.h>
namespace android {
@@ -57,6 +58,7 @@
eOverrideScalingModeChanged = 0x00000800,
eGeometryAppliesWithResize = 0x00001000,
eReparentChildren = 0x00002000,
+ eDetachChildren = 0x00004000
};
layer_state_t()
@@ -77,8 +79,8 @@
struct matrix22_t {
float dsdx{0};
float dtdx{0};
- float dsdy{0};
float dtdy{0};
+ float dsdy{0};
};
sp<IBinder> surface;
uint32_t what;
@@ -95,10 +97,13 @@
matrix22_t matrix;
Rect crop;
Rect finalCrop;
- sp<IBinder> handle;
+ sp<IBinder> barrierHandle;
sp<IBinder> reparentHandle;
uint64_t frameNumber;
int32_t overrideScalingMode;
+
+ sp<IGraphicBufferProducer> barrierGbp;
+
// non POD must be last. see write/read
Region transparentRegion;
};
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index 93b8684..2cb44eb 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -34,6 +34,7 @@
"IResultReceiver.cpp",
"IServiceManager.cpp",
"IShellCallback.cpp",
+ "HalToken.cpp",
"MemoryBase.cpp",
"MemoryDealer.cpp",
"MemoryHeapBase.cpp",
@@ -65,6 +66,8 @@
"liblog",
"libcutils",
"libutils",
+ "libhidlbase",
+ "android.hidl.token@1.0",
],
export_shared_lib_headers: [
"libbase",
diff --git a/libs/binder/HalToken.cpp b/libs/binder/HalToken.cpp
new file mode 100644
index 0000000..6e71a52
--- /dev/null
+++ b/libs/binder/HalToken.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2005 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.
+ */
+
+#define LOG_TAG "HalToken"
+
+#include <utils/Log.h>
+#include <binder/HalToken.h>
+
+#include <android/hidl/token/1.0/ITokenManager.h>
+
+namespace android {
+
+using ::android::hidl::token::V1_0::ITokenManager;
+
+sp<ITokenManager> gTokenManager = nullptr;
+
+ITokenManager* getTokenManager() {
+ if (gTokenManager != nullptr) {
+ return gTokenManager.get();
+ }
+ gTokenManager = ITokenManager::getService();
+ if (gTokenManager == nullptr) {
+ ALOGE("Cannot retrieve TokenManager.");
+ }
+ return gTokenManager.get();
+}
+
+sp<HInterface> retrieveHalInterface(const HalToken& token) {
+ auto transaction = getTokenManager()->get(token);
+ if (!transaction.isOk()) {
+ ALOGE("getHalInterface: Cannot obtain interface from token.");
+ return nullptr;
+ }
+ return static_cast<sp<HInterface> >(transaction);
+}
+
+bool createHalToken(const sp<HInterface>& interface, HalToken* token) {
+ auto transaction = getTokenManager()->createToken(interface);
+ if (!transaction.isOk()) {
+ ALOGE("createHalToken: Cannot create token from interface.");
+ return false;
+ }
+ *token = static_cast<HalToken>(transaction);
+ return true;
+}
+
+bool deleteHalToken(const HalToken& token) {
+ auto transaction = getTokenManager()->unregister(token);
+ if (!transaction.isOk()) {
+ ALOGE("deleteHalToken: Cannot unregister hal token.");
+ return false;
+ }
+ return true;
+}
+
+}; // namespace android
+
diff --git a/libs/binder/IActivityManager.cpp b/libs/binder/IActivityManager.cpp
index 87b295a..50a8b28 100644
--- a/libs/binder/IActivityManager.cpp
+++ b/libs/binder/IActivityManager.cpp
@@ -36,6 +36,7 @@
virtual int openContentUri(const String16& stringUri)
{
Parcel data, reply;
+ data.writeInterfaceToken(IActivityManager::getInterfaceDescriptor());
data.writeString16(stringUri);
status_t ret = remote()->transact(OPEN_CONTENT_URI_TRANSACTION, data, & reply);
int fd = -1;
diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp
index f4e0a60..5c1a4f4 100644
--- a/libs/binder/IMemory.cpp
+++ b/libs/binder/IMemory.cpp
@@ -17,6 +17,8 @@
#define LOG_TAG "IMemory"
#include <atomic>
+#include <stdatomic.h>
+
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
@@ -28,6 +30,7 @@
#include <binder/IMemory.h>
#include <binder/Parcel.h>
#include <log/log.h>
+
#include <utils/CallStack.h>
#include <utils/KeyedVector.h>
#include <utils/threads.h>
diff --git a/libs/gui/Android.bp b/libs/gui/Android.bp
index ddf1072..8f9c38a 100644
--- a/libs/gui/Android.bp
+++ b/libs/gui/Android.bp
@@ -107,6 +107,7 @@
"libGLESv2",
"libui",
"libutils",
+ "libnativewindow",
"liblog",
],
diff --git a/libs/gui/BufferQueueCore.cpp b/libs/gui/BufferQueueCore.cpp
index 6e6cce2..9e3fecb 100644
--- a/libs/gui/BufferQueueCore.cpp
+++ b/libs/gui/BufferQueueCore.cpp
@@ -29,6 +29,7 @@
#include <inttypes.h>
#include <cutils/properties.h>
+#include <cutils/atomic.h>
#include <gui/BufferItem.h>
#include <gui/BufferQueueCore.h>
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index c26de66..8acdfed 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -27,6 +27,8 @@
#include <hardware/hardware.h>
+#include <cutils/atomic.h>
+
#include <gui/BufferItem.h>
#include <gui/IGraphicBufferAlloc.h>
#include <gui/ISurfaceComposer.h>
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 06d1261..4d2692f 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -21,7 +21,6 @@
#include <sys/types.h>
#include <binder/Parcel.h>
-#include <binder/IMemory.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
diff --git a/libs/gui/ISurfaceComposerClient.cpp b/libs/gui/ISurfaceComposerClient.cpp
index 5a3fa04..db8a517 100644
--- a/libs/gui/ISurfaceComposerClient.cpp
+++ b/libs/gui/ISurfaceComposerClient.cpp
@@ -22,7 +22,6 @@
#include <sys/types.h>
#include <binder/Parcel.h>
-#include <binder/IMemory.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index bb552aa..2461cba 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -39,10 +39,11 @@
output.writeInplace(sizeof(layer_state_t::matrix22_t))) = matrix;
output.write(crop);
output.write(finalCrop);
- output.writeStrongBinder(handle);
+ output.writeStrongBinder(barrierHandle);
output.writeStrongBinder(reparentHandle);
output.writeUint64(frameNumber);
output.writeInt32(overrideScalingMode);
+ output.writeStrongBinder(IInterface::asBinder(barrierGbp));
output.write(transparentRegion);
return NO_ERROR;
}
@@ -68,10 +69,12 @@
}
input.read(crop);
input.read(finalCrop);
- handle = input.readStrongBinder();
+ barrierHandle = input.readStrongBinder();
reparentHandle = input.readStrongBinder();
frameNumber = input.readUint64();
overrideScalingMode = input.readInt32();
+ barrierGbp =
+ interface_cast<IGraphicBufferProducer>(input.readStrongBinder());
input.read(transparentRegion);
return NO_ERROR;
}
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index efb1524..ad1984a 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -26,9 +26,10 @@
#include <utils/Trace.h>
#include <utils/NativeHandle.h>
-#include <ui/Fence.h>
-#include <ui/Region.h>
#include <ui/DisplayStatInfo.h>
+#include <ui/Fence.h>
+#include <ui/HdrCapabilities.h>
+#include <ui/Region.h>
#include <gui/BufferItem.h>
#include <gui/IProducerListener.h>
@@ -305,6 +306,51 @@
return NO_ERROR;
}
+status_t Surface::getWideColorSupport(bool* supported) {
+ ATRACE_CALL();
+
+ sp<IBinder> display(
+ composerService()->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain));
+ Vector<android_color_mode_t> colorModes;
+ status_t err =
+ composerService()->getDisplayColorModes(display, &colorModes);
+
+ if (err)
+ return err;
+
+ *supported = false;
+ for (android_color_mode_t colorMode : colorModes) {
+ switch (colorMode) {
+ case HAL_COLOR_MODE_DISPLAY_P3:
+ case HAL_COLOR_MODE_ADOBE_RGB:
+ case HAL_COLOR_MODE_DCI_P3:
+ *supported = true;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return NO_ERROR;
+}
+
+status_t Surface::getHdrSupport(bool* supported) {
+ ATRACE_CALL();
+
+ sp<IBinder> display(
+ composerService()->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain));
+ HdrCapabilities hdrCapabilities;
+ status_t err =
+ composerService()->getHdrCapabilities(display, &hdrCapabilities);
+
+ if (err)
+ return err;
+
+ *supported = !hdrCapabilities.getSupportedHdrTypes().empty();
+
+ return NO_ERROR;
+}
+
int Surface::hook_setSwapInterval(ANativeWindow* window, int interval) {
Surface* c = getSelf(window);
return c->setSwapInterval(interval);
@@ -880,6 +926,12 @@
case NATIVE_WINDOW_GET_FRAME_TIMESTAMPS:
res = dispatchGetFrameTimestamps(args);
break;
+ case NATIVE_WINDOW_GET_WIDE_COLOR_SUPPORT:
+ res = dispatchGetWideColorSupport(args);
+ break;
+ case NATIVE_WINDOW_GET_HDR_SUPPORT:
+ res = dispatchGetHdrSupport(args);
+ break;
default:
res = NAME_NOT_FOUND;
break;
@@ -1044,6 +1096,16 @@
outDisplayRetireTime, outDequeueReadyTime, outReleaseTime);
}
+int Surface::dispatchGetWideColorSupport(va_list args) {
+ bool* outSupport = va_arg(args, bool*);
+ return getWideColorSupport(outSupport);
+}
+
+int Surface::dispatchGetHdrSupport(va_list args) {
+ bool* outSupport = va_arg(args, bool*);
+ return getHdrSupport(outSupport);
+}
+
int Surface::connect(int api) {
static sp<IProducerListener> listener = new DummyProducerListener();
return connect(api, listener);
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index ae81c8f..088933a 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -26,7 +26,6 @@
#include <utils/String8.h>
#include <utils/threads.h>
-#include <binder/IMemory.h>
#include <binder/IServiceManager.h>
#include <system/graphics.h>
@@ -38,6 +37,7 @@
#include <gui/IGraphicBufferProducer.h>
#include <gui/ISurfaceComposer.h>
#include <gui/ISurfaceComposerClient.h>
+#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>
#include <private/gui/ComposerService.h>
@@ -157,7 +157,7 @@
status_t setAlpha(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
float alpha);
status_t setMatrix(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
- float dsdx, float dtdx, float dsdy, float dtdy);
+ float dsdx, float dtdx, float dtdy, float dsdy);
status_t setOrientation(int orientation);
status_t setCrop(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
const Rect& crop);
@@ -168,9 +168,14 @@
status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id, const sp<IBinder>& handle,
uint64_t frameNumber);
+ status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client,
+ const sp<IBinder>& id, const sp<Surface>& barrierSurface,
+ uint64_t frameNumber);
status_t reparentChildren(const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id,
const sp<IBinder>& newParentHandle);
+ status_t detachChildren(const sp<SurfaceComposerClient>& client,
+ const sp<IBinder>& id);
status_t setOverrideScalingMode(const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id, int32_t overrideScalingMode);
status_t setGeometryAppliesWithResize(const sp<SurfaceComposerClient>& client,
@@ -392,7 +397,7 @@
status_t Composer::setMatrix(const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id, float dsdx, float dtdx,
- float dsdy, float dtdy) {
+ float dtdy, float dsdy) {
Mutex::Autolock _l(mLock);
layer_state_t* s = getLayerStateLocked(client, id);
if (!s)
@@ -439,7 +444,21 @@
return BAD_INDEX;
}
s->what |= layer_state_t::eDeferTransaction;
- s->handle = handle;
+ s->barrierHandle = handle;
+ s->frameNumber = frameNumber;
+ return NO_ERROR;
+}
+
+status_t Composer::deferTransactionUntil(
+ const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
+ const sp<Surface>& barrierSurface, uint64_t frameNumber) {
+ Mutex::Autolock lock(mLock);
+ layer_state_t* s = getLayerStateLocked(client, id);
+ if (!s) {
+ return BAD_INDEX;
+ }
+ s->what |= layer_state_t::eDeferTransaction;
+ s->barrierGbp = barrierSurface->getIGraphicBufferProducer();
s->frameNumber = frameNumber;
return NO_ERROR;
}
@@ -458,6 +477,18 @@
return NO_ERROR;
}
+status_t Composer::detachChildren(
+ const sp<SurfaceComposerClient>& client,
+ const sp<IBinder>& id) {
+ Mutex::Autolock lock(mLock);
+ layer_state_t* s = getLayerStateLocked(client, id);
+ if (!s) {
+ return BAD_INDEX;
+ }
+ s->what |= layer_state_t::eDetachChildren;
+ return NO_ERROR;
+}
+
status_t Composer::setOverrideScalingMode(
const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id, int32_t overrideScalingMode) {
@@ -768,8 +799,8 @@
}
status_t SurfaceComposerClient::setMatrix(const sp<IBinder>& id, float dsdx, float dtdx,
- float dsdy, float dtdy) {
- return getComposer().setMatrix(this, id, dsdx, dtdx, dsdy, dtdy);
+ float dtdy, float dsdy) {
+ return getComposer().setMatrix(this, id, dsdx, dtdx, dtdy, dsdy);
}
status_t SurfaceComposerClient::deferTransactionUntil(const sp<IBinder>& id,
@@ -777,11 +808,20 @@
return getComposer().deferTransactionUntil(this, id, handle, frameNumber);
}
+status_t SurfaceComposerClient::deferTransactionUntil(const sp<IBinder>& id,
+ const sp<Surface>& barrierSurface, uint64_t frameNumber) {
+ return getComposer().deferTransactionUntil(this, id, barrierSurface, frameNumber);
+}
+
status_t SurfaceComposerClient::reparentChildren(const sp<IBinder>& id,
const sp<IBinder>& newParentHandle) {
return getComposer().reparentChildren(this, id, newParentHandle);
}
+status_t SurfaceComposerClient::detachChildren(const sp<IBinder>& id) {
+ return getComposer().detachChildren(this, id);
+}
+
status_t SurfaceComposerClient::setOverrideScalingMode(
const sp<IBinder>& id, int32_t overrideScalingMode) {
return getComposer().setOverrideScalingMode(
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index 0362216..1e69379 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -147,10 +147,10 @@
if (err < 0) return err;
return mClient->setAlpha(mHandle, alpha);
}
-status_t SurfaceControl::setMatrix(float dsdx, float dtdx, float dsdy, float dtdy) {
+status_t SurfaceControl::setMatrix(float dsdx, float dtdx, float dtdy, float dsdy) {
status_t err = validate();
if (err < 0) return err;
- return mClient->setMatrix(mHandle, dsdx, dtdx, dsdy, dtdy);
+ return mClient->setMatrix(mHandle, dsdx, dtdx, dtdy, dsdy);
}
status_t SurfaceControl::setCrop(const Rect& crop) {
status_t err = validate();
@@ -170,12 +170,25 @@
return mClient->deferTransactionUntil(mHandle, handle, frameNumber);
}
+status_t SurfaceControl::deferTransactionUntil(const sp<Surface>& handle,
+ uint64_t frameNumber) {
+ status_t err = validate();
+ if (err < 0) return err;
+ return mClient->deferTransactionUntil(mHandle, handle, frameNumber);
+}
+
status_t SurfaceControl::reparentChildren(const sp<IBinder>& newParentHandle) {
status_t err = validate();
if (err < 0) return err;
return mClient->reparentChildren(mHandle, newParentHandle);
}
+status_t SurfaceControl::detachChildren() {
+ status_t err = validate();
+ if (err < 0) return err;
+ return mClient->detachChildren(mHandle);
+}
+
status_t SurfaceControl::setOverrideScalingMode(int32_t overrideScalingMode) {
status_t err = validate();
if (err < 0) return err;
diff --git a/libs/gui/tests/Android.bp b/libs/gui/tests/Android.bp
index 092d597..5944110 100644
--- a/libs/gui/tests/Android.bp
+++ b/libs/gui/tests/Android.bp
@@ -15,7 +15,6 @@
"IGraphicBufferProducer_test.cpp",
"MultiTextureConsumer_test.cpp",
"Sensor_test.cpp",
- "SRGB_test.cpp",
"StreamSplitter_test.cpp",
"SurfaceTextureClient_test.cpp",
"SurfaceTextureFBO_test.cpp",
@@ -37,5 +36,6 @@
"libgui",
"libui",
"libutils",
+ "libnativewindow"
],
}
diff --git a/libs/gui/tests/SRGB_test.cpp b/libs/gui/tests/SRGB_test.cpp
deleted file mode 100644
index c2640cd..0000000
--- a/libs/gui/tests/SRGB_test.cpp
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-#define LOG_TAG "SRGB_test"
-//#define LOG_NDEBUG 0
-
-// Ignore for this file because it flags every instance of
-// ASSERT_EQ(GL_NO_ERROR, glGetError());
-#pragma clang diagnostic ignored "-Wsign-compare"
-
-#include "GLTest.h"
-
-#include <math.h>
-
-#include <gui/CpuConsumer.h>
-#include <gui/Surface.h>
-#include <gui/SurfaceComposerClient.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES3/gl3.h>
-
-#include <android/native_window.h>
-
-#include <gtest/gtest.h>
-
-namespace android {
-
-class SRGBTest : public ::testing::Test {
-protected:
- // Class constants
- enum {
- DISPLAY_WIDTH = 512,
- DISPLAY_HEIGHT = 512,
- PIXEL_SIZE = 4, // bytes or components
- DISPLAY_SIZE = DISPLAY_WIDTH * DISPLAY_HEIGHT * PIXEL_SIZE,
- ALPHA_VALUE = 223, // should be in [0, 255]
- TOLERANCE = 1,
- };
- static const char SHOW_DEBUG_STRING[];
-
- SRGBTest() :
- mInputSurface(), mCpuConsumer(), mLockedBuffer(),
- mEglDisplay(EGL_NO_DISPLAY), mEglConfig(),
- mEglContext(EGL_NO_CONTEXT), mEglSurface(EGL_NO_SURFACE),
- mComposerClient(), mSurfaceControl(), mOutputSurface() {
- }
-
- virtual ~SRGBTest() {
- if (mEglDisplay != EGL_NO_DISPLAY) {
- if (mEglSurface != EGL_NO_SURFACE) {
- eglDestroySurface(mEglDisplay, mEglSurface);
- }
- if (mEglContext != EGL_NO_CONTEXT) {
- eglDestroyContext(mEglDisplay, mEglContext);
- }
- eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
- eglTerminate(mEglDisplay);
- }
- }
-
- virtual void SetUp() {
- sp<IGraphicBufferProducer> producer;
- sp<IGraphicBufferConsumer> consumer;
- BufferQueue::createBufferQueue(&producer, &consumer);
- ASSERT_EQ(NO_ERROR, consumer->setDefaultBufferSize(
- DISPLAY_WIDTH, DISPLAY_HEIGHT));
- mCpuConsumer = new CpuConsumer(consumer, 1);
- String8 name("CpuConsumer_for_SRGBTest");
- mCpuConsumer->setName(name);
- mInputSurface = new Surface(producer);
-
- ASSERT_NO_FATAL_FAILURE(createEGLSurface(mInputSurface.get()));
- ASSERT_NO_FATAL_FAILURE(createDebugSurface());
- }
-
- virtual void TearDown() {
- ASSERT_NO_FATAL_FAILURE(copyToDebugSurface());
- ASSERT_TRUE(mLockedBuffer.data != NULL);
- ASSERT_EQ(NO_ERROR, mCpuConsumer->unlockBuffer(mLockedBuffer));
- }
-
- static float linearToSRGB(float l) {
- if (l <= 0.0031308f) {
- return l * 12.92f;
- } else {
- return 1.055f * pow(l, (1 / 2.4f)) - 0.055f;
- }
- }
-
- static float srgbToLinear(float s) {
- if (s <= 0.04045) {
- return s / 12.92f;
- } else {
- return pow(((s + 0.055f) / 1.055f), 2.4f);
- }
- }
-
- static uint8_t srgbToLinear(uint8_t u) {
- float f = u / 255.0f;
- return static_cast<uint8_t>(srgbToLinear(f) * 255.0f + 0.5f);
- }
-
- void fillTexture(bool writeAsSRGB) {
- uint8_t* textureData = new uint8_t[DISPLAY_SIZE];
-
- for (int y = 0; y < DISPLAY_HEIGHT; ++y) {
- for (int x = 0; x < DISPLAY_WIDTH; ++x) {
- float realValue = static_cast<float>(x) / (DISPLAY_WIDTH - 1);
- realValue *= ALPHA_VALUE / 255.0f; // Premultiply by alpha
- if (writeAsSRGB) {
- realValue = linearToSRGB(realValue);
- }
-
- int offset = (y * DISPLAY_WIDTH + x) * PIXEL_SIZE;
- for (int c = 0; c < 3; ++c) {
- uint8_t intValue = static_cast<uint8_t>(
- realValue * 255.0f + 0.5f);
- textureData[offset + c] = intValue;
- }
- textureData[offset + 3] = ALPHA_VALUE;
- }
- }
-
- glTexImage2D(GL_TEXTURE_2D, 0, writeAsSRGB ? GL_SRGB8_ALPHA8 : GL_RGBA8,
- DISPLAY_WIDTH, DISPLAY_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- textureData);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
-
- delete[] textureData;
- }
-
- void initShaders() {
- static const char vertexSource[] =
- "attribute vec4 vPosition;\n"
- "varying vec2 texCoords;\n"
- "void main() {\n"
- " texCoords = 0.5 * (vPosition.xy + vec2(1.0, 1.0));\n"
- " gl_Position = vPosition;\n"
- "}\n";
-
- static const char fragmentSource[] =
- "precision mediump float;\n"
- "uniform sampler2D texSampler;\n"
- "varying vec2 texCoords;\n"
- "void main() {\n"
- " gl_FragColor = texture2D(texSampler, texCoords);\n"
- "}\n";
-
- GLuint program;
- {
- SCOPED_TRACE("Creating shader program");
- ASSERT_NO_FATAL_FAILURE(GLTest::createProgram(
- vertexSource, fragmentSource, &program));
- }
-
- GLint positionHandle = glGetAttribLocation(program, "vPosition");
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- ASSERT_NE(-1, positionHandle);
-
- GLint samplerHandle = glGetUniformLocation(program, "texSampler");
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- ASSERT_NE(-1, samplerHandle);
-
- static const GLfloat vertices[] = {
- -1.0f, 1.0f,
- -1.0f, -1.0f,
- 1.0f, -1.0f,
- 1.0f, 1.0f,
- };
-
- glVertexAttribPointer(positionHandle, 2, GL_FLOAT, GL_FALSE, 0, vertices);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- glEnableVertexAttribArray(positionHandle);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
-
- glUseProgram(program);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- glUniform1i(samplerHandle, 0);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
-
- GLuint textureHandle;
- glGenTextures(1, &textureHandle);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- glBindTexture(GL_TEXTURE_2D, textureHandle);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- }
-
- void drawTexture(bool asSRGB, GLint x, GLint y, GLsizei width,
- GLsizei height) {
- ASSERT_NO_FATAL_FAILURE(fillTexture(asSRGB));
- glViewport(x, y, width, height);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- ASSERT_EQ(GL_NO_ERROR, glGetError());
- }
-
- void checkLockedBuffer(PixelFormat format, android_dataspace dataSpace) {
- ASSERT_EQ(mLockedBuffer.format, format);
- ASSERT_EQ(mLockedBuffer.width, DISPLAY_WIDTH);
- ASSERT_EQ(mLockedBuffer.height, DISPLAY_HEIGHT);
- ASSERT_EQ(mLockedBuffer.dataSpace, dataSpace);
- }
-
- static bool withinTolerance(int a, int b) {
- int diff = a - b;
- return diff >= 0 ? diff <= TOLERANCE : -diff <= TOLERANCE;
- }
-
- // Primary producer and consumer
- sp<Surface> mInputSurface;
- sp<CpuConsumer> mCpuConsumer;
- CpuConsumer::LockedBuffer mLockedBuffer;
-
- EGLDisplay mEglDisplay;
- EGLConfig mEglConfig;
- EGLContext mEglContext;
- EGLSurface mEglSurface;
-
- // Auxiliary display output
- sp<SurfaceComposerClient> mComposerClient;
- sp<SurfaceControl> mSurfaceControl;
- sp<Surface> mOutputSurface;
-
-private:
- void createEGLSurface(Surface* inputSurface) {
- mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
-
- EXPECT_TRUE(eglInitialize(mEglDisplay, NULL, NULL));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- static const EGLint configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_NONE };
-
- EGLint numConfigs = 0;
- EXPECT_TRUE(eglChooseConfig(mEglDisplay, configAttribs, &mEglConfig, 1,
- &numConfigs));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_GT(numConfigs, 0);
-
- static const EGLint contextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 3,
- EGL_NONE } ;
-
- mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT,
- contextAttribs);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_CONTEXT, mEglContext);
-
- mEglSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig,
- inputSurface, NULL);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_SURFACE, mEglSurface);
-
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
- mEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- }
-
- void createDebugSurface() {
- if (getenv(SHOW_DEBUG_STRING) == NULL) return;
-
- mComposerClient = new SurfaceComposerClient;
- ASSERT_EQ(NO_ERROR, mComposerClient->initCheck());
-
- mSurfaceControl = mComposerClient->createSurface(
- String8("SRGBTest Surface"), DISPLAY_WIDTH, DISPLAY_HEIGHT,
- PIXEL_FORMAT_RGBA_8888);
-
- ASSERT_TRUE(mSurfaceControl != NULL);
- ASSERT_TRUE(mSurfaceControl->isValid());
-
- SurfaceComposerClient::openGlobalTransaction();
- ASSERT_EQ(NO_ERROR, mSurfaceControl->setLayer(0x7FFFFFFF));
- ASSERT_EQ(NO_ERROR, mSurfaceControl->show());
- SurfaceComposerClient::closeGlobalTransaction();
-
- ANativeWindow_Buffer outBuffer;
- ARect inOutDirtyBounds;
- mOutputSurface = mSurfaceControl->getSurface();
- mOutputSurface->lock(&outBuffer, &inOutDirtyBounds);
- uint8_t* bytePointer = reinterpret_cast<uint8_t*>(outBuffer.bits);
- for (int y = 0; y < outBuffer.height; ++y) {
- int rowOffset = y * outBuffer.stride; // pixels
- for (int x = 0; x < outBuffer.width; ++x) {
- int colOffset = (rowOffset + x) * PIXEL_SIZE; // bytes
- for (int c = 0; c < PIXEL_SIZE; ++c) {
- int offset = colOffset + c;
- bytePointer[offset] = ((c + 1) * 56) - 1;
- }
- }
- }
- mOutputSurface->unlockAndPost();
- }
-
- void copyToDebugSurface() {
- if (!mOutputSurface.get()) return;
-
- size_t bufferSize = mLockedBuffer.height * mLockedBuffer.stride *
- PIXEL_SIZE;
-
- ANativeWindow_Buffer outBuffer;
- ARect outBufferBounds;
- mOutputSurface->lock(&outBuffer, &outBufferBounds);
- ASSERT_EQ(mLockedBuffer.width, static_cast<uint32_t>(outBuffer.width));
- ASSERT_EQ(mLockedBuffer.height, static_cast<uint32_t>(outBuffer.height));
- ASSERT_EQ(mLockedBuffer.stride, static_cast<uint32_t>(outBuffer.stride));
-
- if (mLockedBuffer.format == outBuffer.format) {
- memcpy(outBuffer.bits, mLockedBuffer.data, bufferSize);
- } else {
- ASSERT_EQ(mLockedBuffer.format, PIXEL_FORMAT_RGBA_8888);
- ASSERT_EQ(mLockedBuffer.dataSpace, HAL_DATASPACE_SRGB);
- ASSERT_EQ(outBuffer.format, PIXEL_FORMAT_RGBA_8888);
- uint8_t* outPointer = reinterpret_cast<uint8_t*>(outBuffer.bits);
- for (int y = 0; y < outBuffer.height; ++y) {
- int rowOffset = y * outBuffer.stride; // pixels
- for (int x = 0; x < outBuffer.width; ++x) {
- int colOffset = (rowOffset + x) * PIXEL_SIZE; // bytes
-
- // RGB are converted
- for (int c = 0; c < (PIXEL_SIZE - 1); ++c) {
- outPointer[colOffset + c] = srgbToLinear(
- mLockedBuffer.data[colOffset + c]);
- }
-
- // Alpha isn't converted
- outPointer[colOffset + 3] =
- mLockedBuffer.data[colOffset + 3];
- }
- }
- }
- mOutputSurface->unlockAndPost();
-
- int sleepSeconds = atoi(getenv(SHOW_DEBUG_STRING));
- sleep(sleepSeconds);
- }
-};
-
-const char SRGBTest::SHOW_DEBUG_STRING[] = "DEBUG_OUTPUT_SECONDS";
-
-TEST_F(SRGBTest, GLRenderFromSRGBTexture) {
- ASSERT_NO_FATAL_FAILURE(initShaders());
-
- // The RGB texture is displayed in the top half
- ASSERT_NO_FATAL_FAILURE(drawTexture(false, 0, DISPLAY_HEIGHT / 2,
- DISPLAY_WIDTH, DISPLAY_HEIGHT / 2));
-
- // The SRGB texture is displayed in the bottom half
- ASSERT_NO_FATAL_FAILURE(drawTexture(true, 0, 0,
- DISPLAY_WIDTH, DISPLAY_HEIGHT / 2));
-
- eglSwapBuffers(mEglDisplay, mEglSurface);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- // Lock
- ASSERT_EQ(NO_ERROR, mCpuConsumer->lockNextBuffer(&mLockedBuffer));
- ASSERT_NO_FATAL_FAILURE(
- checkLockedBuffer(PIXEL_FORMAT_RGBA_8888, HAL_DATASPACE_UNKNOWN));
-
- // Compare a pixel in the middle of each texture
- int midSRGBOffset = (DISPLAY_HEIGHT / 4) * mLockedBuffer.stride *
- PIXEL_SIZE;
- int midRGBOffset = midSRGBOffset * 3;
- midRGBOffset += (DISPLAY_WIDTH / 2) * PIXEL_SIZE;
- midSRGBOffset += (DISPLAY_WIDTH / 2) * PIXEL_SIZE;
- for (int c = 0; c < PIXEL_SIZE; ++c) {
- int expectedValue = mLockedBuffer.data[midRGBOffset + c];
- int actualValue = mLockedBuffer.data[midSRGBOffset + c];
- ASSERT_PRED2(withinTolerance, expectedValue, actualValue);
- }
-
- // mLockedBuffer is unlocked in TearDown so we can copy data from it to
- // the debug surface if necessary
-}
-
-// XXX: Disabled since we don't currently expect this to work
-TEST_F(SRGBTest, DISABLED_RenderToSRGBSurface) {
- ASSERT_NO_FATAL_FAILURE(initShaders());
-
- // By default, the first buffer we write into will be RGB
-
- // Render an RGB texture across the whole surface
- ASSERT_NO_FATAL_FAILURE(drawTexture(false, 0, 0,
- DISPLAY_WIDTH, DISPLAY_HEIGHT));
- eglSwapBuffers(mEglDisplay, mEglSurface);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- // Lock
- ASSERT_EQ(NO_ERROR, mCpuConsumer->lockNextBuffer(&mLockedBuffer));
- ASSERT_NO_FATAL_FAILURE(
- checkLockedBuffer(PIXEL_FORMAT_RGBA_8888, HAL_DATASPACE_UNKNOWN));
-
- // Save the values of the middle pixel for later comparison against SRGB
- uint8_t values[PIXEL_SIZE] = {};
- int middleOffset = (DISPLAY_HEIGHT / 2) * mLockedBuffer.stride *
- PIXEL_SIZE;
- middleOffset += (DISPLAY_WIDTH / 2) * PIXEL_SIZE;
- for (int c = 0; c < PIXEL_SIZE; ++c) {
- values[c] = mLockedBuffer.data[middleOffset + c];
- }
-
- // Unlock
- ASSERT_EQ(NO_ERROR, mCpuConsumer->unlockBuffer(mLockedBuffer));
-
- // Switch to SRGB window surface
- static const int srgbAttribs[] = {
- EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR,
- EGL_NONE,
- };
-
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
- mEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EXPECT_TRUE(eglDestroySurface(mEglDisplay, mEglSurface));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- mEglSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig,
- mInputSurface.get(), srgbAttribs);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_SURFACE, mEglSurface);
-
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
- mEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- // Render the texture again
- ASSERT_NO_FATAL_FAILURE(drawTexture(false, 0, 0,
- DISPLAY_WIDTH, DISPLAY_HEIGHT));
- eglSwapBuffers(mEglDisplay, mEglSurface);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- // Lock
- ASSERT_EQ(NO_ERROR, mCpuConsumer->lockNextBuffer(&mLockedBuffer));
-
- // Make sure we actually got the SRGB buffer on the consumer side
- ASSERT_NO_FATAL_FAILURE(
- checkLockedBuffer(PIXEL_FORMAT_RGBA_8888, HAL_DATASPACE_SRGB));
-
- // Verify that the stored value is the same, accounting for RGB/SRGB
- for (int c = 0; c < PIXEL_SIZE; ++c) {
- // The alpha value should be equivalent before linear->SRGB
- float rgbAsSRGB = (c == 3) ? values[c] / 255.0f :
- linearToSRGB(values[c] / 255.0f);
- int expectedValue = rgbAsSRGB * 255.0f + 0.5f;
- int actualValue = mLockedBuffer.data[middleOffset + c];
- ASSERT_PRED2(withinTolerance, expectedValue, actualValue);
- }
-
- // mLockedBuffer is unlocked in TearDown so we can copy data from it to
- // the debug surface if necessary
-}
-
-} // namespace android
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index ceeb90a..da6f13d 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -18,13 +18,13 @@
#include <gtest/gtest.h>
-#include <binder/IMemory.h>
#include <binder/ProcessState.h>
+#include <cutils/properties.h>
+#include <gui/BufferItemConsumer.h>
#include <gui/IDisplayEventConnection.h>
#include <gui/ISurfaceComposer.h>
#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>
-#include <gui/BufferItemConsumer.h>
#include <private/gui/ComposerService.h>
#include <ui/Rect.h>
#include <utils/String8.h>
@@ -253,6 +253,35 @@
EXPECT_STREQ("TestConsumer", surface->getConsumerName().string());
}
+TEST_F(SurfaceTest, GetWideColorSupport) {
+ sp<IGraphicBufferProducer> producer;
+ sp<IGraphicBufferConsumer> consumer;
+ BufferQueue::createBufferQueue(&producer, &consumer);
+
+ sp<DummyConsumer> dummyConsumer(new DummyConsumer);
+ consumer->consumerConnect(dummyConsumer, false);
+ consumer->setConsumerName(String8("TestConsumer"));
+
+ sp<Surface> surface = new Surface(producer);
+ sp<ANativeWindow> window(surface);
+ native_window_api_connect(window.get(), NATIVE_WINDOW_API_CPU);
+
+ bool supported;
+ surface->getWideColorSupport(&supported);
+
+ // TODO(courtneygo): How can we know what device we are on to
+ // verify that this is correct?
+ char product[PROPERTY_VALUE_MAX] = "0";
+ property_get("ro.build.product", product, "0");
+ std::cerr << "[ ] product = " << product << std::endl;
+
+ if (strcmp("marlin", product) == 0 || strcmp("sailfish", product) == 0) {
+ ASSERT_EQ(true, supported);
+ } else {
+ ASSERT_EQ(false, supported);
+ }
+}
+
TEST_F(SurfaceTest, DynamicSetBufferCount) {
sp<IGraphicBufferProducer> producer;
sp<IGraphicBufferConsumer> consumer;
diff --git a/libs/input/Android.bp b/libs/input/Android.bp
index 9485d5b..9294419 100644
--- a/libs/input/Android.bp
+++ b/libs/input/Android.bp
@@ -17,7 +17,11 @@
cc_library {
name: "libinput",
host_supported: true,
-
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
srcs: [
"Input.cpp",
"InputDevice.cpp",
diff --git a/libs/input/InputDevice.cpp b/libs/input/InputDevice.cpp
index d755ed3..4287abe 100644
--- a/libs/input/InputDevice.cpp
+++ b/libs/input/InputDevice.cpp
@@ -21,6 +21,7 @@
#include <ctype.h>
#include <input/InputDevice.h>
+#include <input/InputEventLabels.h>
namespace android {
@@ -87,17 +88,23 @@
const String8& name, InputDeviceConfigurationFileType type) {
// Search system repository.
String8 path;
- path.setTo(getenv("ANDROID_ROOT"));
- path.append("/usr/");
- appendInputDeviceConfigurationFileRelativePath(path, name, type);
+
+ // Treblized input device config files will be located /odm/usr or /vendor/usr.
+ const char *rootsForPartition[] {"/odm", "/vendor", getenv("ANDROID_ROOT")};
+ for (size_t i = 0; i < size(rootsForPartition); i++) {
+ path.setTo(rootsForPartition[i]);
+ path.append("/usr/");
+ appendInputDeviceConfigurationFileRelativePath(path, name, type);
#if DEBUG_PROBE
- ALOGD("Probing for system provided input device configuration file: path='%s'", path.string());
+ ALOGD("Probing for system provided input device configuration file: path='%s'",
+ path.string());
#endif
- if (!access(path.string(), R_OK)) {
+ if (!access(path.string(), R_OK)) {
#if DEBUG_PROBE
- ALOGD("Found");
+ ALOGD("Found");
#endif
- return path;
+ return path;
+ }
}
// Search user repository.
diff --git a/libs/input/Keyboard.cpp b/libs/input/Keyboard.cpp
index 9a01395..07f2289 100644
--- a/libs/input/Keyboard.cpp
+++ b/libs/input/Keyboard.cpp
@@ -208,7 +208,6 @@
}
int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState) {
- int32_t mask;
switch (keyCode) {
case AKEYCODE_ALT_LEFT:
return setEphemeralMetaState(AMETA_ALT_LEFT_ON, down, oldMetaState);
diff --git a/libs/nativewindow/AHardwareBuffer.cpp b/libs/nativewindow/AHardwareBuffer.cpp
new file mode 100644
index 0000000..3fbab17
--- /dev/null
+++ b/libs/nativewindow/AHardwareBuffer.cpp
@@ -0,0 +1,435 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#define LOG_TAG "AHardwareBuffer"
+
+#include <android/hardware_buffer.h>
+
+#include <errno.h>
+#include <sys/socket.h>
+#include <memory>
+
+#include <cutils/native_handle.h>
+#include <log/log.h>
+#include <utils/StrongPointer.h>
+#include <ui/GraphicBuffer.h>
+#include <system/graphics.h>
+#include <hardware/gralloc1.h>
+
+#include <private/android/AHardwareBufferHelpers.h>
+
+
+static constexpr int kDataBufferSize = 64 * sizeof(int); // 64 ints
+
+using namespace android;
+
+// ----------------------------------------------------------------------------
+// Public functions
+// ----------------------------------------------------------------------------
+
+int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* desc, AHardwareBuffer** outBuffer) {
+ if (!outBuffer || !desc)
+ return BAD_VALUE;
+
+ int format = AHardwareBuffer_convertToPixelFormat(desc->format);
+ if (format == 0) {
+ ALOGE("Invalid pixel format %u", desc->format);
+ return BAD_VALUE;
+ }
+
+ if (desc->format == AHARDWAREBUFFER_FORMAT_BLOB && desc->height != 1) {
+ ALOGE("Height must be 1 when using the AHARDWAREBUFFER_FORMAT_BLOB format");
+ return BAD_VALUE;
+ }
+
+ uint64_t producerUsage = 0;
+ uint64_t consumerUsage = 0;
+ AHardwareBuffer_convertToGrallocUsageBits(&producerUsage, &consumerUsage, desc->usage0,
+ desc->usage1);
+
+ sp<GraphicBuffer> gbuffer(new GraphicBuffer(
+ desc->width, desc->height, format, desc->layers, producerUsage, consumerUsage,
+ std::string("AHardwareBuffer pid [") + std::to_string(getpid()) + "]"));
+
+ status_t err = gbuffer->initCheck();
+ if (err != 0 || gbuffer->handle == 0) {
+ if (err == NO_MEMORY) {
+ GraphicBuffer::dumpAllocationsToSystemLog();
+ }
+ ALOGE("GraphicBufferAlloc::createGraphicBuffer(w=%u, h=%u, lc=%u) failed (%s), handle=%p",
+ desc->width, desc->height, desc->layers, strerror(-err), gbuffer->handle);
+ return err;
+ }
+
+ *outBuffer = AHardwareBuffer_from_GraphicBuffer(gbuffer.get());
+
+ // Ensure the buffer doesn't get destroyed when the sp<> goes away.
+ AHardwareBuffer_acquire(*outBuffer);
+ return NO_ERROR;
+}
+
+void AHardwareBuffer_acquire(AHardwareBuffer* buffer) {
+ AHardwareBuffer_to_GraphicBuffer(buffer)->incStrong((void*)AHardwareBuffer_acquire);
+}
+
+void AHardwareBuffer_release(AHardwareBuffer* buffer) {
+ AHardwareBuffer_to_GraphicBuffer(buffer)->decStrong((void*)AHardwareBuffer_release);
+}
+
+void AHardwareBuffer_describe(const AHardwareBuffer* buffer,
+ AHardwareBuffer_Desc* outDesc) {
+ if (!buffer || !outDesc) return;
+
+ const GraphicBuffer* gbuffer = AHardwareBuffer_to_GraphicBuffer(buffer);
+
+ outDesc->width = gbuffer->getWidth();
+ outDesc->height = gbuffer->getHeight();
+ outDesc->layers = gbuffer->getLayerCount();
+ AHardwareBuffer_convertFromGrallocUsageBits(&outDesc->usage0, &outDesc->usage1,
+ gbuffer->getUsage(), gbuffer->getUsage());
+ outDesc->format = AHardwareBuffer_convertFromPixelFormat(
+ static_cast<uint32_t>(gbuffer->getPixelFormat()));
+}
+
+int AHardwareBuffer_lock(AHardwareBuffer* buffer, uint64_t usage0,
+ int32_t fence, const ARect* rect, void** outVirtualAddress) {
+ if (!buffer) return BAD_VALUE;
+
+ if (usage0 & ~(AHARDWAREBUFFER_USAGE0_CPU_READ_OFTEN |
+ AHARDWAREBUFFER_USAGE0_CPU_WRITE_OFTEN)) {
+ ALOGE("Invalid usage flags passed to AHardwareBuffer_lock; only "
+ " AHARDWAREBUFFER_USAGE0_CPU_* flags are allowed");
+ return BAD_VALUE;
+ }
+
+ uint64_t producerUsage = 0;
+ uint64_t consumerUsage = 0;
+ AHardwareBuffer_convertToGrallocUsageBits(&producerUsage, &consumerUsage, usage0, 0);
+ GraphicBuffer* gBuffer = AHardwareBuffer_to_GraphicBuffer(buffer);
+ Rect bounds;
+ if (!rect) {
+ bounds.set(Rect(gBuffer->getWidth(), gBuffer->getHeight()));
+ } else {
+ bounds.set(Rect(rect->left, rect->top, rect->right, rect->bottom));
+ }
+ return gBuffer->lockAsync(producerUsage, consumerUsage, bounds,
+ outVirtualAddress, fence);
+}
+
+int AHardwareBuffer_unlock(AHardwareBuffer* buffer, int32_t* fence) {
+ if (!buffer) return BAD_VALUE;
+
+ GraphicBuffer* gBuffer = AHardwareBuffer_to_GraphicBuffer(buffer);
+ return gBuffer->unlockAsync(fence);
+}
+
+int AHardwareBuffer_sendHandleToUnixSocket(const AHardwareBuffer* buffer,
+ int socketFd) {
+ if (!buffer) return BAD_VALUE;
+ const GraphicBuffer* gBuffer = AHardwareBuffer_to_GraphicBuffer(buffer);
+
+ size_t flattenedSize = gBuffer->getFlattenedSize();
+ size_t fdCount = gBuffer->getFdCount();
+
+ std::unique_ptr<uint8_t[]> data(new uint8_t[flattenedSize]);
+ std::unique_ptr<int[]> fds(new int[fdCount]);
+
+ // Make copies of needed items since flatten modifies them, and we don't
+ // want to send anything if there's an error during flatten.
+ size_t flattenedSizeCopy = flattenedSize;
+ size_t fdCountCopy = fdCount;
+ void* dataStart = data.get();
+ int* fdsStart = fds.get();
+ status_t err = gBuffer->flatten(dataStart, flattenedSizeCopy, fdsStart,
+ fdCountCopy);
+ if (err != NO_ERROR) {
+ return err;
+ }
+
+ struct iovec iov[1];
+ iov[0].iov_base = data.get();
+ iov[0].iov_len = flattenedSize;
+
+ char buf[CMSG_SPACE(kDataBufferSize)];
+ struct msghdr msg = {
+ .msg_control = buf,
+ .msg_controllen = sizeof(buf),
+ .msg_iov = &iov[0],
+ .msg_iovlen = 1,
+ };
+
+ struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int) * fdCount);
+ int* fdData = reinterpret_cast<int*>(CMSG_DATA(cmsg));
+ memcpy(fdData, fds.get(), sizeof(int) * fdCount);
+ msg.msg_controllen = cmsg->cmsg_len;
+
+ int result = sendmsg(socketFd, &msg, 0);
+ if (result <= 0) {
+ ALOGE("Error writing AHardwareBuffer to socket: error %#x (%s)",
+ result, strerror(errno));
+ return result;
+ }
+ return NO_ERROR;
+}
+
+int AHardwareBuffer_recvHandleFromUnixSocket(int socketFd,
+ AHardwareBuffer** outBuffer) {
+ if (!outBuffer) return BAD_VALUE;
+
+ char dataBuf[CMSG_SPACE(kDataBufferSize)];
+ char fdBuf[CMSG_SPACE(kDataBufferSize)];
+ struct iovec iov[1];
+ iov[0].iov_base = dataBuf;
+ iov[0].iov_len = sizeof(dataBuf);
+
+ struct msghdr msg = {
+ .msg_control = fdBuf,
+ .msg_controllen = sizeof(fdBuf),
+ .msg_iov = &iov[0],
+ .msg_iovlen = 1,
+ };
+
+ int result = recvmsg(socketFd, &msg, 0);
+ if (result <= 0) {
+ ALOGE("Error reading AHardwareBuffer from socket: error %#x (%s)",
+ result, strerror(errno));
+ return result;
+ }
+
+ if (msg.msg_iovlen != 1) {
+ ALOGE("Error reading AHardwareBuffer from socket: bad data length");
+ return INVALID_OPERATION;
+ }
+
+ if (msg.msg_controllen % sizeof(int) != 0) {
+ ALOGE("Error reading AHardwareBuffer from socket: bad fd length");
+ return INVALID_OPERATION;
+ }
+
+ size_t dataLen = msg.msg_iov[0].iov_len;
+ const void* data = static_cast<const void*>(msg.msg_iov[0].iov_base);
+ if (!data) {
+ ALOGE("Error reading AHardwareBuffer from socket: no buffer data");
+ return INVALID_OPERATION;
+ }
+
+ struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
+ if (!cmsg) {
+ ALOGE("Error reading AHardwareBuffer from socket: no fd header");
+ return INVALID_OPERATION;
+ }
+
+ size_t fdCount = msg.msg_controllen >> 2;
+ const int* fdData = reinterpret_cast<const int*>(CMSG_DATA(cmsg));
+ if (!fdData) {
+ ALOGE("Error reading AHardwareBuffer from socket: no fd data");
+ return INVALID_OPERATION;
+ }
+
+ GraphicBuffer* gBuffer = new GraphicBuffer();
+ status_t err = gBuffer->unflatten(data, dataLen, fdData, fdCount);
+ if (err != NO_ERROR) {
+ return err;
+ }
+ *outBuffer = AHardwareBuffer_from_GraphicBuffer(gBuffer);
+ // Ensure the buffer has a positive ref-count.
+ AHardwareBuffer_acquire(*outBuffer);
+
+ return NO_ERROR;
+}
+
+const struct native_handle* AHardwareBuffer_getNativeHandle(
+ const AHardwareBuffer* buffer) {
+ if (!buffer) return nullptr;
+ const GraphicBuffer* gbuffer = AHardwareBuffer_to_GraphicBuffer(buffer);
+ return gbuffer->handle;
+}
+
+
+// ----------------------------------------------------------------------------
+// Helpers implementation
+// ----------------------------------------------------------------------------
+
+namespace android {
+
+// A 1:1 mapping of AHardwaqreBuffer bitmasks to gralloc1 bitmasks.
+struct UsageMaskMapping {
+ uint64_t hardwareBufferMask;
+ uint64_t grallocMask;
+};
+
+static constexpr UsageMaskMapping kUsage0ProducerMapping[] = {
+ { AHARDWAREBUFFER_USAGE0_CPU_WRITE, GRALLOC1_PRODUCER_USAGE_CPU_WRITE },
+ { AHARDWAREBUFFER_USAGE0_CPU_WRITE_OFTEN, GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN },
+ { AHARDWAREBUFFER_USAGE0_GPU_COLOR_OUTPUT, GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET },
+ { AHARDWAREBUFFER_USAGE0_PROTECTED_CONTENT, GRALLOC1_PRODUCER_USAGE_PROTECTED },
+ { AHARDWAREBUFFER_USAGE0_SENSOR_DIRECT_DATA, GRALLOC1_PRODUCER_USAGE_SENSOR_DIRECT_DATA },
+};
+
+static constexpr UsageMaskMapping kUsage1ProducerMapping[] = {
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_0, GRALLOC1_PRODUCER_USAGE_PRIVATE_0 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_1, GRALLOC1_PRODUCER_USAGE_PRIVATE_1 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_2, GRALLOC1_PRODUCER_USAGE_PRIVATE_2 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_3, GRALLOC1_PRODUCER_USAGE_PRIVATE_3 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_4, GRALLOC1_PRODUCER_USAGE_PRIVATE_4 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_5, GRALLOC1_PRODUCER_USAGE_PRIVATE_5 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_6, GRALLOC1_PRODUCER_USAGE_PRIVATE_6 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_7, GRALLOC1_PRODUCER_USAGE_PRIVATE_7 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_8, GRALLOC1_PRODUCER_USAGE_PRIVATE_8 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_9, GRALLOC1_PRODUCER_USAGE_PRIVATE_9 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_10, GRALLOC1_PRODUCER_USAGE_PRIVATE_10 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_11, GRALLOC1_PRODUCER_USAGE_PRIVATE_11 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_12, GRALLOC1_PRODUCER_USAGE_PRIVATE_12 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_13, GRALLOC1_PRODUCER_USAGE_PRIVATE_13 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_14, GRALLOC1_PRODUCER_USAGE_PRIVATE_14 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_15, GRALLOC1_PRODUCER_USAGE_PRIVATE_15 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_16, GRALLOC1_PRODUCER_USAGE_PRIVATE_16 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_17, GRALLOC1_PRODUCER_USAGE_PRIVATE_17 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_18, GRALLOC1_PRODUCER_USAGE_PRIVATE_18 },
+ { AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_19, GRALLOC1_PRODUCER_USAGE_PRIVATE_19 },
+};
+
+static constexpr UsageMaskMapping kUsage0ConsumerMapping[] = {
+ { AHARDWAREBUFFER_USAGE0_CPU_READ, GRALLOC1_CONSUMER_USAGE_CPU_READ },
+ { AHARDWAREBUFFER_USAGE0_CPU_READ_OFTEN, GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN },
+ { AHARDWAREBUFFER_USAGE0_GPU_SAMPLED_IMAGE, GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE },
+ { AHARDWAREBUFFER_USAGE0_GPU_DATA_BUFFER, GRALLOC1_CONSUMER_USAGE_GPU_DATA_BUFFER },
+ { AHARDWAREBUFFER_USAGE0_VIDEO_ENCODE, GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER },
+};
+
+static constexpr UsageMaskMapping kUsage1ConsumerMapping[] = {
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_0, GRALLOC1_CONSUMER_USAGE_PRIVATE_0 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_1, GRALLOC1_CONSUMER_USAGE_PRIVATE_1 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_2, GRALLOC1_CONSUMER_USAGE_PRIVATE_2 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_3, GRALLOC1_CONSUMER_USAGE_PRIVATE_3 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_4, GRALLOC1_CONSUMER_USAGE_PRIVATE_4 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_5, GRALLOC1_CONSUMER_USAGE_PRIVATE_5 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_6, GRALLOC1_CONSUMER_USAGE_PRIVATE_6 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_7, GRALLOC1_CONSUMER_USAGE_PRIVATE_7 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_8, GRALLOC1_CONSUMER_USAGE_PRIVATE_8 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_9, GRALLOC1_CONSUMER_USAGE_PRIVATE_9 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_10, GRALLOC1_CONSUMER_USAGE_PRIVATE_10 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_11, GRALLOC1_CONSUMER_USAGE_PRIVATE_11 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_12, GRALLOC1_CONSUMER_USAGE_PRIVATE_12 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_13, GRALLOC1_CONSUMER_USAGE_PRIVATE_13 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_14, GRALLOC1_CONSUMER_USAGE_PRIVATE_14 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_15, GRALLOC1_CONSUMER_USAGE_PRIVATE_15 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_16, GRALLOC1_CONSUMER_USAGE_PRIVATE_16 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_17, GRALLOC1_CONSUMER_USAGE_PRIVATE_17 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_18, GRALLOC1_CONSUMER_USAGE_PRIVATE_18 },
+ { AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_19, GRALLOC1_CONSUMER_USAGE_PRIVATE_19 },
+};
+
+static inline bool containsBits(uint64_t mask, uint64_t bitsToCheck) {
+ return (mask & bitsToCheck) == bitsToCheck && bitsToCheck;
+}
+
+uint32_t AHardwareBuffer_convertFromPixelFormat(uint32_t format) {
+ switch (format) {
+ case HAL_PIXEL_FORMAT_RGBA_8888: return AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
+ case HAL_PIXEL_FORMAT_RGBX_8888: return AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM;
+ case HAL_PIXEL_FORMAT_RGB_565: return AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM;
+ case HAL_PIXEL_FORMAT_RGB_888: return AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM;
+ case HAL_PIXEL_FORMAT_RGBA_FP16: return AHARDWAREBUFFER_FORMAT_R16G16B16A16_SFLOAT;
+ case HAL_PIXEL_FORMAT_RGBA_1010102: return AHARDWAREBUFFER_FORMAT_A2R10G10B10_UNORM_PACK32;
+ case HAL_PIXEL_FORMAT_BLOB: return AHARDWAREBUFFER_FORMAT_BLOB;
+ default:ALOGE("Unknown pixel format %u", format);
+ return 0;
+ }
+}
+
+uint32_t AHardwareBuffer_convertToPixelFormat(uint32_t format) {
+ switch (format) {
+ case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: return HAL_PIXEL_FORMAT_RGBA_8888;
+ case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: return HAL_PIXEL_FORMAT_RGBX_8888;
+ case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: return HAL_PIXEL_FORMAT_RGB_565;
+ case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: return HAL_PIXEL_FORMAT_RGB_888;
+ case AHARDWAREBUFFER_FORMAT_R16G16B16A16_SFLOAT: return HAL_PIXEL_FORMAT_RGBA_FP16;
+ case AHARDWAREBUFFER_FORMAT_A2R10G10B10_UNORM_PACK32: return HAL_PIXEL_FORMAT_RGBA_1010102;
+ case AHARDWAREBUFFER_FORMAT_BLOB: return HAL_PIXEL_FORMAT_BLOB;
+ default:ALOGE("Unknown AHardwareBuffer format %u", format);
+ return 0;
+ }
+}
+
+void AHardwareBuffer_convertToGrallocUsageBits(uint64_t* outProducerUsage,
+ uint64_t* outConsumerUsage, uint64_t usage0, uint64_t usage1) {
+ *outProducerUsage = 0;
+ *outConsumerUsage = 0;
+ for (const UsageMaskMapping& mapping : kUsage0ProducerMapping) {
+ if (containsBits(usage0, mapping.hardwareBufferMask)) {
+ *outProducerUsage |= mapping.grallocMask;
+ }
+ }
+ for (const UsageMaskMapping& mapping : kUsage1ProducerMapping) {
+ if (containsBits(usage1, mapping.hardwareBufferMask)) {
+ *outProducerUsage |= mapping.grallocMask;
+ }
+ }
+ for (const UsageMaskMapping& mapping : kUsage0ConsumerMapping) {
+ if (containsBits(usage0, mapping.hardwareBufferMask)) {
+ *outConsumerUsage |= mapping.grallocMask;
+ }
+ }
+ for (const UsageMaskMapping& mapping : kUsage1ConsumerMapping) {
+ if (containsBits(usage1, mapping.hardwareBufferMask)) {
+ *outConsumerUsage |= mapping.grallocMask;
+ }
+ }
+}
+
+void AHardwareBuffer_convertFromGrallocUsageBits(uint64_t* outUsage0, uint64_t* outUsage1,
+ uint64_t producerUsage, uint64_t consumerUsage) {
+ *outUsage0 = 0;
+ *outUsage1 = 0;
+ for (const UsageMaskMapping& mapping : kUsage0ProducerMapping) {
+ if (containsBits(producerUsage, mapping.grallocMask)) {
+ *outUsage0 |= mapping.hardwareBufferMask;
+ }
+ }
+ for (const UsageMaskMapping& mapping : kUsage1ProducerMapping) {
+ if (containsBits(producerUsage, mapping.grallocMask)) {
+ *outUsage1 |= mapping.hardwareBufferMask;
+ }
+ }
+ for (const UsageMaskMapping& mapping : kUsage0ConsumerMapping) {
+ if (containsBits(consumerUsage, mapping.grallocMask)) {
+ *outUsage0 |= mapping.hardwareBufferMask;
+ }
+ }
+ for (const UsageMaskMapping& mapping : kUsage1ConsumerMapping) {
+ if (containsBits(consumerUsage, mapping.grallocMask)) {
+ *outUsage1 |= mapping.hardwareBufferMask;
+ }
+ }
+}
+
+const GraphicBuffer* AHardwareBuffer_to_GraphicBuffer(const AHardwareBuffer* buffer) {
+ return reinterpret_cast<const GraphicBuffer*>(buffer);
+}
+
+GraphicBuffer* AHardwareBuffer_to_GraphicBuffer(AHardwareBuffer* buffer) {
+ return reinterpret_cast<GraphicBuffer*>(buffer);
+}
+
+AHardwareBuffer* AHardwareBuffer_from_GraphicBuffer(GraphicBuffer* buffer) {
+ return reinterpret_cast<AHardwareBuffer*>(buffer);
+}
+
+} // namespace android
diff --git a/libs/nativewindow/ANativeWindow.cpp b/libs/nativewindow/ANativeWindow.cpp
new file mode 100644
index 0000000..34c136a
--- /dev/null
+++ b/libs/nativewindow/ANativeWindow.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#define LOG_TAG "ANativeWindow"
+
+#include <android/native_window.h>
+#include <system/window.h>
+
+void ANativeWindow_acquire(ANativeWindow* window) {
+ window->incStrong((void*)ANativeWindow_acquire);
+}
+
+void ANativeWindow_release(ANativeWindow* window) {
+ window->decStrong((void*)ANativeWindow_release);
+}
+
+static int32_t getWindowProp(ANativeWindow* window, int what) {
+ int value;
+ int res = window->query(window, what, &value);
+ return res < 0 ? res : value;
+}
+
+int32_t ANativeWindow_getWidth(ANativeWindow* window) {
+ return getWindowProp(window, NATIVE_WINDOW_WIDTH);
+}
+
+int32_t ANativeWindow_getHeight(ANativeWindow* window) {
+ return getWindowProp(window, NATIVE_WINDOW_HEIGHT);
+}
+
+int32_t ANativeWindow_getFormat(ANativeWindow* window) {
+ return getWindowProp(window, NATIVE_WINDOW_FORMAT);
+}
+
+int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width,
+ int32_t height, int32_t format) {
+ int32_t err = native_window_set_buffers_format(window, format);
+ if (!err) {
+ err = native_window_set_buffers_user_dimensions(window, width, height);
+ if (!err) {
+ int mode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
+ if (width && height) {
+ mode = NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW;
+ }
+ err = native_window_set_scaling_mode(window, mode);
+ }
+ }
+ return err;
+}
+
+int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer,
+ ARect* inOutDirtyBounds) {
+ return window->perform(window, NATIVE_WINDOW_LOCK, outBuffer, inOutDirtyBounds);
+}
+
+int32_t ANativeWindow_unlockAndPost(ANativeWindow* window) {
+ return window->perform(window, NATIVE_WINDOW_UNLOCK_AND_POST);
+}
diff --git a/libs/nativewindow/Android.bp b/libs/nativewindow/Android.bp
new file mode 100644
index 0000000..9c5f096
--- /dev/null
+++ b/libs/nativewindow/Android.bp
@@ -0,0 +1,60 @@
+// Copyright (C) 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.
+
+ndk_headers {
+ name: "libnativewindow_headers",
+ from: "include/android",
+ to: "android",
+ srcs: ["include/android/*.h"],
+ license: "NOTICE",
+}
+
+ndk_library {
+ name: "libnativewindow.ndk",
+ symbol_file: "libnativewindow.map.txt",
+
+ // Android O
+ first_version: "26",
+}
+
+cc_library {
+ name: "libnativewindow",
+ export_include_dirs: ["include"],
+
+ clang: true,
+
+ srcs: [
+ "AHardwareBuffer.cpp",
+ "ANativeWindow.cpp",
+ ],
+
+ shared_libs: [
+ "libhardware",
+ "libcutils",
+ "liblog",
+ "libutils",
+ "libui",
+ ],
+
+ static_libs: [
+ "libarect",
+ ],
+
+ // headers we include in our public headers
+ export_static_lib_headers: [
+ "libarect",
+ ],
+}
+
+subdirs = ["tests"]
diff --git a/libs/nativewindow/MODULE_LICENSE_APACHE2 b/libs/nativewindow/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libs/nativewindow/MODULE_LICENSE_APACHE2
diff --git a/libs/nativewindow/NOTICE b/libs/nativewindow/NOTICE
new file mode 100644
index 0000000..c5b1efa
--- /dev/null
+++ b/libs/nativewindow/NOTICE
@@ -0,0 +1,190 @@
+
+ Copyright (c) 2005-2008, 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.
+
+ 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.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
diff --git a/include/android/hardware_buffer.h b/libs/nativewindow/include/android/hardware_buffer.h
similarity index 75%
rename from include/android/hardware_buffer.h
rename to libs/nativewindow/include/android/hardware_buffer.h
index 9c08c7b..ef49995 100644
--- a/include/android/hardware_buffer.h
+++ b/libs/nativewindow/include/android/hardware_buffer.h
@@ -97,10 +97,6 @@
AHARDWAREBUFFER_USAGE0_GPU_SAMPLED_IMAGE = 1ULL << 10,
/* The buffer will be written to by the GPU */
AHARDWAREBUFFER_USAGE0_GPU_COLOR_OUTPUT = 1ULL << 11,
- /* The buffer will be read from and written to by the GPU */
- AHARDWAREBUFFER_USAGE0_GPU_STORAGE_IMAGE =
- AHARDWAREBUFFER_USAGE0_GPU_SAMPLED_IMAGE |
- AHARDWAREBUFFER_USAGE0_GPU_COLOR_OUTPUT,
/* The buffer will be used as a cubemap texture */
AHARDWAREBUFFER_USAGE0_GPU_CUBEMAP = 1ULL << 13,
/* The buffer will be used as a shader storage or uniform buffer object*/
@@ -113,13 +109,57 @@
AHARDWAREBUFFER_USAGE0_VIDEO_ENCODE = 1ULL << 21,
};
+/* These flags are intended only for use by device-specific graphics drivers. */
+enum {
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_19 = 1ULL << 24,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_19 = 1ULL << 25,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_18 = 1ULL << 26,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_18 = 1ULL << 27,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_17 = 1ULL << 28,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_17 = 1ULL << 29,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_16 = 1ULL << 30,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_16 = 1ULL << 31,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_15 = 1ULL << 32,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_15 = 1ULL << 33,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_14 = 1ULL << 34,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_14 = 1ULL << 35,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_13 = 1ULL << 36,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_13 = 1ULL << 37,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_12 = 1ULL << 38,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_12 = 1ULL << 39,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_11 = 1ULL << 40,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_11 = 1ULL << 41,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_10 = 1ULL << 42,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_10 = 1ULL << 43,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_9 = 1ULL << 44,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_9 = 1ULL << 45,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_8 = 1ULL << 46,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_8 = 1ULL << 47,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_7 = 1ULL << 48,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_7 = 1ULL << 49,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_6 = 1ULL << 50,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_6 = 1ULL << 51,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_5 = 1ULL << 52,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_5 = 1ULL << 53,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_4 = 1ULL << 54,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_4 = 1ULL << 55,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_3 = 1ULL << 56,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_3 = 1ULL << 57,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_2 = 1ULL << 58,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_2 = 1ULL << 59,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_1 = 1ULL << 60,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_1 = 1ULL << 61,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_0 = 1ULL << 62,
+ AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_0 = 1ULL << 63,
+};
+
typedef struct AHardwareBuffer_Desc {
uint32_t width;
uint32_t height;
uint32_t layers;
+ uint32_t format; // One of AHARDWAREBUFFER_FORMAT_*
uint64_t usage0; // Combination of AHARDWAREBUFFER_USAGE0_*
uint64_t usage1; // Initialize to zero, reserved for future use
- uint32_t format; // One of AHARDWAREBUFFER_FORMAT_*
} AHardwareBuffer_Desc;
typedef struct AHardwareBuffer AHardwareBuffer;
diff --git a/include/android/native_window.h b/libs/nativewindow/include/android/native_window.h
similarity index 100%
rename from include/android/native_window.h
rename to libs/nativewindow/include/android/native_window.h
diff --git a/libs/nativewindow/include/private/android/AHardwareBufferHelpers.h b/libs/nativewindow/include/private/android/AHardwareBufferHelpers.h
new file mode 100644
index 0000000..612ee80
--- /dev/null
+++ b/libs/nativewindow/include/private/android/AHardwareBufferHelpers.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 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_PRIVATE_NATIVE_AHARDWARE_BUFFER_HELPERS_H
+#define ANDROID_PRIVATE_NATIVE_AHARDWARE_BUFFER_HELPERS_H
+
+/*
+ * This file contains utility functions related to AHardwareBuffer, mostly to
+ * convert to/from HAL formats.
+ *
+ * These are PRIVATE methods, so this file can NEVER appear in a public NDK
+ * header. They are used by higher level libraries such as core/jni.
+ */
+
+#include <stdint.h>
+
+struct AHardwareBuffer;
+
+namespace android {
+
+uint32_t AHardwareBuffer_convertFromPixelFormat(uint32_t format);
+
+uint32_t AHardwareBuffer_convertToPixelFormat(uint32_t format);
+
+void AHardwareBuffer_convertToGrallocUsageBits(uint64_t* outProducerUsage,
+ uint64_t* outConsumerUsage, uint64_t usage0, uint64_t usage1);
+
+void AHardwareBuffer_convertFromGrallocUsageBits(uint64_t* outUsage0, uint64_t* outUsage1,
+ uint64_t producerUsage, uint64_t consumerUsage);
+
+class GraphicBuffer;
+const GraphicBuffer* AHardwareBuffer_to_GraphicBuffer(const AHardwareBuffer* buffer);
+GraphicBuffer* AHardwareBuffer_to_GraphicBuffer(AHardwareBuffer* buffer);
+AHardwareBuffer* AHardwareBuffer_from_GraphicBuffer(GraphicBuffer* buffer);
+
+} // namespace android
+
+#endif // ANDROID_PRIVATE_NATIVE_AHARDWARE_BUFFER_HELPERS_H
diff --git a/libs/nativewindow/libnativewindow.map.txt b/libs/nativewindow/libnativewindow.map.txt
new file mode 100644
index 0000000..dcfabac
--- /dev/null
+++ b/libs/nativewindow/libnativewindow.map.txt
@@ -0,0 +1,26 @@
+LIBNATIVEWINDOW {
+ global:
+ AHardwareBuffer_acquire;
+ AHardwareBuffer_allocate;
+ AHardwareBuffer_describe;
+ AHardwareBuffer_fromHardwareBuffer;
+ AHardwareBuffer_getNativeHandle;
+ AHardwareBuffer_lock;
+ AHardwareBuffer_recvHandleFromUnixSocket;
+ AHardwareBuffer_release;
+ AHardwareBuffer_sendHandleToUnixSocket;
+ AHardwareBuffer_toHardwareBuffer;
+ AHardwareBuffer_unlock;
+ ANativeWindow_acquire;
+ ANativeWindow_fromSurface;
+ ANativeWindow_fromSurfaceTexture;
+ ANativeWindow_getFormat;
+ ANativeWindow_getHeight;
+ ANativeWindow_getWidth;
+ ANativeWindow_lock;
+ ANativeWindow_release;
+ ANativeWindow_setBuffersGeometry;
+ ANativeWindow_unlockAndPost;
+ local:
+ *;
+};
diff --git a/libs/nativewindow/tests/AHardwareBufferTest.cpp b/libs/nativewindow/tests/AHardwareBufferTest.cpp
new file mode 100644
index 0000000..1099043
--- /dev/null
+++ b/libs/nativewindow/tests/AHardwareBufferTest.cpp
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#define LOG_TAG "AHardwareBuffer_test"
+//#define LOG_NDEBUG 0
+
+#include <android/hardware_buffer.h>
+#include <private/android/AHardwareBufferHelpers.h>
+#include <hardware/gralloc1.h>
+
+#include <gtest/gtest.h>
+
+using namespace android;
+
+static ::testing::AssertionResult BuildHexFailureMessage(uint64_t expected,
+ uint64_t actual, const char* type) {
+ std::ostringstream ss;
+ ss << type << " 0x" << std::hex << actual
+ << " does not match expected " << type << " 0x" << std::hex
+ << expected;
+ return ::testing::AssertionFailure() << ss.str();
+}
+
+static ::testing::AssertionResult TestUsageConversion(
+ uint64_t grallocProducerUsage, uint64_t grallocConsumerUsage,
+ uint64_t hardwareBufferUsage0, uint64_t hardwareBufferUsage1) {
+ uint64_t producerUsage = 0;
+ uint64_t consumerUsage = 0;
+ uint64_t usage0 = 0;
+ uint64_t usage1 = 0;
+
+ AHardwareBuffer_convertToGrallocUsageBits(
+ &producerUsage, &consumerUsage, hardwareBufferUsage0, hardwareBufferUsage1);
+ if (producerUsage != grallocProducerUsage)
+ return BuildHexFailureMessage(grallocProducerUsage, producerUsage,
+ "producer");
+ if (consumerUsage != grallocConsumerUsage)
+ return BuildHexFailureMessage(grallocConsumerUsage, consumerUsage,
+ "consumer");
+
+ AHardwareBuffer_convertFromGrallocUsageBits(
+ &usage0, &usage1, grallocProducerUsage, grallocConsumerUsage);
+ if (usage0 != hardwareBufferUsage0)
+ return BuildHexFailureMessage(hardwareBufferUsage0, usage0, "usage0");
+ if (usage1 != hardwareBufferUsage1)
+ return BuildHexFailureMessage(hardwareBufferUsage1, usage1, "usage1");
+
+ return testing::AssertionSuccess();
+}
+
+// This is a unit test rather than going through AHardwareBuffer because not
+// all flags may be supported by the host device.
+TEST(AHardwareBufferTest, ConvertToAndFromGrallocBits) {
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_CPU_READ,
+ AHARDWAREBUFFER_USAGE0_CPU_READ, 0));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN,
+ AHARDWAREBUFFER_USAGE0_CPU_READ_OFTEN, 0));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_CPU_WRITE, 0,
+ AHARDWAREBUFFER_USAGE0_CPU_WRITE, 0));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN, 0,
+ AHARDWAREBUFFER_USAGE0_CPU_WRITE_OFTEN, 0));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE,
+ AHARDWAREBUFFER_USAGE0_GPU_SAMPLED_IMAGE, 0));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET,
+ 0, AHARDWAREBUFFER_USAGE0_GPU_COLOR_OUTPUT, 0));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_GPU_DATA_BUFFER,
+ AHARDWAREBUFFER_USAGE0_GPU_DATA_BUFFER, 0));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PROTECTED, 0,
+ AHARDWAREBUFFER_USAGE0_PROTECTED_CONTENT, 0));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_SENSOR_DIRECT_DATA,
+ 0, AHARDWAREBUFFER_USAGE0_SENSOR_DIRECT_DATA, 0));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER,
+ AHARDWAREBUFFER_USAGE0_VIDEO_ENCODE, 0));
+
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_0, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_0));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_1, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_1));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_2, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_2));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_3, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_3));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_4, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_4));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_5, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_5));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_6, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_6));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_7, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_7));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_8, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_8));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_9, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_9));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_10, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_10));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_11, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_11));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_12, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_12));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_13, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_13));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_14, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_14));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_15, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_15));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_16, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_16));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_17, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_17));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_18, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_18));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_PRIVATE_19, 0,
+ 0, AHARDWAREBUFFER_USAGE1_PRODUCER_PRIVATE_19));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_0,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_0));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_1,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_1));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_2,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_2));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_3,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_3));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_4,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_4));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_5,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_5));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_6,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_6));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_7,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_7));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_8,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_8));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_9,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_9));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_10,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_10));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_11,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_11));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_12,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_12));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_13,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_13));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_14,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_14));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_15,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_15));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_16,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_16));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_17,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_17));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_18,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_18));
+ EXPECT_TRUE(TestUsageConversion(0, GRALLOC1_CONSUMER_USAGE_PRIVATE_19,
+ 0, AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_19));
+
+ // Test some more complex flag combinations.
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_CPU_WRITE,
+ GRALLOC1_CONSUMER_USAGE_CPU_READ,
+ AHARDWAREBUFFER_USAGE0_CPU_READ | AHARDWAREBUFFER_USAGE0_CPU_WRITE,
+ 0));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN, 0,
+ AHARDWAREBUFFER_USAGE0_CPU_WRITE_OFTEN, 0));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET,
+ GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE |
+ GRALLOC1_CONSUMER_USAGE_PRIVATE_17,
+ AHARDWAREBUFFER_USAGE0_GPU_COLOR_OUTPUT |
+ AHARDWAREBUFFER_USAGE0_GPU_SAMPLED_IMAGE,
+ AHARDWAREBUFFER_USAGE1_CONSUMER_PRIVATE_17));
+ EXPECT_TRUE(TestUsageConversion(GRALLOC1_PRODUCER_USAGE_SENSOR_DIRECT_DATA,
+ GRALLOC1_CONSUMER_USAGE_GPU_DATA_BUFFER,
+ AHARDWAREBUFFER_USAGE0_GPU_DATA_BUFFER |
+ AHARDWAREBUFFER_USAGE0_SENSOR_DIRECT_DATA, 0));
+}
diff --git a/libs/nativewindow/tests/Android.bp b/libs/nativewindow/tests/Android.bp
new file mode 100644
index 0000000..437ab75
--- /dev/null
+++ b/libs/nativewindow/tests/Android.bp
@@ -0,0 +1,21 @@
+//
+// Copyright (C) 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.
+//
+
+cc_test {
+ name: "AHardwareBufferTest",
+ shared_libs: ["libnativewindow"],
+ srcs: ["AHardwareBufferTest.cpp"],
+}
diff --git a/libs/ui/GrallocAllocator.cpp b/libs/ui/GrallocAllocator.cpp
index 5c5d5b3..7af55e7 100644
--- a/libs/ui/GrallocAllocator.cpp
+++ b/libs/ui/GrallocAllocator.cpp
@@ -29,7 +29,7 @@
Allocator::Allocator()
{
- mAllocator = IAllocator::getService("gralloc");
+ mAllocator = IAllocator::getService();
if (mAllocator != nullptr) {
mAllocator->createClient(
[&](const auto& tmpError, const auto& tmpClient) {
diff --git a/libs/ui/GrallocMapper.cpp b/libs/ui/GrallocMapper.cpp
index 6884dcb..8095247 100644
--- a/libs/ui/GrallocMapper.cpp
+++ b/libs/ui/GrallocMapper.cpp
@@ -28,7 +28,7 @@
Mapper::Mapper()
{
- mMapper = IMapper::getService("gralloc-mapper");
+ mMapper = IMapper::getService();
if (mMapper != nullptr && mMapper->isRemote()) {
LOG_ALWAYS_FATAL("gralloc-mapper must be in passthrough mode");
}
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
index 37ebfb3..9006178 100644
--- a/libs/ui/GraphicBuffer.cpp
+++ b/libs/ui/GraphicBuffer.cpp
@@ -16,7 +16,12 @@
#define LOG_TAG "GraphicBuffer"
+#include <cutils/atomic.h>
+
#include <ui/GraphicBuffer.h>
+
+#include <cutils/atomic.h>
+
#include <ui/GrallocMapper.h>
#include <ui/GraphicBufferAllocator.h>
#include <ui/GraphicBufferMapper.h>
diff --git a/libs/ui/tests/Android.bp b/libs/ui/tests/Android.bp
index 6733505..b55c212 100644
--- a/libs/ui/tests/Android.bp
+++ b/libs/ui/tests/Android.bp
@@ -25,3 +25,9 @@
shared_libs: ["libui"],
srcs: ["colorspace_test.cpp"],
}
+
+cc_test {
+ name: "Gralloc1Mapper_test",
+ shared_libs: ["libui", "libutils"],
+ srcs: ["Gralloc1Mapper_test.cpp"],
+}
diff --git a/libs/ui/tests/Gralloc1Mapper_test.cpp b/libs/ui/tests/Gralloc1Mapper_test.cpp
new file mode 100644
index 0000000..b7c9f0f
--- /dev/null
+++ b/libs/ui/tests/Gralloc1Mapper_test.cpp
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#define LOG_TAG "Gralloc1Mapper_test"
+//#define LOG_NDEBUG 0
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <ui/GraphicBuffer.h>
+#include <ui/GraphicBufferMapper.h>
+#include <utils/Errors.h>
+
+#include <gtest/gtest.h>
+
+using namespace android;
+
+class Gralloc1MapperTest : public ::testing::Test
+{
+public:
+ ~Gralloc1MapperTest() override = default;
+
+protected:
+ void SetUp() override {
+ buffer = new GraphicBuffer(4, 8, HAL_PIXEL_FORMAT_RGBA_8888, 1,
+ GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN,
+ GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN, "Gralloc1MapperTest");
+ ASSERT_NE(nullptr, buffer.get());
+
+ handle = static_cast<buffer_handle_t>(buffer->handle);
+
+ mapper = &GraphicBufferMapper::get();
+ }
+
+ sp<GraphicBuffer> buffer;
+ buffer_handle_t handle;
+ GraphicBufferMapper* mapper;
+};
+
+TEST_F(Gralloc1MapperTest, Gralloc1MapperTest_getDimensions) {
+ uint32_t width = 0;
+ uint32_t height = 0;
+ status_t err = mapper->getDimensions(handle, &width, &height);
+ ASSERT_EQ(GRALLOC1_ERROR_NONE, err);
+ EXPECT_EQ(4U, width);
+ EXPECT_EQ(8U, height);
+}
+
+TEST_F(Gralloc1MapperTest, Gralloc1MapperTest_getFormat) {
+ int32_t value = 0;
+ status_t err = mapper->getFormat(handle, &value);
+ ASSERT_EQ(GRALLOC1_ERROR_NONE, err);
+ EXPECT_EQ(HAL_PIXEL_FORMAT_RGBA_8888, value);
+}
+
+TEST_F(Gralloc1MapperTest, Gralloc1MapperTest_getLayerCount) {
+ uint32_t value = 0;
+ status_t err = mapper->getLayerCount(handle, &value);
+ if (err != GRALLOC1_ERROR_UNSUPPORTED) {
+ EXPECT_EQ(1U, value);
+ }
+}
+
+TEST_F(Gralloc1MapperTest, Gralloc1MapperTest_getProducerUsage) {
+ uint64_t value = 0;
+ status_t err = mapper->getProducerUsage(handle, &value);
+ ASSERT_EQ(GRALLOC1_ERROR_NONE, err);
+ EXPECT_EQ(GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN, value);
+}
+
+TEST_F(Gralloc1MapperTest, Gralloc1MapperTest_getConsumerUsage) {
+ uint64_t value = 0;
+ status_t err = mapper->getConsumerUsage(handle, &value);
+ ASSERT_EQ(GRALLOC1_ERROR_NONE, err);
+ EXPECT_EQ(GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN, value);
+}
+
+TEST_F(Gralloc1MapperTest, Gralloc1MapperTest_getBackingStore) {
+ uint64_t value = 0;
+ status_t err = mapper->getBackingStore(handle, &value);
+ ASSERT_EQ(GRALLOC1_ERROR_NONE, err);
+}
+
+TEST_F(Gralloc1MapperTest, Gralloc1MapperTest_getStride) {
+ uint32_t value = 0;
+ status_t err = mapper->getStride(handle, &value);
+ ASSERT_EQ(GRALLOC1_ERROR_NONE, err);
+ // The stride should be at least the width of the buffer.
+ EXPECT_LE(4U, value);
+}
diff --git a/libs/vr/libbufferhub/bufferhub_tests.cpp b/libs/vr/libbufferhub/bufferhub_tests.cpp
index 0b9e0cc..fa61c4a 100644
--- a/libs/vr/libbufferhub/bufferhub_tests.cpp
+++ b/libs/vr/libbufferhub/bufferhub_tests.cpp
@@ -1,4 +1,3 @@
-#include <android/native_window.h>
#include <gtest/gtest.h>
#include <private/dvr/buffer_hub_client.h>
diff --git a/libs/vr/libdisplay/Android.mk b/libs/vr/libdisplay/Android.mk
index f0e62df..6a9458c 100644
--- a/libs/vr/libdisplay/Android.mk
+++ b/libs/vr/libdisplay/Android.mk
@@ -46,7 +46,8 @@
libui \
libgui \
libhardware \
- libsync
+ libsync \
+ libnativewindow \
staticLibraries := \
libbufferhub \
diff --git a/libs/vr/libdisplay/display_manager_client.cpp b/libs/vr/libdisplay/display_manager_client.cpp
index f454b08..8fd3627 100644
--- a/libs/vr/libdisplay/display_manager_client.cpp
+++ b/libs/vr/libdisplay/display_manager_client.cpp
@@ -41,6 +41,23 @@
delete client;
}
+int dvrDisplayManagerClientGetEventFd(DvrDisplayManagerClient* client) {
+ return client->client->event_fd();
+}
+
+int dvrDisplayManagerClientTranslateEpollEventMask(
+ DvrDisplayManagerClient* client, int in_events, int* out_events) {
+ auto result = client->client->GetChannel()->GetEventMask(in_events);
+
+ if (!result) {
+ return -EIO;
+ }
+
+ *out_events = result.get();
+
+ return 0;
+}
+
int dvrDisplayManagerClientGetSurfaceList(
DvrDisplayManagerClient* client,
DvrDisplayManagerClientSurfaceList** surface_list) {
diff --git a/libs/vr/libdisplay/include/private/dvr/display_manager_client.h b/libs/vr/libdisplay/include/private/dvr/display_manager_client.h
index f28c1e4..8ba9175 100644
--- a/libs/vr/libdisplay/include/private/dvr/display_manager_client.h
+++ b/libs/vr/libdisplay/include/private/dvr/display_manager_client.h
@@ -19,6 +19,21 @@
void dvrDisplayManagerClientDestroy(DvrDisplayManagerClient* client);
+// 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
+// dvrDisplayManagerClientTranslateEpollEventMask in order to get the real
+// event flags.
+// @return the fd
+int dvrDisplayManagerClientGetEventFd(DvrDisplayManagerClient* client);
+
+// Once you have received an epoll event, you must translate it to its true
+// flags. This is a workaround for working with UDS.
+// @param in_events pass in the epoll revents that were initially returned
+// @param on success, this value will be overwritten with the true epoll values
+// @return 0 on success, non-zero otherwise
+int dvrDisplayManagerClientTranslateEpollEventMask(
+ DvrDisplayManagerClient* client, int in_events, int* out_events);
+
// If successful, populates |surface_list| with a list of application
// surfaces the display is currently using.
//
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 645ccce..4ecd8d4 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
@@ -20,6 +20,9 @@
int GetSurfaceBuffers(
int surface_id, std::vector<std::unique_ptr<BufferConsumer>>* consumers);
+ using Client::event_fd;
+ using Client::GetChannel;
+
private:
friend BASE;
diff --git a/libs/vr/libeds/Android.mk b/libs/vr/libeds/Android.mk
index fd2c56e..d2e6526 100644
--- a/libs/vr/libeds/Android.mk
+++ b/libs/vr/libeds/Android.mk
@@ -37,7 +37,6 @@
libGLESv1_CM \
libGLESv2 \
libvulkan \
- libandroid
staticLibraries := \
libdisplay \
diff --git a/libs/vr/libsensor/Android.mk b/libs/vr/libsensor/Android.mk
index 89abcb0..8c7ad43 100644
--- a/libs/vr/libsensor/Android.mk
+++ b/libs/vr/libsensor/Android.mk
@@ -32,7 +32,6 @@
libhardware \
liblog \
libutils \
- libandroid \
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(sourceFiles)
diff --git a/libs/vr/libsensor/tests/sensor_app_tests.cpp b/libs/vr/libsensor/tests/sensor_app_tests.cpp
index 0f5bf00..64c9864 100644
--- a/libs/vr/libsensor/tests/sensor_app_tests.cpp
+++ b/libs/vr/libsensor/tests/sensor_app_tests.cpp
@@ -1,6 +1,7 @@
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <math.h>
+#include <inttypes.h>
#include <dvr/graphics.h>
#include <dvr/pose_client.h>
diff --git a/libs/vr/libvrflinger/Android.mk b/libs/vr/libvrflinger/Android.mk
index 1706f30..3450788 100644
--- a/libs/vr/libvrflinger/Android.mk
+++ b/libs/vr/libvrflinger/Android.mk
@@ -56,6 +56,7 @@
libcutils \
liblog \
libhardware \
+ libnativewindow \
libutils \
libEGL \
libGLESv1_CM \
diff --git a/opengl/include/EGL/eglext.h b/opengl/include/EGL/eglext.h
index 0ac74db..740ead3 100644
--- a/opengl/include/EGL/eglext.h
+++ b/opengl/include/EGL/eglext.h
@@ -623,9 +623,9 @@
#define EGL_ANDROID_get_native_client_buffer 1
struct AHardwareBuffer;
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLClientBuffer eglGetNativeClientBufferANDROID (const AHardwareBuffer *buffer);
+EGLAPI EGLClientBuffer eglGetNativeClientBufferANDROID (const struct AHardwareBuffer *buffer);
#else
-typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLGETNATIVECLIENTBUFFERANDROID) (const AHardwareBuffer *buffer);
+typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLGETNATIVECLIENTBUFFERANDROID) (const struct AHardwareBuffer *buffer);
#endif
#endif
diff --git a/opengl/libs/Android.bp b/opengl/libs/Android.bp
index 865313c..4fa6a33 100644
--- a/opengl/libs/Android.bp
+++ b/opengl/libs/Android.bp
@@ -80,6 +80,7 @@
"libbinder",
"libutils",
"libui",
+ "libnativewindow",
],
}
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index b1ca13d..9aedc61 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -17,26 +17,21 @@
//#define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-#include <array>
-#include <ctype.h>
+#include "Loader.h"
+
#include <dirent.h>
#include <dlfcn.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <android/dlext.h>
#include <cutils/properties.h>
#include <log/log.h>
+
+#include <utils/String8.h>
#include <utils/Trace.h>
+
#include <ui/GraphicsEnv.h>
-#include <EGL/egl.h>
-
#include "egldefs.h"
-#include "Loader.h"
// ----------------------------------------------------------------------------
namespace android {
@@ -437,10 +432,10 @@
return android_dlopen_ext(path, mode, info);
}
-static const std::array<const char*, 2> HAL_SUBNAME_KEY_PROPERTIES = {{
+static const char* HAL_SUBNAME_KEY_PROPERTIES[2] = {
"ro.hardware.egl",
"ro.board.platform",
-}};
+};
static void* load_updated_driver(const char* kind, android_namespace_t* ns) {
ATRACE_CALL();
@@ -454,10 +449,10 @@
if (property_get(key, prop, nullptr) > 0) {
String8 name;
name.appendFormat("lib%s_%s.so", kind, prop);
- so = do_android_dlopen_ext(name.string(), RTLD_LOCAL | RTLD_NOW,
- &dlextinfo);
- if (so)
+ so = do_android_dlopen_ext(name.string(), RTLD_LOCAL | RTLD_NOW, &dlextinfo);
+ if (so) {
return so;
+ }
}
}
return nullptr;
diff --git a/opengl/libs/EGL/Loader.h b/opengl/libs/EGL/Loader.h
index b0743a5..2dd4206 100644
--- a/opengl/libs/EGL/Loader.h
+++ b/opengl/libs/EGL/Loader.h
@@ -17,13 +17,10 @@
#ifndef ANDROID_EGL_LOADER_H
#define ANDROID_EGL_LOADER_H
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
+#include <stdint.h>
#include <utils/Errors.h>
#include <utils/Singleton.h>
-#include <utils/String8.h>
#include <EGL/egl.h>
@@ -33,12 +30,10 @@
struct egl_connection_t;
-class Loader : public Singleton<Loader>
-{
+class Loader : public Singleton<Loader> {
friend class Singleton<Loader>;
- typedef __eglMustCastToProperFunctionPointerType (*getProcAddressType)(
- const char*);
+ typedef __eglMustCastToProperFunctionPointerType (* getProcAddressType)(const char*);
enum {
EGL = 0x01,
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index ee83ada..34b0ba2 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -14,30 +14,26 @@
** limitations under the License.
*/
-#include <ctype.h>
#include <stdlib.h>
-#include <string.h>
#include <hardware/gralloc.h>
-#include <system/window.h>
#include <EGL/egl.h>
-#include <EGL/eglext.h>
#include <cutils/atomic.h>
#include <cutils/properties.h>
+
#include <log/log.h>
+
#include <utils/CallStack.h>
-#include <utils/String8.h>
#include "../egl_impl.h"
-#include "egl_tls.h"
#include "egldefs.h"
-#include "Loader.h"
-
+#include "egl_tls.h"
#include "egl_display.h"
#include "egl_object.h"
+#include "Loader.h"
typedef __eglMustCastToProperFunctionPointerType EGLFuncPointer;
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index f15c29d..e52713f 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -22,15 +22,14 @@
#include <string.h>
#include <hardware/gralloc1.h>
-#include <system/window.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <android/hardware_buffer.h>
-#include <cutils/atomic.h>
+#include <private/android/AHardwareBufferHelpers.h>
+
#include <cutils/compiler.h>
-#include <cutils/memory.h>
#include <cutils/properties.h>
#include <log/log.h>
@@ -38,22 +37,21 @@
#include <ui/GraphicBuffer.h>
+
#include <utils/KeyedVector.h>
-#include <utils/SortedVector.h>
#include <utils/String8.h>
#include <utils/Trace.h>
+#include <utils/Thread.h>
#include "binder/Binder.h"
#include "binder/Parcel.h"
#include "binder/IServiceManager.h"
#include "../egl_impl.h"
-#include "../hooks.h"
#include "egl_display.h"
#include "egl_object.h"
#include "egl_tls.h"
-#include "egldefs.h"
using namespace android;
@@ -81,7 +79,11 @@
*
* NOTE: Both strings MUST have a single space as the last character.
*/
-extern char const * const gBuiltinExtensionString =
+
+extern char const * const gBuiltinExtensionString;
+extern char const * const gExtensionString;
+
+char const * const gBuiltinExtensionString =
"EGL_KHR_get_all_proc_addresses "
"EGL_ANDROID_presentation_time "
"EGL_KHR_swap_buffers_with_damage "
@@ -90,7 +92,8 @@
"EGL_ANDROID_front_buffer_auto_refresh "
"EGL_ANDROID_get_frame_timestamps "
;
-extern char const * const gExtensionString =
+
+char const * const gExtensionString =
"EGL_KHR_image " // mandatory
"EGL_KHR_image_base " // mandatory
"EGL_KHR_image_pixmap "
@@ -123,6 +126,7 @@
"EGL_EXT_yuv_surface "
"EGL_EXT_protected_content "
"EGL_IMG_context_priority "
+ "EGL_KHR_no_config_context "
;
// extensions not exposed to applications but used by the ANDROID system
@@ -301,7 +305,7 @@
clearError();
egl_display_ptr dp = get_display(dpy);
- if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+ if (!dp) return setError(EGL_BAD_DISPLAY, (EGLBoolean)EGL_FALSE);
EGLBoolean res = dp->initialize(major, minor);
@@ -317,7 +321,7 @@
clearError();
egl_display_ptr dp = get_display(dpy);
- if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+ if (!dp) return setError(EGL_BAD_DISPLAY, (EGLBoolean)EGL_FALSE);
EGLBoolean res = dp->terminate();
@@ -338,7 +342,7 @@
if (!dp) return EGL_FALSE;
if (num_config==0) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
}
EGLBoolean res = EGL_FALSE;
@@ -363,7 +367,7 @@
if (!dp) return EGL_FALSE;
if (num_config==0) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
}
EGLBoolean res = EGL_FALSE;
@@ -395,6 +399,8 @@
case EGL_CONFIG_CAVEAT:
attribCaveat = &attrib_list[attribCount];
break;
+ default:
+ break;
}
attribCount++;
}
@@ -490,14 +496,8 @@
cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_COLOR_COMPONENT_TYPE_EXT,
&componentType);
- // by default, just pick appropriate RGBA
- EGLint format = HAL_PIXEL_FORMAT_RGBA_8888;
- if (dp->haveExtension("EGL_EXT_pixel_format_float") &&
- (componentType == EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT)) {
- format = HAL_PIXEL_FORMAT_RGBA_FP16;
- }
+ EGLint format;
android_dataspace dataSpace = HAL_DATASPACE_UNKNOWN;
-
EGLint a = 0;
EGLint r, g, b;
r = g = b = 0;
@@ -630,7 +630,7 @@
SurfaceRef _s(dp.get(), surface);
if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
egl_surface_t * const s = get_surface(surface);
EGLBoolean result = s->cnx->egl.eglDestroySurface(dp->disp.dpy, s->surface);
@@ -650,7 +650,7 @@
SurfaceRef _s(dp.get(), surface);
if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
egl_surface_t const * const s = get_surface(surface);
return s->cnx->egl.eglQuerySurface(
@@ -669,7 +669,6 @@
SurfaceRef _s(dp.get(), surface);
if (!_s.get()) {
setError(EGL_BAD_SURFACE, EGL_FALSE);
- return;
}
}
@@ -728,7 +727,7 @@
ContextRef _c(dp.get(), ctx);
if (!_c.get())
- return setError(EGL_BAD_CONTEXT, EGL_FALSE);
+ return setError(EGL_BAD_CONTEXT, (EGLBoolean)EGL_FALSE);
egl_context_t * const c = get_context(ctx);
EGLBoolean result = c->cnx->egl.eglDestroyContext(dp->disp.dpy, c->context);
@@ -744,14 +743,14 @@
clearError();
egl_display_ptr dp = validate_display(dpy);
- if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+ if (!dp) return setError(EGL_BAD_DISPLAY, (EGLBoolean)EGL_FALSE);
// If ctx is not EGL_NO_CONTEXT, read is not EGL_NO_SURFACE, or draw is not
// EGL_NO_SURFACE, then an EGL_NOT_INITIALIZED error is generated if dpy is
// a valid but uninitialized display.
if ( (ctx != EGL_NO_CONTEXT) || (read != EGL_NO_SURFACE) ||
(draw != EGL_NO_SURFACE) ) {
- if (!dp->isReady()) return setError(EGL_NOT_INITIALIZED, EGL_FALSE);
+ if (!dp->isReady()) return setError(EGL_NOT_INITIALIZED, (EGLBoolean)EGL_FALSE);
}
// get a reference to the object passed in
@@ -762,7 +761,7 @@
// validate the context (if not EGL_NO_CONTEXT)
if ((ctx != EGL_NO_CONTEXT) && !_c.get()) {
// EGL_NO_CONTEXT is valid
- return setError(EGL_BAD_CONTEXT, EGL_FALSE);
+ return setError(EGL_BAD_CONTEXT, (EGLBoolean)EGL_FALSE);
}
// these are the underlying implementation's object
@@ -785,7 +784,7 @@
// no context given, use the implementation of the current context
if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) {
// calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT);
- return setError(EGL_BAD_MATCH, EGL_FALSE);
+ return setError(EGL_BAD_MATCH, (EGLBoolean)EGL_FALSE);
}
if (cur_c == NULL) {
// no current context
@@ -796,14 +795,14 @@
// retrieve the underlying implementation's draw EGLSurface
if (draw != EGL_NO_SURFACE) {
- if (!_d.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ if (!_d.get()) return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
d = get_surface(draw);
impl_draw = d->surface;
}
// retrieve the underlying implementation's read EGLSurface
if (read != EGL_NO_SURFACE) {
- if (!_r.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ if (!_r.get()) return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
r = get_surface(read);
impl_read = r->surface;
}
@@ -827,7 +826,7 @@
} else {
// this will ALOGE the error
egl_connection_t* const cnx = &gEGLImpl;
- result = setError(cnx->egl.eglGetError(), EGL_FALSE);
+ result = setError(cnx->egl.eglGetError(), (EGLBoolean)EGL_FALSE);
}
return result;
}
@@ -842,7 +841,7 @@
if (!dp) return EGL_FALSE;
ContextRef _c(dp.get(), ctx);
- if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_FALSE);
+ if (!_c.get()) return setError(EGL_BAD_CONTEXT, (EGLBoolean)EGL_FALSE);
egl_context_t * const c = get_context(ctx);
return c->cnx->egl.eglQueryContext(
@@ -903,7 +902,7 @@
egl_connection_t* const cnx = &gEGLImpl;
if (!cnx->dso)
- return setError(EGL_BAD_CONTEXT, EGL_FALSE);
+ return setError(EGL_BAD_CONTEXT, (EGLBoolean)EGL_FALSE);
return cnx->egl.eglWaitGL();
}
@@ -914,7 +913,7 @@
egl_connection_t* const cnx = &gEGLImpl;
if (!cnx->dso)
- return setError(EGL_BAD_CONTEXT, EGL_FALSE);
+ return setError(EGL_BAD_CONTEXT, (EGLBoolean)EGL_FALSE);
return cnx->egl.eglWaitNative(engine);
}
@@ -1042,7 +1041,7 @@
thread->mQueue.push_back(sync);
thread->mCondition.signal();
thread->mFramesQueued++;
- ATRACE_INT("GPU Frames Outstanding", thread->mQueue.size());
+ ATRACE_INT("GPU Frames Outstanding", int32_t(thread->mQueue.size()));
}
}
@@ -1076,7 +1075,7 @@
Mutex::Autolock lock(mMutex);
mQueue.removeAt(0);
mFramesCompleted++;
- ATRACE_INT("GPU Frames Outstanding", mQueue.size());
+ ATRACE_INT("GPU Frames Outstanding", int32_t(mQueue.size()));
}
return true;
}
@@ -1099,7 +1098,7 @@
SurfaceRef _s(dp.get(), draw);
if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
egl_surface_t const * const s = get_surface(draw);
@@ -1164,7 +1163,7 @@
SurfaceRef _s(dp.get(), surface);
if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
egl_surface_t const * const s = get_surface(surface);
return s->cnx->egl.eglCopyBuffers(dp->disp.dpy, s->surface, target);
@@ -1182,7 +1181,7 @@
// If we want to support EGL_EXT_client_extensions later, we can return
// the client extension string here instead.
if (dpy == EGL_NO_DISPLAY && name == EGL_EXTENSIONS)
- return setErrorQuiet(EGL_BAD_DISPLAY, nullptr);
+ return setErrorQuiet(EGL_BAD_DISPLAY, (const char*)0);
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return (const char *) NULL;
@@ -1196,6 +1195,8 @@
return dp->getExtensionString();
case EGL_CLIENT_APIS:
return dp->getClientApiString();
+ default:
+ break;
}
return setError(EGL_BAD_PARAMETER, (const char *)0);
}
@@ -1216,6 +1217,8 @@
return dp->disp.queryString.extensions;
case EGL_CLIENT_APIS:
return dp->disp.queryString.clientApi;
+ default:
+ break;
}
return setError(EGL_BAD_PARAMETER, (const char *)0);
}
@@ -1234,7 +1237,7 @@
SurfaceRef _s(dp.get(), surface);
if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
egl_surface_t * const s = get_surface(surface);
@@ -1242,27 +1245,23 @@
if (!s->win.get()) {
setError(EGL_BAD_SURFACE, EGL_FALSE);
}
- int err = native_window_set_auto_refresh(s->win.get(),
- value ? true : false);
- return (err == NO_ERROR) ? EGL_TRUE :
- setError(EGL_BAD_SURFACE, EGL_FALSE);
+ int err = native_window_set_auto_refresh(s->win.get(), value ? true : false);
+ return (err == NO_ERROR) ? EGL_TRUE : setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
if (attribute == EGL_TIMESTAMPS_ANDROID) {
if (!s->win.get()) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
- int err = native_window_enable_frame_timestamps(
- s->win.get(), value ? true : false);
- return (err == NO_ERROR) ? EGL_TRUE :
- setError(EGL_BAD_SURFACE, EGL_FALSE);
+ int err = native_window_enable_frame_timestamps(s->win.get(), value ? true : false);
+ return (err == NO_ERROR) ? EGL_TRUE : setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
if (s->cnx->egl.eglSurfaceAttrib) {
return s->cnx->egl.eglSurfaceAttrib(
dp->disp.dpy, s->surface, attribute, value);
}
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
EGLBoolean eglBindTexImage(
@@ -1275,14 +1274,14 @@
SurfaceRef _s(dp.get(), surface);
if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
egl_surface_t const * const s = get_surface(surface);
if (s->cnx->egl.eglBindTexImage) {
return s->cnx->egl.eglBindTexImage(
dp->disp.dpy, s->surface, buffer);
}
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
EGLBoolean eglReleaseTexImage(
@@ -1295,14 +1294,14 @@
SurfaceRef _s(dp.get(), surface);
if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
egl_surface_t const * const s = get_surface(surface);
if (s->cnx->egl.eglReleaseTexImage) {
return s->cnx->egl.eglReleaseTexImage(
dp->disp.dpy, s->surface, buffer);
}
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
@@ -1332,7 +1331,7 @@
egl_connection_t* const cnx = &gEGLImpl;
if (!cnx->dso)
- return setError(EGL_BAD_CONTEXT, EGL_FALSE);
+ return setError(EGL_BAD_CONTEXT, (EGLBoolean)EGL_FALSE);
EGLBoolean res;
if (cnx->egl.eglWaitClient) {
@@ -1348,7 +1347,7 @@
clearError();
if (egl_init_drivers() == EGL_FALSE) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
}
// bind this API on all EGLs
@@ -1365,7 +1364,7 @@
clearError();
if (egl_init_drivers() == EGL_FALSE) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
}
egl_connection_t* const cnx = &gEGLImpl;
@@ -1423,14 +1422,14 @@
SurfaceRef _s(dp.get(), surface);
if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
egl_surface_t const * const s = get_surface(surface);
if (s->cnx->egl.eglLockSurfaceKHR) {
return s->cnx->egl.eglLockSurfaceKHR(
dp->disp.dpy, s->surface, attrib_list);
}
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+ return setError(EGL_BAD_DISPLAY, (EGLBoolean)EGL_FALSE);
}
EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface)
@@ -1442,13 +1441,13 @@
SurfaceRef _s(dp.get(), surface);
if (!_s.get())
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
egl_surface_t const * const s = get_surface(surface);
if (s->cnx->egl.eglUnlockSurfaceKHR) {
return s->cnx->egl.eglUnlockSurfaceKHR(dp->disp.dpy, s->surface);
}
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+ return setError(EGL_BAD_DISPLAY, (EGLBoolean)EGL_FALSE);
}
EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
@@ -1546,7 +1545,7 @@
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
- EGLBoolean result = EGL_FALSE;
+ EGLint result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglClientWaitSyncKHR) {
result = cnx->egl.eglClientWaitSyncKHR(
@@ -1991,9 +1990,7 @@
if (!buffer) return setError(EGL_BAD_PARAMETER, (EGLClientBuffer)0);
- // FIXME: remove this dangerous reinterpret_cast.
- const GraphicBuffer* graphicBuffer =
- reinterpret_cast<const GraphicBuffer*>(buffer);
+ const GraphicBuffer* graphicBuffer = AHardwareBuffer_to_GraphicBuffer(buffer);
return static_cast<EGLClientBuffer>(graphicBuffer->getNativeBuffer());
}
@@ -2005,7 +2002,7 @@
clearError();
if (egl_init_drivers() == EGL_FALSE) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
}
EGLuint64NV ret = 0;
@@ -2015,7 +2012,7 @@
return cnx->egl.eglGetSystemTimeFrequencyNV();
}
- return setErrorQuiet(EGL_BAD_DISPLAY, 0);
+ return setErrorQuiet(EGL_BAD_DISPLAY, (EGLuint64NV)0);
}
EGLuint64NV eglGetSystemTimeNV()
@@ -2023,7 +2020,7 @@
clearError();
if (egl_init_drivers() == EGL_FALSE) {
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
}
EGLuint64NV ret = 0;
@@ -2033,7 +2030,7 @@
return cnx->egl.eglGetSystemTimeNV();
}
- return setErrorQuiet(EGL_BAD_DISPLAY, 0);
+ return setErrorQuiet(EGL_BAD_DISPLAY, (EGLuint64NV)0);
}
// ----------------------------------------------------------------------------
@@ -2071,18 +2068,18 @@
const egl_display_ptr dp = validate_display(dpy);
if (!dp) {
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+ return setError(EGL_BAD_DISPLAY, (EGLBoolean)EGL_FALSE);
}
SurfaceRef _s(dp.get(), surface);
if (!_s.get()) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
egl_surface_t const * const s = get_surface(surface);
if (!s->win.get()) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
uint64_t nextFrameId = 0;
@@ -2092,7 +2089,7 @@
// This should not happen. Return an error that is not in the spec
// so it's obvious something is very wrong.
ALOGE("eglGetNextFrameId: Unexpected error.");
- return setError(EGL_NOT_INITIALIZED, EGL_FALSE);
+ return setError(EGL_NOT_INITIALIZED, (EGLBoolean)EGL_FALSE);
}
*frameId = nextFrameId;
@@ -2106,18 +2103,18 @@
const egl_display_ptr dp = validate_display(dpy);
if (!dp) {
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+ return setError(EGL_BAD_DISPLAY, (EGLBoolean)EGL_FALSE);
}
SurfaceRef _s(dp.get(), surface);
if (!_s.get()) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
egl_surface_t const * const s = get_surface(surface);
if (!s->win.get()) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
nsecs_t* compositeDeadline = nullptr;
@@ -2136,7 +2133,7 @@
compositeToPresentLatency = &values[i];
break;
default:
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
}
}
@@ -2147,12 +2144,12 @@
case NO_ERROR:
return EGL_TRUE;
case INVALID_OPERATION:
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
default:
// This should not happen. Return an error that is not in the spec
// so it's obvious something is very wrong.
ALOGE("eglGetCompositorTiming: Unexpected error.");
- return setError(EGL_NOT_INITIALIZED, EGL_FALSE);
+ return setError(EGL_NOT_INITIALIZED, (EGLBoolean)EGL_FALSE);
}
}
@@ -2163,19 +2160,19 @@
const egl_display_ptr dp = validate_display(dpy);
if (!dp) {
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+ return setError(EGL_BAD_DISPLAY, (EGLBoolean)EGL_FALSE);
}
SurfaceRef _s(dp.get(), surface);
if (!_s.get()) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
egl_surface_t const * const s = get_surface(surface);
ANativeWindow* window = s->win.get();
if (!window) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
switch (name) {
@@ -2196,18 +2193,18 @@
const egl_display_ptr dp = validate_display(dpy);
if (!dp) {
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+ return setError(EGL_BAD_DISPLAY, (EGLBoolean)EGL_FALSE);
}
SurfaceRef _s(dp.get(), surface);
if (!_s.get()) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
egl_surface_t const * const s = get_surface(surface);
if (!s->win.get()) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
nsecs_t* requestedPresentTime = nullptr;
@@ -2254,7 +2251,7 @@
releaseTime = &values[i];
break;
default:
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
+ return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
}
}
@@ -2264,19 +2261,19 @@
displayRetireTime, dequeueReadyTime, releaseTime);
switch (ret) {
- case NO_ERROR:
- return EGL_TRUE;
- case NAME_NOT_FOUND:
- return setError(EGL_BAD_ACCESS, EGL_FALSE);
- case INVALID_OPERATION:
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
- case BAD_VALUE:
- return setError(EGL_BAD_PARAMETER, EGL_FALSE);
- default:
- // This should not happen. Return an error that is not in the spec
- // so it's obvious something is very wrong.
- ALOGE("eglGetFrameTimestamps: Unexpected error.");
- return setError(EGL_NOT_INITIALIZED, EGL_FALSE);
+ case NO_ERROR:
+ return EGL_TRUE;
+ case NAME_NOT_FOUND:
+ return setError(EGL_BAD_ACCESS, (EGLBoolean)EGL_FALSE);
+ case INVALID_OPERATION:
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
+ case BAD_VALUE:
+ return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
+ default:
+ // This should not happen. Return an error that is not in the spec
+ // so it's obvious something is very wrong.
+ ALOGE("eglGetFrameTimestamps: Unexpected error.");
+ return setError(EGL_NOT_INITIALIZED, (EGLBoolean)EGL_FALSE);
}
}
@@ -2287,19 +2284,19 @@
const egl_display_ptr dp = validate_display(dpy);
if (!dp) {
- return setError(EGL_BAD_DISPLAY, EGL_FALSE);
+ return setError(EGL_BAD_DISPLAY, (EGLBoolean)EGL_FALSE);
}
SurfaceRef _s(dp.get(), surface);
if (!_s.get()) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
egl_surface_t const * const s = get_surface(surface);
ANativeWindow* window = s->win.get();
if (!window) {
- return setError(EGL_BAD_SURFACE, EGL_FALSE);
+ return setError(EGL_BAD_SURFACE, (EGLBoolean)EGL_FALSE);
}
switch (timestamp) {
@@ -2317,14 +2314,12 @@
return EGL_TRUE;
case EGL_DISPLAY_PRESENT_TIME_ANDROID: {
int value = 0;
- window->query(window,
- NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_PRESENT, &value);
+ window->query(window, NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_PRESENT, &value);
return value == 0 ? EGL_FALSE : EGL_TRUE;
}
case EGL_DISPLAY_RETIRE_TIME_ANDROID: {
int value = 0;
- window->query(window,
- NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_RETIRE, &value);
+ window->query(window, NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_RETIRE, &value);
return value == 0 ? EGL_FALSE : EGL_TRUE;
}
default:
diff --git a/opengl/libs/EGL/egl_cache.cpp b/opengl/libs/EGL/egl_cache.cpp
index 1fe322d..e46716c 100644
--- a/opengl/libs/EGL/egl_cache.cpp
+++ b/opengl/libs/EGL/egl_cache.cpp
@@ -14,18 +14,17 @@
** limitations under the License.
*/
+#include "egl_cache.h"
+
#include "../egl_impl.h"
-#include "egl_cache.h"
#include "egl_display.h"
-#include "egldefs.h"
-#include <fcntl.h>
#include <inttypes.h>
#include <sys/mman.h>
#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
+
+#include <utils/Thread.h>
// Cache size limits.
static const size_t maxKeySize = 12 * 1024;
@@ -87,7 +86,7 @@
bool atStart = !strncmp(BC_EXT_STR " ", exts, bcExtLen+1);
bool atEnd = (bcExtLen+1) < extsLen &&
!strcmp(" " BC_EXT_STR, exts + extsLen - (bcExtLen+1));
- bool inMiddle = strstr(exts, " " BC_EXT_STR " ");
+ bool inMiddle = strstr(exts, " " BC_EXT_STR " ") != nullptr;
if (equal || atStart || atEnd || inMiddle) {
PFNEGLSETBLOBCACHEFUNCSANDROIDPROC eglSetBlobCacheFuncsANDROID;
eglSetBlobCacheFuncsANDROID =
diff --git a/opengl/libs/EGL/egl_cache.h b/opengl/libs/EGL/egl_cache.h
index 8760009..e7f1712 100644
--- a/opengl/libs/EGL/egl_cache.h
+++ b/opengl/libs/EGL/egl_cache.h
@@ -21,6 +21,7 @@
#include <EGL/eglext.h>
#include <utils/BlobCache.h>
+#include <utils/Mutex.h>
#include <utils/String8.h>
#include <utils/StrongPointer.h>
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index d7df40c..c804fa7 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -17,16 +17,16 @@
#define __STDC_LIMIT_MACROS 1
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-#include <string.h>
+#include "egl_display.h"
#include "../egl_impl.h"
#include "egl_cache.h"
-#include "egl_display.h"
#include "egl_object.h"
#include "egl_tls.h"
#include "Loader.h"
#include <cutils/properties.h>
+
#include <utils/Trace.h>
// ----------------------------------------------------------------------------
diff --git a/opengl/libs/EGL/egl_display.h b/opengl/libs/EGL/egl_display.h
index e17558c..f5e7294 100644
--- a/opengl/libs/EGL/egl_display.h
+++ b/opengl/libs/EGL/egl_display.h
@@ -18,16 +18,16 @@
#define ANDROID_EGL_DISPLAY_H
-#include <ctype.h>
#include <stdint.h>
-#include <stdlib.h>
+#include <stddef.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <cutils/compiler.h>
#include <utils/SortedVector.h>
-#include <utils/threads.h>
+#include <utils/Condition.h>
+#include <utils/Mutex.h>
#include <utils/String8.h>
#include "egldefs.h"
diff --git a/opengl/libs/EGL/egl_object.cpp b/opengl/libs/EGL/egl_object.cpp
index 7fc5609..b553d71 100644
--- a/opengl/libs/EGL/egl_object.cpp
+++ b/opengl/libs/EGL/egl_object.cpp
@@ -14,19 +14,10 @@
** limitations under the License.
*/
-#include <string>
+#include "egl_object.h"
+
#include <sstream>
-#include <ctype.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include <utils/threads.h>
-
-#include "egl_object.h"
// ----------------------------------------------------------------------------
namespace android {
diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h
index 8ceba1d..f4012ab 100644
--- a/opengl/libs/EGL/egl_object.h
+++ b/opengl/libs/EGL/egl_object.h
@@ -17,15 +17,13 @@
#ifndef ANDROID_EGL_OBJECT_H
#define ANDROID_EGL_OBJECT_H
-#include <atomic>
-#include <ctype.h>
#include <stdint.h>
-#include <stdlib.h>
+#include <stddef.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include <utils/threads.h>
+#include <utils/StrongPointer.h>
#include <utils/String8.h>
#include <utils/Vector.h>
@@ -62,8 +60,8 @@
template <typename N, typename T>
class LocalRef {
egl_object_t* ref;
- LocalRef();
- explicit LocalRef(const LocalRef* rhs);
+ LocalRef() = delete;
+ LocalRef(const LocalRef* rhs) = delete;
public:
~LocalRef();
explicit LocalRef(egl_object_t* rhs);
diff --git a/opengl/libs/EGL/egl_tls.cpp b/opengl/libs/EGL/egl_tls.cpp
index 6de5f27..ca8684e 100644
--- a/opengl/libs/EGL/egl_tls.cpp
+++ b/opengl/libs/EGL/egl_tls.cpp
@@ -14,16 +14,14 @@
** limitations under the License.
*/
-#include <pthread.h>
+#include "egl_tls.h"
+
#include <stdlib.h>
#include <cutils/properties.h>
#include <log/log.h>
#include <utils/CallStack.h>
-#include <EGL/egl.h>
-
-#include "egl_tls.h"
namespace android {
@@ -31,7 +29,7 @@
pthread_once_t egl_tls_t::sOnceKey = PTHREAD_ONCE_INIT;
egl_tls_t::egl_tls_t()
- : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(EGL_TRUE) {
+ : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(true) {
}
const char *egl_tls_t::egl_strerror(EGLint err) {
@@ -85,11 +83,12 @@
bool egl_tls_t::logNoContextCall() {
egl_tls_t* tls = getTLS();
- if (tls->logCallWithNoContext == true) {
+ if (tls->logCallWithNoContext) {
tls->logCallWithNoContext = false;
return true;
}
return false;
+
}
egl_tls_t* egl_tls_t::getTLS() {
diff --git a/opengl/libs/EGL/egl_tls.h b/opengl/libs/EGL/egl_tls.h
index 00eae0b..9feae68 100644
--- a/opengl/libs/EGL/egl_tls.h
+++ b/opengl/libs/EGL/egl_tls.h
@@ -17,11 +17,9 @@
#ifndef ANDROID_EGL_TLS_H
#define ANDROID_EGL_TLS_H
-#include <pthread.h>
-
#include <EGL/egl.h>
-#include "egldefs.h"
+#include <pthread.h>
// ----------------------------------------------------------------------------
namespace android {
@@ -36,7 +34,7 @@
EGLint error;
EGLContext ctx;
- EGLBoolean logCallWithNoContext;
+ bool logCallWithNoContext;
egl_tls_t();
static void validateTLSKey();
diff --git a/opengl/libs/egl_impl.h b/opengl/libs/egl_impl.h
index c0990ec..a8855ef 100644
--- a/opengl/libs/egl_impl.h
+++ b/opengl/libs/egl_impl.h
@@ -17,8 +17,6 @@
#ifndef ANDROID_EGL_IMPL_H
#define ANDROID_EGL_IMPL_H
-#include <ctype.h>
-
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <EGL/eglplatform.h>
@@ -30,8 +28,7 @@
// ----------------------------------------------------------------------------
EGLAPI const GLubyte * egl_get_string_for_current_context(GLenum name);
-EGLAPI const GLubyte * egl_get_string_for_current_context(GLenum name,
- GLuint index);
+EGLAPI const GLubyte * egl_get_string_for_current_context(GLenum name, GLuint index);
EGLAPI GLint egl_get_num_extensions_for_current_context();
// ----------------------------------------------------------------------------
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index 3edd50b..7bd495f 100644
--- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp
@@ -13,21 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-#include <inttypes.h>
-#include <math.h>
-#include <stdint.h>
-#include <sys/types.h>
+#include "SensorDevice.h"
+#include "SensorService.h"
#include <android-base/logging.h>
+#include <sensors/convert.h>
#include <utils/Atomic.h>
#include <utils/Errors.h>
#include <utils/Singleton.h>
-#include "SensorDevice.h"
-#include "SensorService.h"
-
-#include <sensors/convert.h>
+#include <chrono>
+#include <cinttypes>
+#include <thread>
using android::hardware::hidl_vec;
@@ -55,13 +52,38 @@
}
SensorDevice::SensorDevice() {
- mSensors = ISensors::getService();
+ // SensorDevice may wait upto 100ms * 10 = 1s for hidl service.
+ constexpr auto RETRY_DELAY = std::chrono::milliseconds(100);
+ size_t retry = 10;
- if (mSensors == NULL) {
- return;
+ while (true) {
+ int initStep = 0;
+ mSensors = ISensors::getService();
+ if (mSensors != nullptr) {
+ ++initStep;
+ // Poke ISensor service. If it has lingering connection from previous generation of
+ // system server, it will kill itself. There is no intention to handle the poll result,
+ // which will be done since the size is 0.
+ if(mSensors->poll(0, [](auto, const auto &, const auto &) {}).isOk()) {
+ // ok to continue
+ break;
+ }
+ // hidl service is restarting, pointer is invalid.
+ mSensors = nullptr;
+ }
+
+ if (--retry <= 0) {
+ ALOGE("Cannot connect to ISensors hidl service!");
+ return;
+ }
+ // Delay 100ms before retry, hidl service is expected to come up in short time after
+ // crash.
+ ALOGI("%s unsuccessful, try again soon (remaining retry %zu).",
+ (initStep == 0) ? "getService()" : "poll() check", retry);
+ std::this_thread::sleep_for(RETRY_DELAY);
}
- mSensors->getSensorsList(
+ checkReturn(mSensors->getSensorsList(
[&](const auto &list) {
const size_t count = list.size();
@@ -74,19 +96,19 @@
mActivationCount.add(list[i].sensorHandle, model);
- mSensors->activate(list[i].sensorHandle, 0 /* enabled */);
+ checkReturn(mSensors->activate(list[i].sensorHandle, 0 /* enabled */));
}
- });
+ }));
mIsDirectReportSupported =
- (mSensors->unregisterDirectChannel(-1) != Result::INVALID_OPERATION);
+ (checkReturn(mSensors->unregisterDirectChannel(-1)) != Result::INVALID_OPERATION);
}
void SensorDevice::handleDynamicSensorConnection(int handle, bool connected) {
if (connected) {
Info model;
mActivationCount.add(handle, model);
- mSensors->activate(handle, 0 /* enabled */);
+ checkReturn(mSensors->activate(handle, 0 /* enabled */));
} else {
mActivationCount.removeItem(handle);
}
@@ -96,7 +118,7 @@
if (mSensors == NULL) return "HAL not initialized\n";
String8 result;
- mSensors->getSensorsList([&](const auto &list) {
+ checkReturn(mSensors->getSensorsList([&](const auto &list) {
const size_t count = list.size();
result.appendFormat(
@@ -141,7 +163,7 @@
"}, selected = %.1f ms\n",
info.bestBatchParams.batchTimeout / 1e6f);
}
- });
+ }));
return result.string();
}
@@ -161,7 +183,7 @@
ssize_t err;
- mSensors->poll(
+ checkReturn(mSensors->poll(
count,
[&](auto result,
const auto &events,
@@ -172,7 +194,7 @@
} else {
err = StatusFromResult(result);
}
- });
+ }));
return err;
}
@@ -237,10 +259,10 @@
"\t>>> actuating h/w batch %d %d %" PRId64 " %" PRId64, handle,
info.bestBatchParams.flags, info.bestBatchParams.batchDelay,
info.bestBatchParams.batchTimeout);
- mSensors->batch(
+ checkReturn(mSensors->batch(
handle,
info.bestBatchParams.batchDelay,
- info.bestBatchParams.batchTimeout);
+ info.bestBatchParams.batchTimeout));
}
} else {
// sensor wasn't enabled for this ident
@@ -254,7 +276,7 @@
if (actuateHardware) {
ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w activate handle=%d enabled=%d", handle,
enabled);
- err = StatusFromResult(mSensors->activate(handle, enabled));
+ err = StatusFromResult(checkReturn(mSensors->activate(handle, enabled)));
ALOGE_IF(err, "Error %s sensor %d (%s)", enabled ? "activating" : "disabling", handle,
strerror(-err));
@@ -311,10 +333,10 @@
info.bestBatchParams.flags, info.bestBatchParams.batchDelay,
info.bestBatchParams.batchTimeout);
err = StatusFromResult(
- mSensors->batch(
+ checkReturn(mSensors->batch(
handle,
info.bestBatchParams.batchDelay,
- info.bestBatchParams.batchTimeout));
+ info.bestBatchParams.batchTimeout)));
if (err != NO_ERROR) {
ALOGE("sensor batch failed %p %d %d %" PRId64 " %" PRId64 " err=%s",
mSensors.get(), handle,
@@ -348,7 +370,7 @@
info.selectBatchParams();
return StatusFromResult(
- mSensors->batch(handle, info.bestBatchParams.batchDelay, 0));
+ checkReturn(mSensors->batch(handle, info.bestBatchParams.batchDelay, 0)));
}
int SensorDevice::getHalDeviceVersion() const {
@@ -359,7 +381,7 @@
status_t SensorDevice::flush(void* ident, int handle) {
if (isClientDisabled(ident)) return INVALID_OPERATION;
ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w flush %d", handle);
- return StatusFromResult(mSensors->flush(handle));
+ return StatusFromResult(checkReturn(mSensors->flush(handle)));
}
bool SensorDevice::isClientDisabled(void* ident) {
@@ -383,15 +405,15 @@
ALOGD_IF(DEBUG_CONNECTIONS, "\t>> reenable actuating h/w sensor enable handle=%d ",
sensor_handle);
status_t err = StatusFromResult(
- mSensors->batch(
+ checkReturn(mSensors->batch(
sensor_handle,
info.bestBatchParams.batchDelay,
- info.bestBatchParams.batchTimeout));
+ info.bestBatchParams.batchTimeout)));
ALOGE_IF(err, "Error calling batch on sensor %d (%s)", sensor_handle, strerror(-err));
if (err == NO_ERROR) {
err = StatusFromResult(
- mSensors->activate(sensor_handle, 1 /* enabled */));
+ checkReturn(mSensors->activate(sensor_handle, 1 /* enabled */)));
ALOGE_IF(err, "Error activating sensor %d (%s)", sensor_handle, strerror(-err));
}
}
@@ -406,7 +428,7 @@
const int sensor_handle = mActivationCount.keyAt(i);
ALOGD_IF(DEBUG_CONNECTIONS, "\t>> actuating h/w sensor disable handle=%d ",
sensor_handle);
- mSensors->activate(sensor_handle, 0 /* enabled */);
+ checkReturn(mSensors->activate(sensor_handle, 0 /* enabled */));
// Add all the connections that were registered for this sensor to the disabled
// clients list.
@@ -431,14 +453,14 @@
Event ev;
convertFromSensorEvent(*injected_sensor_event, &ev);
- return StatusFromResult(mSensors->injectSensorData(ev));
+ return StatusFromResult(checkReturn(mSensors->injectSensorData(ev)));
}
status_t SensorDevice::setMode(uint32_t mode) {
return StatusFromResult(
- mSensors->setOperationMode(
- static_cast<hardware::sensors::V1_0::OperationMode>(mode)));
+ checkReturn(mSensors->setOperationMode(
+ static_cast<hardware::sensors::V1_0::OperationMode>(mode))));
}
// ---------------------------------------------------------------------------
@@ -529,20 +551,20 @@
};
int32_t ret;
- mSensors->registerDirectChannel(mem,
+ checkReturn(mSensors->registerDirectChannel(mem,
[&ret](auto result, auto channelHandle) {
if (result == Result::OK) {
ret = channelHandle;
} else {
ret = StatusFromResult(result);
}
- });
+ }));
return ret;
}
void SensorDevice::unregisterDirectChannel(int32_t channelHandle) {
Mutex::Autolock _l(mLock);
- mSensors->unregisterDirectChannel(channelHandle);
+ checkReturn(mSensors->unregisterDirectChannel(channelHandle));
}
int32_t SensorDevice::configureDirectChannel(int32_t sensorHandle,
@@ -568,7 +590,7 @@
}
int32_t ret;
- mSensors->configDirectReport(sensorHandle, channelHandle, rate,
+ checkReturn(mSensors->configDirectReport(sensorHandle, channelHandle, rate,
[&ret, rate] (auto result, auto token) {
if (rate == RateLevel::STOP) {
ret = StatusFromResult(result);
@@ -579,7 +601,7 @@
ret = StatusFromResult(result);
}
}
- });
+ }));
return ret;
}
@@ -635,5 +657,10 @@
}
}
+void SensorDevice::handleHidlDeath(const std::string & detail) {
+ // restart is the only option at present.
+ LOG_ALWAYS_FATAL("Abort due to ISensors hidl service failure, detail: %s.", detail.c_str());
+}
+
// ---------------------------------------------------------------------------
}; // namespace android
diff --git a/services/sensorservice/SensorDevice.h b/services/sensorservice/SensorDevice.h
index 7f95429..55a745f 100644
--- a/services/sensorservice/SensorDevice.h
+++ b/services/sensorservice/SensorDevice.h
@@ -37,6 +37,7 @@
// ---------------------------------------------------------------------------
using SensorServiceUtil::Dumpable;
+using hardware::Return;
class SensorDevice : public Singleton<SensorDevice>, public Dumpable {
public:
@@ -128,6 +129,15 @@
SortedVector<void *> mDisabledClients;
SensorDevice();
+ static void handleHidlDeath(const std::string &detail);
+ template<typename T>
+ static Return<T> checkReturn(Return<T> &&ret) {
+ if (!ret.isOk()) {
+ handleHidlDeath(ret.description());
+ }
+ return std::move(ret);
+ }
+
bool isClientDisabled(void* ident);
bool isClientDisabledLocked(void* ident);
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
index 24c68ec..afaccd2 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -131,9 +131,11 @@
LOCAL_CFLAGS += -fvisibility=hidden -Werror=format
+LOCAL_HEADER_LIBRARIES := \
+ android.hardware.configstore-utils
+
LOCAL_STATIC_LIBRARIES := \
libhwcomposer-command-buffer \
- android.hardware.configstore-utils \
libtrace_proto \
libvkjson \
libvr_manager \
diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp
index 2b4f4cb..9ddae2b 100644
--- a/services/surfaceflinger/Client.cpp
+++ b/services/surfaceflinger/Client.cpp
@@ -49,7 +49,10 @@
{
const size_t count = mLayers.size();
for (size_t i=0 ; i<count ; i++) {
- mFlinger->removeLayer(mLayers.valueAt(i));
+ sp<Layer> l = mLayers.valueAt(i).promote();
+ if (l != nullptr) {
+ mFlinger->removeLayer(l);
+ }
}
}
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index 92ede08..caa7adc 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -242,7 +242,11 @@
static status_t orientationToTransfrom(int orientation,
int w, int h, Transform* tr);
+ // The identifier of the active layer stack for this display. Several displays
+ // can use the same layer stack: A z-ordered group of layers (sometimes called
+ // "surfaces"). Any given layer can only be on a single layer stack.
uint32_t mLayerStack;
+
int mOrientation;
static uint32_t sPrimaryDisplayOrientation;
// user-provided visible area of the layer stack
diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
index 3e9ef24..c6e6dcb 100644
--- a/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
+++ b/services/surfaceflinger/DisplayHardware/ComposerHal.cpp
@@ -131,7 +131,7 @@
if (mIsUsingVrComposer) {
mComposer = IComposer::getService("vr_hwcomposer");
} else {
- mComposer = IComposer::getService("hwcomposer");
+ mComposer = IComposer::getService(); // use default name
}
if (mComposer == nullptr) {
diff --git a/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.cpp b/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.cpp
index d72139e..4187890 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.cpp
@@ -961,8 +961,6 @@
uint32_t* outNumRequests) {
std::unique_lock<std::recursive_mutex> lock(mStateMutex);
- ALOGV("[%" PRIu64 "] Entering validate", mId);
-
if (!mChanges) {
if (!mDevice.prepareAllDisplays()) {
return Error::BadDisplay;
@@ -1189,8 +1187,6 @@
return false;
}
- ALOGV("[%" PRIu64 "] Entering prepare", mId);
-
allocateRequestedContents();
assignHwc1LayerIds();
@@ -2207,7 +2203,6 @@
// Adapter helpers
void HWC2On1Adapter::populateCapabilities() {
- ALOGV("populateCapabilities");
if (mHwc1MinorVersion >= 3U) {
int supportedTypes = 0;
auto result = mHwc1Device->query(mHwc1Device,
@@ -2265,8 +2260,6 @@
}
void HWC2On1Adapter::populatePrimary() {
- ALOGV("populatePrimary");
-
std::unique_lock<std::recursive_timed_mutex> lock(mStateMutex);
auto display = std::make_shared<Display>(*this, HWC2::DisplayType::Physical);
@@ -2367,6 +2360,83 @@
return true;
}
+void dumpHWC1Message(hwc_composer_device_1* device, size_t numDisplays,
+ hwc_display_contents_1_t** displays) {
+ ALOGV("*****************************");
+ size_t displayId = 0;
+ while (displayId < numDisplays) {
+ hwc_display_contents_1_t* display = displays[displayId];
+
+ ALOGV("hwc_display_contents_1_t[%zu] @0x%p", displayId, display);
+ if (display == nullptr) {
+ displayId++;
+ continue;
+ }
+ ALOGV(" retirefd:0x%08x", display->retireFenceFd);
+ ALOGV(" outbuf :0x%p", display->outbuf);
+ ALOGV(" outbuffd:0x%08x", display->outbufAcquireFenceFd);
+ ALOGV(" flags :0x%08x", display->flags);
+ for(size_t layerId=0 ; layerId < display->numHwLayers ; layerId++) {
+ hwc_layer_1_t& layer = display->hwLayers[layerId];
+ ALOGV(" Layer[%zu]:", layerId);
+ ALOGV(" composition : 0x%08x", layer.compositionType);
+ ALOGV(" hints : 0x%08x", layer.hints);
+ ALOGV(" flags : 0x%08x", layer.flags);
+ ALOGV(" handle : 0x%p", layer.handle);
+ ALOGV(" transform : 0x%08x", layer.transform);
+ ALOGV(" blending : 0x%08x", layer.blending);
+ ALOGV(" sourceCropf : %f, %f, %f, %f",
+ layer.sourceCropf.left,
+ layer.sourceCropf.top,
+ layer.sourceCropf.right,
+ layer.sourceCropf.bottom);
+ ALOGV(" displayFrame : %d, %d, %d, %d",
+ layer.displayFrame.left,
+ layer.displayFrame.left,
+ layer.displayFrame.left,
+ layer.displayFrame.left);
+ hwc_region_t& visReg = layer.visibleRegionScreen;
+ ALOGV(" visibleRegionScreen: #0x%08zx[@0x%p]",
+ visReg.numRects,
+ visReg.rects);
+ for (size_t visRegId=0; visRegId < visReg.numRects ; visRegId++) {
+ if (layer.visibleRegionScreen.rects == nullptr) {
+ ALOGV(" null");
+ } else {
+ ALOGV(" visibleRegionScreen[%zu] %d, %d, %d, %d",
+ visRegId,
+ visReg.rects[visRegId].left,
+ visReg.rects[visRegId].top,
+ visReg.rects[visRegId].right,
+ visReg.rects[visRegId].bottom);
+ }
+ }
+ ALOGV(" acquireFenceFd : 0x%08x", layer.acquireFenceFd);
+ ALOGV(" releaseFenceFd : 0x%08x", layer.releaseFenceFd);
+ ALOGV(" planeAlpha : 0x%08x", layer.planeAlpha);
+ if (getMinorVersion(device) < 5)
+ continue;
+ ALOGV(" surfaceDamage : #0x%08zx[@0x%p]",
+ layer.surfaceDamage.numRects,
+ layer.surfaceDamage.rects);
+ for (size_t sdId=0; sdId < layer.surfaceDamage.numRects ; sdId++) {
+ if (layer.surfaceDamage.rects == nullptr) {
+ ALOGV(" null");
+ } else {
+ ALOGV(" surfaceDamage[%zu] %d, %d, %d, %d",
+ sdId,
+ layer.surfaceDamage.rects[sdId].left,
+ layer.surfaceDamage.rects[sdId].top,
+ layer.surfaceDamage.rects[sdId].right,
+ layer.surfaceDamage.rects[sdId].bottom);
+ }
+ }
+ }
+ displayId++;
+ }
+ ALOGV("-----------------------------");
+}
+
Error HWC2On1Adapter::setAllDisplays() {
ATRACE_CALL();
@@ -2391,6 +2461,7 @@
ALOGV("Calling HWC1 set");
{
ATRACE_NAME("HWC1 set");
+ //dumpHWC1Message(mHwc1Device, mHwc1Contents.size(), mHwc1Contents.data());
mHwc1Device->set(mHwc1Device, mHwc1Contents.size(),
mHwc1Contents.data());
}
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 4a281d4..f03491f 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -69,7 +69,8 @@
mCBContext(),
mEventHandler(nullptr),
mVSyncCounts(),
- mRemainingHwcVirtualDisplays(0)
+ mRemainingHwcVirtualDisplays(0),
+ mDumpMayLockUp(false)
{
for (size_t i=0 ; i<HWC_NUM_PHYSICAL_DISPLAY_TYPES ; i++) {
mLastHwVSync[i] = 0;
@@ -489,6 +490,8 @@
return NO_ERROR;
}
+ mDumpMayLockUp = true;
+
uint32_t numTypes = 0;
uint32_t numRequests = 0;
auto error = hwcDisplay->validate(&numTypes, &numRequests);
@@ -633,6 +636,9 @@
auto& displayData = mDisplayData[displayId];
auto& hwcDisplay = displayData.hwcDisplay;
auto error = hwcDisplay->present(&displayData.lastPresentFence);
+
+ mDumpMayLockUp = false;
+
if (error != HWC2::Error::None) {
ALOGE("presentAndGetReleaseFences: failed for display %d: %s (%d)",
displayId, to_string(error).c_str(), static_cast<int32_t>(error));
@@ -878,6 +884,11 @@
}
void HWComposer::dump(String8& result) const {
+ if (mDumpMayLockUp) {
+ result.append("HWComposer dump skipped because present in progress");
+ return;
+ }
+
// TODO: In order to provide a dump equivalent to HWC1, we need to shadow
// all the state going into the layers. This is probably better done in
// Layer itself, but it's going to take a bit of work to get there.
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index 0713709..20cca39 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -231,6 +231,9 @@
// thread-safe
mutable Mutex mVsyncLock;
+
+ // XXX temporary workaround for b/35806047
+ mutable std::atomic<bool> mDumpMayLockUp;
};
class HWComposerBufferCache {
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 2f83c0e..c3f8665 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -604,14 +604,15 @@
// this gives us only the "orientation" component of the transform
const State& s(getDrawingState());
#ifdef USE_HWC2
+ auto blendMode = HWC2::BlendMode::None;
if (!isOpaque(s) || s.alpha != 1.0f) {
- auto blendMode = mPremultipliedAlpha ?
+ blendMode = mPremultipliedAlpha ?
HWC2::BlendMode::Premultiplied : HWC2::BlendMode::Coverage;
- auto error = hwcLayer->setBlendMode(blendMode);
- ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set blend mode %s:"
- " %s (%d)", mName.string(), to_string(blendMode).c_str(),
- to_string(error).c_str(), static_cast<int32_t>(error));
}
+ auto error = hwcLayer->setBlendMode(blendMode);
+ ALOGE_IF(error != HWC2::Error::None, "[%s] Failed to set blend mode %s:"
+ " %s (%d)", mName.string(), to_string(blendMode).c_str(),
+ to_string(error).c_str(), static_cast<int32_t>(error));
#else
if (!isOpaque(s) || s.alpha != 0xFF) {
layer.setBlending(mPremultipliedAlpha ?
@@ -666,7 +667,7 @@
}
const Transform& tr(displayDevice->getTransform());
Rect transformedFrame = tr.transform(frame);
- auto error = hwcLayer->setDisplayFrame(transformedFrame);
+ error = hwcLayer->setDisplayFrame(transformedFrame);
if (error != HWC2::Error::None) {
ALOGE("[%s] Failed to set display frame [%d, %d, %d, %d]: %s (%d)",
mName.string(), transformedFrame.left, transformedFrame.top,
@@ -1436,29 +1437,23 @@
// If this transaction is waiting on the receipt of a frame, generate a sync
// point and send it to the remote layer.
- if (mCurrentState.handle != nullptr) {
- sp<IBinder> strongBinder = mCurrentState.handle.promote();
- sp<Handle> handle = nullptr;
- sp<Layer> handleLayer = nullptr;
- if (strongBinder != nullptr) {
- handle = static_cast<Handle*>(strongBinder.get());
- handleLayer = handle->owner.promote();
- }
- if (strongBinder == nullptr || handleLayer == nullptr) {
- ALOGE("[%s] Unable to promote Layer handle", mName.string());
+ if (mCurrentState.barrierLayer != nullptr) {
+ sp<Layer> barrierLayer = mCurrentState.barrierLayer.promote();
+ if (barrierLayer == nullptr) {
+ ALOGE("[%s] Unable to promote barrier Layer.", mName.string());
// If we can't promote the layer we are intended to wait on,
// then it is expired or otherwise invalid. Allow this transaction
// to be applied as per normal (no synchronization).
- mCurrentState.handle = nullptr;
+ mCurrentState.barrierLayer = nullptr;
} else {
auto syncPoint = std::make_shared<SyncPoint>(
mCurrentState.frameNumber);
- if (handleLayer->addSyncPoint(syncPoint)) {
+ if (barrierLayer->addSyncPoint(syncPoint)) {
mRemoteSyncPoints.push_back(std::move(syncPoint));
} else {
// We already missed the frame we're supposed to synchronize
// on, so go ahead and apply the state update
- mCurrentState.handle = nullptr;
+ mCurrentState.barrierLayer = nullptr;
}
}
@@ -1481,7 +1476,7 @@
bool Layer::applyPendingStates(State* stateToCommit) {
bool stateUpdateAvailable = false;
while (!mPendingStates.empty()) {
- if (mPendingStates[0].handle != nullptr) {
+ if (mPendingStates[0].barrierLayer != nullptr) {
if (mRemoteSyncPoints.empty()) {
// If we don't have a sync point for this, apply it anyway. It
// will be visually wrong, but it should keep us from getting
@@ -1733,7 +1728,7 @@
bool Layer::setMatrix(const layer_state_t::matrix22_t& matrix) {
mCurrentState.sequence++;
mCurrentState.requested.transform.set(
- matrix.dsdx, matrix.dsdy, matrix.dtdx, matrix.dtdy);
+ matrix.dsdx, matrix.dtdy, matrix.dtdx, matrix.dsdy);
mCurrentState.modified = true;
setTransactionFlags(eTransactionNeeded);
return true;
@@ -1828,17 +1823,24 @@
return p->getLayerStack();
}
-void Layer::deferTransactionUntil(const sp<IBinder>& handle,
+void Layer::deferTransactionUntil(const sp<Layer>& barrierLayer,
uint64_t frameNumber) {
- mCurrentState.handle = handle;
+ mCurrentState.barrierLayer = barrierLayer;
mCurrentState.frameNumber = frameNumber;
// We don't set eTransactionNeeded, because just receiving a deferral
// request without any other state updates shouldn't actually induce a delay
mCurrentState.modified = true;
pushPendingState();
- mCurrentState.handle = nullptr;
+ mCurrentState.barrierLayer = nullptr;
mCurrentState.frameNumber = 0;
mCurrentState.modified = false;
+ ALOGE("Deferred transaction");
+}
+
+void Layer::deferTransactionUntil(const sp<IBinder>& barrierHandle,
+ uint64_t frameNumber) {
+ sp<Handle> handle = static_cast<Handle*>(barrierHandle.get());
+ deferTransactionUntil(handle->owner.promote(), frameNumber);
}
void Layer::useSurfaceDamage() {
@@ -2454,6 +2456,21 @@
return true;
}
+bool Layer::detachChildren() {
+ traverseInZOrder([this](Layer* child) {
+ if (child == this) {
+ return;
+ }
+
+ sp<Client> client(child->mClientRef.promote());
+ if (client != nullptr) {
+ client->detachLayer(child);
+ }
+ });
+
+ return true;
+}
+
void Layer::setParent(const sp<Layer>& layer) {
mParent = layer;
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index c5fea73..e2b2a3a 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -109,7 +109,14 @@
Geometry active;
Geometry requested;
int32_t z;
+
+ // The identifier of the layer stack this layer belongs to. A layer can
+ // only be associated to a single layer stack. A layer stack is a
+ // z-ordered group of layers which can be associated to one or more
+ // displays. Using the same layer stack on different displays is a way
+ // to achieve mirroring.
uint32_t layerStack;
+
#ifdef USE_HWC2
float alpha;
#else
@@ -128,9 +135,9 @@
// finalCrop is expressed in display space coordinate.
Rect finalCrop;
- // If set, defers this state update until the Layer identified by handle
+ // If set, defers this state update until the identified Layer
// receives a frame with the given frameNumber
- wp<IBinder> handle;
+ wp<Layer> barrierLayer;
uint64_t frameNumber;
// the transparentRegion hint is a bit special, it's latched only
@@ -171,10 +178,12 @@
bool setLayerStack(uint32_t layerStack);
bool setDataSpace(android_dataspace dataSpace);
uint32_t getLayerStack() const;
- void deferTransactionUntil(const sp<IBinder>& handle, uint64_t frameNumber);
+ void deferTransactionUntil(const sp<IBinder>& barrierHandle, uint64_t frameNumber);
+ void deferTransactionUntil(const sp<Layer>& barrierLayer, uint64_t frameNumber);
bool setOverrideScalingMode(int32_t overrideScalingMode);
void setInfo(uint32_t type, uint32_t appId);
bool reparentChildren(const sp<IBinder>& layer);
+ bool detachChildren();
// If we have received a new buffer this frame, we will pass its surface
// damage down to hardware composer. Otherwise, we must send a region with
@@ -695,6 +704,11 @@
Rect displayFrame;
FloatRect sourceCrop;
};
+
+ // A layer can be attached to multiple displays when operating in mirror mode
+ // (a.k.a: when several displays are attached with equal layerStack). In this
+ // case we need to keep track. In non-mirror mode, a layer will have only one.
+ // HWCInfo. This map key is a display layerStack.
std::unordered_map<int32_t, HWCInfo> mHwcLayers;
// We need one HWComposerBufferCache for each HWC display. We cannot have
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 2781e8c..daeac27 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -33,7 +33,6 @@
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
-#include <binder/MemoryHeapBase.h>
#include <binder/PermissionCache.h>
#include <dvr/vr_flinger.h>
@@ -157,6 +156,7 @@
mVisibleRegionsDirty(false),
mGeometryInvalid(false),
mAnimCompositionPending(false),
+ mVrModeSupported(0),
mDebugRegion(0),
mDebugDDMS(0),
mDebugDisableHWC(0),
@@ -167,7 +167,7 @@
mLastTransactionTime(0),
mBootFinished(false),
mForceFullDamage(false),
- mInterceptor(),
+ mInterceptor(this),
mPrimaryDispSync("PrimaryDispSync"),
mPrimaryHWVsyncEnabled(false),
mHWVsyncAvailable(false),
@@ -176,14 +176,20 @@
mFrameBuckets(),
mTotalTime(0),
mLastSwapTime(0),
- mNumLayers(0),
- mEnterVrMode(false)
+ mNumLayers(0)
+#ifdef USE_HWC2
+ ,mEnterVrMode(false)
+#endif
{
ALOGI("SurfaceFlinger is starting");
// debugging stuff...
char value[PROPERTY_VALUE_MAX];
+ // TODO (urbanus): remove once b/35319396 is fixed.
+ property_get("ro.boot.vr", value, "0");
+ mVrModeSupported = atoi(value);
+
property_get("ro.bq.gpu_to_cpu_unsupported", value, "0");
mGpuToCpuSupported = !atoi(value);
@@ -627,6 +633,11 @@
bool SurfaceFlinger::authenticateSurfaceTexture(
const sp<IGraphicBufferProducer>& bufferProducer) const {
Mutex::Autolock _l(mStateLock);
+ return authenticateSurfaceTextureLocked(bufferProducer);
+}
+
+bool SurfaceFlinger::authenticateSurfaceTextureLocked(
+ const sp<IGraphicBufferProducer>& bufferProducer) const {
sp<IBinder> surfaceTextureBinder(IInterface::asBinder(bufferProducer));
return mGraphicBufferProducerList.indexOf(surfaceTextureBinder) >= 0;
}
@@ -1204,12 +1215,17 @@
}
void SurfaceFlinger::updateVrMode() {
+ bool enteringVrMode = mEnterVrMode;
+ if (enteringVrMode == mHwc->isUsingVrComposer()) {
+ return;
+ }
+ if (enteringVrMode && !mVrHwc) {
+ // Construct new HWComposer without holding any locks.
+ mVrHwc = new HWComposer(true);
+ ALOGV("Vr HWC created");
+ }
{
Mutex::Autolock _l(mStateLock);
- bool enteringVrMode = mEnterVrMode;
- if (enteringVrMode == mHwc->isUsingVrComposer()) {
- return;
- }
if (enteringVrMode) {
// Start vrflinger thread, if it hasn't been started already.
@@ -1224,11 +1240,6 @@
}
}
- if (!mVrHwc) {
- mVrHwc = new HWComposer(true);
- ALOGV("Vr HWC created");
- }
-
resetHwc();
mHwc = mVrHwc;
@@ -1256,8 +1267,11 @@
ATRACE_CALL();
switch (what) {
case MessageQueue::INVALIDATE: {
- // TODO(eieio): Disabled until SELinux issues are resolved.
- //updateVrMode();
+ // TODO(eieio): Tied to a conditional until SELinux issues
+ // are resolved.
+ if (mVrModeSupported) {
+ updateVrMode();
+ }
bool frameMissed = !mHadClientComposition &&
mPreviousPresentFence != Fence::NO_FENCE &&
@@ -1265,6 +1279,7 @@
Fence::SIGNAL_TIME_PENDING);
ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
if (mPropagateBackpressure && frameMissed) {
+ ALOGD("Backpressure trigger, skipping transaction & refresh!");
signalLayerUpdate();
break;
}
@@ -1579,6 +1594,9 @@
layer->setHwcLayer(displayDevice->getHwcDisplayId(),
nullptr);
}
+ } else {
+ layer->setHwcLayer(displayDevice->getHwcDisplayId(),
+ nullptr);
}
});
}
@@ -1633,7 +1651,6 @@
if (hwcId >= 0) {
const Vector<sp<Layer>>& currentLayers(
displayDevice->getVisibleLayersSortedByZ());
- bool foundLayerWithoutHwc = false;
for (size_t i = 0; i < currentLayers.size(); i++) {
const auto& layer = currentLayers[i];
if (!layer->hasHwcLayer(hwcId)) {
@@ -1642,7 +1659,6 @@
layer->setHwcLayer(hwcId, std::move(hwcLayer));
} else {
layer->forceClientComposition(hwcId);
- foundLayerWithoutHwc = true;
continue;
}
}
@@ -2527,14 +2543,7 @@
return NO_ERROR;
}
-status_t SurfaceFlinger::removeLayer(const wp<Layer>& weakLayer) {
- Mutex::Autolock _l(mStateLock);
- sp<Layer> layer = weakLayer.promote();
- if (layer == nullptr) {
- // The layer has already been removed, carry on
- return NO_ERROR;
- }
-
+status_t SurfaceFlinger::removeLayer(const sp<Layer>& layer) {
const auto& p = layer->getParent();
const ssize_t index = (p != nullptr) ? p->removeChild(layer) :
mCurrentState.layersSortedByZ.remove(layer);
@@ -2796,7 +2805,19 @@
}
}
if (what & layer_state_t::eDeferTransaction) {
- layer->deferTransactionUntil(s.handle, s.frameNumber);
+ if (s.barrierHandle != nullptr) {
+ layer->deferTransactionUntil(s.barrierHandle, s.frameNumber);
+ } else if (s.barrierGbp != nullptr) {
+ const sp<IGraphicBufferProducer>& gbp = s.barrierGbp;
+ if (authenticateSurfaceTextureLocked(gbp)) {
+ const auto& otherLayer =
+ (static_cast<MonitoredProducer*>(gbp.get()))->getLayer();
+ layer->deferTransactionUntil(otherLayer, s.frameNumber);
+ } else {
+ ALOGE("Attempt to defer transaction to to an"
+ " unrecognized GraphicBufferProducer");
+ }
+ }
// We don't trigger a traversal here because if no other state is
// changed, we don't want this to cause any more work
}
@@ -2805,6 +2826,9 @@
flags |= eTransactionNeeded|eTraversalNeeded;
}
}
+ if (what & layer_state_t::eDetachChildren) {
+ layer->detachChildren();
+ }
if (what & layer_state_t::eOverrideScalingModeChanged) {
layer->setOverrideScalingMode(s.overrideScalingMode);
// We don't trigger a traversal here because if no other state is
@@ -2901,7 +2925,7 @@
status_t SurfaceFlinger::onLayerRemoved(const sp<Client>& client, const sp<IBinder>& handle)
{
- // called by the window manager when it wants to remove a Layer
+ // called by a client when it wants to remove a Layer
status_t err = NO_ERROR;
sp<Layer> l(client->getLayerUser(handle));
if (l != NULL) {
@@ -2917,7 +2941,15 @@
{
// called by ~LayerCleaner() when all references to the IBinder (handle)
// are gone
- return removeLayer(layer);
+ sp<Layer> l = layer.promote();
+ if (l == nullptr) {
+ // The layer has already been removed, carry on
+ return NO_ERROR;
+ } if (l->getParent() != nullptr) {
+ // If we have a parent, then we can continue to live as long as it does.
+ return NO_ERROR;
+ }
+ return removeLayer(l);
}
// ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index c43786a..d63c0bb 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -36,8 +36,6 @@
#include <utils/SortedVector.h>
#include <utils/threads.h>
-#include <binder/IMemory.h>
-
#include <ui/FenceTime.h>
#include <ui/PixelFormat.h>
#include <math/mat4.h>
@@ -160,6 +158,9 @@
return *mRenderEngine;
}
+ bool authenticateSurfaceTextureLocked(
+ const sp<IGraphicBufferProducer>& bufferProducer) const;
+
private:
friend class Client;
friend class DisplayEventConnection;
@@ -329,7 +330,7 @@
status_t onLayerDestroyed(const wp<Layer>& layer);
// remove a layer from SurfaceFlinger immediately
- status_t removeLayer(const wp<Layer>& layer);
+ status_t removeLayer(const sp<Layer>& layer);
// add a layer to SurfaceFlinger
status_t addClientLayer(const sp<Client>& client,
@@ -556,6 +557,7 @@
DefaultKeyedVector< wp<IBinder>, sp<DisplayDevice> > mDisplays;
// don't use a lock for these, we don't care
+ int mVrModeSupported;
int mDebugRegion;
int mDebugDDMS;
int mDebugDisableHWC;
diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.cpp b/services/surfaceflinger/SurfaceFlingerConsumer.cpp
index 04f4f7e..2fcbdba 100644
--- a/services/surfaceflinger/SurfaceFlingerConsumer.cpp
+++ b/services/surfaceflinger/SurfaceFlingerConsumer.cpp
@@ -223,7 +223,7 @@
status_t result = releaseBufferLocked(mPendingRelease.currentTexture,
mPendingRelease.graphicBuffer, mPendingRelease.display,
mPendingRelease.fence);
- ALOGE_IF(result != NO_ERROR, "releasePendingBuffer failed: %s (%d)",
+ ALOGE_IF(result < NO_ERROR, "releasePendingBuffer failed: %s (%d)",
strerror(-result), result);
mPendingRelease = PendingRelease();
return true;
diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
index 5aaaab1..fe8dd0c 100644
--- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
+++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
@@ -33,7 +33,6 @@
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
-#include <binder/MemoryHeapBase.h>
#include <binder/PermissionCache.h>
#include <ui/DisplayInfo.h>
@@ -155,7 +154,7 @@
mLastTransactionTime(0),
mBootFinished(false),
mForceFullDamage(false),
- mInterceptor(),
+ mInterceptor(this),
mPrimaryDispSync("PrimaryDispSync"),
mPrimaryHWVsyncEnabled(false),
mHWVsyncAvailable(false),
@@ -628,6 +627,11 @@
bool SurfaceFlinger::authenticateSurfaceTexture(
const sp<IGraphicBufferProducer>& bufferProducer) const {
Mutex::Autolock _l(mStateLock);
+ return authenticateSurfaceTextureLocked(bufferProducer);
+}
+
+bool SurfaceFlinger::authenticateSurfaceTextureLocked(
+ const sp<IGraphicBufferProducer>& bufferProducer) const {
sp<IBinder> surfaceTextureBinder(IInterface::asBinder(bufferProducer));
return mGraphicBufferProducerList.indexOf(surfaceTextureBinder) >= 0;
}
@@ -2313,14 +2317,7 @@
return NO_ERROR;
}
-status_t SurfaceFlinger::removeLayer(const wp<Layer>& weakLayer) {
- Mutex::Autolock _l(mStateLock);
- sp<Layer> layer = weakLayer.promote();
- if (layer == nullptr) {
- // The layer has already been removed, carry on
- return NO_ERROR;
- }
-
+status_t SurfaceFlinger::removeLayer(const sp<Layer>& layer) {
const auto& p = layer->getParent();
const ssize_t index = (p != nullptr) ? p->removeChild(layer) :
mCurrentState.layersSortedByZ.remove(layer);
@@ -2582,7 +2579,19 @@
}
}
if (what & layer_state_t::eDeferTransaction) {
- layer->deferTransactionUntil(s.handle, s.frameNumber);
+ if (s.barrierHandle != nullptr) {
+ layer->deferTransactionUntil(s.barrierHandle, s.frameNumber);
+ } else if (s.barrierGbp != nullptr) {
+ const sp<IGraphicBufferProducer>& gbp = s.barrierGbp;
+ if (authenticateSurfaceTextureLocked(gbp)) {
+ const auto& otherLayer =
+ (static_cast<MonitoredProducer*>(gbp.get()))->getLayer();
+ layer->deferTransactionUntil(otherLayer, s.frameNumber);
+ } else {
+ ALOGE("Attempt to defer transaction to to an"
+ " unrecognized GraphicBufferProducer");
+ }
+ }
// We don't trigger a traversal here because if no other state is
// changed, we don't want this to cause any more work
}
@@ -2591,6 +2600,9 @@
flags |= eTransactionNeeded|eTraversalNeeded;
}
}
+ if (what & layer_state_t::eDetachChildren) {
+ layer->detachChildren();
+ }
if (what & layer_state_t::eOverrideScalingModeChanged) {
layer->setOverrideScalingMode(s.overrideScalingMode);
// We don't trigger a traversal here because if no other state is
@@ -2687,7 +2699,7 @@
status_t SurfaceFlinger::onLayerRemoved(const sp<Client>& client, const sp<IBinder>& handle)
{
- // called by the window manager when it wants to remove a Layer
+ // called by a client when it wants to remove a Layer
status_t err = NO_ERROR;
sp<Layer> l(client->getLayerUser(handle));
if (l != NULL) {
@@ -2703,7 +2715,15 @@
{
// called by ~LayerCleaner() when all references to the IBinder (handle)
// are gone
- return removeLayer(layer);
+ sp<Layer> l = layer.promote();
+ if (l == nullptr) {
+ // The layer has already been removed, carry on
+ return NO_ERROR;
+ } if (l->getParent() != nullptr) {
+ // If we have a parent, then we can continue to live as long as it does.
+ return NO_ERROR;
+ }
+ return removeLayer(l);
}
// ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/SurfaceInterceptor.cpp b/services/surfaceflinger/SurfaceInterceptor.cpp
index 2d6472a..026fe80 100644
--- a/services/surfaceflinger/SurfaceInterceptor.cpp
+++ b/services/surfaceflinger/SurfaceInterceptor.cpp
@@ -31,6 +31,11 @@
// ----------------------------------------------------------------------------
+SurfaceInterceptor::SurfaceInterceptor(SurfaceFlinger* flinger)
+ : mFlinger(flinger)
+{
+}
+
void SurfaceInterceptor::enable(const SortedVector<sp<Layer>>& layers,
const DefaultKeyedVector< wp<IBinder>, DisplayDeviceState>& displays)
{
@@ -97,8 +102,8 @@
addTransparentRegionLocked(transaction, layerId, layer->mCurrentState.activeTransparentRegion);
addLayerStackLocked(transaction, layerId, layer->mCurrentState.layerStack);
addCropLocked(transaction, layerId, layer->mCurrentState.crop);
- if (layer->mCurrentState.handle != nullptr) {
- addDeferTransactionLocked(transaction, layerId, layer->mCurrentState.handle,
+ if (layer->mCurrentState.barrierLayer != nullptr) {
+ addDeferTransactionLocked(transaction, layerId, layer->mCurrentState.barrierLayer.promote(),
layer->mCurrentState.frameNumber);
}
addFinalCropLocked(transaction, layerId, layer->mCurrentState.finalCrop);
@@ -287,10 +292,9 @@
}
void SurfaceInterceptor::addDeferTransactionLocked(Transaction* transaction, int32_t layerId,
- const wp<const IBinder>& weakHandle, uint64_t frameNumber)
+ const sp<const Layer>& layer, uint64_t frameNumber)
{
SurfaceChange* change(createSurfaceChangeLocked(transaction, layerId));
- const sp<const Layer> layer(getLayer(weakHandle));
if (layer == nullptr) {
ALOGE("An existing layer could not be retrieved with the handle"
" for the deferred transaction");
@@ -349,7 +353,18 @@
addCropLocked(transaction, layerId, state.crop);
}
if (state.what & layer_state_t::eDeferTransaction) {
- addDeferTransactionLocked(transaction, layerId, state.handle, state.frameNumber);
+ sp<Layer> otherLayer = nullptr;
+ if (state.barrierHandle != nullptr) {
+ otherLayer = static_cast<Layer::Handle*>(state.barrierHandle.get())->owner.promote();
+ } else if (state.barrierGbp != nullptr) {
+ auto const& gbp = state.barrierGbp;
+ if (mFlinger->authenticateSurfaceTextureLocked(gbp)) {
+ otherLayer = (static_cast<MonitoredProducer*>(gbp.get()))->getLayer();
+ } else {
+ ALOGE("Attempt to defer transaction to to an unrecognized GraphicBufferProducer");
+ }
+ }
+ addDeferTransactionLocked(transaction, layerId, otherLayer, state.frameNumber);
}
if (state.what & layer_state_t::eFinalCropChanged) {
addFinalCropLocked(transaction, layerId, state.finalCrop);
diff --git a/services/surfaceflinger/SurfaceInterceptor.h b/services/surfaceflinger/SurfaceInterceptor.h
index 9af6e61..30ebcc6 100644
--- a/services/surfaceflinger/SurfaceInterceptor.h
+++ b/services/surfaceflinger/SurfaceInterceptor.h
@@ -28,6 +28,7 @@
class BufferItem;
class Layer;
+class SurfaceFlinger;
struct DisplayState;
struct layer_state_t;
@@ -39,6 +40,7 @@
*/
class SurfaceInterceptor {
public:
+ SurfaceInterceptor(SurfaceFlinger* const flinger);
// Both vectors are used to capture the current state of SF as the initial snapshot in the trace
void enable(const SortedVector<sp<Layer>>& layers,
const DefaultKeyedVector< wp<IBinder>, DisplayDeviceState>& displays);
@@ -102,7 +104,7 @@
void addLayerStackLocked(Transaction* transaction, int32_t layerId, uint32_t layerStack);
void addCropLocked(Transaction* transaction, int32_t layerId, const Rect& rect);
void addDeferTransactionLocked(Transaction* transaction, int32_t layerId,
- const wp<const IBinder>& weakHandle, uint64_t frameNumber);
+ const sp<const Layer>& layer, uint64_t frameNumber);
void addFinalCropLocked(Transaction* transaction, int32_t layerId, const Rect& rect);
void addOverrideScalingModeLocked(Transaction* transaction, int32_t layerId,
int32_t overrideScalingMode);
@@ -129,6 +131,7 @@
std::string mOutputFileName {DEFAULT_FILENAME};
std::mutex mTraceMutex {};
Trace mTrace {};
+ SurfaceFlinger* const mFlinger;
};
}
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index d9f1438..aeb557a 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -18,8 +18,6 @@
#include <android/native_window.h>
-#include <binder/IMemory.h>
-
#include <gui/ISurfaceComposer.h>
#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>
@@ -199,9 +197,9 @@
{
SCOPED_TRACE("before move");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 0, 12, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(0, 12);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
SurfaceComposerClient::openGlobalTransaction();
@@ -211,9 +209,9 @@
// This should reflect the new position, but not the new color.
SCOPED_TRACE("after move, before redraw");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 63, 195);
- sc->checkPixel(145, 145, 195, 63, 63);
+ sc->expectBGColor(24, 24);
+ sc->expectBGColor(75, 75);
+ sc->expectFGColor(145, 145);
}
fillSurfaceRGBA8(mFGSurfaceControl, 63, 195, 63);
@@ -222,9 +220,9 @@
// This should reflect the new position and the new color.
SCOPED_TRACE("after redraw");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 63, 195);
- sc->checkPixel(145, 145, 63, 195, 63);
+ sc->expectBGColor(24, 24);
+ sc->expectBGColor(75, 75);
+ sc->checkPixel(145, 145, 63, 195, 63);
}
}
@@ -233,9 +231,9 @@
{
SCOPED_TRACE("before resize");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 0, 12, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(0, 12);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
ALOGD("resizing");
@@ -248,9 +246,9 @@
// has not yet received a buffer of the correct size.
SCOPED_TRACE("after resize, before redraw");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 0, 12, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(0, 12);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
ALOGD("drawing");
@@ -261,9 +259,9 @@
// This should reflect the new size and the new color.
SCOPED_TRACE("after redraw");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 195, 63);
- sc->checkPixel(145, 145, 63, 195, 63);
+ sc->expectBGColor(24, 24);
+ sc->checkPixel(75, 75, 63, 195, 63);
+ sc->checkPixel(145, 145, 63, 195, 63);
}
}
@@ -272,9 +270,9 @@
{
SCOPED_TRACE("before crop");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
SurfaceComposerClient::openGlobalTransaction();
@@ -285,11 +283,11 @@
// This should crop the foreground surface.
SCOPED_TRACE("after crop");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 63, 195);
- sc->checkPixel( 95, 80, 195, 63, 63);
- sc->checkPixel( 80, 95, 195, 63, 63);
- sc->checkPixel( 96, 96, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectBGColor(75, 75);
+ sc->expectFGColor(95, 80);
+ sc->expectFGColor(80, 95);
+ sc->expectBGColor(96, 96);
}
}
@@ -298,9 +296,9 @@
{
SCOPED_TRACE("before crop");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
SurfaceComposerClient::openGlobalTransaction();
Rect cropRect(16, 16, 32, 32);
@@ -310,11 +308,11 @@
// This should crop the foreground surface.
SCOPED_TRACE("after crop");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 63, 195);
- sc->checkPixel( 95, 80, 63, 63, 195);
- sc->checkPixel( 80, 95, 63, 63, 195);
- sc->checkPixel( 96, 96, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectBGColor(75, 75);
+ sc->expectBGColor(95, 80);
+ sc->expectBGColor(80, 95);
+ sc->expectBGColor(96, 96);
}
}
@@ -323,9 +321,9 @@
{
SCOPED_TRACE("before setLayer");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
SurfaceComposerClient::openGlobalTransaction();
@@ -335,9 +333,9 @@
// This should hide the foreground surface beneath the background.
SCOPED_TRACE("after setLayer");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 63, 195);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectBGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
}
@@ -346,9 +344,9 @@
{
SCOPED_TRACE("before hide");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
SurfaceComposerClient::openGlobalTransaction();
@@ -358,9 +356,9 @@
// This should hide the foreground surface.
SCOPED_TRACE("after hide, before show");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 63, 195);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectBGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
SurfaceComposerClient::openGlobalTransaction();
@@ -370,9 +368,9 @@
// This should show the foreground surface.
SCOPED_TRACE("after show");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
}
@@ -381,9 +379,9 @@
{
SCOPED_TRACE("before setAlpha");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
SurfaceComposerClient::openGlobalTransaction();
@@ -393,9 +391,9 @@
// This should set foreground to be 75% opaque.
SCOPED_TRACE("after setAlpha");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 162, 63, 96);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->checkPixel(75, 75, 162, 63, 96);
+ sc->expectBGColor(145, 145);
}
}
@@ -404,9 +402,9 @@
{
SCOPED_TRACE("before setLayerStack");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
SurfaceComposerClient::openGlobalTransaction();
@@ -417,9 +415,9 @@
// layer stack.
SCOPED_TRACE("after setLayerStack");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 63, 195);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectBGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
}
@@ -428,9 +426,9 @@
{
SCOPED_TRACE("before setFlags");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectFGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
SurfaceComposerClient::openGlobalTransaction();
@@ -441,9 +439,9 @@
// This should hide the foreground surface
SCOPED_TRACE("after setFlags");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 75, 75, 63, 63, 195);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectBGColor(75, 75);
+ sc->expectBGColor(145, 145);
}
}
@@ -452,10 +450,10 @@
{
SCOPED_TRACE("before setMatrix");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 91, 96, 195, 63, 63);
- sc->checkPixel( 96, 101, 195, 63, 63);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectFGColor(91, 96);
+ sc->expectFGColor(96, 101);
+ sc->expectBGColor(145, 145);
}
SurfaceComposerClient::openGlobalTransaction();
@@ -465,10 +463,10 @@
{
SCOPED_TRACE("after setMatrix");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 24, 24, 63, 63, 195);
- sc->checkPixel( 91, 96, 195, 63, 63);
- sc->checkPixel( 96, 91, 63, 63, 195);
- sc->checkPixel(145, 145, 63, 63, 195);
+ sc->expectBGColor(24, 24);
+ sc->expectFGColor(91, 96);
+ sc->expectBGColor(96, 91);
+ sc->expectBGColor(145, 145);
}
}
@@ -477,9 +475,9 @@
{
SCOPED_TRACE("before anything");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 32, 32, 63, 63, 195);
- sc->checkPixel( 96, 96, 195, 63, 63);
- sc->checkPixel(160, 160, 63, 63, 195);
+ sc->expectBGColor(32, 32);
+ sc->expectFGColor(96, 96);
+ sc->expectBGColor(160, 160);
}
// set up two deferred transactions on different frames
@@ -498,9 +496,9 @@
{
SCOPED_TRACE("before any trigger");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 32, 32, 63, 63, 195);
- sc->checkPixel( 96, 96, 195, 63, 63);
- sc->checkPixel(160, 160, 63, 63, 195);
+ sc->expectBGColor(32, 32);
+ sc->expectFGColor(96, 96);
+ sc->expectBGColor(160, 160);
}
// should trigger the first deferred transaction, but not the second one
@@ -508,9 +506,9 @@
{
SCOPED_TRACE("after first trigger");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 32, 32, 63, 63, 195);
- sc->checkPixel( 96, 96, 162, 63, 96);
- sc->checkPixel(160, 160, 63, 63, 195);
+ sc->expectBGColor(32, 32);
+ sc->checkPixel(96, 96, 162, 63, 96);
+ sc->expectBGColor(160, 160);
}
// should show up immediately since it's not deferred
@@ -523,9 +521,9 @@
{
SCOPED_TRACE("after second trigger");
ScreenCapture::captureScreen(&sc);
- sc->checkPixel( 32, 32, 63, 63, 195);
- sc->checkPixel( 96, 96, 63, 63, 195);
- sc->checkPixel(160, 160, 195, 63, 63);
+ sc->expectBGColor(32, 32);
+ sc->expectBGColor(96, 96);
+ sc->expectFGColor(160, 160);
}
}
@@ -630,4 +628,68 @@
mCapture->expectFGColor(20, 20);
}
}
+
+TEST_F(ChildLayerTest, ReparentChildren) {
+ SurfaceComposerClient::openGlobalTransaction();
+ mChild->show();
+ mChild->setPosition(10, 10);
+ mFGSurfaceControl->setPosition(64, 64);
+ SurfaceComposerClient::closeGlobalTransaction(true);
+
+ {
+ ScreenCapture::captureScreen(&mCapture);
+ // Top left of foreground must now be visible
+ mCapture->expectFGColor(64, 64);
+ // But 10 pixels in we should see the child surface
+ mCapture->expectChildColor(74, 74);
+ // And 10 more pixels we should be back to the foreground surface
+ mCapture->expectFGColor(84, 84);
+ }
+ mFGSurfaceControl->reparentChildren(mBGSurfaceControl->getHandle());
+ {
+ ScreenCapture::captureScreen(&mCapture);
+ mCapture->expectFGColor(64, 64);
+ // In reparenting we should have exposed the entire foreground surface.
+ mCapture->expectFGColor(74, 74);
+ // And the child layer should now begin at 10, 10 (since the BG
+ // layer is at (0, 0)).
+ mCapture->expectBGColor(9, 9);
+ mCapture->expectChildColor(10, 10);
+ }
+}
+
+TEST_F(ChildLayerTest, DetachChildren) {
+ SurfaceComposerClient::openGlobalTransaction();
+ mChild->show();
+ mChild->setPosition(10, 10);
+ mFGSurfaceControl->setPosition(64, 64);
+ SurfaceComposerClient::closeGlobalTransaction(true);
+
+ {
+ ScreenCapture::captureScreen(&mCapture);
+ // Top left of foreground must now be visible
+ mCapture->expectFGColor(64, 64);
+ // But 10 pixels in we should see the child surface
+ mCapture->expectChildColor(74, 74);
+ // And 10 more pixels we should be back to the foreground surface
+ mCapture->expectFGColor(84, 84);
+ }
+
+ SurfaceComposerClient::openGlobalTransaction();
+ mFGSurfaceControl->detachChildren();
+ SurfaceComposerClient::closeGlobalTransaction();
+
+ SurfaceComposerClient::openGlobalTransaction();
+ mChild->hide();
+ SurfaceComposerClient::closeGlobalTransaction();
+
+ // Nothing should have changed.
+ {
+ ScreenCapture::captureScreen(&mCapture);
+ mCapture->expectFGColor(64, 64);
+ mCapture->expectChildColor(74, 74);
+ mCapture->expectFGColor(84, 84);
+ }
+}
+
}
diff --git a/services/vr/sensord/pose_service.cpp b/services/vr/sensord/pose_service.cpp
index 40eb21d..32a2160 100644
--- a/services/vr/sensord/pose_service.cpp
+++ b/services/vr/sensord/pose_service.cpp
@@ -25,8 +25,6 @@
#include <private/dvr/sensor_constants.h>
#include <utils/Trace.h>
-#define arraysize(x) (static_cast<ssize_t>(std::extent<decltype(x)>::value))
-
using android::pdx::LocalChannelHandle;
using android::pdx::default_transport::Endpoint;
using android::pdx::Status;
@@ -35,11 +33,8 @@
namespace dvr {
using Vector3d = vec3d;
-using Vector3f = vec3f;
using Rotationd = quatd;
-using Rotationf = quatf;
using AngleAxisd = Eigen::AngleAxis<double>;
-using AngleAxisf = Eigen::AngleAxis<float>;
namespace {
// Wait a few seconds before checking if we need to disable sensors.
@@ -69,7 +64,6 @@
static constexpr int kDatasetIdLength = 36;
static constexpr char kDatasetIdChars[] = "0123456789abcdef-";
-static constexpr char kDatasetLocation[] = "/data/sdcard/datasets/";
// These are the flags used by BufferProducer::CreatePersistentUncachedBlob,
// plus PRIVATE_ADSP_HEAP to allow access from the DSP.
@@ -77,14 +71,6 @@
GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY |
GRALLOC_USAGE_PRIVATE_UNCACHED | GRALLOC_USAGE_PRIVATE_ADSP_HEAP;
-// Extract yaw angle from a given quaternion rotation.
-// Y-axis is considered to be vertical. Result is in rad.
-template <typename T>
-T ExtractYaw(Eigen::Quaternion<T> rotation) {
- const Eigen::Vector3<T> yaw_axis = rotation * vec3::UnitZ();
- return std::atan2(yaw_axis.z(), yaw_axis.x());
-}
-
std::string GetPoseModeString(DvrPoseMode mode) {
switch (mode) {
case DVR_POSE_MODE_6DOF:
@@ -110,19 +96,6 @@
}
}
-inline std::string GetVector3dString(const Vector3d& vector) {
- std::ostringstream stream;
- stream << "[" << vector[0] << "," << vector[1] << "," << vector[2] << "]";
- return stream.str();
-}
-
-inline std::string GetRotationdString(const Rotationd& rotation) {
- std::ostringstream stream;
- stream << "[" << rotation.w() << ", " << GetVector3dString(rotation.vec())
- << "]";
- return stream.str();
-}
-
} // namespace
PoseService::PoseService(SensorThread* sensor_thread)
diff --git a/services/vr/sensord/sensor_ndk_thread.cpp b/services/vr/sensord/sensor_ndk_thread.cpp
index 815453b..9c3abbc 100644
--- a/services/vr/sensord/sensor_ndk_thread.cpp
+++ b/services/vr/sensord/sensor_ndk_thread.cpp
@@ -37,11 +37,10 @@
// Start ALooper and initialize sensor access.
{
std::unique_lock<std::mutex> lock(mutex_);
- initialization_result_ = InitializeSensors();
+ InitializeSensors();
thread_started_ = true;
init_condition_.notify_one();
- if (!initialization_result_)
- return;
+ // Continue on failure - the loop below will periodically retry.
}
EventConsumer consumer;
@@ -61,7 +60,7 @@
constexpr int kMaxEvents = 100;
sensors_event_t events[kMaxEvents];
ssize_t event_count = 0;
- if (looper_ && sensor_manager_) {
+ if (initialization_result_) {
int poll_fd, poll_events;
void* poll_source;
// Poll for events.
@@ -79,7 +78,6 @@
// This happens when sensorservice has died and restarted. To avoid
// spinning we need to restart the sensor access.
DestroySensors();
- InitializeSensors();
}
} else {
// When there is no sensor_device_, we still call the consumer at
@@ -114,7 +112,8 @@
}
// At this point, we've successfully initialized everything.
- *out_success = initialization_result_;
+ // The NDK sensor thread will continue to retry on error, so assume success here.
+ *out_success = true;
}
SensorNdkThread::~SensorNdkThread() {
@@ -167,10 +166,13 @@
}
}
+ initialization_result_ = true;
return true;
}
void SensorNdkThread::DestroySensors() {
+ if (!event_queue_)
+ return;
for (size_t sensor_index = 0; sensor_index < sensor_user_count_.size();
++sensor_index) {
if (sensor_user_count_[sensor_index] > 0) {
@@ -178,9 +180,19 @@
}
}
ASensorManager_destroyEventQueue(sensor_manager_, event_queue_);
+ event_queue_ = nullptr;
+ initialization_result_ = false;
}
void SensorNdkThread::UpdateSensorUse() {
+ if (!initialization_result_) {
+ // Sleep for 1 second to avoid spinning during system instability.
+ usleep(1000 * 1000);
+ InitializeSensors();
+ if (!initialization_result_)
+ return;
+ }
+
if (!enable_sensors_.empty()) {
for (int sensor_index : enable_sensors_) {
if (sensor_user_count_[sensor_index]++ == 0) {
diff --git a/services/vr/virtual_touchpad/Android.mk b/services/vr/virtual_touchpad/Android.mk
index 4224aaa..b78eb99 100644
--- a/services/vr/virtual_touchpad/Android.mk
+++ b/services/vr/virtual_touchpad/Android.mk
@@ -6,13 +6,14 @@
src := \
EvdevInjector.cpp \
- VirtualTouchpad.cpp
+ VirtualTouchpadEvdev.cpp
shared_libs := \
libbase
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(src)
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_SHARED_LIBRARIES := $(shared_libs)
LOCAL_CPPFLAGS += -std=c++11
LOCAL_CFLAGS += -DLOG_TAG=\"VrVirtualTouchpad\"
@@ -29,11 +30,13 @@
static_libs := \
libbase \
libcutils \
+ libutils \
libvirtualtouchpad
$(foreach file,$(test_src_files), \
$(eval include $(CLEAR_VARS)) \
$(eval LOCAL_SRC_FILES := $(file)) \
+ $(eval LOCAL_C_INCLUDES := $(LOCAL_PATH)/include) \
$(eval LOCAL_STATIC_LIBRARIES := $(static_libs)) \
$(eval LOCAL_SHARED_LIBRARIES := $(shared_libs)) \
$(eval LOCAL_CPPFLAGS += -std=c++11) \
@@ -63,6 +66,7 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(src)
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := $(static_libs)
LOCAL_SHARED_LIBRARIES := $(shared_libs)
LOCAL_CPPFLAGS += -std=c++11
@@ -74,3 +78,27 @@
LOCAL_MULTILIB := 64
LOCAL_CXX_STL := libc++_static
include $(BUILD_EXECUTABLE)
+
+
+# Touchpad client library.
+
+src := \
+ VirtualTouchpadClient.cpp \
+ aidl/android/dvr/VirtualTouchpadService.aidl
+
+shared_libs := \
+ libbase \
+ libbinder \
+ libutils
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := $(src)
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
+LOCAL_SHARED_LIBRARIES := $(shared_libs)
+LOCAL_CPPFLAGS += -std=c++11
+LOCAL_CFLAGS += -DLOG_TAG=\"VirtualTouchpadClient\"
+LOCAL_LDLIBS := -llog
+LOCAL_MODULE := libvirtualtouchpadclient
+LOCAL_MODULE_TAGS := optional
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+include $(BUILD_STATIC_LIBRARY)
diff --git a/services/vr/virtual_touchpad/VirtualTouchpad.h b/services/vr/virtual_touchpad/VirtualTouchpad.h
deleted file mode 100644
index 17aeb35..0000000
--- a/services/vr/virtual_touchpad/VirtualTouchpad.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef ANDROID_DVR_VIRTUAL_TOUCHPAD_H
-#define ANDROID_DVR_VIRTUAL_TOUCHPAD_H
-
-#include <memory>
-
-#include "EvdevInjector.h"
-
-namespace android {
-namespace dvr {
-
-class EvdevInjector;
-
-// Provides a virtual touchpad for injecting events into the input system.
-//
-class VirtualTouchpad {
- public:
- VirtualTouchpad() {}
- ~VirtualTouchpad() {}
-
- // |Intialize()| must be called once on a VirtualTouchpad before
- // and other public method. Returns zero on success.
- int Initialize();
-
- // Generate a simulated touch event.
- //
- // @param x Horizontal touch position.
- // @param y Vertical touch position.
- // Values must be in the range [0.0, 1.0).
- // @param pressure Touch pressure.
- // Positive values represent contact; use 1.0f if contact
- // is binary. Use 0.0f for no contact.
- // @returns Zero on success.
- //
- int Touch(float x, float y, float pressure);
-
- // Generate a simulated touchpad button state.
- //
- // @param buttons A union of MotionEvent BUTTON_* values.
- // @returns Zero on success.
- //
- // Currently only BUTTON_BACK is supported, as the implementation
- // restricts itself to operations actually required by VrWindowManager.
- //
- int ButtonState(int buttons);
-
- protected:
- // Must be called only between construction and Initialize().
- inline void SetEvdevInjectorForTesting(EvdevInjector* injector) {
- injector_ = injector;
- }
-
- private:
- // Except for testing, the |EvdevInjector| used to inject evdev events.
- std::unique_ptr<EvdevInjector> owned_injector_;
-
- // Active pointer to |owned_injector_| or to a testing injector.
- EvdevInjector* injector_ = nullptr;
-
- // Previous (x, y) position in device space, to suppress redundant events.
- int32_t last_device_x_ = INT32_MIN;
- int32_t last_device_y_ = INT32_MIN;
-
- // Records current touch state (0=up 1=down) in bit 0, and previous state
- // in bit 1, to track transitions.
- int touches_ = 0;
-
- // Previous injected button state, to detect changes.
- int32_t last_motion_event_buttons_ = 0;
-
- VirtualTouchpad(const VirtualTouchpad&) = delete;
- void operator=(const VirtualTouchpad&) = delete;
-};
-
-} // namespace dvr
-} // namespace android
-
-#endif // ANDROID_DVR_VIRTUAL_TOUCHPAD_H
diff --git a/services/vr/virtual_touchpad/VirtualTouchpadClient.cpp b/services/vr/virtual_touchpad/VirtualTouchpadClient.cpp
new file mode 100644
index 0000000..23a2e31
--- /dev/null
+++ b/services/vr/virtual_touchpad/VirtualTouchpadClient.cpp
@@ -0,0 +1,52 @@
+#include "VirtualTouchpadClient.h"
+
+#include <android/dvr/IVirtualTouchpadService.h>
+#include <binder/IServiceManager.h>
+
+namespace android {
+namespace dvr {
+
+namespace {
+
+class VirtualTouchpadClientImpl : public VirtualTouchpadClient {
+ public:
+ VirtualTouchpadClientImpl(sp<IVirtualTouchpadService> service)
+ : service_(service) {}
+ ~VirtualTouchpadClientImpl() {}
+
+ status_t Touch(float x, float y, float pressure) override {
+ if (service_ == nullptr) {
+ return NO_INIT;
+ }
+ return service_->touch(x, y, pressure).transactionError();
+ }
+ status_t ButtonState(int buttons) override {
+ if (service_ == nullptr) {
+ return NO_INIT;
+ }
+ return service_->buttonState(buttons).transactionError();
+ }
+
+ private:
+ sp<IVirtualTouchpadService> service_;
+};
+
+} // anonymous namespace
+
+sp<VirtualTouchpad> VirtualTouchpadClient::Create() {
+ sp<IServiceManager> sm = defaultServiceManager();
+ if (sm == nullptr) {
+ ALOGE("no service manager");
+ return sp<VirtualTouchpad>();
+ }
+ sp<IVirtualTouchpadService> service = interface_cast<IVirtualTouchpadService>(
+ sm->getService(IVirtualTouchpadService::SERVICE_NAME()));
+ if (service == nullptr) {
+ ALOGE("failed to get service");
+ return sp<VirtualTouchpad>();
+ }
+ return new VirtualTouchpadClientImpl(service);
+}
+
+} // namespace dvr
+} // namespace android
diff --git a/services/vr/virtual_touchpad/VirtualTouchpad.cpp b/services/vr/virtual_touchpad/VirtualTouchpadEvdev.cpp
similarity index 87%
rename from services/vr/virtual_touchpad/VirtualTouchpad.cpp
rename to services/vr/virtual_touchpad/VirtualTouchpadEvdev.cpp
index 4793058..ae31156 100644
--- a/services/vr/virtual_touchpad/VirtualTouchpad.cpp
+++ b/services/vr/virtual_touchpad/VirtualTouchpadEvdev.cpp
@@ -1,4 +1,4 @@
-#include "VirtualTouchpad.h"
+#include "VirtualTouchpadEvdev.h"
#include <android/input.h>
#include <inttypes.h>
@@ -30,7 +30,17 @@
} // anonymous namespace
-int VirtualTouchpad::Initialize() {
+sp<VirtualTouchpad> VirtualTouchpadEvdev::Create() {
+ VirtualTouchpadEvdev* const touchpad = new VirtualTouchpadEvdev();
+ const status_t status = touchpad->Initialize();
+ if (status) {
+ ALOGE("initialization failed: %d", status);
+ return sp<VirtualTouchpad>();
+ }
+ return sp<VirtualTouchpad>(touchpad);
+}
+
+int VirtualTouchpadEvdev::Initialize() {
if (!injector_) {
owned_injector_.reset(new EvdevInjector());
injector_ = owned_injector_.get();
@@ -46,7 +56,7 @@
return injector_->GetError();
}
-int VirtualTouchpad::Touch(float x, float y, float pressure) {
+int VirtualTouchpadEvdev::Touch(float x, float y, float pressure) {
if ((x < 0.0f) || (x >= 1.0f) || (y < 0.0f) || (y >= 1.0f)) {
return EINVAL;
}
@@ -91,7 +101,7 @@
return injector_->GetError();
}
-int VirtualTouchpad::ButtonState(int buttons) {
+int VirtualTouchpadEvdev::ButtonState(int buttons) {
const int changes = last_motion_event_buttons_ ^ buttons;
if (!changes) {
return 0;
diff --git a/services/vr/virtual_touchpad/VirtualTouchpadEvdev.h b/services/vr/virtual_touchpad/VirtualTouchpadEvdev.h
new file mode 100644
index 0000000..c763529
--- /dev/null
+++ b/services/vr/virtual_touchpad/VirtualTouchpadEvdev.h
@@ -0,0 +1,59 @@
+#ifndef ANDROID_DVR_VIRTUAL_TOUCHPAD_EVDEV_H
+#define ANDROID_DVR_VIRTUAL_TOUCHPAD_EVDEV_H
+
+#include <memory>
+
+#include "VirtualTouchpad.h"
+#include "EvdevInjector.h"
+
+namespace android {
+namespace dvr {
+
+class EvdevInjector;
+
+// VirtualTouchpadEvdev implements a VirtualTouchpad by injecting evdev events.
+//
+class VirtualTouchpadEvdev : public VirtualTouchpad {
+ public:
+ static sp<VirtualTouchpad> Create();
+
+ // VirtualTouchpad implementation:
+ status_t Touch(float x, float y, float pressure) override;
+ status_t ButtonState(int buttons) override;
+
+ protected:
+ VirtualTouchpadEvdev() {}
+ ~VirtualTouchpadEvdev() {}
+ status_t Initialize();
+
+ // Must be called only between construction and Initialize().
+ inline void SetEvdevInjectorForTesting(EvdevInjector* injector) {
+ injector_ = injector;
+ }
+
+ private:
+ // Except for testing, the |EvdevInjector| used to inject evdev events.
+ std::unique_ptr<EvdevInjector> owned_injector_;
+
+ // Active pointer to |owned_injector_| or to a testing injector.
+ EvdevInjector* injector_ = nullptr;
+
+ // Previous (x, y) position in device space, to suppress redundant events.
+ int32_t last_device_x_ = INT32_MIN;
+ int32_t last_device_y_ = INT32_MIN;
+
+ // Records current touch state (0=up 1=down) in bit 0, and previous state
+ // in bit 1, to track transitions.
+ int touches_ = 0;
+
+ // Previous injected button state, to detect changes.
+ int32_t last_motion_event_buttons_ = 0;
+
+ VirtualTouchpadEvdev(const VirtualTouchpadEvdev&) = delete;
+ void operator=(const VirtualTouchpadEvdev&) = delete;
+};
+
+} // namespace dvr
+} // namespace android
+
+#endif // ANDROID_DVR_VIRTUAL_TOUCHPAD_EVDEV_H
diff --git a/services/vr/virtual_touchpad/VirtualTouchpadService.cpp b/services/vr/virtual_touchpad/VirtualTouchpadService.cpp
index 25c1a4f..3fcb8fc 100644
--- a/services/vr/virtual_touchpad/VirtualTouchpadService.cpp
+++ b/services/vr/virtual_touchpad/VirtualTouchpadService.cpp
@@ -8,19 +8,15 @@
namespace android {
namespace dvr {
-int VirtualTouchpadService::Initialize() {
- return touchpad_.Initialize();
-}
-
binder::Status VirtualTouchpadService::touch(float x, float y, float pressure) {
- const int error = touchpad_.Touch(x, y, pressure);
- return error ? binder::Status::fromServiceSpecificError(error)
+ const status_t error = touchpad_->Touch(x, y, pressure);
+ return error ? binder::Status::fromStatusT(error)
: binder::Status::ok();
}
binder::Status VirtualTouchpadService::buttonState(int buttons) {
- const int error = touchpad_.ButtonState(buttons);
- return error ? binder::Status::fromServiceSpecificError(error)
+ const status_t error = touchpad_->ButtonState(buttons);
+ return error ? binder::Status::fromStatusT(error)
: binder::Status::ok();
}
diff --git a/services/vr/virtual_touchpad/VirtualTouchpadService.h b/services/vr/virtual_touchpad/VirtualTouchpadService.h
index e2426e3..b832c8f 100644
--- a/services/vr/virtual_touchpad/VirtualTouchpadService.h
+++ b/services/vr/virtual_touchpad/VirtualTouchpadService.h
@@ -13,22 +13,16 @@
//
class VirtualTouchpadService : public BnVirtualTouchpadService {
public:
- VirtualTouchpadService(VirtualTouchpad& touchpad)
+ VirtualTouchpadService(sp<VirtualTouchpad> touchpad)
: touchpad_(touchpad) {}
- // Must be called before clients can connect.
- // Returns 0 if initialization is successful.
- int Initialize();
-
- static char const* getServiceName() { return "virtual_touchpad"; }
-
protected:
// Implements IVirtualTouchpadService.
- ::android::binder::Status touch(float x, float y, float pressure) override;
- ::android::binder::Status buttonState(int buttons) override;
+ binder::Status touch(float x, float y, float pressure) override;
+ binder::Status buttonState(int buttons) override;
private:
- VirtualTouchpad& touchpad_;
+ sp<VirtualTouchpad> touchpad_;
VirtualTouchpadService(const VirtualTouchpadService&) = delete;
void operator=(const VirtualTouchpadService&) = delete;
diff --git a/services/vr/virtual_touchpad/aidl/android/dvr/VirtualTouchpadService.aidl b/services/vr/virtual_touchpad/aidl/android/dvr/VirtualTouchpadService.aidl
index e048837..c2044da 100644
--- a/services/vr/virtual_touchpad/aidl/android/dvr/VirtualTouchpadService.aidl
+++ b/services/vr/virtual_touchpad/aidl/android/dvr/VirtualTouchpadService.aidl
@@ -3,6 +3,8 @@
/** @hide */
interface VirtualTouchpadService
{
+ const String SERVICE_NAME = "virtual_touchpad";
+
/**
* Generate a simulated touch event.
*
diff --git a/services/vr/virtual_touchpad/include/VirtualTouchpad.h b/services/vr/virtual_touchpad/include/VirtualTouchpad.h
new file mode 100644
index 0000000..bbaf69b
--- /dev/null
+++ b/services/vr/virtual_touchpad/include/VirtualTouchpad.h
@@ -0,0 +1,57 @@
+#ifndef ANDROID_DVR_VIRTUAL_TOUCHPAD_INTERFACE_H
+#define ANDROID_DVR_VIRTUAL_TOUCHPAD_INTERFACE_H
+
+#include <utils/Errors.h>
+#include <utils/RefBase.h>
+#include <utils/StrongPointer.h>
+
+namespace android {
+namespace dvr {
+
+// Provides a virtual touchpad for injecting events into the input system.
+//
+class VirtualTouchpad : public RefBase {
+ public:
+ // Create a virtual touchpad.
+ // Implementations should provide this, and hide their constructors.
+ // For the user, switching implementations should be as simple as changing
+ // the class whose |Create()| is called.
+ static sp<VirtualTouchpad> Create() {
+ return sp<VirtualTouchpad>();
+ }
+
+ // Generate a simulated touch event.
+ //
+ // @param x Horizontal touch position.
+ // @param y Vertical touch position.
+ // Values must be in the range [0.0, 1.0).
+ // @param pressure Touch pressure.
+ // Positive values represent contact; use 1.0f if contact
+ // is binary. Use 0.0f for no contact.
+ // @returns OK on success.
+ //
+ virtual status_t Touch(float x, float y, float pressure) = 0;
+
+ // Generate a simulated touchpad button state.
+ //
+ // @param buttons A union of MotionEvent BUTTON_* values.
+ // @returns OK on success.
+ //
+ // Currently only BUTTON_BACK is supported, as the implementation
+ // restricts itself to operations actually required by VrWindowManager.
+ //
+ virtual status_t ButtonState(int buttons) = 0;
+
+ protected:
+ VirtualTouchpad() {}
+ virtual ~VirtualTouchpad() {}
+
+ private:
+ VirtualTouchpad(const VirtualTouchpad&) = delete;
+ void operator=(const VirtualTouchpad&) = delete;
+};
+
+} // namespace dvr
+} // namespace android
+
+#endif // ANDROID_DVR_VIRTUAL_TOUCHPAD_INTERFACE_H
diff --git a/services/vr/virtual_touchpad/include/VirtualTouchpadClient.h b/services/vr/virtual_touchpad/include/VirtualTouchpadClient.h
new file mode 100644
index 0000000..46bec0e
--- /dev/null
+++ b/services/vr/virtual_touchpad/include/VirtualTouchpadClient.h
@@ -0,0 +1,31 @@
+#ifndef ANDROID_DVR_VIRTUAL_TOUCHPAD_CLIENT_H
+#define ANDROID_DVR_VIRTUAL_TOUCHPAD_CLIENT_H
+
+#include "VirtualTouchpad.h"
+
+namespace android {
+namespace dvr {
+
+// VirtualTouchpadClient implements a VirtualTouchpad by connecting to
+// a VirtualTouchpadService over Binder.
+//
+class VirtualTouchpadClient : public VirtualTouchpad {
+ public:
+ // VirtualTouchpad implementation:
+ static sp<VirtualTouchpad> Create();
+ status_t Touch(float x, float y, float pressure) override;
+ status_t ButtonState(int buttons) override;
+
+ protected:
+ VirtualTouchpadClient() {}
+ virtual ~VirtualTouchpadClient() {}
+
+ private:
+ VirtualTouchpadClient(const VirtualTouchpadClient&) = delete;
+ void operator=(const VirtualTouchpadClient&) = delete;
+};
+
+} // namespace dvr
+} // namespace android
+
+#endif // ANDROID_DVR_VIRTUAL_TOUCHPAD_CLIENT_H
diff --git a/services/vr/virtual_touchpad/main.cpp b/services/vr/virtual_touchpad/main.cpp
index 1debe9f..e73f8b9 100644
--- a/services/vr/virtual_touchpad/main.cpp
+++ b/services/vr/virtual_touchpad/main.cpp
@@ -3,17 +3,13 @@
#include <binder/ProcessState.h>
#include <log/log.h>
+#include "VirtualTouchpadEvdev.h"
#include "VirtualTouchpadService.h"
int main() {
ALOGI("Starting");
- android::dvr::VirtualTouchpad touchpad;
- android::dvr::VirtualTouchpadService touchpad_service(touchpad);
- const int touchpad_status = touchpad_service.Initialize();
- if (touchpad_status) {
- ALOGE("virtual touchpad initialization failed: %d", touchpad_status);
- exit(1);
- }
+ android::dvr::VirtualTouchpadService touchpad_service(
+ android::dvr::VirtualTouchpadEvdev::Create());
signal(SIGPIPE, SIG_IGN);
android::sp<android::ProcessState> ps(android::ProcessState::self());
@@ -23,7 +19,7 @@
android::sp<android::IServiceManager> sm(android::defaultServiceManager());
const android::status_t service_status =
- sm->addService(android::String16(touchpad_service.getServiceName()),
+ sm->addService(android::String16(touchpad_service.SERVICE_NAME()),
&touchpad_service, false /*allowIsolated*/);
if (service_status != android::OK) {
ALOGE("virtual touchpad service not added: %d",
diff --git a/services/vr/virtual_touchpad/tests/VirtualTouchpad_test.cpp b/services/vr/virtual_touchpad/tests/VirtualTouchpad_test.cpp
index 256c6bc..b448fd1 100644
--- a/services/vr/virtual_touchpad/tests/VirtualTouchpad_test.cpp
+++ b/services/vr/virtual_touchpad/tests/VirtualTouchpad_test.cpp
@@ -1,12 +1,12 @@
#include <android/input.h>
+#include <gtest/gtest.h>
+#include <linux/input.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
-#include <gtest/gtest.h>
-#include <linux/input.h>
#include "EvdevInjector.h"
-#include "VirtualTouchpad.h"
+#include "VirtualTouchpadEvdev.h"
namespace android {
namespace dvr {
@@ -21,7 +21,7 @@
event.type = type;
event.code = code;
event.value = value;
- Write(&event, sizeof (event));
+ Write(&event, sizeof(event));
}
};
@@ -87,16 +87,17 @@
class EvdevInjectorForTesting : public EvdevInjector {
public:
- EvdevInjectorForTesting(UInput& uinput) {
- SetUInputForTesting(&uinput);
- }
+ EvdevInjectorForTesting(UInput& uinput) { SetUInputForTesting(&uinput); }
const uinput_user_dev* GetUiDev() const { return GetUiDevForTesting(); }
};
-class VirtualTouchpadForTesting : public VirtualTouchpad {
+class VirtualTouchpadForTesting : public VirtualTouchpadEvdev {
public:
- VirtualTouchpadForTesting(EvdevInjector& injector) {
- SetEvdevInjectorForTesting(&injector);
+ static sp<VirtualTouchpad> Create(EvdevInjectorForTesting& injector) {
+ VirtualTouchpadForTesting* const touchpad = new VirtualTouchpadForTesting();
+ touchpad->SetEvdevInjectorForTesting(&injector);
+ touchpad->Initialize();
+ return sp<VirtualTouchpad>(touchpad);
}
};
@@ -113,17 +114,13 @@
} // anonymous namespace
-class VirtualTouchpadTest : public testing::Test {
-};
+class VirtualTouchpadTest : public testing::Test {};
TEST_F(VirtualTouchpadTest, Goodness) {
UInputRecorder expect;
UInputRecorder record;
EvdevInjectorForTesting injector(record);
- VirtualTouchpadForTesting touchpad(injector);
-
- const int initialization_status = touchpad.Initialize();
- EXPECT_EQ(0, initialization_status);
+ sp<VirtualTouchpad> touchpad(VirtualTouchpadForTesting::Create(injector));
// Check some aspects of uinput_user_dev.
const uinput_user_dev* uidev = injector.GetUiDev();
@@ -154,13 +151,13 @@
expect.IoctlSetInt(UI_SET_EVBIT, EV_KEY);
expect.IoctlSetInt(UI_SET_KEYBIT, BTN_TOUCH);
// From ConfigureEnd():
- expect.Write(uidev, sizeof (uinput_user_dev));
+ expect.Write(uidev, sizeof(uinput_user_dev));
expect.IoctlVoid(UI_DEV_CREATE);
EXPECT_EQ(expect.GetString(), record.GetString());
expect.Reset();
record.Reset();
- int touch_status = touchpad.Touch(0, 0, 0);
+ int touch_status = touchpad->Touch(0, 0, 0);
EXPECT_EQ(0, touch_status);
expect.WriteInputEvent(EV_ABS, ABS_MT_SLOT, 0);
expect.WriteInputEvent(EV_ABS, ABS_MT_TRACKING_ID, 0);
@@ -171,7 +168,7 @@
expect.Reset();
record.Reset();
- touch_status = touchpad.Touch(0.25f, 0.75f, 0.5f);
+ touch_status = touchpad->Touch(0.25f, 0.75f, 0.5f);
EXPECT_EQ(0, touch_status);
expect.WriteInputEvent(EV_ABS, ABS_MT_TRACKING_ID, 0);
expect.WriteInputEvent(EV_ABS, ABS_MT_POSITION_X, 0.25f * width);
@@ -182,7 +179,7 @@
expect.Reset();
record.Reset();
- touch_status = touchpad.Touch(1.0f, 1.0f, 1.0f);
+ touch_status = touchpad->Touch(1.0f, 1.0f, 1.0f);
EXPECT_EQ(0, touch_status);
expect.WriteInputEvent(EV_ABS, ABS_MT_TRACKING_ID, 0);
expect.WriteInputEvent(EV_ABS, ABS_MT_POSITION_X, width);
@@ -192,7 +189,7 @@
expect.Reset();
record.Reset();
- touch_status = touchpad.Touch(0.25f, 0.75f, -0.01f);
+ touch_status = touchpad->Touch(0.25f, 0.75f, -0.01f);
EXPECT_EQ(0, touch_status);
expect.WriteInputEvent(EV_KEY, BTN_TOUCH, EvdevInjector::KEY_RELEASE);
expect.WriteInputEvent(EV_ABS, ABS_MT_TRACKING_ID, -1);
@@ -201,7 +198,7 @@
expect.Reset();
record.Reset();
- touch_status = touchpad.ButtonState(AMOTION_EVENT_BUTTON_BACK);
+ touch_status = touchpad->ButtonState(AMOTION_EVENT_BUTTON_BACK);
EXPECT_EQ(0, touch_status);
expect.WriteInputEvent(EV_KEY, BTN_BACK, EvdevInjector::KEY_PRESS);
expect.WriteInputEvent(EV_SYN, SYN_REPORT, 0);
@@ -209,13 +206,13 @@
expect.Reset();
record.Reset();
- touch_status = touchpad.ButtonState(AMOTION_EVENT_BUTTON_BACK);
+ touch_status = touchpad->ButtonState(AMOTION_EVENT_BUTTON_BACK);
EXPECT_EQ(0, touch_status);
EXPECT_EQ(expect.GetString(), record.GetString());
expect.Reset();
record.Reset();
- touch_status = touchpad.ButtonState(0);
+ touch_status = touchpad->ButtonState(0);
EXPECT_EQ(0, touch_status);
expect.WriteInputEvent(EV_KEY, BTN_BACK, EvdevInjector::KEY_RELEASE);
expect.WriteInputEvent(EV_SYN, SYN_REPORT, 0);
@@ -229,56 +226,29 @@
UInputRecorder expect;
UInputRecorder record;
EvdevInjectorForTesting injector(record);
- VirtualTouchpadForTesting touchpad(injector);
-
- // Touch before initialization should return an error,
- // and should not result in any system calls.
- expect.Reset();
- record.Reset();
- int touch_status = touchpad.Touch(0.25f, 0.75f, -0.01f);
- EXPECT_NE(0, touch_status);
- EXPECT_EQ(expect.GetString(), record.GetString());
-
- // Button change before initialization should return an error,
- // and should not result in any system calls.
- expect.Reset();
- record.Reset();
- touch_status = touchpad.ButtonState(AMOTION_EVENT_BUTTON_BACK);
- EXPECT_NE(0, touch_status);
- EXPECT_EQ(expect.GetString(), record.GetString());
-
- expect.Reset();
- record.Reset();
- touchpad.Initialize();
-
- // Repeated initialization should return an error,
- // and should not result in any system calls.
- expect.Reset();
- record.Reset();
- const int initialization_status = touchpad.Initialize();
- EXPECT_NE(0, initialization_status);
- EXPECT_EQ(expect.GetString(), record.GetString());
+ sp<VirtualTouchpad> touchpad(
+ VirtualTouchpadForTesting::Create(injector));
// Touch off-screen should return an error,
// and should not result in any system calls.
expect.Reset();
record.Reset();
- touch_status = touchpad.Touch(-0.25f, 0.75f, 1.0f);
- EXPECT_NE(0, touch_status);
- touch_status = touchpad.Touch(0.25f, -0.75f, 1.0f);
- EXPECT_NE(0, touch_status);
- touch_status = touchpad.Touch(1.25f, 0.75f, 1.0f);
- EXPECT_NE(0, touch_status);
- touch_status = touchpad.Touch(0.25f, 1.75f, 1.0f);
- EXPECT_NE(0, touch_status);
+ status_t touch_status = touchpad->Touch(-0.25f, 0.75f, 1.0f);
+ EXPECT_NE(OK, touch_status);
+ touch_status = touchpad->Touch(0.25f, -0.75f, 1.0f);
+ EXPECT_NE(OK, touch_status);
+ touch_status = touchpad->Touch(1.25f, 0.75f, 1.0f);
+ EXPECT_NE(OK, touch_status);
+ touch_status = touchpad->Touch(0.25f, 1.75f, 1.0f);
+ EXPECT_NE(OK, touch_status);
EXPECT_EQ(expect.GetString(), record.GetString());
// Unsupported button should return an error,
// and should not result in any system calls.
expect.Reset();
record.Reset();
- touch_status = touchpad.ButtonState(AMOTION_EVENT_BUTTON_FORWARD);
- EXPECT_NE(0, touch_status);
+ touch_status = touchpad->ButtonState(AMOTION_EVENT_BUTTON_FORWARD);
+ EXPECT_NE(OK, touch_status);
EXPECT_EQ(expect.GetString(), record.GetString());
}
diff --git a/services/vr/vr_window_manager/Android.mk b/services/vr/vr_window_manager/Android.mk
index e9552bc..ddb58e9 100644
--- a/services/vr/vr_window_manager/Android.mk
+++ b/services/vr/vr_window_manager/Android.mk
@@ -14,29 +14,6 @@
LOCAL_PATH := $(call my-dir)
-binder_src := \
- vr_window_manager_binder.cpp \
- aidl/android/service/vr/IVrWindowManager.aidl
-
-static_libs := \
- libcutils
-
-shared_libs := \
- libbase \
- libbinder \
- libutils
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(binder_src)
-LOCAL_STATIC_LIBRARIES := $(static_libs)
-LOCAL_SHARED_LIBRARIES := $(shared_libs)
-LOCAL_CPPFLAGS += -std=c++11
-LOCAL_CFLAGS += -DLOG_TAG=\"VrWindowManager\"
-LOCAL_LDLIBS := -llog
-LOCAL_MODULE := libvrwm_binder
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_STATIC_LIBRARY)
-
native_src := \
application.cpp \
controller_mesh.cpp \
@@ -47,7 +24,8 @@
surface_flinger_view.cpp \
texture.cpp \
vr_window_manager.cpp \
- ../virtual_touchpad/aidl/android/dvr/VirtualTouchpadService.aidl \
+ vr_window_manager_binder.cpp \
+ aidl/android/service/vr/IVrWindowManager.aidl
static_libs := \
libdisplay \
@@ -61,12 +39,13 @@
libperformance \
libpdx_default_transport \
libcutils \
+ libvr_manager \
+ libvirtualtouchpadclient
shared_libs := \
android.dvr.composer@1.0 \
android.hardware.graphics.composer@2.1 \
libvrhwc \
- libandroid \
libbase \
libbinder \
libinput \
@@ -85,7 +64,7 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(native_src)
-LOCAL_STATIC_LIBRARIES := $(static_libs) libvrwm_binder
+LOCAL_STATIC_LIBRARIES := $(static_libs)
LOCAL_SHARED_LIBRARIES := $(shared_libs)
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES
diff --git a/services/vr/vr_window_manager/application.cpp b/services/vr/vr_window_manager/application.cpp
index 33cd499..dba797f 100644
--- a/services/vr/vr_window_manager/application.cpp
+++ b/services/vr/vr_window_manager/application.cpp
@@ -1,5 +1,6 @@
#include "application.h"
+#include <inttypes.h>
#include <EGL/egl.h>
#include <GLES3/gl3.h>
#include <binder/IServiceManager.h>
@@ -16,9 +17,16 @@
namespace android {
namespace dvr {
-Application::Application() {}
+Application::Application() {
+ vr_mode_listener_ = new VrModeListener(this);
+}
Application::~Application() {
+ sp<IVrManager> vrManagerService = interface_cast<IVrManager>(
+ defaultServiceManager()->getService(String16("vrmanager")));
+ if (vrManagerService.get()) {
+ vrManagerService->unregisterListener(vr_mode_listener_);
+ }
}
int Application::Initialize() {
@@ -28,6 +36,11 @@
elbow_model_.Enable(ElbowModel::kDefaultNeckPosition, is_right_handed);
last_frame_time_ = std::chrono::system_clock::now();
+ sp<IVrManager> vrManagerService = interface_cast<IVrManager>(
+ defaultServiceManager()->getService(String16("vrmanager")));
+ if (vrManagerService.get()) {
+ vrManagerService->registerListener(vr_mode_listener_);
+ }
return 0;
}
@@ -273,6 +286,11 @@
}
void Application::SetVisibility(bool visible) {
+ if (visible && !initialized_) {
+ if (AllocateResources())
+ ALOGE("Failed to allocate resources");
+ }
+
bool changed = is_visible_ != visible;
if (changed) {
is_visible_ = visible;
@@ -295,5 +313,10 @@
wake_up_init_and_render_.notify_one();
}
+void Application::VrModeListener::onVrStateChanged(bool enabled) {
+ if (!enabled)
+ app_->QueueTask(MainThreadTask::ExitingVrMode);
+}
+
} // namespace dvr
} // namespace android
diff --git a/services/vr/vr_window_manager/application.h b/services/vr/vr_window_manager/application.h
index c7aa4dd..2c60e0a 100644
--- a/services/vr/vr_window_manager/application.h
+++ b/services/vr/vr_window_manager/application.h
@@ -4,6 +4,7 @@
#include <memory>
#include <private/dvr/types.h>
#include <stdint.h>
+#include <vr/vr_manager/vr_manager.h>
#include <chrono>
#include <mutex>
@@ -43,6 +44,16 @@
Show,
};
+ class VrModeListener : public BnVrStateCallbacks {
+ public:
+ VrModeListener(Application *app) : app_(app) {}
+ void onVrStateChanged(bool enabled) override;
+
+ private:
+ Application *app_;
+ };
+
+ sp<VrModeListener> vr_mode_listener_;
virtual void OnDrawFrame() = 0;
virtual void DrawEye(EyeType eye, const mat4& perspective,
const mat4& eye_matrix, const mat4& head_matrix) = 0;
diff --git a/services/vr/vr_window_manager/composer/1.0/Android.bp b/services/vr/vr_window_manager/composer/1.0/Android.bp
index 5e791a7..58f83f8 100644
--- a/services/vr/vr_window_manager/composer/1.0/Android.bp
+++ b/services/vr/vr_window_manager/composer/1.0/Android.bp
@@ -6,13 +6,9 @@
cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hidl:system/libhidl/transport -randroid.hardware:hardware/interfaces/ -randroid.dvr:frameworks/native/services/vr/vr_window_manager android.dvr.composer@1.0",
srcs: [
"IVrComposerClient.hal",
- "IVrComposerView.hal",
- "IVrComposerCallback.hal",
],
out: [
"android/dvr/composer/1.0/VrComposerClientAll.cpp",
- "android/dvr/composer/1.0/VrComposerViewAll.cpp",
- "android/dvr/composer/1.0/VrComposerCallbackAll.cpp",
],
}
@@ -22,8 +18,6 @@
cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hidl:system/libhidl/transport -randroid.hardware:hardware/interfaces/ -randroid.dvr:frameworks/native/services/vr/vr_window_manager android.dvr.composer@1.0",
srcs: [
"IVrComposerClient.hal",
- "IVrComposerView.hal",
- "IVrComposerCallback.hal",
],
out: [
"android/dvr/composer/1.0/IVrComposerClient.h",
@@ -31,18 +25,6 @@
"android/dvr/composer/1.0/BnHwVrComposerClient.h",
"android/dvr/composer/1.0/BpHwVrComposerClient.h",
"android/dvr/composer/1.0/BsVrComposerClient.h",
-
- "android/dvr/composer/1.0/IVrComposerView.h",
- "android/dvr/composer/1.0/IHwVrComposerView.h",
- "android/dvr/composer/1.0/BnHwVrComposerView.h",
- "android/dvr/composer/1.0/BpHwVrComposerView.h",
- "android/dvr/composer/1.0/BsVrComposerView.h",
-
- "android/dvr/composer/1.0/IVrComposerCallback.h",
- "android/dvr/composer/1.0/IHwVrComposerCallback.h",
- "android/dvr/composer/1.0/BnHwVrComposerCallback.h",
- "android/dvr/composer/1.0/BpHwVrComposerCallback.h",
- "android/dvr/composer/1.0/BsVrComposerCallback.h",
],
}
diff --git a/services/vr/vr_window_manager/composer/1.0/IVrComposerCallback.hal b/services/vr/vr_window_manager/composer/1.0/IVrComposerCallback.hal
deleted file mode 100644
index 6e7255e..0000000
--- a/services/vr/vr_window_manager/composer/1.0/IVrComposerCallback.hal
+++ /dev/null
@@ -1,18 +0,0 @@
-package android.dvr.composer@1.0;
-
-import android.hardware.graphics.composer@2.1::IComposerClient;
-
-interface IVrComposerCallback {
- struct Layer {
- handle buffer;
- handle fence;
- android.hardware.graphics.composer@2.1::IComposerClient.Rect display_frame;
- android.hardware.graphics.composer@2.1::IComposerClient.FRect crop;
- android.hardware.graphics.composer@2.1::IComposerClient.BlendMode blend_mode;
- float alpha;
- uint32_t type;
- uint32_t app_id;
- };
-
- onNewFrame(vec<Layer> frame);
-};
diff --git a/services/vr/vr_window_manager/composer/1.0/IVrComposerView.hal b/services/vr/vr_window_manager/composer/1.0/IVrComposerView.hal
deleted file mode 100644
index e16131a..0000000
--- a/services/vr/vr_window_manager/composer/1.0/IVrComposerView.hal
+++ /dev/null
@@ -1,9 +0,0 @@
-package android.dvr.composer@1.0;
-
-import IVrComposerCallback;
-
-interface IVrComposerView {
- registerCallback(IVrComposerCallback callback);
-
- releaseFrame();
-};
diff --git a/services/vr/vr_window_manager/composer/Android.bp b/services/vr/vr_window_manager/composer/Android.bp
index 08c105c..7c8bb86 100644
--- a/services/vr/vr_window_manager/composer/Android.bp
+++ b/services/vr/vr_window_manager/composer/Android.bp
@@ -6,7 +6,6 @@
name: "libvrhwc",
srcs: [
- "impl/sync_timeline.cpp",
"impl/vr_composer_view.cpp",
"impl/vr_hwc.cpp",
"impl/vr_composer_client.cpp",
@@ -33,11 +32,6 @@
export_include_dirs: ["."],
- include_dirs: [
- // Access to software sync timeline.
- "system/core/libsync",
- ],
-
cflags: [
"-DLOG_TAG=\"vrhwc\"",
],
diff --git a/services/vr/vr_window_manager/composer/impl/sync_timeline.cpp b/services/vr/vr_window_manager/composer/impl/sync_timeline.cpp
deleted file mode 100644
index e63ed26..0000000
--- a/services/vr/vr_window_manager/composer/impl/sync_timeline.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2016 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 "sync_timeline.h"
-
-#include <sys/cdefs.h>
-#include <sw_sync.h>
-#include <unistd.h>
-
-namespace android {
-namespace dvr {
-
-SyncTimeline::SyncTimeline() {}
-
-SyncTimeline::~SyncTimeline() {}
-
-bool SyncTimeline::Initialize() {
- timeline_fd_.reset(sw_sync_timeline_create());
- return timeline_fd_ >= 0;
-}
-
-int SyncTimeline::CreateFence(int time) {
- return sw_sync_fence_create(timeline_fd_.get(), "dummy fence", time);
-}
-
-bool SyncTimeline::IncrementTimeline() {
- return sw_sync_timeline_inc(timeline_fd_.get(), 1) == 0;
-}
-
-} // namespace dvr
-} // namespace android
diff --git a/services/vr/vr_window_manager/composer/impl/sync_timeline.h b/services/vr/vr_window_manager/composer/impl/sync_timeline.h
deleted file mode 100644
index 945acbd..0000000
--- a/services/vr/vr_window_manager/composer/impl/sync_timeline.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2016 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 VR_WINDOW_MANAGER_COMPOSER_IMPL_SYNC_TIMELINE_H_
-#define VR_WINDOW_MANAGER_COMPOSER_IMPL_SYNC_TIMELINE_H_
-
-#include <android-base/unique_fd.h>
-
-namespace android {
-namespace dvr {
-
-// TODO(dnicoara): Remove this and move to EGL based fences.
-class SyncTimeline {
- public:
- SyncTimeline();
- ~SyncTimeline();
-
- bool Initialize();
-
- int CreateFence(int time);
- bool IncrementTimeline();
-
- private:
- base::unique_fd timeline_fd_;
-
- SyncTimeline(const SyncTimeline&) = delete;
- void operator=(const SyncTimeline&) = delete;
-};
-
-} // namespace dvr
-} // namespace android
-
-#endif // VR_WINDOW_MANAGER_COMPOSER_IMPL_SYNC_TIMELINE_H_
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
index 1096a37..299e8f1 100644
--- a/services/vr/vr_window_manager/composer/impl/vr_composer_view.cpp
+++ b/services/vr/vr_window_manager/composer/impl/vr_composer_view.cpp
@@ -16,19 +16,12 @@
composer_view_->RegisterObserver(this);
}
-void VrComposerView::ReleaseFrame() {
- LOG_ALWAYS_FATAL_IF(!composer_view_, "VrComposerView not initialized");
- composer_view_->ReleaseFrame();
-}
-
-void VrComposerView::OnNewFrame(const ComposerView::Frame& frame) {
+base::unique_fd VrComposerView::OnNewFrame(const ComposerView::Frame& frame) {
std::lock_guard<std::mutex> guard(mutex_);
- if (!callback_.get()) {
- ReleaseFrame();
- return;
- }
+ if (!callback_.get())
+ return base::unique_fd();
- callback_->OnNewFrame(frame);
+ return callback_->OnNewFrame(frame);
}
} // namespace dvr
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
index 5a938e9..8c5ee1f 100644
--- a/services/vr/vr_window_manager/composer/impl/vr_composer_view.h
+++ b/services/vr/vr_window_manager/composer/impl/vr_composer_view.h
@@ -13,7 +13,7 @@
class Callback {
public:
virtual ~Callback() = default;
- virtual void OnNewFrame(const ComposerView::Frame& frame) = 0;
+ virtual base::unique_fd OnNewFrame(const ComposerView::Frame& frame) = 0;
};
VrComposerView(std::unique_ptr<Callback> callback);
@@ -21,10 +21,8 @@
void Initialize(ComposerView* composer_view);
- void ReleaseFrame();
-
// ComposerView::Observer
- void OnNewFrame(const ComposerView::Frame& frame) override;
+ base::unique_fd OnNewFrame(const ComposerView::Frame& frame) override;
private:
ComposerView* composer_view_;
diff --git a/services/vr/vr_window_manager/composer/impl/vr_hwc.cpp b/services/vr/vr_window_manager/composer/impl/vr_hwc.cpp
index 264ee1c..6a78c98 100644
--- a/services/vr/vr_window_manager/composer/impl/vr_hwc.cpp
+++ b/services/vr/vr_window_manager/composer/impl/vr_hwc.cpp
@@ -21,7 +21,6 @@
#include <mutex>
-#include "sync_timeline.h"
#include "vr_composer_client.h"
using namespace android::hardware::graphics::common::V1_0;
@@ -86,8 +85,6 @@
HwcDisplay::~HwcDisplay() {}
-bool HwcDisplay::Initialize() { return hwc_timeline_.Initialize(); }
-
bool HwcDisplay::SetClientTarget(const native_handle_t* handle,
base::unique_fd fence) {
if (handle)
@@ -105,14 +102,14 @@
HwcLayer* HwcDisplay::GetLayer(Layer id) {
for (size_t i = 0; i < layers_.size(); ++i)
- if (layers_[i].id == id) return &layers_[i];
+ if (layers_[i].info.id == id) return &layers_[i];
return nullptr;
}
bool HwcDisplay::DestroyLayer(Layer id) {
for (auto it = layers_.begin(); it != layers_.end(); ++it) {
- if (it->id == id) {
+ if (it->info.id == id) {
layers_.erase(it);
return true;
}
@@ -148,7 +145,7 @@
for (size_t i = 0; i < layers_.size(); ++i) {
if (i >= first_client_layer && i <= last_client_layer) {
if (layers_[i].composition_type != IComposerClient::Composition::CLIENT) {
- layer_ids->push_back(layers_[i].id);
+ layer_ids->push_back(layers_[i].info.id);
types->push_back(IComposerClient::Composition::CLIENT);
layers_[i].composition_type = IComposerClient::Composition::CLIENT;
}
@@ -157,7 +154,7 @@
}
if (layers_[i].composition_type != IComposerClient::Composition::DEVICE) {
- layer_ids->push_back(layers_[i].id);
+ layer_ids->push_back(layers_[i].info.id);
types->push_back(IComposerClient::Composition::DEVICE);
layers_[i].composition_type = IComposerClient::Composition::DEVICE;
}
@@ -205,26 +202,18 @@
return Error::BAD_LAYER;
}
- // Increment the time the fence is signalled every time we get the
- // presentation frame. This ensures that calling ReleaseFrame() only affects
- // the current frame.
- fence_time_++;
out_frames->swap(frame);
return Error::NONE;
}
-void HwcDisplay::GetReleaseFences(int* present_fence,
- std::vector<Layer>* layer_ids,
- std::vector<int>* fences) {
- *present_fence = hwc_timeline_.CreateFence(fence_time_);
- for (const auto& layer : layers_) {
- layer_ids->push_back(layer.id);
- fences->push_back(hwc_timeline_.CreateFence(fence_time_));
- }
-}
+std::vector<Layer> HwcDisplay::UpdateLastFrameAndGetLastFrameLayers() {
+ std::vector<Layer> last_frame_layers;
+ last_frame_layers.swap(last_frame_layers_ids_);
-void HwcDisplay::ReleaseFrame() {
- hwc_timeline_.IncrementTimeline();
+ for (const auto& layer : layers_)
+ last_frame_layers_ids_.push_back(layer.info.id);
+
+ return last_frame_layers;
}
////////////////////////////////////////////////////////////////////////////////
@@ -234,8 +223,6 @@
VrHwc::~VrHwc() {}
-bool VrHwc::Initialize() { return display_.Initialize(); }
-
bool VrHwc::hasCapability(Capability capability) const { return false; }
void VrHwc::removeClient() {
@@ -270,7 +257,7 @@
std::lock_guard<std::mutex> guard(mutex_);
HwcLayer* layer = display_.CreateLayer();
- *outLayer = layer->id;
+ *outLayer = layer->info.id;
return Error::NONE;
}
@@ -456,24 +443,33 @@
std::vector<Layer>* outLayers,
std::vector<int32_t>* outReleaseFences) {
*outPresentFence = -1;
+ outLayers->clear();
+ outReleaseFences->clear();
+
if (display != kDefaultDisplayId) {
return Error::BAD_DISPLAY;
}
std::vector<ComposerView::ComposerLayer> frame;
- {
- std::lock_guard<std::mutex> guard(mutex_);
- Error status = display_.GetFrame(&frame);
- if (status != Error::NONE)
- return status;
+ std::vector<Layer> last_frame_layers;
+ std::lock_guard<std::mutex> guard(mutex_);
+ Error status = display_.GetFrame(&frame);
+ if (status != Error::NONE)
+ return status;
- display_.GetReleaseFences(outPresentFence, outLayers, outReleaseFences);
- }
+ last_frame_layers = display_.UpdateLastFrameAndGetLastFrameLayers();
+ base::unique_fd fence;
if (observer_)
- observer_->OnNewFrame(frame);
- else
- ReleaseFrame();
+ fence = observer_->OnNewFrame(frame);
+
+ if (fence.get() < 0)
+ return Error::NONE;
+
+ *outPresentFence = dup(fence.get());
+ outLayers->swap(last_frame_layers);
+ for (size_t i = 0; i < outLayers->size(); ++i)
+ outReleaseFences->push_back(dup(fence.get()));
return Error::NONE;
}
@@ -669,11 +665,6 @@
observer_ = nullptr;
}
-void VrHwc::ReleaseFrame() {
- std::lock_guard<std::mutex> guard(mutex_);
- display_.ReleaseFrame();
-}
-
ComposerView* GetComposerViewFromIComposer(
hardware::graphics::composer::V2_1::IComposer* composer) {
return static_cast<VrHwc*>(composer);
diff --git a/services/vr/vr_window_manager/composer/impl/vr_hwc.h b/services/vr/vr_window_manager/composer/impl/vr_hwc.h
index 9450097..df09687 100644
--- a/services/vr/vr_window_manager/composer/impl/vr_hwc.h
+++ b/services/vr/vr_window_manager/composer/impl/vr_hwc.h
@@ -16,6 +16,7 @@
#ifndef VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_HWC_H_
#define VR_WINDOW_MANAGER_COMPOSER_IMPL_VR_HWC_H_
+#include <android-base/unique_fd.h>
#include <android/hardware/graphics/composer/2.1/IComposer.h>
#include <ComposerBase.h>
#include <ui/Fence.h>
@@ -24,8 +25,6 @@
#include <mutex>
-#include "sync_timeline.h"
-
using namespace android::hardware::graphics::common::V1_0;
using namespace android::hardware::graphics::composer::V2_1;
@@ -57,6 +56,7 @@
// TODO(dnicoara): Add all layer properties. For now just the basics to get
// it going.
+ Layer id;
sp<GraphicBuffer> buffer;
sp<Fence> fence;
Recti display_frame;
@@ -75,25 +75,23 @@
// Returns a list of layers that need to be shown together. Layers are
// returned in z-order, with the lowest layer first.
- virtual void OnNewFrame(const Frame& frame) = 0;
+ virtual base::unique_fd OnNewFrame(const Frame& frame) = 0;
};
virtual ~ComposerView() {}
virtual void RegisterObserver(Observer* observer) = 0;
virtual void UnregisterObserver(Observer* observer) = 0;
-
- // Called to release the oldest frame received by the observer.
- virtual void ReleaseFrame() = 0;
};
struct HwcLayer {
using Composition =
hardware::graphics::composer::V2_1::IComposerClient::Composition;
- HwcLayer(Layer new_id) : id(new_id) {}
+ HwcLayer(Layer new_id) {
+ info.id = new_id;
+ }
- Layer id;
Composition composition_type;
uint32_t z_order;
ComposerView::ComposerLayer info;
@@ -104,8 +102,6 @@
HwcDisplay();
~HwcDisplay();
- bool Initialize();
-
HwcLayer* CreateLayer();
bool DestroyLayer(Layer id);
HwcLayer* GetLayer(Layer id);
@@ -118,10 +114,7 @@
Error GetFrame(std::vector<ComposerView::ComposerLayer>* out_frame);
- void GetReleaseFences(int* present_fence, std::vector<Layer>* layer_ids,
- std::vector<int>* fences);
-
- void ReleaseFrame();
+ std::vector<Layer> UpdateLastFrameAndGetLastFrameLayers();
private:
// The client target buffer and the associated fence.
@@ -132,19 +125,11 @@
// List of currently active layers.
std::vector<HwcLayer> layers_;
+ std::vector<Layer> last_frame_layers_ids_;
+
// Layer ID generator.
uint64_t layer_ids_ = 1;
- // Creates software sync fences used to signal releasing frames.
- SyncTimeline hwc_timeline_;
-
- // Keeps track of the current fence time. Used in conjunction with
- // |hwc_timeline_| to properly signal frame release times. Allows the observer
- // to receive multiple presentation frames without calling ReleaseFrame() in
- // between each presentation. When the observer is ready to release a frame
- // only the oldest presentation frame is affected by the release.
- int fence_time_ = 0;
-
HwcDisplay(const HwcDisplay&) = delete;
void operator=(const HwcDisplay&) = delete;
};
@@ -154,8 +139,6 @@
VrHwc();
~VrHwc() override;
- bool Initialize();
-
bool hasCapability(Capability capability) const;
Error setLayerInfo(Display display, Layer layer, uint32_t type,
@@ -246,7 +229,6 @@
// ComposerView:
void RegisterObserver(Observer* observer) override;
void UnregisterObserver(Observer* observer) override;
- void ReleaseFrame() override;
private:
wp<VrComposerClient> client_;
diff --git a/services/vr/vr_window_manager/hwc_callback.cpp b/services/vr/vr_window_manager/hwc_callback.cpp
index d3cd38c..05ec64a 100644
--- a/services/vr/vr_window_manager/hwc_callback.cpp
+++ b/services/vr/vr_window_manager/hwc_callback.cpp
@@ -38,7 +38,7 @@
HwcCallback::~HwcCallback() {
}
-void HwcCallback::OnNewFrame(const ComposerView::Frame& frame) {
+base::unique_fd HwcCallback::OnNewFrame(const ComposerView::Frame& frame) {
std::vector<HwcLayer> hwc_frame(frame.size());
for (size_t i = 0; i < frame.size(); ++i) {
hwc_frame[i] = HwcLayer{
@@ -53,7 +53,8 @@
};
}
- client_->OnFrame(std::make_unique<Frame>(std::move(hwc_frame)));
+ return client_->OnFrame(
+ std::make_unique<Frame>(std::move(hwc_frame)));
}
HwcCallback::Frame::Frame(std::vector<HwcLayer>&& layers)
diff --git a/services/vr/vr_window_manager/hwc_callback.h b/services/vr/vr_window_manager/hwc_callback.h
index d4d6e66..be56856 100644
--- a/services/vr/vr_window_manager/hwc_callback.h
+++ b/services/vr/vr_window_manager/hwc_callback.h
@@ -6,6 +6,7 @@
#include <mutex>
#include <vector>
+#include <android-base/unique_fd.h>
#include <impl/vr_composer_view.h>
#include <impl/vr_hwc.h>
@@ -24,7 +25,8 @@
struct HwcLayer {
enum LayerType : uint32_t {
// These are from frameworks/base/core/java/android/view/WindowManager.java
- kUndefinedWindow = 0,
+ kSurfaceFlingerLayer = 0,
+ kUndefinedWindow = ~0U,
kFirstApplicationWindow = 1,
kLastApplicationWindow = 99,
kFirstSubWindow = 1000,
@@ -41,6 +43,19 @@
// Always skip the following layer types
case kNavigationBar:
case kStatusBar:
+ case kSurfaceFlingerLayer:
+ case kUndefinedWindow:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ // This is a layer that provides some other functionality, eg dim layer.
+ // We use this to determine the point at which layers are "on top".
+ bool is_extra_layer() const {
+ switch(type) {
+ case kSurfaceFlingerLayer:
case kUndefinedWindow:
return true;
default:
@@ -79,14 +94,15 @@
class Client {
public:
virtual ~Client() {}
- virtual void OnFrame(std::unique_ptr<Frame>) = 0;
+ virtual base::unique_fd OnFrame(std::unique_ptr<Frame>) = 0;
};
explicit HwcCallback(Client* client);
~HwcCallback() override;
private:
- void OnNewFrame(const ComposerView::Frame& frame) override;
+ base::unique_fd OnNewFrame(const ComposerView::Frame& frame) override;
+
Client *client_;
HwcCallback(const HwcCallback&) = delete;
diff --git a/services/vr/vr_window_manager/shell_view.cpp b/services/vr/vr_window_manager/shell_view.cpp
index 84b8467..7321ed0 100644
--- a/services/vr/vr_window_manager/shell_view.cpp
+++ b/services/vr/vr_window_manager/shell_view.cpp
@@ -195,7 +195,8 @@
uint32_t vr_app) {
auto& layers = frame.layers();
- // We assume the first two layers are the VR app.
+ // We assume the first two layers are the VR app. In the case of a 2D app,
+ // there will be the app + at least one system layer so this is still safe.
if (layers.size() < kVRAppLayerCount)
return ViewMode::Hidden;
@@ -203,19 +204,23 @@
layers[1].appid != layers[0].appid) {
if (layers[1].appid != layers[0].appid && layers[0].appid) {
// This might be a 2D app.
+ // If a dim layer exists afterwards it is much more likely that this is
+ // actually an app launch artifact.
+ for (size_t i = 2; i < layers.size(); i++) {
+ if (layers[i].is_extra_layer())
+ return ViewMode::Hidden;
+ }
return ViewMode::App;
}
return ViewMode::Hidden;
}
- // If a non-VR-app, non-skipped layer appears, show.
size_t index = kVRAppLayerCount;
// Now, find a dim layer if it exists.
// If it does, ignore any layers behind it for visibility determination.
for (size_t i = index; i < layers.size(); i++) {
- if (layers[i].appid == 0) {
+ if (layers[i].appid == HwcCallback::HwcLayer::kSurfaceFlingerLayer) {
index = i + 1;
- break;
}
}
@@ -319,10 +324,6 @@
frame.frame->Finish() == HwcCallback::FrameStatus::kFinished) {
current_frame_ = std::move(frame);
pending_frames_.pop_front();
-
- for(int i = 0; i < skipped_frame_count_ + 1; i++)
- surface_flinger_view_->ReleaseFrame();
- skipped_frame_count_ = 0;
}
}
}
@@ -392,7 +393,7 @@
return true;
}
-void ShellView::OnFrame(std::unique_ptr<HwcCallback::Frame> frame) {
+base::unique_fd ShellView::OnFrame(std::unique_ptr<HwcCallback::Frame> frame) {
ViewMode visibility =
CalculateVisibilityFromLayerConfig(*frame.get(), current_vr_app_);
@@ -409,7 +410,6 @@
pending_frames_.emplace_back(std::move(frame), visibility);
if (pending_frames_.size() > kMaximumPendingFrames) {
- skipped_frame_count_++;
pending_frames_.pop_front();
}
@@ -424,9 +424,10 @@
// so give it a kick.
if (visibility != ViewMode::Hidden &&
current_frame_.visibility == ViewMode::Hidden) {
- QueueTask(MainThreadTask::EnteringVrMode);
QueueTask(MainThreadTask::Show);
}
+
+ return base::unique_fd(dup(release_fence_.get()));
}
bool ShellView::IsHit(const vec3& view_location, const vec3& view_direction,
@@ -518,6 +519,20 @@
DrawIme();
}
+
+ EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ EGLSyncKHR sync = eglCreateSyncKHR(display, EGL_SYNC_NATIVE_FENCE_ANDROID,
+ nullptr);
+ if (sync != EGL_NO_SYNC_KHR) {
+ // Need to flush in order to get the fence FD.
+ glFlush();
+ base::unique_fd fence(eglDupNativeFenceFDANDROID(display, sync));
+ eglDestroySyncKHR(display, sync);
+ UpdateReleaseFence(std::move(fence));
+ } else {
+ ALOGE("Failed to create sync fence");
+ UpdateReleaseFence(base::unique_fd());
+ }
}
void ShellView::DrawIme() {
@@ -688,10 +703,7 @@
}
bool ShellView::InitializeTouch() {
- virtual_touchpad_ =
- android::interface_cast<android::dvr::IVirtualTouchpadService>(
- android::defaultServiceManager()->getService(
- android::String16("virtual_touchpad")));
+ virtual_touchpad_ = VirtualTouchpadClient::Create();
if (!virtual_touchpad_.get()) {
ALOGE("Failed to connect to virtual touchpad");
return false;
@@ -708,12 +720,12 @@
}
}
- const android::binder::Status status = virtual_touchpad_->touch(
+ const android::status_t status = virtual_touchpad_->Touch(
hit_location_in_window_coord_.x() / size_.x(),
hit_location_in_window_coord_.y() / size_.y(),
is_touching_ ? 1.0f : 0.0f);
- if (!status.isOk()) {
- ALOGE("touch failed: %s", status.toString8().string());
+ if (status != OK) {
+ ALOGE("touch failed: %d", status);
}
}
@@ -735,14 +747,18 @@
return false;
}
- const android::binder::Status status =
- virtual_touchpad_->buttonState(touchpad_buttons_);
- if (!status.isOk()) {
- ALOGE("touchpad button failed: %d %s", touchpad_buttons_,
- status.toString8().string());
+ const android::status_t status =
+ virtual_touchpad_->ButtonState(touchpad_buttons_);
+ if (status != OK) {
+ ALOGE("touchpad button failed: %d %d", touchpad_buttons_, status);
}
return true;
}
+void ShellView::UpdateReleaseFence(base::unique_fd fence) {
+ std::lock_guard<std::mutex> guard(pending_frame_mutex_);
+ release_fence_ = std::move(fence);
+}
+
} // namespace dvr
} // namespace android
diff --git a/services/vr/vr_window_manager/shell_view.h b/services/vr/vr_window_manager/shell_view.h
index 39b5451..c477669 100644
--- a/services/vr/vr_window_manager/shell_view.h
+++ b/services/vr/vr_window_manager/shell_view.h
@@ -3,10 +3,10 @@
#include <private/dvr/graphics/mesh.h>
#include <private/dvr/graphics/shader_program.h>
-#include <android/dvr/IVirtualTouchpadService.h>
#include <deque>
+#include "VirtualTouchpadClient.h"
#include "application.h"
#include "reticle.h"
#include "shell_view_binder_interface.h"
@@ -69,16 +69,15 @@
void AdvanceFrame();
+ void UpdateReleaseFence(base::unique_fd fence);
+
// HwcCallback::Client:
- void OnFrame(std::unique_ptr<HwcCallback::Frame> frame) override;
+ base::unique_fd OnFrame(std::unique_ptr<HwcCallback::Frame> frame) override;
std::unique_ptr<ShaderProgram> program_;
std::unique_ptr<ShaderProgram> overlay_program_;
std::unique_ptr<ShaderProgram> controller_program_;
- // This starts at -1 so we don't call ReleaseFrame for the first frame.
- int skipped_frame_count_ = -1;
-
uint32_t current_vr_app_;
// Used to center the scene when the shell becomes visible.
@@ -91,7 +90,7 @@
std::unique_ptr<SurfaceFlingerView> surface_flinger_view_;
std::unique_ptr<Reticle> reticle_;
- sp<IVirtualTouchpadService> virtual_touchpad_;
+ sp<VirtualTouchpad> virtual_touchpad_;
std::vector<TextureLayer> textures_;
TextureLayer ime_texture_;
@@ -126,6 +125,8 @@
mat4 controller_translate_;
+ base::unique_fd release_fence_;
+
ShellView(const ShellView&) = delete;
void operator=(const ShellView&) = delete;
};
diff --git a/services/vr/vr_window_manager/surface_flinger_view.cpp b/services/vr/vr_window_manager/surface_flinger_view.cpp
index d42d3ff..63bc143 100644
--- a/services/vr/vr_window_manager/surface_flinger_view.cpp
+++ b/services/vr/vr_window_manager/surface_flinger_view.cpp
@@ -84,9 +84,5 @@
return true;
}
-void SurfaceFlingerView::ReleaseFrame() {
- vr_composer_view_->ReleaseFrame();
-}
-
} // namespace dvr
} // namespace android
diff --git a/services/vr/vr_window_manager/surface_flinger_view.h b/services/vr/vr_window_manager/surface_flinger_view.h
index 9c16192..7370299 100644
--- a/services/vr/vr_window_manager/surface_flinger_view.h
+++ b/services/vr/vr_window_manager/surface_flinger_view.h
@@ -36,8 +36,6 @@
TextureLayer* ime_layer, bool debug,
bool skip_first_layer) const;
- void ReleaseFrame();
-
private:
sp<IComposer> vr_hwcomposer_;
std::unique_ptr<VrComposerView> vr_composer_view_;
diff --git a/vulkan/api/platform.api b/vulkan/api/platform.api
index fb8e3ce..b82cbb4 100644
--- a/vulkan/api/platform.api
+++ b/vulkan/api/platform.api
@@ -49,4 +49,5 @@
@internal type void* HINSTANCE
@internal type void* HWND
@internal type void* HANDLE
+@internal type u32 DWORD
@internal class SECURITY_ATTRIBUTES {}
diff --git a/vulkan/api/vulkan.api b/vulkan/api/vulkan.api
index eed44ad..cfeeeef 100644
--- a/vulkan/api/vulkan.api
+++ b/vulkan/api/vulkan.api
@@ -45,118 +45,154 @@
// API keyword, but needs special handling by some templates
define NULL_HANDLE 0
+// 1
@extension("VK_KHR_surface") define VK_KHR_SURFACE_SPEC_VERSION 25
@extension("VK_KHR_surface") define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface"
+// 2
@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_SPEC_VERSION 68
@extension("VK_KHR_swapchain") define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain"
+// 3
@extension("VK_KHR_display") define VK_KHR_DISPLAY_SPEC_VERSION 21
@extension("VK_KHR_display") define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display"
+// 4
@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 9
@extension("VK_KHR_display_swapchain") define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain"
+// 5
@extension("VK_KHR_xlib_surface") define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6
@extension("VK_KHR_xlib_surface") define VK_KHR_XLIB_SURFACE_NAME "VK_KHR_xlib_surface"
+// 6
@extension("VK_KHR_xcb_surface") define VK_KHR_XCB_SURFACE_SPEC_VERSION 6
@extension("VK_KHR_xcb_surface") define VK_KHR_XCB_SURFACE_NAME "VK_KHR_xcb_surface"
+// 7
@extension("VK_KHR_wayland_surface") define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 5
@extension("VK_KHR_wayland_surface") define VK_KHR_WAYLAND_SURFACE_NAME "VK_KHR_wayland_surface"
+// 8
@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_SPEC_VERSION 4
@extension("VK_KHR_mir_surface") define VK_KHR_MIR_SURFACE_NAME "VK_KHR_mir_surface"
+// 9
@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6
@extension("VK_KHR_android_surface") define VK_KHR_ANDROID_SURFACE_NAME "VK_KHR_android_surface"
+// 10
@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_SPEC_VERSION 5
@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_NAME "VK_KHR_win32_surface"
-@extension("VK_KHR_incremental_present") define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 1
-@extension("VK_KHR_incremental_present") define VK_KHR_INCREMENTAL_PRESENT_NAME "VK_KHR_incremental_present"
-
-@extension("VK_ANDROID_native_buffer") define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 6
+// 11
+@extension("VK_ANDROID_native_buffer") define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 7
@extension("VK_ANDROID_native_buffer") define VK_ANDROID_NATIVE_BUFFER_NAME "VK_ANDROID_native_buffer"
-@extension("VK_GOOGLE_display_timing") define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1
-@extension("VK_GOOGLE_display_timing") define VK_GOOGLE_DISPLAY_TIMING_NAME "VK_GOOGLE_display_timing"
-
+// 12
@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_SPEC_VERSION 4
@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_NAME "VK_EXT_debug_report"
+// 13
@extension("VK_NV_glsl_shader") define VK_NV_GLSL_SHADER_SPEC_VERSION 1
@extension("VK_NV_glsl_shader") define VK_NV_GLSL_SHADER_NAME "VK_NV_glsl_shader"
+// 15
@extension("VK_KHR_sampler_mirror_clamp_to_edge") define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1
@extension("VK_KHR_sampler_mirror_clamp_to_edge") define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_NAME "VK_KHR_sampler_mirror_clamp_to_edge"
+// 16
@extension("VK_IMG_filter_cubic") define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1
@extension("VK_IMG_filter_cubic") define VK_IMG_FILTER_CUBIC_NAME "VK_IMG_filter_cubic"
+// 19
@extension("VK_AMD_rasterization_order") define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1
@extension("VK_AMD_rasterization_order") define VK_AMD_RASTERIZATION_ORDER_NAME "VK_AMD_rasterization_order"
+// 21
@extension("VK_AMD_shader_trinary_minmax") define VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION 1
@extension("VK_AMD_shader_trinary_minmax") define VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME "VK_AMD_shader_trinary_minmax"
+// 22
@extension("VK_AMD_shader_explicit_vertex_parameter") define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION 1
@extension("VK_AMD_shader_explicit_vertex_parameter") define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME "VK_AMD_shader_explicit_vertex_parameter"
+// 23
@extension("VK_EXT_debug_marker") define VK_EXT_DEBUG_MARKER_SPEC_VERSION 3
@extension("VK_EXT_debug_marker") define VK_EXT_DEBUG_MARKER_NAME "VK_EXT_debug_marker"
+// 26
@extension("VK_AMD_gcn_shader") define VK_AMD_GCN_SHADER_SPEC_VERSION 1
@extension("VK_AMD_gcn_shader") define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader"
+// 27
@extension("VK_NV_dedicated_allocation") define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1
@extension("VK_NV_dedicated_allocation") define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation"
-@extension("VK_KHR_get_physical_device_properties2") define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 1
-@extension("VK_KHR_get_physical_device_properties2") define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2"
-
-@extension("VK_AMD_draw_indirect_count") define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 1
-@extension("VK_AMD_draw_indirect_count") define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count"
-
-@extension("VK_AMD_negative_viewport_height") define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1
-@extension("VK_AMD_negative_viewport_height") define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height"
-
-@extension("VK_AMD_gpu_shader_half_float") define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 1
-@extension("VK_AMD_gpu_shader_half_float") define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float"
-
-@extension("VK_AMD_shader_ballot") define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1
-@extension("VK_AMD_shader_ballot") define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot"
-
+// 28
@extension("VK_IMG_format_pvrtc") define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1
@extension("VK_IMG_format_pvrtc") define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc"
+// 34
+@extension("VK_AMD_draw_indirect_count") define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 1
+@extension("VK_AMD_draw_indirect_count") define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count"
+
+// 36
+@extension("VK_AMD_negative_viewport_height") define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1
+@extension("VK_AMD_negative_viewport_height") define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height"
+
+// 37
+@extension("VK_AMD_gpu_shader_half_float") define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 1
+@extension("VK_AMD_gpu_shader_half_float") define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float"
+
+// 38
+@extension("VK_AMD_shader_ballot") define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1
+@extension("VK_AMD_shader_ballot") define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot"
+
+// 56
@extension("VK_NV_external_memory_capabilities") define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1
@extension("VK_NV_external_memory_capabilities") define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_NV_external_memory_capabilities"
+// 57
@extension("VK_NV_external_memory") define VK_NV_EXTERNAL_MEMORY_SPEC_VERSION 1
@extension("VK_NV_external_memory") define VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME "VK_NV_external_memory"
+// 58
@extension("VK_NV_external_memory_win32") define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
@extension("VK_NV_external_memory_win32") define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32"
+// 59
@extension("VK_NV_win32_keyed_mutex") define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 1
@extension("VK_NV_win32_keyed_mutex") define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex"
+// 60
+@extension("VK_KHR_get_physical_device_properties2") define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 1
+@extension("VK_KHR_get_physical_device_properties2") define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2"
+
+// 62
@extension("VK_EXT_validation_flags") define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 1
@extension("VK_EXT_validation_flags") define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags"
+// 85
+@extension("VK_KHR_incremental_present") define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 1
+@extension("VK_KHR_incremental_present") define VK_KHR_INCREMENTAL_PRESENT_NAME "VK_KHR_incremental_present"
+
+// 87
@extension("VK_NVX_device_generated_commands") define VK_NVX_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 1
@extension("VK_NVX_device_generated_commands") define VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME "VK_NVX_device_generated_commands"
+// 93
+@extension("VK_GOOGLE_display_timing") define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1
+@extension("VK_GOOGLE_display_timing") define VK_GOOGLE_DISPLAY_TIMING_NAME "VK_GOOGLE_display_timing"
+
+// 106
+@extension("VK_EXT_hdr_metadata") define VK_EXT_HDR_METADATA_SPEC_VERSION 1
+@extension("VK_EXT_hdr_metadata") define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata"
+
+// 112
@extension("VK_KHR_shared_presentable_image") define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1
@extension("VK_KHR_shared_presentable_image") define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image"
-@extension("VK_EXT_HDR_METADATA_SPEC_VERSION") define VK_EXT_HDR_METADATA_SPEC_VERSION 1
-@extension("VK_EXT_HDR_METADATA_EXTENSION_NAME") define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata"
-
-
/////////////
// Types //
/////////////
@@ -652,28 +688,14 @@
VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184,
//@extension("VK_IMG_format_pvrtc")
- VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000,
-
- //@extension("VK_IMG_format_pvrtc")
- VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001,
-
- //@extension("VK_IMG_format_pvrtc")
- VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002,
-
- //@extension("VK_IMG_format_pvrtc")
- VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003,
-
- //@extension("VK_IMG_format_pvrtc")
- VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004,
-
- //@extension("VK_IMG_format_pvrtc")
- VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005,
-
- //@extension("VK_IMG_format_pvrtc")
- VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006,
-
- //@extension("VK_IMG_format_pvrtc")
- VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007,
+ VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000,
+ VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001,
+ VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002,
+ VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003,
+ VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004,
+ VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005,
+ VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006,
+ VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007,
}
/// Structure type enumerant
@@ -763,6 +785,7 @@
//@extension("VK_ANDROID_native_buffer")
VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID = 1000010000,
VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID = 1000010001,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID = 1000010002,
//@extension("VK_GOOGLE_display_timing")
VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE = 1000092000,
@@ -775,87 +798,49 @@
//@extension("VK_EXT_debug_marker")
VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000,
-
- //@extension("VK_EXT_debug_marker")
VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001,
-
- //@extension("VK_EXT_debug_marker")
VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002,
//@extension("VK_NV_dedicated_allocation")
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000,
-
- //@extension("VK_NV_dedicated_allocation")
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001,
-
- //@extension("VK_NV_dedicated_allocation")
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002,
//@extension("VK_NV_external_memory")
- VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000,
-
- //@extension("VK_NV_external_memory")
- VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001,
+ VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000,
+ VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001,
//@extension("VK_NV_external_memory_win32")
- VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000,
-
- //@extension("VK_NV_external_memory_win32")
- VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057001,
+ VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000,
+ VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057001,
//@extension("VK_NV_win32_keyed_mutex")
VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = 1000058000,
//@extension("VK_KHR_get_physical_device_properties2")
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = 1000059000,
-
- //@extension("VK_KHR_get_physical_device_properties2")
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = 1000059001,
-
- //@extension("VK_KHR_get_physical_device_properties2")
- VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = 1000059002,
-
- //@extension("VK_KHR_get_physical_device_properties2")
- VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059003,
-
- //@extension("VK_KHR_get_physical_device_properties2")
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = 1000059004,
-
- //@extension("VK_KHR_get_physical_device_properties2")
- VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = 1000059005,
-
- //@extension("VK_KHR_get_physical_device_properties2")
- VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = 1000059006,
-
- //@extension("VK_KHR_get_physical_device_properties2")
- VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059007,
-
- //@extension("VK_KHR_get_physical_device_properties2")
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = 1000059000,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = 1000059001,
+ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = 1000059002,
+ VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059003,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = 1000059004,
+ VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = 1000059005,
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = 1000059006,
+ VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059007,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = 1000059008,
//@extension("VK_EXT_validation_flags")
- VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000,
+ VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000,
//@extension("VK_KHR_incremental_present")
- VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000,
+ VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000,
//@extension("VK_NVX_device_generated_commands")
- VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = 1000086000,
-
- //@extension("VK_NVX_device_generated_commands")
- VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX = 1000086001,
-
- //@extension("VK_NVX_device_generated_commands")
- VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX = 1000086002,
-
- //@extension("VK_NVX_device_generated_commands")
- VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX = 1000086003,
-
- //@extension("VK_NVX_device_generated_commands")
- VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX = 1000086004,
-
- //@extension("VK_NVX_device_generated_commands")
- VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX = 1000086005,
+ VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = 1000086000,
+ VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX = 1000086001,
+ VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX = 1000086002,
+ VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX = 1000086003,
+ VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX = 1000086004,
+ VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX = 1000086005,
}
enum VkSubpassContents {
@@ -941,7 +926,7 @@
@extension("VK_KHR_surface")
enum VkColorSpaceKHR {
VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0x00000000,
- VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT = 1000104001,
+ VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT = 1000104001,
VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104002,
VK_COLOR_SPACE_SCRGB_LINEAR_EXT = 1000104003,
VK_COLOR_SPACE_SCRGB_NONLINEAR_EXT = 1000104004,
@@ -1011,23 +996,23 @@
@extension("VK_NVX_device_generated_commands")
enum VkIndirectCommandsTokenTypeNVX {
- VK_INDIRECT_COMMANDS_TOKEN_PIPELINE_NVX = 0,
- VK_INDIRECT_COMMANDS_TOKEN_DESCRIPTOR_SET_NVX = 1,
- VK_INDIRECT_COMMANDS_TOKEN_INDEX_BUFFER_NVX = 2,
- VK_INDIRECT_COMMANDS_TOKEN_VERTEX_BUFFER_NVX = 3,
- VK_INDIRECT_COMMANDS_TOKEN_PUSH_CONSTANT_NVX = 4,
- VK_INDIRECT_COMMANDS_TOKEN_DRAW_INDEXED_NVX = 5,
- VK_INDIRECT_COMMANDS_TOKEN_DRAW_NVX = 6,
- VK_INDIRECT_COMMANDS_TOKEN_DISPATCH_NVX = 7,
+ VK_INDIRECT_COMMANDS_TOKEN_PIPELINE_NVX = 0,
+ VK_INDIRECT_COMMANDS_TOKEN_DESCRIPTOR_SET_NVX = 1,
+ VK_INDIRECT_COMMANDS_TOKEN_INDEX_BUFFER_NVX = 2,
+ VK_INDIRECT_COMMANDS_TOKEN_VERTEX_BUFFER_NVX = 3,
+ VK_INDIRECT_COMMANDS_TOKEN_PUSH_CONSTANT_NVX = 4,
+ VK_INDIRECT_COMMANDS_TOKEN_DRAW_INDEXED_NVX = 5,
+ VK_INDIRECT_COMMANDS_TOKEN_DRAW_NVX = 6,
+ VK_INDIRECT_COMMANDS_TOKEN_DISPATCH_NVX = 7,
}
@extension("VK_NVX_device_generated_commands")
enum VkObjectEntryTypeNVX {
- VK_OBJECT_ENTRY_DESCRIPTOR_SET_NVX = 0,
- VK_OBJECT_ENTRY_PIPELINE_NVX = 1,
- VK_OBJECT_ENTRY_INDEX_BUFFER_NVX = 2,
- VK_OBJECT_ENTRY_VERTEX_BUFFER_NVX = 3,
- VK_OBJECT_ENTRY_PUSH_CONSTANT_NVX = 4,
+ VK_OBJECT_ENTRY_DESCRIPTOR_SET_NVX = 0,
+ VK_OBJECT_ENTRY_PIPELINE_NVX = 1,
+ VK_OBJECT_ENTRY_INDEX_BUFFER_NVX = 2,
+ VK_OBJECT_ENTRY_VERTEX_BUFFER_NVX = 3,
+ VK_OBJECT_ENTRY_PUSH_CONSTANT_NVX = 4,
}
/////////////////
@@ -1082,8 +1067,6 @@
//@extension("VK_NVX_device_generated_commands")
VK_ACCESS_COMMAND_PROCESS_READ_BIT_NVX = 0x00020000,
-
- //@extension("VK_NVX_device_generated_commands")
VK_ACCESS_COMMAND_PROCESS_WRITE_BIT_NVX = 0x00040000,
}
@@ -1570,6 +1553,13 @@
//bitfield VkWin32SurfaceCreateFlagBitsKHR {
//}
+@extension("VK_ANDROID_native_buffer")
+type VkFlags VkSwapchainImageUsageFlagsANDROID
+@extension("VK_ANDROID_native_buffer")
+bitfield VkSwapchainImageUsageFlagBitsANDROID {
+ VK_SWAPCHAIN_IMAGE_USAGE_FLAGS_SHARED_BIT_ANDROID = 0x00000001,
+}
+
@extension("VK_EXT_debug_report")
type VkFlags VkDebugReportFlagsEXT
@extension("VK_EXT_debug_report")
@@ -1581,51 +1571,43 @@
VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
}
-@extension("VK_ANDROID_native_buffer")
-type VkFlags VkSwapchainImageUsageFlagsANDROID
-@extension("VK_ANDROID_native_buffer")
-bitfield VkSwapchainImageUsageFlagBitsANDROID {
- VK_SWAPCHAIN_IMAGE_USAGE_FLAGS_SHARED_BIT_ANDROID = 0x00000001,
-}
-
@extension("VK_NV_external_memory_capabilities")
type VkFlags VkExternalMemoryHandleTypeFlagsNV
@extension("VK_NV_external_memory_capabilities")
bitfield VkExternalMemoryHandleTypeFlagBitsNV {
- VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = 0x00000001,
- VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = 0x00000002,
- VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = 0x00000004,
- VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = 0x00000008,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = 0x00000001,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = 0x00000002,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = 0x00000004,
+ VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = 0x00000008,
}
@extension("VK_NV_external_memory_capabilities")
type VkFlags VkExternalMemoryFeatureFlagsNV
@extension("VK_NV_external_memory_capabilities")
bitfield VkExternalMemoryFeatureFlagBitsNV {
- VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = 0x00000001,
- VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = 0x00000002,
- VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = 0x00000004,
+ VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = 0x00000001,
+ VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = 0x00000002,
+ VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = 0x00000004,
}
@extension("VK_NVX_device_generated_commands")
type VkFlags VkIndirectCommandsLayoutUsageFlagsNVX
@extension("VK_NVX_device_generated_commands")
bitfield VkIndirectCommandsLayoutUsageFlagBitsNVX {
- VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX = 0x00000001,
- VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX = 0x00000002,
- VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX = 0x00000004,
- VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX = 0x00000008,
+ VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX = 0x00000001,
+ VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX = 0x00000002,
+ VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX = 0x00000004,
+ VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX = 0x00000008,
}
@extension("VK_NVX_device_generated_commands")
type VkFlags VkObjectEntryUsageFlagsNVX
@extension("VK_NVX_device_generated_commands")
bitfield VkObjectEntryUsageFlagBitsNVX {
- VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX = 0x00000001,
- VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX = 0x00000002,
+ VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX = 0x00000001,
+ VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX = 0x00000002,
}
-
//////////////////
// Structures //
//////////////////
@@ -2933,6 +2915,13 @@
VkSwapchainImageUsageFlagsANDROID flags
}
+@extension("VK_ANDROID_native_buffer")
+class VkPhysicalDevicePresentationPropertiesANDROID {
+ VkStructureType sType
+ void* pNext
+ VkBool32 sharedImage
+}
+
@extension("VK_GOOGLE_display_timing")
class VkRefreshCycleDurationGOOGLE {
u64 minRefreshDuration
@@ -3028,6 +3017,57 @@
VkBuffer buffer
}
+@extension("VK_NV_external_memory_capabilities")
+class VkExternalImageFormatPropertiesNV {
+ VkImageFormatProperties imageFormatProperties
+ VkExternalMemoryFeatureFlagsNV externalMemoryFeatures
+ VkExternalMemoryHandleTypeFlagsNV exportFromImportedHandleTypes
+ VkExternalMemoryHandleTypeFlagsNV compatibleHandleTypes
+}
+
+@extension("VK_NV_external_memory")
+class VkExternalMemoryImageCreateInfoNV {
+ VkStructureType sType
+ const void* pNext
+ VkExternalMemoryHandleTypeFlagsNV handleTypes
+}
+
+@extension("VK_NV_external_memory")
+class VkExportMemoryAllocateInfoNV {
+ VkStructureType sType
+ const void* pNext
+ VkExternalMemoryHandleTypeFlagsNV handleTypes
+}
+
+@extension("VK_NV_external_memory_win32")
+class VkImportMemoryWin32HandleInfoNV {
+ VkStructureType sType
+ const void* pNext
+ VkExternalMemoryHandleTypeFlagsNV handleType
+ platform.HANDLE handle
+}
+
+@extension("VK_NV_external_memory_win32")
+class VkExportMemoryWin32HandleInfoNV {
+ VkStructureType sType
+ const void* pNext
+ const platform.SECURITY_ATTRIBUTES* pAttributes
+ platform.DWORD dwAccess
+}
+
+@extension("VK_NV_win32_keyed_mutex")
+class VkWin32KeyedMutexAcquireReleaseInfoNV {
+ VkStructureType sType
+ const void* pNext
+ u32 acquireCount
+ const VkDeviceMemory* pAcquireSyncs
+ const u64* pAcquireKeys
+ const u32* pAcquireTimeoutMilliseconds
+ u32 releaseCount
+ const VkDeviceMemory* pReleaseSyncs
+ const u64* pReleaseKeys
+}
+
@extension("VK_KHR_get_physical_device_properties2")
class VkPhysicalDeviceFeatures2KHR {
VkStructureType sType
@@ -3099,78 +3139,6 @@
VkImageTiling tiling
}
-@extension("VK_KHR_incremental_present")
-class VkRectLayerKHR {
- VkOffset2D offset
- VkExtent2D extent
- u32 layer
-}
-
-@extension("VK_KHR_incremental_present")
-class VkPresentRegionKHR {
- u32 rectangleCount
- const VkRectLayerKHR* pRectangles
-}
-
-@extension("VK_KHR_incremental_present")
-class VkPresentRegionsKHR {
- VkStructureType sType
- const void* pNext
- u32 swapchainCount
- const VkPresentRegionKHR* pRegions
-}
-
-@extension("VK_NV_external_memory_capabilities")
-class VkExternalImageFormatPropertiesNV {
- VkImageFormatProperties imageFormatProperties
- VkExternalMemoryFeatureFlagsNV externalMemoryFeatures
- VkExternalMemoryHandleTypeFlagsNV exportFromImportedHandleTypes
- VkExternalMemoryHandleTypeFlagsNV compatibleHandleTypes
-}
-
-@extension("VK_NV_external_memory")
-class VkExternalMemoryImageCreateInfoNV {
- VkStructureType sType
- const void* pNext
- VkExternalMemoryHandleTypeFlagsNV handleTypes
-}
-
-@extension("VK_NV_external_memory")
-class VkExportMemoryAllocateInfoNV {
- VkStructureType sType
- const void* pNext
- VkExternalMemoryHandleTypeFlagsNV handleTypes
-}
-
-@extension("VK_NV_external_memory_win32")
-class VkImportMemoryWin32HandleInfoNV {
- VkStructureType sType
- const void* pNext
- VkExternalMemoryHandleTypeFlagsNV handleType
- platform.HANDLE handle
-}
-
-@extension("VK_NV_external_memory_win32")
-class VkExportMemoryWin32HandleInfoNV {
- VkStructureType sType
- const void* pNext
- const platform.SECURITY_ATTRIBUTES* pAttributes
- u32 dwAccess
-}
-
-@extension("VK_NV_win32_keyed_mutex")
-class VkWin32KeyedMutexAcquireReleaseInfoNV {
- VkStructureType sType
- const void* pNext
- u32 acquireCount
- const VkDeviceMemory* pAcquireSyncs
- const u64* pAcquireKeys
- const u32* pAcquireTimeoutMilliseconds
- u32 releaseCount
- const VkDeviceMemory* pReleaseSyncs
- const u64* pReleaseKeys
-}
-
@extension("VK_EXT_validation_flags")
class VkValidationFlagsEXT {
VkStructureType sType
@@ -3305,6 +3273,27 @@
VkShaderStageFlags stageFlags
}
+@extension("VK_KHR_incremental_present")
+class VkRectLayerKHR {
+ VkOffset2D offset
+ VkExtent2D extent
+ u32 layer
+}
+
+@extension("VK_KHR_incremental_present")
+class VkPresentRegionKHR {
+ u32 rectangleCount
+ const VkRectLayerKHR* pRectangles
+}
+
+@extension("VK_KHR_incremental_present")
+class VkPresentRegionsKHR {
+ VkStructureType sType
+ const void* pNext
+ u32 swapchainCount
+ const VkPresentRegionKHR* pRegions
+}
+
@extension("VK_EXT_hdr_metadata")
class VkXYColorEXT {
f32 x
@@ -3323,8 +3312,6 @@
f32 maxFrameAverageLightLevel
}
-
-
////////////////
// Commands //
////////////////
@@ -5997,6 +5984,50 @@
VkDebugMarkerMarkerInfoEXT* pMarkerInfo) {
}
+@extension("VK_AMD_draw_indirect_count")
+cmd void vkCmdDrawIndirectCountAMD(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkBuffer countBuffer,
+ VkDeviceSize countBufferOffset,
+ u32 maxDrawCount,
+ u32 stride) {
+}
+
+@extension("VK_AMD_draw_indirect_count")
+cmd void vkCmdDrawIndexedIndirectCountAMD(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkBuffer countBuffer,
+ VkDeviceSize countBufferOffset,
+ u32 maxDrawCount,
+ u32 stride) {
+}
+
+@extension("VK_NV_external_memory_capabilities")
+cmd VkResult vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
+ VkPhysicalDevice physicalDevice,
+ VkFormat format,
+ VkImageType type,
+ VkImageTiling tiling,
+ VkImageUsageFlags usage,
+ VkImageCreateFlags flags,
+ VkExternalMemoryHandleTypeFlagsNV externalHandleType,
+ VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties) {
+ return ?
+}
+
+@extension("VK_NV_external_memory_win32")
+cmd VkResult vkGetMemoryWin32HandleNV(
+ VkDevice device,
+ VkDeviceMemory memory,
+ VkExternalMemoryHandleTypeFlagsNV handleType,
+ platform.HANDLE* pHandle) {
+ return ?
+}
+
@extension("VK_KHR_get_physical_device_properties2")
cmd void vkGetPhysicalDeviceFeatures2KHR(
VkPhysicalDevice physicalDevice,
@@ -6045,64 +6076,20 @@
VkSparseImageFormatProperties2KHR* pProperties) {
}
-@extension("VK_AMD_draw_indirect_count")
-cmd void vkCmdDrawIndirectCountAMD(
- VkCommandBuffer commandBuffer,
- VkBuffer buffer,
- VkDeviceSize offset,
- VkBuffer countBuffer,
- VkDeviceSize countBufferOffset,
- u32 maxDrawCount,
- u32 stride) {
-}
-
-@extension("VK_AMD_draw_indirect_count")
-cmd void vkCmdDrawIndexedIndirectCountAMD(
- VkCommandBuffer commandBuffer,
- VkBuffer buffer,
- VkDeviceSize offset,
- VkBuffer countBuffer,
- VkDeviceSize countBufferOffset,
- u32 maxDrawCount,
- u32 stride) {
-}
-
-@extension("VK_NV_external_memory_capabilities")
-cmd VkResult vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
- VkPhysicalDevice physicalDevice,
- VkFormat format,
- VkImageType type,
- VkImageTiling tiling,
- VkImageUsageFlags usage,
- VkImageCreateFlags flags,
- VkExternalMemoryHandleTypeFlagsNV externalHandleType,
- VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties) {
- return ?
-}
-
-@extension("VK_NV_external_memory_win32")
-cmd VkResult vkGetMemoryWin32HandleNV(
- VkDevice device,
- VkDeviceMemory memory,
- VkExternalMemoryHandleTypeFlagsNV handleType,
- platform.HANDLE* pHandle) {
- return ?
-}
-
-@extension("VK_NV_external_memory_win32")
-cmd void vkCmdProcessCommandsNVX(
+@extension("VK_NVX_device_generated_commands")
+cmd void vkCmdProcessCommandsNVX(
VkCommandBuffer commandBuffer,
const VkCmdProcessCommandsInfoNVX* pProcessCommandsInfo) {
}
-@extension("VK_NV_external_memory_win32")
-cmd void vkCmdReserveSpaceForCommandsNVX(
+@extension("VK_NVX_device_generated_commands")
+cmd void vkCmdReserveSpaceForCommandsNVX(
VkCommandBuffer commandBuffer,
const VkCmdReserveSpaceForCommandsInfoNVX* pReserveSpaceInfo) {
}
-@extension("VK_NV_external_memory_win32")
-cmd VkResult vkCreateIndirectCommandsLayoutNVX(
+@extension("VK_NVX_device_generated_commands")
+cmd VkResult vkCreateIndirectCommandsLayoutNVX(
VkDevice device,
const VkIndirectCommandsLayoutCreateInfoNVX* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
@@ -6110,15 +6097,15 @@
return ?
}
-@extension("VK_NV_external_memory_win32")
-cmd void vkDestroyIndirectCommandsLayoutNVX(
+@extension("VK_NVX_device_generated_commands")
+cmd void vkDestroyIndirectCommandsLayoutNVX(
VkDevice device,
VkIndirectCommandsLayoutNVX indirectCommandsLayout,
const VkAllocationCallbacks* pAllocator) {
}
-@extension("VK_NV_external_memory_win32")
-cmd VkResult vkCreateObjectTableNVX(
+@extension("VK_NVX_device_generated_commands")
+cmd VkResult vkCreateObjectTableNVX(
VkDevice device,
const VkObjectTableCreateInfoNVX* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
@@ -6126,15 +6113,15 @@
return ?
}
-@extension("VK_NV_external_memory_win32")
-cmd void vkDestroyObjectTableNVX(
+@extension("VK_NVX_device_generated_commands")
+cmd void vkDestroyObjectTableNVX(
VkDevice device,
VkObjectTableNVX objectTable,
const VkAllocationCallbacks* pAllocator) {
}
-@extension("VK_NV_external_memory_win32")
-cmd VkResult vkRegisterObjectsNVX(
+@extension("VK_NVX_device_generated_commands")
+cmd VkResult vkRegisterObjectsNVX(
VkDevice device,
VkObjectTableNVX objectTable,
u32 objectCount,
@@ -6143,8 +6130,8 @@
return ?
}
-@extension("VK_NV_external_memory_win32")
-cmd VkResult vkUnregisterObjectsNVX(
+@extension("VK_NVX_device_generated_commands")
+cmd VkResult vkUnregisterObjectsNVX(
VkDevice device,
VkObjectTableNVX objectTable,
u32 objectCount,
@@ -6153,13 +6140,21 @@
return ?
}
-@extension("VK_NV_external_memory_win32")
-cmd void vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX(
+@extension("VK_NVX_device_generated_commands")
+cmd void vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX(
VkPhysicalDevice physicalDevice,
VkDeviceGeneratedCommandsFeaturesNVX* pFeatures,
VkDeviceGeneratedCommandsLimitsNVX* pLimits) {
}
+@extension("VK_EXT_hdr_metadata")
+cmd void vkSetHdrMetadataEXT(
+ VkDevice device,
+ u32 swapchainCount,
+ const VkSwapchainKHR* pSwapchains,
+ const VkHdrMetadataEXT* pMetadata) {
+}
+
@extension("VK_KHR_shared_presentable_image")
cmd VkResult vkGetSwapchainStatusKHR(
VkDevice device,
@@ -6167,15 +6162,6 @@
return ?
}
-@extension("VK_EXT_hdr_metadata")
-cmd void vkSetHdrMetadataEXT(
- VkDevice device,
- u32 swapchainCount,
- const VkSwapchainKHR* pSwapchains,
- const VkHdrMetadataEXT* pMetadata) {
-}
-
-
////////////////
// Validation //
////////////////
diff --git a/vulkan/include/vulkan/vk_android_native_buffer.h b/vulkan/include/vulkan/vk_android_native_buffer.h
index d7c5a07..43a9a9c 100644
--- a/vulkan/include/vulkan/vk_android_native_buffer.h
+++ b/vulkan/include/vulkan/vk_android_native_buffer.h
@@ -37,12 +37,13 @@
* backwards-compatibility support is temporary, and will likely be removed in
* (along with all gralloc0 support) in a future release.
*/
-#define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 6
+#define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 7
#define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME "VK_ANDROID_native_buffer"
#define VK_ANDROID_NATIVE_BUFFER_ENUM(type,id) ((type)(1000000000 + (1000 * (VK_ANDROID_NATIVE_BUFFER_EXTENSION_NUMBER - 1)) + (id)))
#define VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 0)
#define VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 1)
+#define VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID VK_ANDROID_NATIVE_BUFFER_ENUM(VkStructureType, 2)
typedef enum VkSwapchainImageUsageFlagBitsANDROID {
VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_ANDROID = 0x00000001,
@@ -75,6 +76,13 @@
VkSwapchainImageUsageFlagsANDROID usage;
} VkSwapchainImageCreateInfoANDROID;
+typedef struct {
+ VkStructureType sType; // must be VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID
+ const void* pNext;
+
+ VkBool32 sharedImage;
+} VkPhysicalDevicePresentationPropertiesANDROID;
+
// -- DEPRECATED in SPEC_VERSION 6 --
typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsageANDROID)(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
// -- ADDED in SPEC_VERSION 6 --
diff --git a/vulkan/include/vulkan/vk_platform.h b/vulkan/include/vulkan/vk_platform.h
index 610c723..2054447 100644
--- a/vulkan/include/vulkan/vk_platform.h
+++ b/vulkan/include/vulkan/vk_platform.h
@@ -53,7 +53,7 @@
#define VKAPI_PTR VKAPI_CALL
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
#error "Vulkan isn't supported for the 'armeabi' NDK ABI"
-#elif defined(__ANDROID__) && __ARM_ARCH >= 7 && __ARM_32BIT_STATE
+#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
// On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
// calling convention, i.e. float parameters are passed in registers. This
// is true even if the rest of the application passes floats on the stack,
@@ -94,9 +94,6 @@
// controls inclusion of the extension interfaces in vulkan.h.
#ifdef VK_USE_PLATFORM_ANDROID_KHR
-// FIXME: this forces a dependency on libandroid.so, we can't have that right now
-// because of circular dependencies. this will be resolved at a later time.
-//#include <android/native_window.h>
struct ANativeWindow;
#endif
diff --git a/vulkan/include/vulkan/vulkan.h b/vulkan/include/vulkan/vulkan.h
index 16f43e5..3c8ee1c 100644
--- a/vulkan/include/vulkan/vulkan.h
+++ b/vulkan/include/vulkan/vulkan.h
@@ -220,7 +220,6 @@
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000,
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001,
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002,
- VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000,
VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000,
VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001,
VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000,
@@ -236,6 +235,7 @@
VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059007,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = 1000059008,
VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000,
+ VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000,
VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = 1000086000,
VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX = 1000086001,
VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX = 1000086002,
@@ -3218,18 +3218,19 @@
typedef enum VkColorSpaceKHR {
VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0,
- VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT = 1000104001,
- VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104002,
- VK_COLOR_SPACE_SCRGB_LINEAR_EXT = 1000104003,
- VK_COLOR_SPACE_SCRGB_NONLINEAR_EXT = 1000104004,
- VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = 1000104005,
- VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104006,
- VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104007,
- VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104008,
- VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104009,
- VK_COLOR_SPACE_BT2020_NONLINEAR_EXT = 1000104010,
+ VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104001,
+ VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT = 1000104002,
+ VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104003,
+ VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = 1000104004,
+ VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104005,
+ VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104006,
+ VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104007,
+ VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104008,
+ VK_COLOR_SPACE_BT2020_170M_EXT = 1000104009,
+ VK_COLOR_SPACE_BT2020_ST2084_EXT = 1000104010,
VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011,
VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012,
+ VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013,
VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1),
@@ -3702,7 +3703,6 @@
#ifdef VK_USE_PLATFORM_ANDROID_KHR
#define VK_KHR_android_surface 1
-#include <android/native_window.h>
#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6
#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface"
@@ -3713,7 +3713,7 @@
VkStructureType sType;
const void* pNext;
VkAndroidSurfaceCreateFlagsKHR flags;
- ANativeWindow* window;
+ struct ANativeWindow* window;
} VkAndroidSurfaceCreateInfoKHR;
@@ -4154,52 +4154,6 @@
} VkDedicatedAllocationMemoryAllocateInfoNV;
-#define VK_GOOGLE_display_timing 1
-#define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1
-#define VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME "VK_GOOGLE_display_timing"
-
-typedef struct VkRefreshCycleDurationGOOGLE {
- uint64_t refreshDuration;
-} VkRefreshCycleDurationGOOGLE;
-
-typedef struct VkPastPresentationTimingGOOGLE {
- uint32_t presentID;
- uint64_t desiredPresentTime;
- uint64_t actualPresentTime;
- uint64_t earliestPresentTime;
- uint64_t presentMargin;
-} VkPastPresentationTimingGOOGLE;
-
-typedef struct VkPresentTimeGOOGLE {
- uint32_t presentID;
- uint64_t desiredPresentTime;
-} VkPresentTimeGOOGLE;
-
-typedef struct VkPresentTimesInfoGOOGLE {
- VkStructureType sType;
- const void* pNext;
- uint32_t swapchainCount;
- const VkPresentTimeGOOGLE* pTimes;
-} VkPresentTimesInfoGOOGLE;
-
-
-typedef VkResult (VKAPI_PTR *PFN_vkGetRefreshCycleDurationGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties);
-typedef VkResult (VKAPI_PTR *PFN_vkGetPastPresentationTimingGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pPresentationTimingCount, VkPastPresentationTimingGOOGLE* pPresentationTimings);
-
-#ifndef VK_NO_PROTOTYPES
-VKAPI_ATTR VkResult VKAPI_CALL vkGetRefreshCycleDurationGOOGLE(
- VkDevice device,
- VkSwapchainKHR swapchain,
- VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties);
-
-VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE(
- VkDevice device,
- VkSwapchainKHR swapchain,
- uint32_t* pPresentationTimingCount,
- VkPastPresentationTimingGOOGLE* pPresentationTimings);
-#endif
-
-
#define VK_AMD_draw_indirect_count 1
#define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 1
#define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count"
@@ -4608,6 +4562,55 @@
VkDeviceGeneratedCommandsLimitsNVX* pLimits);
#endif
+#define VK_GOOGLE_display_timing 1
+#define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1
+#define VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME "VK_GOOGLE_display_timing"
+
+typedef struct VkRefreshCycleDurationGOOGLE {
+ uint64_t refreshDuration;
+} VkRefreshCycleDurationGOOGLE;
+
+typedef struct VkPastPresentationTimingGOOGLE {
+ uint32_t presentID;
+ uint64_t desiredPresentTime;
+ uint64_t actualPresentTime;
+ uint64_t earliestPresentTime;
+ uint64_t presentMargin;
+} VkPastPresentationTimingGOOGLE;
+
+typedef struct VkPresentTimeGOOGLE {
+ uint32_t presentID;
+ uint64_t desiredPresentTime;
+} VkPresentTimeGOOGLE;
+
+typedef struct VkPresentTimesInfoGOOGLE {
+ VkStructureType sType;
+ const void* pNext;
+ uint32_t swapchainCount;
+ const VkPresentTimeGOOGLE* pTimes;
+} VkPresentTimesInfoGOOGLE;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetRefreshCycleDurationGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPastPresentationTimingGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pPresentationTimingCount, VkPastPresentationTimingGOOGLE* pPresentationTimings);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetRefreshCycleDurationGOOGLE(
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE(
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ uint32_t* pPresentationTimingCount,
+ VkPastPresentationTimingGOOGLE* pPresentationTimings);
+#endif
+
+#define VK_EXT_swapchain_colorspace 1
+#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 1
+#define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace"
+
#define VK_EXT_hdr_metadata 1
#define VK_EXT_HDR_METADATA_SPEC_VERSION 0
#define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata"
diff --git a/vulkan/libvulkan/code-generator.tmpl b/vulkan/libvulkan/code-generator.tmpl
index caf38bc..992c5d1 100644
--- a/vulkan/libvulkan/code-generator.tmpl
+++ b/vulkan/libvulkan/code-generator.tmpl
@@ -319,7 +319,7 @@
}
¶
ProcHook::Extension GetProcHookExtension(const char* name) {
- {{$exts := Strings (Macro "driver.InterceptedExtensions") | SplitOn "\n"}}
+ {{$exts := Strings (Macro "driver.KnownExtensions") | SplitOn "\n"}}
// clang-format off
{{range $e := $exts}}
if (strcmp(name, "{{$e}}") == 0) return ProcHook::{{TrimPrefix "VK_" $e}};
@@ -683,12 +683,24 @@
VK_ANDROID_native_buffer
VK_EXT_debug_report
VK_EXT_hdr_metadata
+VK_EXT_swapchain_colorspace
VK_GOOGLE_display_timing
VK_KHR_android_surface
VK_KHR_incremental_present
+VK_KHR_shared_presentable_image
VK_KHR_surface
VK_KHR_swapchain
-VK_KHR_shared_presentable_image
+{{end}}
+
+
+{{/*
+------------------------------------------------------------------------------
+ Emits a list of extensions known to vulkan::driver.
+------------------------------------------------------------------------------
+*/}}
+{{define "driver.KnownExtensions"}}
+{{Macro "driver.InterceptedExtensions"}}
+VK_KHR_get_physical_device_properties2
{{end}}
@@ -776,7 +788,7 @@
};
enum Extension {
- {{$exts := Strings (Macro "driver.InterceptedExtensions") | SplitOn "\n"}}
+ {{$exts := Strings (Macro "driver.KnownExtensions") | SplitOn "\n"}}
{{range $e := $exts}}
{{TrimPrefix "VK_" $e}},
{{end}}
@@ -965,7 +977,7 @@
{{else if eq $.Name "vkDestroyImage"}}true
{{else if eq $.Name "vkGetPhysicalDeviceProperties"}}true
-
+ {{else if eq $.Name "vkGetPhysicalDeviceProperties2KHR"}}true
{{end}}
{{$ext := GetAnnotation $ "extension"}}
@@ -1122,6 +1134,8 @@
{{else if eq $ext "VK_KHR_wayland_surface"}}true
{{else if eq $ext "VK_KHR_mir_surface"}}true
{{else if eq $ext "VK_KHR_win32_surface"}}true
+ {{else if eq $ext "VK_NV_external_memory_win32"}}true
+ {{else if eq $ext "VK_NV_win32_keyed_mutex"}}true
{{end}}
{{end}}
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index 71bfecf..b62eec6 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -29,6 +29,7 @@
#include <android/dlext.h>
#include <cutils/properties.h>
#include <ui/GraphicsEnv.h>
+#include <utils/Vector.h>
#include "driver.h"
#include "stubhal.h"
@@ -446,6 +447,7 @@
switch (ext_bit) {
case ProcHook::KHR_android_surface:
case ProcHook::KHR_surface:
+ case ProcHook::EXT_swapchain_colorspace:
hook_extensions_.set(ext_bit);
// return now as these extensions do not require HAL support
return;
@@ -454,6 +456,7 @@
hook_extensions_.set(ext_bit);
break;
case ProcHook::EXTENSION_UNKNOWN:
+ case ProcHook::KHR_get_physical_device_properties2:
// HAL's extensions
break;
default:
@@ -469,6 +472,7 @@
break;
case ProcHook::KHR_incremental_present:
case ProcHook::GOOGLE_display_timing:
+ case ProcHook::KHR_shared_presentable_image:
hook_extensions_.set(ext_bit);
// return now as these extensions do not require HAL support
return;
@@ -478,9 +482,6 @@
case ProcHook::EXTENSION_UNKNOWN:
// HAL's extensions
break;
- case ProcHook::KHR_shared_presentable_image:
- // Exposed by HAL, but API surface is all in the loader
- break;
default:
ALOGW("Ignored invalid device extension %s", name);
return;
@@ -498,10 +499,6 @@
if (ext_bit == ProcHook::ANDROID_native_buffer)
hook_extensions_.set(ProcHook::KHR_swapchain);
- // Exposed by HAL, but API surface is all in the loader
- if (ext_bit == ProcHook::KHR_shared_presentable_image)
- hook_extensions_.set(ext_bit);
-
hal_extensions_.set(ext_bit);
}
@@ -677,11 +674,13 @@
const char* pLayerName,
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties) {
- static const std::array<VkExtensionProperties, 2> loader_extensions = {{
+ static const std::array<VkExtensionProperties, 3> loader_extensions = {{
// WSI extensions
{VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_SPEC_VERSION},
{VK_KHR_ANDROID_SURFACE_EXTENSION_NAME,
VK_KHR_ANDROID_SURFACE_SPEC_VERSION},
+ {VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME,
+ VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION},
}};
static const VkExtensionProperties loader_debug_report_extension = {
VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION,
@@ -734,21 +733,60 @@
return result;
}
+bool QueryPresentationProperties(
+ VkPhysicalDevice physicalDevice,
+ VkPhysicalDevicePresentationPropertiesANDROID *presentation_properties)
+{
+ const InstanceData& data = GetData(physicalDevice);
+
+ // GPDP2 must be present and enabled on the instance.
+ if (!data.driver.GetPhysicalDeviceProperties2KHR)
+ return false;
+
+ // Request the android-specific presentation properties via GPDP2
+ VkPhysicalDeviceProperties2KHR properties = {
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR,
+ presentation_properties,
+ {}
+ };
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wold-style-cast"
+ presentation_properties->sType =
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID;
+#pragma clang diagnostic pop
+ presentation_properties->pNext = nullptr;
+ presentation_properties->sharedImage = VK_FALSE;
+
+ data.driver.GetPhysicalDeviceProperties2KHR(physicalDevice,
+ &properties);
+
+ return true;
+}
+
VkResult EnumerateDeviceExtensionProperties(
VkPhysicalDevice physicalDevice,
const char* pLayerName,
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties) {
const InstanceData& data = GetData(physicalDevice);
- static const std::array<VkExtensionProperties, 3> loader_extensions = {{
- // WSI extensions
- {VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME,
- VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION},
- {VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME,
- VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION},
- {VK_EXT_HDR_METADATA_EXTENSION_NAME,
- VK_EXT_HDR_METADATA_SPEC_VERSION},
- }};
+ // extensions that are unconditionally exposed by the loader
+ android::Vector<VkExtensionProperties> loader_extensions;
+ loader_extensions.push_back({
+ VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME,
+ VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION});
+ loader_extensions.push_back({
+ VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME,
+ VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION});
+
+ // conditionally add shared_presentable_image if supportable
+ VkPhysicalDevicePresentationPropertiesANDROID presentation_properties;
+ if (QueryPresentationProperties(physicalDevice, &presentation_properties) &&
+ presentation_properties.sharedImage) {
+ loader_extensions.push_back({
+ VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME,
+ VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION});
+ }
// enumerate our extensions first
if (!pLayerName && pProperties) {
diff --git a/vulkan/libvulkan/driver.h b/vulkan/libvulkan/driver.h
index 5383f59..7f8ae98 100644
--- a/vulkan/libvulkan/driver.h
+++ b/vulkan/libvulkan/driver.h
@@ -109,6 +109,10 @@
bool OpenHAL();
const VkAllocationCallbacks& GetDefaultAllocator();
+bool QueryPresentationProperties(
+ VkPhysicalDevice physicalDevice,
+ VkPhysicalDevicePresentationPropertiesANDROID *presentation_properties);
+
// clang-format off
VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* pName);
VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pName);
diff --git a/vulkan/libvulkan/driver_gen.cpp b/vulkan/libvulkan/driver_gen.cpp
index 59964fb..fc3f87a 100644
--- a/vulkan/libvulkan/driver_gen.cpp
+++ b/vulkan/libvulkan/driver_gen.cpp
@@ -93,6 +93,14 @@
}
}
+VKAPI_ATTR void checkedSetHdrMetadataEXT(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR* pSwapchains, const VkHdrMetadataEXT* pMetadata) {
+ if (GetData(device).hook_extensions[ProcHook::EXT_hdr_metadata]) {
+ SetHdrMetadataEXT(device, swapchainCount, pSwapchains, pMetadata);
+ } else {
+ Logger(device).Err(device, "VK_EXT_hdr_metadata not enabled. vkSetHdrMetadataEXT not executed.");
+ }
+}
+
VKAPI_ATTR VkResult checkedGetSwapchainStatusKHR(VkDevice device, VkSwapchainKHR swapchain) {
if (GetData(device).hook_extensions[ProcHook::KHR_shared_presentable_image]) {
return GetSwapchainStatusKHR(device, swapchain);
@@ -102,14 +110,6 @@
}
}
-VKAPI_ATTR void checkedSetHdrMetadataEXT(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR* pSwapchains, const VkHdrMetadataEXT* pMetadata) {
- if (GetData(device).hook_extensions[ProcHook::EXT_hdr_metadata]) {
- SetHdrMetadataEXT(device, swapchainCount, pSwapchains, pMetadata);
- } else {
- Logger(device).Err(device, "VK_EXT_hdr_metadata not enabled. vkSetHdrMetadataEXT not executed.");
- }
-}
-
// clang-format on
const ProcHook g_proc_hooks[] = {
@@ -365,12 +365,14 @@
if (strcmp(name, "VK_ANDROID_native_buffer") == 0) return ProcHook::ANDROID_native_buffer;
if (strcmp(name, "VK_EXT_debug_report") == 0) return ProcHook::EXT_debug_report;
if (strcmp(name, "VK_EXT_hdr_metadata") == 0) return ProcHook::EXT_hdr_metadata;
+ if (strcmp(name, "VK_EXT_swapchain_colorspace") == 0) return ProcHook::EXT_swapchain_colorspace;
if (strcmp(name, "VK_GOOGLE_display_timing") == 0) return ProcHook::GOOGLE_display_timing;
if (strcmp(name, "VK_KHR_android_surface") == 0) return ProcHook::KHR_android_surface;
if (strcmp(name, "VK_KHR_incremental_present") == 0) return ProcHook::KHR_incremental_present;
+ if (strcmp(name, "VK_KHR_shared_presentable_image") == 0) return ProcHook::KHR_shared_presentable_image;
if (strcmp(name, "VK_KHR_surface") == 0) return ProcHook::KHR_surface;
if (strcmp(name, "VK_KHR_swapchain") == 0) return ProcHook::KHR_swapchain;
- if (strcmp(name, "VK_KHR_shared_presentable_image") == 0) return ProcHook::KHR_shared_presentable_image;
+ if (strcmp(name, "VK_KHR_get_physical_device_properties2") == 0) return ProcHook::KHR_get_physical_device_properties2;
// clang-format on
return ProcHook::EXTENSION_UNKNOWN;
}
@@ -409,6 +411,7 @@
INIT_PROC_EXT(EXT_debug_report, true, instance, CreateDebugReportCallbackEXT);
INIT_PROC_EXT(EXT_debug_report, true, instance, DestroyDebugReportCallbackEXT);
INIT_PROC_EXT(EXT_debug_report, true, instance, DebugReportMessageEXT);
+ INIT_PROC_EXT(KHR_get_physical_device_properties2, true, instance, GetPhysicalDeviceProperties2KHR);
// clang-format on
return success;
diff --git a/vulkan/libvulkan/driver_gen.h b/vulkan/libvulkan/driver_gen.h
index 273e796..738da5b 100644
--- a/vulkan/libvulkan/driver_gen.h
+++ b/vulkan/libvulkan/driver_gen.h
@@ -36,12 +36,14 @@
ANDROID_native_buffer,
EXT_debug_report,
EXT_hdr_metadata,
+ EXT_swapchain_colorspace,
GOOGLE_display_timing,
KHR_android_surface,
KHR_incremental_present,
+ KHR_shared_presentable_image,
KHR_surface,
KHR_swapchain,
- KHR_shared_presentable_image,
+ KHR_get_physical_device_properties2,
EXTENSION_CORE, // valid bit
EXTENSION_COUNT,
@@ -67,6 +69,7 @@
PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
+ PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR;
// clang-format on
};
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index b1e3d61..a0ae1f3 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -380,6 +380,75 @@
*count = num_copied;
}
+android_pixel_format GetNativePixelFormat(VkFormat format) {
+ android_pixel_format native_format = HAL_PIXEL_FORMAT_RGBA_8888;
+ switch (format) {
+ case VK_FORMAT_R8G8B8A8_UNORM:
+ case VK_FORMAT_R8G8B8A8_SRGB:
+ native_format = HAL_PIXEL_FORMAT_RGBA_8888;
+ break;
+ case VK_FORMAT_R5G6B5_UNORM_PACK16:
+ native_format = HAL_PIXEL_FORMAT_RGB_565;
+ break;
+ case VK_FORMAT_R16G16B16A16_SFLOAT:
+ native_format = HAL_PIXEL_FORMAT_RGBA_FP16;
+ break;
+ case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
+ native_format = HAL_PIXEL_FORMAT_RGBA_1010102;
+ break;
+ default:
+ ALOGV("unsupported swapchain format %d", format);
+ break;
+ }
+ return native_format;
+}
+
+android_dataspace GetNativeDataspace(VkColorSpaceKHR colorspace) {
+ switch (colorspace) {
+ case VK_COLOR_SPACE_SRGB_NONLINEAR_KHR:
+ return HAL_DATASPACE_V0_SRGB;
+ case VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT:
+ return HAL_DATASPACE_DISPLAY_P3;
+ case VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT:
+ return HAL_DATASPACE_V0_SCRGB_LINEAR;
+ case VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT:
+ return HAL_DATASPACE_V0_SCRGB;
+ case VK_COLOR_SPACE_DCI_P3_LINEAR_EXT:
+ return HAL_DATASPACE_DCI_P3_LINEAR;
+ case VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT:
+ return HAL_DATASPACE_DCI_P3;
+ case VK_COLOR_SPACE_BT709_LINEAR_EXT:
+ return HAL_DATASPACE_V0_SRGB_LINEAR;
+ case VK_COLOR_SPACE_BT709_NONLINEAR_EXT:
+ return HAL_DATASPACE_V0_SRGB;
+ case VK_COLOR_SPACE_BT2020_170M_EXT:
+ return static_cast<android_dataspace>(
+ HAL_DATASPACE_STANDARD_BT2020 |
+ HAL_DATASPACE_TRANSFER_SMPTE_170M | HAL_DATASPACE_RANGE_FULL);
+ case VK_COLOR_SPACE_BT2020_ST2084_EXT:
+ return static_cast<android_dataspace>(
+ HAL_DATASPACE_STANDARD_BT2020 | HAL_DATASPACE_TRANSFER_ST2084 |
+ HAL_DATASPACE_RANGE_FULL);
+ case VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT:
+ return static_cast<android_dataspace>(
+ HAL_DATASPACE_STANDARD_ADOBE_RGB |
+ HAL_DATASPACE_TRANSFER_LINEAR | HAL_DATASPACE_RANGE_FULL);
+ case VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT:
+ return HAL_DATASPACE_ADOBE_RGB;
+
+ // Pass through is intended to allow app to provide data that is passed
+ // to the display system without modification.
+ case VK_COLOR_SPACE_PASS_THROUGH_EXT:
+ return HAL_DATASPACE_ARBITRARY;
+
+ default:
+ // This indicates that we don't know about the
+ // dataspace specified and we should indicate that
+ // it's unsupported
+ return HAL_DATASPACE_UNKNOWN;
+ }
+}
+
} // anonymous namespace
VKAPI_ATTR
@@ -410,7 +479,7 @@
err);
surface->~Surface();
allocator->pfnFree(allocator->pUserData, surface);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR;
}
*out_surface = HandleFromSurface(surface);
@@ -458,13 +527,13 @@
if (err != 0) {
ALOGE("NATIVE_WINDOW_DEFAULT_WIDTH query failed: %s (%d)",
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
err = window->query(window, NATIVE_WINDOW_DEFAULT_HEIGHT, &height);
if (err != 0) {
ALOGE("NATIVE_WINDOW_DEFAULT_WIDTH query failed: %s (%d)",
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
int transform_hint;
@@ -472,7 +541,7 @@
if (err != 0) {
ALOGE("NATIVE_WINDOW_TRANSFORM_HINT query failed: %s (%d)",
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
// TODO(jessehall): Figure out what the min/max values should be.
@@ -512,10 +581,12 @@
}
VKAPI_ATTR
-VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice /*pdev*/,
- VkSurfaceKHR /*surface*/,
+VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice pdev,
+ VkSurfaceKHR surface_handle,
uint32_t* count,
VkSurfaceFormatKHR* formats) {
+ const InstanceData& instance_data = GetData(pdev);
+
// TODO(jessehall): Fill out the set of supported formats. Longer term, add
// a new gralloc method to query whether a (format, usage) pair is
// supported, and check that for each gralloc format that corresponds to a
@@ -528,40 +599,82 @@
{VK_FORMAT_R5G6B5_UNORM_PACK16, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR},
};
const uint32_t kNumFormats = sizeof(kFormats) / sizeof(kFormats[0]);
+ uint32_t total_num_formats = kNumFormats;
+
+ bool wide_color_support = false;
+ Surface& surface = *SurfaceFromHandle(surface_handle);
+ int err = native_window_get_wide_color_support(surface.window.get(),
+ &wide_color_support);
+ if (err) {
+ // Not allowed to return a more sensible error code, so do this
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
+ ALOGV("wide_color_support is: %d", wide_color_support);
+ wide_color_support =
+ wide_color_support &&
+ instance_data.hook_extensions.test(ProcHook::EXT_swapchain_colorspace);
+
+ const VkSurfaceFormatKHR kWideColorFormats[] = {
+ {VK_FORMAT_R16G16B16A16_SFLOAT,
+ VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT},
+ {VK_FORMAT_A2R10G10B10_UNORM_PACK32,
+ VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT},
+ };
+ const uint32_t kNumWideColorFormats =
+ sizeof(kWideColorFormats) / sizeof(kWideColorFormats[0]);
+ if (wide_color_support) {
+ total_num_formats += kNumWideColorFormats;
+ }
VkResult result = VK_SUCCESS;
if (formats) {
- if (*count < kNumFormats)
+ uint32_t out_count = 0;
+ uint32_t transfer_count = 0;
+ if (*count < total_num_formats)
result = VK_INCOMPLETE;
- *count = std::min(*count, kNumFormats);
- std::copy(kFormats, kFormats + *count, formats);
+ transfer_count = std::min(*count, kNumFormats);
+ std::copy(kFormats, kFormats + transfer_count, formats);
+ out_count += transfer_count;
+ if (wide_color_support) {
+ transfer_count = std::min(*count - out_count, kNumWideColorFormats);
+ std::copy(kWideColorFormats, kWideColorFormats + transfer_count,
+ formats + out_count);
+ out_count += transfer_count;
+ }
+ *count = out_count;
} else {
- *count = kNumFormats;
+ *count = total_num_formats;
}
return result;
}
VKAPI_ATTR
-VkResult GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice /*pdev*/,
+VkResult GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice pdev,
VkSurfaceKHR /*surface*/,
uint32_t* count,
VkPresentModeKHR* modes) {
- const VkPresentModeKHR kModes[] = {
- VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_FIFO_KHR,
- // TODO(chrisforbes): should only expose this if the driver can.
- // VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR,
- // VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR,
- };
- const uint32_t kNumModes = sizeof(kModes) / sizeof(kModes[0]);
+ android::Vector<VkPresentModeKHR> present_modes;
+ present_modes.push_back(VK_PRESENT_MODE_MAILBOX_KHR);
+ present_modes.push_back(VK_PRESENT_MODE_FIFO_KHR);
+
+ VkPhysicalDevicePresentationPropertiesANDROID present_properties;
+ if (QueryPresentationProperties(pdev, &present_properties)) {
+ if (present_properties.sharedImage) {
+ present_modes.push_back(VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR);
+ present_modes.push_back(VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR);
+ }
+ }
+
+ uint32_t num_modes = uint32_t(present_modes.size());
VkResult result = VK_SUCCESS;
if (modes) {
- if (*count < kNumModes)
+ if (*count < num_modes)
result = VK_INCOMPLETE;
- *count = std::min(*count, kNumModes);
- std::copy(kModes, kModes + *count, modes);
+ *count = std::min(*count, num_modes);
+ std::copy(present_modes.begin(), present_modes.begin() + int(*count), modes);
} else {
- *count = kNumModes;
+ *count = num_modes;
}
return result;
}
@@ -588,12 +701,21 @@
if (!allocator)
allocator = &GetData(device).allocator;
+ android_pixel_format native_pixel_format =
+ GetNativePixelFormat(create_info->imageFormat);
+ android_dataspace native_dataspace =
+ GetNativeDataspace(create_info->imageColorSpace);
+ if (native_dataspace == HAL_DATASPACE_UNKNOWN) {
+ ALOGE(
+ "CreateSwapchainKHR(VkSwapchainCreateInfoKHR.imageColorSpace = %d) "
+ "failed: Unsupported color space",
+ create_info->imageColorSpace);
+ return VK_ERROR_INITIALIZATION_FAILED;
+ }
+
ALOGV_IF(create_info->imageArrayLayers != 1,
"swapchain imageArrayLayers=%u not supported",
create_info->imageArrayLayers);
- ALOGV_IF(create_info->imageColorSpace != VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
- "swapchain imageColorSpace=%u not supported",
- create_info->imageColorSpace);
ALOGV_IF((create_info->preTransform & ~kSupportedTransforms) != 0,
"swapchain preTransform=%#x not supported",
create_info->preTransform);
@@ -642,65 +764,55 @@
if (err != 0) {
ALOGE("native_window_set_buffer_count(0) failed: %s (%d)",
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
- err = surface.window->setSwapInterval(surface.window.get(), 1);
+ int swap_interval =
+ create_info->presentMode == VK_PRESENT_MODE_MAILBOX_KHR ? 0 : 1;
+ err = surface.window->setSwapInterval(surface.window.get(), swap_interval);
if (err != 0) {
// TODO(jessehall): Improve error reporting. Can we enumerate possible
// errors and translate them to valid Vulkan result codes?
ALOGE("native_window->setSwapInterval(1) failed: %s (%d)",
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
err = native_window_set_shared_buffer_mode(surface.window.get(), false);
if (err != 0) {
ALOGE("native_window_set_shared_buffer_mode(false) failed: %s (%d)",
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
err = native_window_set_auto_refresh(surface.window.get(), false);
if (err != 0) {
ALOGE("native_window_set_auto_refresh(false) failed: %s (%d)",
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
// -- Configure the native window --
const auto& dispatch = GetData(device).driver;
- int native_format = HAL_PIXEL_FORMAT_RGBA_8888;
- switch (create_info->imageFormat) {
- case VK_FORMAT_R8G8B8A8_UNORM:
- case VK_FORMAT_R8G8B8A8_SRGB:
- native_format = HAL_PIXEL_FORMAT_RGBA_8888;
- break;
- case VK_FORMAT_R5G6B5_UNORM_PACK16:
- native_format = HAL_PIXEL_FORMAT_RGB_565;
- break;
- default:
- ALOGV("unsupported swapchain format %d", create_info->imageFormat);
- break;
- }
- err = native_window_set_buffers_format(surface.window.get(), native_format);
+ err = native_window_set_buffers_format(surface.window.get(),
+ native_pixel_format);
if (err != 0) {
// TODO(jessehall): Improve error reporting. Can we enumerate possible
// errors and translate them to valid Vulkan result codes?
ALOGE("native_window_set_buffers_format(%d) failed: %s (%d)",
- native_format, strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ native_pixel_format, strerror(-err), err);
+ return VK_ERROR_SURFACE_LOST_KHR;
}
err = native_window_set_buffers_data_space(surface.window.get(),
- HAL_DATASPACE_SRGB_LINEAR);
+ native_dataspace);
if (err != 0) {
// TODO(jessehall): Improve error reporting. Can we enumerate possible
// errors and translate them to valid Vulkan result codes?
ALOGE("native_window_set_buffers_data_space(%d) failed: %s (%d)",
- HAL_DATASPACE_SRGB_LINEAR, strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ native_dataspace, strerror(-err), err);
+ return VK_ERROR_SURFACE_LOST_KHR;
}
err = native_window_set_buffers_dimensions(
@@ -712,7 +824,7 @@
ALOGE("native_window_set_buffers_dimensions(%d,%d) failed: %s (%d)",
create_info->imageExtent.width, create_info->imageExtent.height,
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
// VkSwapchainCreateInfo::preTransform indicates the transformation the app
@@ -732,7 +844,7 @@
ALOGE("native_window_set_buffers_transform(%d) failed: %s (%d)",
InvertTransformToNative(create_info->preTransform),
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
err = native_window_set_scaling_mode(
@@ -742,7 +854,7 @@
// errors and translate them to valid Vulkan result codes?
ALOGE("native_window_set_scaling_mode(SCALE_TO_WINDOW) failed: %s (%d)",
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
int query_value;
@@ -754,16 +866,9 @@
// errors and translate them to valid Vulkan result codes?
ALOGE("window->query failed: %s (%d) value=%d", strerror(-err), err,
query_value);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
uint32_t min_undequeued_buffers = static_cast<uint32_t>(query_value);
- // The MIN_UNDEQUEUED_BUFFERS query doesn't know whether we'll be using
- // async mode or not, and assumes not. But in async mode, the BufferQueue
- // requires an extra undequeued buffer.
- // See BufferQueueCore::getMinUndequeuedBufferCountLocked().
- if (create_info->presentMode == VK_PRESENT_MODE_MAILBOX_KHR)
- min_undequeued_buffers += 1;
-
uint32_t num_images =
(create_info->minImageCount - 1) + min_undequeued_buffers;
err = native_window_set_buffer_count(surface.window.get(), num_images);
@@ -772,7 +877,7 @@
// errors and translate them to valid Vulkan result codes?
ALOGE("native_window_set_buffer_count(%d) failed: %s (%d)", num_images,
strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
VkSwapchainImageUsageFlagsANDROID swapchain_image_usage = 0;
@@ -783,7 +888,7 @@
err = native_window_set_shared_buffer_mode(surface.window.get(), true);
if (err != 0) {
ALOGE("native_window_set_shared_buffer_mode failed: %s (%d)", strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
}
@@ -791,14 +896,15 @@
err = native_window_set_auto_refresh(surface.window.get(), true);
if (err != 0) {
ALOGE("native_window_set_auto_refresh failed: %s (%d)", strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
}
int gralloc_usage = 0;
if (dispatch.GetSwapchainGrallocUsage2ANDROID) {
uint64_t consumer_usage, producer_usage;
- if (GetData(device).driver_version == 256587285) {
+ uint32_t driver_version = GetData(device).driver_version;
+ if (driver_version == 256587285 || driver_version == 96011958) {
// HACK workaround for loader/driver mismatch during transition to
// vkGetSwapchainGrallocUsage2ANDROID.
typedef VkResult(VKAPI_PTR *
@@ -819,7 +925,7 @@
}
if (result != VK_SUCCESS) {
ALOGE("vkGetSwapchainGrallocUsage2ANDROID failed: %d", result);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
// TODO: This is the same translation done by Gralloc1On0Adapter.
// Remove it once ANativeWindow has been updated to take gralloc1-style
@@ -832,7 +938,7 @@
&gralloc_usage);
if (result != VK_SUCCESS) {
ALOGE("vkGetSwapchainGrallocUsageANDROID failed: %d", result);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
}
err = native_window_set_usage(surface.window.get(), gralloc_usage);
@@ -840,18 +946,7 @@
// TODO(jessehall): Improve error reporting. Can we enumerate possible
// errors and translate them to valid Vulkan result codes?
ALOGE("native_window_set_usage failed: %s (%d)", strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
- }
-
- int swap_interval =
- create_info->presentMode == VK_PRESENT_MODE_MAILBOX_KHR ? 0 : 1;
- err = surface.window->setSwapInterval(surface.window.get(), swap_interval);
- if (err != 0) {
- // TODO(jessehall): Improve error reporting. Can we enumerate possible
- // errors and translate them to valid Vulkan result codes?
- ALOGE("native_window->setSwapInterval(%d) failed: %s (%d)",
- swap_interval, strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
// -- Allocate our Swapchain object --
@@ -910,7 +1005,7 @@
// TODO(jessehall): Improve error reporting. Can we enumerate
// possible errors and translate them to valid Vulkan result codes?
ALOGE("dequeueBuffer[%u] failed: %s (%d)", i, strerror(-err), err);
- result = VK_ERROR_INITIALIZATION_FAILED;
+ result = VK_ERROR_SURFACE_LOST_KHR;
break;
}
img.buffer = buffer;
@@ -1046,7 +1141,7 @@
// TODO(jessehall): Improve error reporting. Can we enumerate possible
// errors and translate them to valid Vulkan result codes?
ALOGE("dequeueBuffer failed: %s (%d)", strerror(-err), err);
- return VK_ERROR_INITIALIZATION_FAILED;
+ return VK_ERROR_SURFACE_LOST_KHR;
}
uint32_t idx;
diff --git a/vulkan/libvulkan/swapchain.h b/vulkan/libvulkan/swapchain.h
index 4d9f18f..976c995 100644
--- a/vulkan/libvulkan/swapchain.h
+++ b/vulkan/libvulkan/swapchain.h
@@ -27,7 +27,7 @@
VKAPI_ATTR void DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* allocator);
VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice pdev, uint32_t queue_family, VkSurfaceKHR surface, VkBool32* pSupported);
VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice pdev, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* capabilities);
-VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice pdev, VkSurfaceKHR surface, uint32_t* count, VkSurfaceFormatKHR* formats);
+VKAPI_ATTR VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice pdev, VkSurfaceKHR surface_handle, uint32_t* count, VkSurfaceFormatKHR* formats);
VKAPI_ATTR VkResult GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice pdev, VkSurfaceKHR surface, uint32_t* count, VkPresentModeKHR* modes);
VKAPI_ATTR VkResult CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* create_info, const VkAllocationCallbacks* allocator, VkSwapchainKHR* swapchain_handle);
VKAPI_ATTR void DestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain_handle, const VkAllocationCallbacks* allocator);