diff options
39 files changed, 592 insertions, 357 deletions
diff --git a/cmds/atrace/Android.bp b/cmds/atrace/Android.bp index 6c5869ae9b..5548699c3e 100644 --- a/cmds/atrace/Android.bp +++ b/cmds/atrace/Android.bp @@ -7,11 +7,9 @@ cc_binary { shared_libs: [ "libbinder", "libhwbinder", - "android.hidl.manager@1.0", "libhidlbase", "libhidltransport", "liblog", - "libcutils", "libutils", "libz", "libbase", diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp index 8758516a4d..56070e665b 100644 --- a/cmds/atrace/atrace.cpp +++ b/cmds/atrace/atrace.cpp @@ -26,7 +26,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/sendfile.h> #include <time.h> #include <unistd.h> #include <zlib.h> @@ -40,18 +39,19 @@ #include <android/hidl/manager/1.0/IServiceManager.h> #include <hidl/ServiceManagement.h> -#include <cutils/properties.h> #include <utils/String8.h> #include <utils/Timers.h> #include <utils/Tokenizer.h> #include <utils/Trace.h> #include <android-base/file.h> +#include <android-base/macros.h> +#include <android-base/properties.h> +#include <android-base/stringprintf.h> using namespace android; using std::string; -#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) #define MAX_SYS_FILES 10 #define MAX_PACKAGES 16 @@ -183,9 +183,9 @@ static const TracingCategory k_categories[] = { { REQ, "events/binder/binder_transaction_received/enable" }, } }, { "binder_lock", "Binder global lock trace", 0, { - { REQ, "events/binder/binder_lock/enable" }, - { REQ, "events/binder/binder_locked/enable" }, - { REQ, "events/binder/binder_unlock/enable" }, + { OPT, "events/binder/binder_lock/enable" }, + { OPT, "events/binder/binder_locked/enable" }, + { OPT, "events/binder/binder_unlock/enable" }, } }, { "pagecache", "Page cache", 0, { { REQ, "events/filemap/enable" }, @@ -206,7 +206,7 @@ static const char* g_outputFile = nullptr; /* Global state */ static bool g_traceAborted = false; -static bool g_categoryEnables[NELEM(k_categories)] = {}; +static bool g_categoryEnables[arraysize(k_categories)] = {}; static std::string g_traceFolder; /* Sys file paths */ @@ -361,9 +361,7 @@ static bool setKernelOptionEnable(const char* filename, bool enable) static bool isCategorySupported(const TracingCategory& category) { if (strcmp(category.name, k_coreServiceCategory) == 0) { - char value[PROPERTY_VALUE_MAX]; - property_get(k_coreServicesProp, value, ""); - return strlen(value) != 0; + return !android::base::GetProperty(k_coreServicesProp, "").empty(); } bool ok = category.tags != 0; @@ -378,7 +376,7 @@ static bool isCategorySupported(const TracingCategory& category) ok = true; } } else { - ok |= fileIsWritable(path); + ok = true; } } } @@ -564,9 +562,8 @@ static void pokeHalServices() // processes to pick up the new value. static bool setTagsProperty(uint64_t tags) { - char buf[PROPERTY_VALUE_MAX]; - snprintf(buf, sizeof(buf), "%#" PRIx64, tags); - if (property_set(k_traceTagsProperty, buf) < 0) { + std::string value = android::base::StringPrintf("%#" PRIx64, tags); + if (!android::base::SetProperty(k_traceTagsProperty, value)) { fprintf(stderr, "error setting trace tags system property\n"); return false; } @@ -575,14 +572,13 @@ static bool setTagsProperty(uint64_t tags) static void clearAppProperties() { - char buf[PROPERTY_KEY_MAX]; for (int i = 0; i < MAX_PACKAGES; i++) { - snprintf(buf, sizeof(buf), k_traceAppsPropertyTemplate, i); - if (property_set(buf, "") < 0) { - fprintf(stderr, "failed to clear system property: %s\n", buf); + std::string key = android::base::StringPrintf(k_traceAppsPropertyTemplate, i); + if (!android::base::SetProperty(key, "")) { + fprintf(stderr, "failed to clear system property: %s\n", key.c_str()); } } - if (property_set(k_traceAppsNumberProperty, "") < 0) { + if (!android::base::SetProperty(k_traceAppsNumberProperty, "")) { fprintf(stderr, "failed to clear system property: %s", k_traceAppsNumberProperty); } @@ -592,7 +588,6 @@ static void clearAppProperties() // application-level tracing. static bool setAppCmdlineProperty(char* cmdline) { - char buf[PROPERTY_KEY_MAX]; int i = 0; char* start = cmdline; while (start != NULL) { @@ -606,9 +601,9 @@ static bool setAppCmdlineProperty(char* cmdline) *end = '\0'; end++; } - snprintf(buf, sizeof(buf), k_traceAppsPropertyTemplate, i); - if (property_set(buf, start) < 0) { - fprintf(stderr, "error setting trace app %d property to %s\n", i, buf); + std::string key = android::base::StringPrintf(k_traceAppsPropertyTemplate, i); + if (!android::base::SetProperty(key, start)) { + fprintf(stderr, "error setting trace app %d property to %s\n", i, key.c_str()); clearAppProperties(); return false; } @@ -616,9 +611,9 @@ static bool setAppCmdlineProperty(char* cmdline) i++; } - snprintf(buf, sizeof(buf), "%d", i); - if (property_set(k_traceAppsNumberProperty, buf) < 0) { - fprintf(stderr, "error setting trace app number property to %s\n", buf); + std::string value = android::base::StringPrintf("%d", i); + if (!android::base::SetProperty(k_traceAppsNumberProperty, value)) { + fprintf(stderr, "error setting trace app number property to %s\n", value.c_str()); clearAppProperties(); return false; } @@ -628,7 +623,7 @@ static bool setAppCmdlineProperty(char* cmdline) // Disable all /sys/ enable files. static bool disableKernelTraceEvents() { bool ok = true; - for (int i = 0; i < NELEM(k_categories); i++) { + for (size_t i = 0; i < arraysize(k_categories); i++) { const TracingCategory &c = k_categories[i]; for (int j = 0; j < MAX_SYS_FILES; j++) { const char* path = c.sysfiles[j].path; @@ -716,7 +711,7 @@ static bool setKernelTraceFuncs(const char* funcs) static bool setCategoryEnable(const char* name, bool enable) { - for (int i = 0; i < NELEM(k_categories); i++) { + for (size_t i = 0; i < arraysize(k_categories); i++) { const TracingCategory& c = k_categories[i]; if (strcmp(name, c.name) == 0) { if (isCategorySupported(c)) { @@ -777,7 +772,7 @@ static bool setUpTrace() // Set up the tags property. uint64_t tags = 0; - for (int i = 0; i < NELEM(k_categories); i++) { + for (size_t i = 0; i < arraysize(k_categories); i++) { if (g_categoryEnables[i]) { const TracingCategory &c = k_categories[i]; tags |= c.tags; @@ -786,7 +781,7 @@ static bool setUpTrace() ok &= setTagsProperty(tags); bool coreServicesTagEnabled = false; - for (int i = 0; i < NELEM(k_categories); i++) { + for (size_t i = 0; i < arraysize(k_categories); i++) { if (strcmp(k_categories[i].name, k_coreServiceCategory) == 0) { coreServicesTagEnabled = g_categoryEnables[i]; } @@ -794,12 +789,10 @@ static bool setUpTrace() std::string packageList(g_debugAppCmdLine); if (coreServicesTagEnabled) { - char value[PROPERTY_VALUE_MAX]; - property_get(k_coreServicesProp, value, ""); if (!packageList.empty()) { packageList += ","; } - packageList += value; + packageList += android::base::GetProperty(k_coreServicesProp, ""); } ok &= setAppCmdlineProperty(&packageList[0]); ok &= pokeBinderServices(); @@ -810,7 +803,7 @@ static bool setUpTrace() ok &= disableKernelTraceEvents(); // Enable all the sysfs enables that are in an enabled category. - for (int i = 0; i < NELEM(k_categories); i++) { + for (size_t i = 0; i < arraysize(k_categories); i++) { if (g_categoryEnables[i]) { const TracingCategory &c = k_categories[i]; for (int j = 0; j < MAX_SYS_FILES; j++) { @@ -975,11 +968,16 @@ static void dumpTrace(int outFd) fprintf(stderr, "error cleaning up zlib: %d\n", result); } } else { - ssize_t sent = 0; - while ((sent = sendfile(outFd, traceFD, NULL, 64*1024*1024)) > 0); - if (sent == -1) { - fprintf(stderr, "error dumping trace: %s (%d)\n", strerror(errno), - errno); + char buf[4096]; + ssize_t rc; + while ((rc = TEMP_FAILURE_RETRY(read(traceFD, buf, sizeof(buf)))) > 0) { + if (!android::base::WriteFully(outFd, buf, rc)) { + fprintf(stderr, "error writing trace: %s\n", strerror(errno)); + break; + } + } + if (rc == -1) { + fprintf(stderr, "error dumping trace: %s\n", strerror(errno)); } } @@ -1007,7 +1005,7 @@ static void registerSigHandler() static void listSupportedCategories() { - for (int i = 0; i < NELEM(k_categories); i++) { + for (size_t i = 0; i < arraysize(k_categories); i++) { const TracingCategory& c = k_categories[i]; if (isCategorySupported(c)) { printf(" %10s - %s\n", c.name, c.longname); diff --git a/cmds/dumpstate/Android.mk b/cmds/dumpstate/Android.mk index a407ea276e..18a4078d36 100644 --- a/cmds/dumpstate/Android.mk +++ b/cmds/dumpstate/Android.mk @@ -16,8 +16,8 @@ COMMON_SRC_FILES := \ utils.cpp COMMON_SHARED_LIBRARIES := \ android.hardware.dumpstate@1.0 \ - android.hidl.manager@1.0 \ libhidlbase \ + libhidltransport \ libbase \ libbinder \ libcutils \ diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp index eefdcbdfda..91deb36152 100644 --- a/cmds/dumpstate/utils.cpp +++ b/cmds/dumpstate/utils.cpp @@ -974,7 +974,8 @@ const char *dump_traces() { /* If 3 backtrace dumps fail in a row, consider debuggerd dead. */ if (timeout_failures == 3) { dprintf(fd, "too many stack dump failures, skipping...\n"); - } else if (dump_backtrace_to_file_timeout(pid, fd, 20) == -1) { + } else if (dump_backtrace_to_file_timeout( + pid, kDebuggerdNativeBacktrace, 20, fd) == -1) { dprintf(fd, "dumping failed, likely due to a timeout\n"); timeout_failures++; } else { diff --git a/cmds/dumpsys/tests/Android.bp b/cmds/dumpsys/tests/Android.bp index 7698ed5b95..127e0f360d 100644 --- a/cmds/dumpsys/tests/Android.bp +++ b/cmds/dumpsys/tests/Android.bp @@ -1,6 +1,7 @@ // Build the unit tests for dumpsys cc_test { name: "dumpsys_test", + test_suites: ["device-tests"], srcs: ["dumpsys_test.cpp"], diff --git a/cmds/dumpsys/tests/AndroidTest.xml b/cmds/dumpsys/tests/AndroidTest.xml new file mode 100644 index 0000000000..1a8c67f7aa --- /dev/null +++ b/cmds/dumpsys/tests/AndroidTest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Config for dumpsys_test"> + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="dumpsys_test->/data/local/tmp/dumpsys_test" /> + </target_preparer> + <option name="test-suite-tag" value="apct" /> + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="dumpsys_test" /> + </test> +</configuration>
\ No newline at end of file diff --git a/cmds/installd/dexopt.h b/cmds/installd/dexopt.h index 355adb1375..cb8aaeba75 100644 --- a/cmds/installd/dexopt.h +++ b/cmds/installd/dexopt.h @@ -30,7 +30,6 @@ static constexpr int DEX2OAT_FROM_SCRATCH = 1; static constexpr int DEX2OAT_FOR_BOOT_IMAGE = 2; static constexpr int DEX2OAT_FOR_FILTER = 3; static constexpr int DEX2OAT_FOR_RELOCATION = 4; -static constexpr int PATCHOAT_FOR_RELOCATION = 5; // Clear the reference profile for the primary apk of the given package. bool clear_primary_reference_profile(const std::string& pkgname); diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp index c7920821c6..7c054173b9 100644 --- a/cmds/installd/utils.cpp +++ b/cmds/installd/utils.cpp @@ -168,18 +168,19 @@ std::string create_data_app_path(const char* volume_uuid) { /** * Create the path name for user data for a certain userid. + * Keep same implementation as vold to minimize path walking overhead */ std::string create_data_user_ce_path(const char* volume_uuid, userid_t userid) { std::string data(create_data_path(volume_uuid)); - if (volume_uuid == nullptr) { - if (userid == 0) { - return StringPrintf("%s/data", data.c_str()); - } else { - return StringPrintf("%s/user/%u", data.c_str(), userid); + if (volume_uuid == nullptr && userid == 0) { + std::string legacy = StringPrintf("%s/data", data.c_str()); + struct stat sb; + if (lstat(legacy.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)) { + /* /data/data is dir, return /data/data for legacy system */ + return legacy; } - } else { - return StringPrintf("%s/user/%u", data.c_str(), userid); } + return StringPrintf("%s/user/%u", data.c_str(), userid); } /** diff --git a/cmds/lshal/Android.bp b/cmds/lshal/Android.bp index 38647eb5e0..67b5b46829 100644 --- a/cmds/lshal/Android.bp +++ b/cmds/lshal/Android.bp @@ -22,7 +22,6 @@ cc_library_shared { "libhidltransport", "libhidl-gen-utils", "libvintf", - "android.hidl.manager@1.0", ], srcs: [ "DebugCommand.cpp", diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp index 710b6e4c84..7c6cfd94ab 100644 --- a/cmds/lshal/ListCommand.cpp +++ b/cmds/lshal/ListCommand.cpp @@ -73,44 +73,90 @@ void ListCommand::removeDeadProcesses(Pids *pids) { }), pids->end()); } -bool ListCommand::getReferencedPids( - pid_t serverPid, std::map<uint64_t, Pids> *objects) const { - - std::ifstream ifs("/d/binder/proc/" + std::to_string(serverPid)); +bool scanBinderContext(pid_t pid, + const std::string &contextName, + std::function<void(const std::string&)> eachLine) { + std::ifstream ifs("/d/binder/proc/" + std::to_string(pid)); if (!ifs.is_open()) { return false; } - static const std::regex prefix("^\\s*node \\d+:\\s+u([0-9a-f]+)\\s+c([0-9a-f]+)\\s+"); + static const std::regex kContextLine("^context (\\w+)$"); + bool isDesiredContext = false; std::string line; std::smatch match; while(getline(ifs, line)) { - if (!std::regex_search(line, match, prefix)) { - // the line doesn't start with the correct prefix + if (std::regex_search(line, match, kContextLine)) { + isDesiredContext = match.str(1) == contextName; continue; } - std::string ptrString = "0x" + match.str(2); // use number after c - uint64_t ptr; - if (!::android::base::ParseUint(ptrString.c_str(), &ptr)) { - // Should not reach here, but just be tolerant. - mErr << "Could not parse number " << ptrString << std::endl; + + if (!isDesiredContext) { continue; } - const std::string proc = " proc "; - auto pos = line.rfind(proc); - if (pos != std::string::npos) { - for (const std::string &pidStr : split(line.substr(pos + proc.size()), ' ')) { - int32_t pid; - if (!::android::base::ParseInt(pidStr, &pid)) { - mErr << "Could not parse number " << pidStr << std::endl; - continue; + + eachLine(line); + } + return true; +} + +bool ListCommand::getPidInfo( + pid_t serverPid, PidInfo *pidInfo) const { + static const std::regex kReferencePrefix("^\\s*node \\d+:\\s+u([0-9a-f]+)\\s+c([0-9a-f]+)\\s+"); + static const std::regex kThreadPrefix("^\\s*thread \\d+:\\s+l\\s+(\\d)(\\d)"); + + std::smatch match; + return scanBinderContext(serverPid, "hwbinder", [&](const std::string& line) { + if (std::regex_search(line, match, kReferencePrefix)) { + const std::string &ptrString = "0x" + match.str(2); // use number after c + uint64_t ptr; + if (!::android::base::ParseUint(ptrString.c_str(), &ptr)) { + // Should not reach here, but just be tolerant. + mErr << "Could not parse number " << ptrString << std::endl; + return; + } + const std::string proc = " proc "; + auto pos = line.rfind(proc); + if (pos != std::string::npos) { + for (const std::string &pidStr : split(line.substr(pos + proc.size()), ' ')) { + int32_t pid; + if (!::android::base::ParseInt(pidStr, &pid)) { + mErr << "Could not parse number " << pidStr << std::endl; + return; + } + pidInfo->refPids[ptr].push_back(pid); } - (*objects)[ptr].push_back(pid); } + + return; } - } - return true; + + if (std::regex_search(line, match, kThreadPrefix)) { + // "1" is waiting in binder driver + // "2" is poll. It's impossible to tell if these are in use. + // and HIDL default code doesn't use it. + bool isInUse = match.str(1) != "1"; + // "0" is a thread that has called into binder + // "1" is looper thread + // "2" is main looper thread + bool isHwbinderThread = match.str(2) != "0"; + + if (!isHwbinderThread) { + return; + } + + if (isInUse) { + pidInfo->threadUsage++; + } + + pidInfo->threadCount++; + return; + } + + // not reference or thread line + return; + }); } // Must process hwbinder services first, then passthrough services. @@ -164,9 +210,11 @@ void ListCommand::printLine( const std::string &interfaceName, const std::string &transport, const std::string &arch, + const std::string &threadUsage, const std::string &server, const std::string &serverCmdline, - const std::string &address, const std::string &clients, + const std::string &address, + const std::string &clients, const std::string &clientCmdlines) const { if (mSelectedColumns & ENABLE_INTERFACE_NAME) mOut << std::setw(80) << interfaceName << "\t"; @@ -174,6 +222,9 @@ void ListCommand::printLine( mOut << std::setw(10) << transport << "\t"; if (mSelectedColumns & ENABLE_ARCH) mOut << std::setw(5) << arch << "\t"; + if (mSelectedColumns & ENABLE_THREADS) { + mOut << std::setw(8) << threadUsage << "\t"; + } if (mSelectedColumns & ENABLE_SERVER_PID) { if (mEnableCmdlines) { mOut << std::setw(15) << serverCmdline << "\t"; @@ -193,7 +244,18 @@ void ListCommand::printLine( mOut << std::endl; } +static inline bool findAndBumpVersion(vintf::ManifestHal* hal, const vintf::Version& version) { + for (vintf::Version& v : hal->versions) { + if (v.majorVer == version.majorVer) { + v.minorVer = std::max(v.minorVer, version.minorVer); + return true; + } + } + return false; +} + void ListCommand::dumpVintf() const { + using vintf::operator|=; mOut << "<!-- " << std::endl << " This is a skeleton device manifest. Notes: " << std::endl << " 1. android.hidl.*, android.frameworks.*, android.system.* are not included." << std::endl @@ -201,7 +263,9 @@ void ListCommand::dumpVintf() const { << " only hwbinder is shown." << std::endl << " 3. It is likely that HALs in passthrough transport does not have" << std::endl << " <interface> declared; users will have to write them by hand." << std::endl - << " 4. sepolicy version is set to 0.0. It is recommended that the entry" << std::endl + << " 4. A HAL with lower minor version can be overridden by a HAL with" << std::endl + << " higher minor version if they have the same name and major version." << std::endl + << " 5. sepolicy version is set to 0.0. It is recommended that the entry" << std::endl << " is removed from the manifest file and written by assemble_vintf" << std::endl << " at build time." << std::endl << "-->" << std::endl; @@ -265,17 +329,19 @@ void ListCommand::dumpVintf() const { for (vintf::ManifestHal *hal : manifest.getHals(fqName.package())) { if (hal->transport() != transport) { if (transport != vintf::Transport::PASSTHROUGH) { - mErr << "Fatal: should not reach here. Generated result may be wrong." + mErr << "Fatal: should not reach here. Generated result may be wrong for '" + << hal->name << "'." << std::endl; } done = true; break; } - if (hal->hasVersion(version)) { + if (findAndBumpVersion(hal, version)) { if (&table != &mImplementationsTable) { hal->interfaces[interfaceName].name = interfaceName; hal->interfaces[interfaceName].instances.insert(instanceName); } + hal->transportArch.arch |= arch; done = true; break; } @@ -344,15 +410,20 @@ void ListCommand::dumpTable() { mImplementationsTable.description = "All available passthrough implementations (all -impl.so files)"; forEachTable([this] (const Table &table) { - mOut << table.description << std::endl; + if (!mNeat) { + mOut << table.description << std::endl; + } mOut << std::left; - printLine("Interface", "Transport", "Arch", "Server", "Server CMD", - "PTR", "Clients", "Clients CMD"); + if (!mNeat) { + printLine("Interface", "Transport", "Arch", "Thread Use", "Server", + "Server CMD", "PTR", "Clients", "Clients CMD"); + } for (const auto &entry : table) { printLine(entry.interfaceName, entry.transport, getArchString(entry.arch), + entry.getThreadUsage(), entry.serverPid == NO_PID ? "N/A" : std::to_string(entry.serverPid), entry.serverCmdline, entry.serverObjectAddress == NO_PTR ? "N/A" : toHexString(entry.serverObjectAddress), @@ -369,7 +440,9 @@ void ListCommand::dumpTable() { NullableOStream<std::ostream>(nullptr)); } } - mOut << std::endl; + if (!mNeat) { + mOut << std::endl; + } }); } @@ -409,7 +482,8 @@ Status ListCommand::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::debugDump, [&] (const auto &infos) { + using std::literals::chrono_literals::operator""s; + auto ret = timeoutIPC(2s, 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()} + "/" + @@ -419,7 +493,7 @@ Status ListCommand::fetchAllLibraries(const sp<IServiceManager> &manager) { .transport = "passthrough", .serverPid = NO_PID, .serverObjectAddress = NO_PTR, - .clientPids = {}, + .clientPids = info.clientPids, .arch = ARCH_UNKNOWN }).first->second.arch |= fromBaseArchitecture(info.arch); } @@ -486,7 +560,7 @@ Status ListCommand::fetchBinderized(const sp<IServiceManager> &manager) { 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; + std::map<pid_t, PidInfo> allPids; for (const auto &fqInstanceName : fqInstanceNames) { const auto pair = splitFirst(fqInstanceName, '/'); const auto &serviceName = pair.first; @@ -510,7 +584,7 @@ Status ListCommand::fetchBinderized(const sp<IServiceManager> &manager) { auto debugRet = timeoutIPC(service, &IBase::getDebugInfo, [&] (const auto &debugInfo) { allDebugInfos[fqInstanceName] = debugInfo; if (debugInfo.pid >= 0) { - allPids[static_cast<pid_t>(debugInfo.pid)].clear(); + allPids[static_cast<pid_t>(debugInfo.pid)] = PidInfo(); } }); if (!debugRet.isOk()) { @@ -520,9 +594,10 @@ Status ListCommand::fetchBinderized(const sp<IServiceManager> &manager) { status |= DUMP_BINDERIZED_ERROR; } } + for (auto &pair : allPids) { pid_t serverPid = pair.first; - if (!getReferencedPids(serverPid, &allPids[serverPid])) { + if (!getPidInfo(serverPid, &allPids[serverPid])) { mErr << "Warning: no information for PID " << serverPid << ", are you root?" << std::endl; status |= DUMP_BINDERIZED_ERROR; @@ -537,18 +612,23 @@ Status ListCommand::fetchBinderized(const sp<IServiceManager> &manager) { .serverPid = NO_PID, .serverObjectAddress = NO_PTR, .clientPids = {}, + .threadUsage = 0, + .threadCount = 0, .arch = ARCH_UNKNOWN }); continue; } const DebugInfo &info = it->second; + bool writePidInfo = info.pid != NO_PID && info.ptr != NO_PTR; + 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], + .clientPids = writePidInfo ? allPids[info.pid].refPids[info.ptr] : Pids{}, + .threadUsage = writePidInfo ? allPids[info.pid].threadUsage : 0, + .threadCount = writePidInfo ? allPids[info.pid].threadCount : 0, .arch = fromBaseArchitecture(info.arch), }); } @@ -587,12 +667,14 @@ Status ListCommand::parseArgs(const std::string &command, const Arg &arg) { {"pid", no_argument, 0, 'p' }, {"address", no_argument, 0, 'a' }, {"clients", no_argument, 0, 'c' }, + {"threads", no_argument, 0, 'e' }, {"cmdline", no_argument, 0, 'm' }, {"debug", optional_argument, 0, 'd' }, // long options without short alternatives {"sort", required_argument, 0, 's' }, {"init-vintf",optional_argument, 0, 'v' }, + {"neat", no_argument, 0, 'n' }, { 0, 0, 0, 0 } }; @@ -602,7 +684,7 @@ Status ListCommand::parseArgs(const std::string &command, const Arg &arg) { for (;;) { // using getopt_long in case we want to add other options in the future c = getopt_long(arg.argc, arg.argv, - "hitrpacmd", longOptions, &optionIndex); + "hitrpacmde", longOptions, &optionIndex); if (c == -1) { break; } @@ -654,6 +736,10 @@ Status ListCommand::parseArgs(const std::string &command, const Arg &arg) { mSelectedColumns |= ENABLE_CLIENT_PIDS; break; } + case 'e': { + mSelectedColumns |= ENABLE_THREADS; + break; + } case 'm': { mEnableCmdlines = true; break; @@ -672,6 +758,10 @@ Status ListCommand::parseArgs(const std::string &command, const Arg &arg) { } break; } + case 'n': { + mNeat = true; + break; + } case 'h': // falls through default: // see unrecognized options mLshal.usage(command); @@ -684,7 +774,7 @@ Status ListCommand::parseArgs(const std::string &command, const Arg &arg) { } if (mSelectedColumns == 0) { - mSelectedColumns = ENABLE_INTERFACE_NAME | ENABLE_SERVER_PID | ENABLE_CLIENT_PIDS; + mSelectedColumns = ENABLE_INTERFACE_NAME | ENABLE_SERVER_PID | ENABLE_CLIENT_PIDS | ENABLE_THREADS; } return OK; } diff --git a/cmds/lshal/ListCommand.h b/cmds/lshal/ListCommand.h index 42c965fb28..a75db04960 100644 --- a/cmds/lshal/ListCommand.h +++ b/cmds/lshal/ListCommand.h @@ -48,18 +48,26 @@ private: 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; + + struct PidInfo { + std::map<uint64_t, Pids> refPids; // pids that are referenced + uint32_t threadUsage; // number of threads in use + uint32_t threadCount; // number of threads total + }; + bool getPidInfo(pid_t serverPid, PidInfo *info) const; + void dumpTable(); void dumpVintf() const; void printLine( const std::string &interfaceName, const std::string &transport, const std::string &arch, + const std::string &threadUsage, const std::string &server, const std::string &serverCmdline, - const std::string &address, const std::string &clients, - const std::string &clientCmdlines) const ; + const std::string &address, + const std::string &clients, + const std::string &clientCmdlines) const; // Return /proc/{pid}/cmdline if it exists, else empty string. const std::string &getCmdline(pid_t pid); // Call getCmdline on all pid in pids. If it returns empty string, the process might @@ -85,7 +93,12 @@ private: // If true, calls IBase::debug(...) on each service. bool mEmitDebugInfo = false; + // If true, output in VINTF format. bool mVintf = false; + + // If true, explanatory text are not emitted. + bool mNeat = 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/Lshal.cpp b/cmds/lshal/Lshal.cpp index 9db42f10ca..e2d5f6df0a 100644 --- a/cmds/lshal/Lshal.cpp +++ b/cmds/lshal/Lshal.cpp @@ -66,7 +66,7 @@ void Lshal::usage(const std::string &command) const { " List all hals with default ordering and columns (`lshal list -ipc`)\n" " lshal list [-h|--help]\n" " -h, --help: Print help message for list (`lshal help list`)\n" - " lshal [list] [--interface|-i] [--transport|-t] [-r|--arch]\n" + " lshal [list] [--interface|-i] [--transport|-t] [-r|--arch] [-e|--threads]\n" " [--pid|-p] [--address|-a] [--clients|-c] [--cmdline|-m]\n" " [--sort={interface|i|pid|p}] [--init-vintf[=<output file>]]\n" " [--debug|-d[=<output file>]]\n" @@ -74,6 +74,8 @@ void Lshal::usage(const std::string &command) const { " -n, --instance: print the instance name column\n" " -t, --transport: print the transport mode column\n" " -r, --arch: print if the HAL is in 64-bit or 32-bit\n" + " -e, --threads: print currently used/available threads\n" + " (note, available threads created lazily)\n" " -p, --pid: print the server PID, or server cmdline if -m is set\n" " -a, --address: print the server object address column\n" " -c, --clients: print the client PIDs, or client cmdlines if -m is set\n" diff --git a/cmds/lshal/TableEntry.h b/cmds/lshal/TableEntry.h index 9ae8f7863a..e04c3ca252 100644 --- a/cmds/lshal/TableEntry.h +++ b/cmds/lshal/TableEntry.h @@ -47,6 +47,8 @@ struct TableEntry { std::string interfaceName; std::string transport; int32_t serverPid; + uint32_t threadUsage; + uint32_t threadCount; std::string serverCmdline; uint64_t serverObjectAddress; Pids clientPids; @@ -59,6 +61,14 @@ struct TableEntry { static bool sortByServerPid(const TableEntry &a, const TableEntry &b) { return a.serverPid < b.serverPid; }; + + std::string getThreadUsage() const { + if (threadCount == 0) { + return "N/A"; + } + + return std::to_string(threadUsage) + "/" + std::to_string(threadCount); + } }; struct Table { @@ -80,7 +90,8 @@ enum : unsigned int { ENABLE_SERVER_PID = 1 << 2, ENABLE_SERVER_ADDR = 1 << 3, ENABLE_CLIENT_PIDS = 1 << 4, - ENABLE_ARCH = 1 << 5 + ENABLE_ARCH = 1 << 5, + ENABLE_THREADS = 1 << 6, }; using TableEntrySelect = unsigned int; diff --git a/cmds/lshal/Timeout.h b/cmds/lshal/Timeout.h index ca477bf615..c940404200 100644 --- a/cmds/lshal/Timeout.h +++ b/cmds/lshal/Timeout.h @@ -77,14 +77,15 @@ bool timeout(std::chrono::duration<R, P> delay, std::function<void(void)> &&func return success; } -template<class Function, class I, class... Args> +template<class R, class P, class Function, class I, class... Args> typename std::result_of<Function(I *, Args...)>::type -timeoutIPC(const sp<I> &interfaceObject, Function &&func, Args &&... args) { +timeoutIPC(std::chrono::duration<R, P> wait, const sp<I> &interfaceObject, Function &&func, + Args &&... args) { using ::android::hardware::Status; typename std::result_of<Function(I *, Args...)>::type ret{Status::ok()}; auto boundFunc = std::bind(std::forward<Function>(func), interfaceObject.get(), std::forward<Args>(args)...); - bool success = timeout(IPC_CALL_WAIT, [&ret, &boundFunc] { + bool success = timeout(wait, [&ret, &boundFunc] { ret = std::move(boundFunc()); }); if (!success) { @@ -93,5 +94,12 @@ timeoutIPC(const sp<I> &interfaceObject, Function &&func, Args &&... args) { return ret; } +template<class Function, class I, class... Args> +typename std::result_of<Function(I *, Args...)>::type +timeoutIPC(const sp<I> &interfaceObject, Function &&func, Args &&... args) { + return timeoutIPC(IPC_CALL_WAIT, interfaceObject, func, args...); +} + + } // namespace lshal } // namespace android diff --git a/include/android/sensor.h b/include/android/sensor.h index cdb3fffedc..97b4a2ae60 100644 --- a/include/android/sensor.h +++ b/include/android/sensor.h @@ -50,6 +50,7 @@ #include <android/looper.h> +#include <stdbool.h> #include <sys/types.h> #include <math.h> #include <stdint.h> diff --git a/include/gui/BufferItemConsumer.h b/include/gui/BufferItemConsumer.h index db7e944fcd..217fe6ad81 100644 --- a/include/gui/BufferItemConsumer.h +++ b/include/gui/BufferItemConsumer.h @@ -55,7 +55,7 @@ class BufferItemConsumer: public ConsumerBase uint32_t consumerUsage, int bufferCount = DEFAULT_MAX_BUFFERS, bool controlledByApp = false); - virtual ~BufferItemConsumer(); + ~BufferItemConsumer() override; // set the name of the BufferItemConsumer that will be used to identify it in // log messages. diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h index bd62d85afb..ba5cbf7eb4 100644 --- a/include/gui/BufferQueue.h +++ b/include/gui/BufferQueue.h @@ -57,7 +57,7 @@ public: class ProxyConsumerListener : public BnConsumerListener { public: explicit ProxyConsumerListener(const wp<ConsumerListener>& consumerListener); - virtual ~ProxyConsumerListener(); + ~ProxyConsumerListener() override; void onDisconnect() override; void onFrameAvailable(const BufferItem& item) override; void onFrameReplaced(const BufferItem& item) override; diff --git a/include/gui/BufferQueueConsumer.h b/include/gui/BufferQueueConsumer.h index b383056c6e..f194bdf758 100644 --- a/include/gui/BufferQueueConsumer.h +++ b/include/gui/BufferQueueConsumer.h @@ -32,7 +32,7 @@ class BufferQueueConsumer : public BnGraphicBufferConsumer { public: BufferQueueConsumer(const sp<BufferQueueCore>& core); - virtual ~BufferQueueConsumer(); + ~BufferQueueConsumer() override; // acquireBuffer attempts to acquire ownership of the next pending buffer in // the BufferQueue. If no buffer is pending then it returns diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h index 5541468998..87bc8008e1 100644 --- a/include/gui/BufferQueueProducer.h +++ b/include/gui/BufferQueueProducer.h @@ -30,7 +30,7 @@ public: friend class BufferQueue; // Needed to access binderDied BufferQueueProducer(const sp<BufferQueueCore>& core, bool consumerIsSurfaceFlinger = false); - virtual ~BufferQueueProducer(); + ~BufferQueueProducer() override; // requestBuffer returns the GraphicBuffer for slot N. // diff --git a/include/gui/ConsumerBase.h b/include/gui/ConsumerBase.h index 7912528ba7..d1a9b04ad6 100644 --- a/include/gui/ConsumerBase.h +++ b/include/gui/ConsumerBase.h @@ -47,7 +47,7 @@ public: virtual void onFrameReplaced(const BufferItem& /* item */) {} }; - virtual ~ConsumerBase(); + ~ConsumerBase() override; // abandon frees all the buffers and puts the ConsumerBase into the // 'abandoned' state. Once put in this state the ConsumerBase can never diff --git a/libs/binder/include/binder/Parcelable.h b/libs/binder/include/binder/Parcelable.h index d5b57ac587..a9166e2408 100644 --- a/libs/binder/include/binder/Parcelable.h +++ b/libs/binder/include/binder/Parcelable.h @@ -36,6 +36,9 @@ class Parcelable { public: virtual ~Parcelable() = default; + Parcelable() = default; + Parcelable(const Parcelable&) = default; + // Write |this| parcelable to the given |parcel|. Keep in mind that // implementations of writeToParcel must be manually kept in sync // with readFromParcel and the Java equivalent versions of these methods. diff --git a/libs/gui/Android.bp b/libs/gui/Android.bp index a07726a78c..f1d1346366 100644 --- a/libs/gui/Android.bp +++ b/libs/gui/Android.bp @@ -111,7 +111,6 @@ cc_library_shared { "liblog", "libhidlbase", "libhidltransport", - "android.hidl.base@1.0", "android.hidl.token@1.0-utils", "android.hardware.graphics.bufferqueue@1.0", "android.hardware.configstore@1.0", diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp index bca645f251..8481b502a0 100644 --- a/libs/gui/IGraphicBufferProducer.cpp +++ b/libs/gui/IGraphicBufferProducer.cpp @@ -73,7 +73,7 @@ public: { } - virtual ~BpGraphicBufferProducer(); + ~BpGraphicBufferProducer() override; virtual status_t requestBuffer(int bufferIdx, sp<GraphicBuffer>* buf) { Parcel data, reply; diff --git a/libs/gui/tests/Android.bp b/libs/gui/tests/Android.bp index 7efdb14bbf..fa87f29aa1 100644 --- a/libs/gui/tests/Android.bp +++ b/libs/gui/tests/Android.bp @@ -4,6 +4,7 @@ // to integrate with auto-test framework. cc_test { name: "libgui_test", + test_suites: ["device-tests"], clang: true, diff --git a/libs/gui/tests/AndroidTest.xml b/libs/gui/tests/AndroidTest.xml new file mode 100644 index 0000000000..c02e020be6 --- /dev/null +++ b/libs/gui/tests/AndroidTest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> +<configuration description="Config for libgui_test"> + <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> + <option name="cleanup" value="true" /> + <option name="push" value="libgui_test->/data/local/tmp/libgui_test" /> + </target_preparer> + <option name="test-suite-tag" value="apct" /> + <test class="com.android.tradefed.testtype.GTest" > + <option name="native-test-device-path" value="/data/local/tmp" /> + <option name="module-name" value="libgui_test" /> + </test> +</configuration>
\ No newline at end of file diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp index af1c0af815..293bc25ab5 100644 --- a/libs/input/InputTransport.cpp +++ b/libs/input/InputTransport.cpp @@ -842,15 +842,14 @@ status_t InputConsumer::sendFinishedSignal(uint32_t seq, bool handled) { } if (status) { // An error occurred so at least one signal was not sent, reconstruct the chain. - do { + for (;;) { SeqChain seqChain; seqChain.seq = chainIndex != 0 ? chainSeqs[chainIndex - 1] : seq; seqChain.chain = chainSeqs[chainIndex]; mSeqChains.push(seqChain); - if (chainIndex != 0) { - chainIndex--; - } - } while (chainIndex > 0); + if (!chainIndex) break; + chainIndex--; + } return status; } } diff --git a/libs/math/include/math/half.h b/libs/math/include/math/half.h index 615b840b01..76829734a4 100644 --- a/libs/math/include/math/half.h +++ b/libs/math/include/math/half.h @@ -56,8 +56,8 @@ namespace android { */ class half { struct fp16 { - uint16_t bits = 0; - fp16() noexcept = default; + uint16_t bits; + explicit constexpr fp16() noexcept : bits(0) { } explicit constexpr fp16(uint16_t b) noexcept : bits(b) { } void setS(unsigned int s) noexcept { bits = uint16_t((bits & 0x7FFF) | (s<<15)); } void setE(unsigned int s) noexcept { bits = uint16_t((bits & 0xE3FF) | (s<<10)); } @@ -68,11 +68,11 @@ class half { }; struct fp32 { union { - uint32_t bits = 0; + uint32_t bits; float fp; }; - fp32() noexcept = default; - explicit constexpr fp32(float f) : fp(f) { } + explicit constexpr fp32() noexcept : bits(0) { } + explicit constexpr fp32(float f) noexcept : fp(f) { } void setS(unsigned int s) noexcept { bits = uint32_t((bits & 0x7FFFFFFF) | (s<<31)); } void setE(unsigned int s) noexcept { bits = uint32_t((bits & 0x807FFFFF) | (s<<23)); } void setM(unsigned int s) noexcept { bits = uint32_t((bits & 0xFF800000) | (s<< 0)); } diff --git a/services/inputflinger/Android.bp b/services/inputflinger/Android.bp new file mode 100644 index 0000000000..4fd98e2a7e --- /dev/null +++ b/services/inputflinger/Android.bp @@ -0,0 +1,51 @@ +// Copyright (C) 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. + +cc_library_shared { + name: "libinputflinger", + + srcs: [ + "EventHub.cpp", + "InputApplication.cpp", + "InputDispatcher.cpp", + "InputListener.cpp", + "InputManager.cpp", + "InputReader.cpp", + "InputWindow.cpp", + ], + + shared_libs: [ + "libbinder", + "libcrypto", + "libcutils", + "libinput", + "liblog", + "libutils", + "libui", + "libhardware_legacy", + ], + + cflags: [ + "-Wno-unused-parameter", + // TODO: Move inputflinger to its own process and mark it hidden + //-fvisibility=hidden + ], + + export_include_dirs: ["."], +} + +subdirs = [ + "host", + "tests", +] diff --git a/services/inputflinger/Android.mk b/services/inputflinger/Android.mk deleted file mode 100644 index ed867d8441..0000000000 --- a/services/inputflinger/Android.mk +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 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. - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - EventHub.cpp \ - InputApplication.cpp \ - InputDispatcher.cpp \ - InputListener.cpp \ - InputManager.cpp \ - InputReader.cpp \ - InputWindow.cpp - -LOCAL_SHARED_LIBRARIES := \ - libbinder \ - libcrypto \ - libcutils \ - libinput \ - liblog \ - libutils \ - libui \ - libhardware_legacy - - -# TODO: Move inputflinger to its own process and mark it hidden -#LOCAL_CFLAGS += -fvisibility=hidden - -LOCAL_CFLAGS += -Wno-unused-parameter - -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -LOCAL_MODULE := libinputflinger - -include $(BUILD_SHARED_LIBRARY) - -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/services/inputflinger/InputWindow.h b/services/inputflinger/InputWindow.h index feca6cf4e2..0ac868b1c5 100644 --- a/services/inputflinger/InputWindow.h +++ b/services/inputflinger/InputWindow.h @@ -101,7 +101,7 @@ struct InputWindowInfo { TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19, TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20, TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21, - TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+22, + TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27, TYPE_DOCK_DIVIDER = FIRST_SYSTEM_WINDOW+34, LAST_SYSTEM_WINDOW = 2999, }; diff --git a/services/inputflinger/host/Android.bp b/services/inputflinger/host/Android.bp new file mode 100644 index 0000000000..b8e9bce4bd --- /dev/null +++ b/services/inputflinger/host/Android.bp @@ -0,0 +1,57 @@ +// Copyright (C) 2015 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_library_shared { + name: "libinputflingerhost", + + srcs: [ + "InputFlinger.cpp", + "InputDriver.cpp", + "InputHost.cpp", + ], + + shared_libs: [ + "libbinder", + "libcrypto", + "libcutils", + "libinput", + "liblog", + "libutils", + "libhardware", + ], + + cflags: [ + "-Wno-unused-parameter", + // TODO: Move inputflinger to its own process and mark it hidden + //-fvisibility=hidden + ], + + export_include_dirs: ["."], +} + +//####################################################################### +// build input flinger executable +cc_binary { + name: "inputflinger", + + srcs: ["main.cpp"], + + shared_libs: [ + "libbinder", + "libinputflingerhost", + "libutils", + ], + + init_rc: ["inputflinger.rc"], +} diff --git a/services/inputflinger/host/Android.mk b/services/inputflinger/host/Android.mk deleted file mode 100644 index 0a7fc27ade..0000000000 --- a/services/inputflinger/host/Android.mk +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (C) 2015 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. - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_CLANG := true - -LOCAL_SRC_FILES:= \ - InputFlinger.cpp \ - InputDriver.cpp \ - InputHost.cpp - -LOCAL_SHARED_LIBRARIES := \ - libbinder \ - libcrypto \ - libcutils \ - libinput \ - liblog \ - libutils \ - libhardware - - -# TODO: Move inputflinger to its own process and mark it hidden -#LOCAL_CFLAGS += -fvisibility=hidden - -LOCAL_CFLAGS += -Wno-unused-parameter - -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -LOCAL_MODULE := libinputflingerhost - -include $(BUILD_SHARED_LIBRARY) - -######################################################################## -# build input flinger executable -include $(CLEAR_VARS) - -LOCAL_CLANG := true - -LOCAL_SRC_FILES:= \ - main.cpp - -LOCAL_SHARED_LIBRARIES := \ - libbinder \ - libinputflingerhost \ - libutils - -LOCAL_MODULE := inputflinger -LOCAL_INIT_RC := inputflinger.rc - -include $(BUILD_EXECUTABLE) diff --git a/services/inputflinger/tests/Android.bp b/services/inputflinger/tests/Android.bp new file mode 100644 index 0000000000..29d93f034b --- /dev/null +++ b/services/inputflinger/tests/Android.bp @@ -0,0 +1,23 @@ +// Build the unit tests. + +cc_test { + name: "inputflinger_tests", + srcs: [ + "InputReader_test.cpp", + "InputDispatcher_test.cpp", + ], + test_per_src: true, + cflags: ["-Wno-unused-parameter"], + shared_libs = [ + "libcutils", + "liblog", + "libutils", + "libhardware", + "libhardware_legacy", + "libui", + "libskia", + "libinput", + "libinputflinger", + "libinputservice", + ], +} diff --git a/services/inputflinger/tests/Android.mk b/services/inputflinger/tests/Android.mk deleted file mode 100644 index 4c433929ef..0000000000 --- a/services/inputflinger/tests/Android.mk +++ /dev/null @@ -1,40 +0,0 @@ -# Build the unit tests. -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -# Build the unit tests. -test_src_files := \ - InputReader_test.cpp \ - InputDispatcher_test.cpp - -shared_libraries := \ - libcutils \ - liblog \ - libutils \ - libhardware \ - libhardware_legacy \ - libui \ - libskia \ - libinput \ - libinputflinger \ - libinputservice - -c_includes := \ - external/skia/include/core - - -module_tags := tests - -$(foreach file,$(test_src_files), \ - $(eval include $(CLEAR_VARS)) \ - $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \ - $(eval LOCAL_C_INCLUDES := $(c_includes)) \ - $(eval LOCAL_CFLAGS += -Wno-unused-parameter) \ - $(eval LOCAL_SRC_FILES := $(file)) \ - $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ - $(eval LOCAL_MODULE_TAGS := $(module_tags)) \ - $(eval include $(BUILD_NATIVE_TEST)) \ -) - -# Build the manual test programs. -include $(call all-makefiles-under, $(LOCAL_PATH)) diff --git a/services/schedulerservice/Android.bp b/services/schedulerservice/Android.bp index 1f1340ca47..ca91b8e85f 100644 --- a/services/schedulerservice/Android.bp +++ b/services/schedulerservice/Android.bp @@ -10,7 +10,6 @@ cc_library_shared { "libmediautils", "liblog", "libutils", - "android.hidl.base@1.0", "android.frameworks.schedulerservice@1.0", ], header_libs: [ diff --git a/services/sensorservice/hidl/Android.bp b/services/sensorservice/hidl/Android.bp index 748dafcf62..8bbc4c59a8 100644 --- a/services/sensorservice/hidl/Android.bp +++ b/services/sensorservice/hidl/Android.bp @@ -18,7 +18,6 @@ cc_library_shared { "libsensor", "android.frameworks.sensorservice@1.0", "android.hardware.sensors@1.0", - "android.hidl.base@1.0", ], static_libs: [ "android.hardware.sensors@1.0-convert", diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 022b41634d..b4d6dcaff9 100644..100755 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1417,9 +1417,9 @@ void Layer::computeGeometry(const sp<const DisplayDevice>& hw, Mesh& mesh, bool Layer::isOpaque(const Layer::State& s) const { - // if we don't have a buffer yet, we're translucent regardless of the + // if we don't have a buffer or sidebandStream yet, we're translucent regardless of the // layer's opaque flag. - if (mActiveBuffer == 0) { + if ((mSidebandStream == nullptr) && (mActiveBuffer == nullptr)) { return false; } diff --git a/vulkan/api/vulkan.api b/vulkan/api/vulkan.api index a19fcf1c56..3efc13163e 100644 --- a/vulkan/api/vulkan.api +++ b/vulkan/api/vulkan.api @@ -28,7 +28,7 @@ import platform "platform.api" // API version (major.minor.patch) define VERSION_MAJOR 1 define VERSION_MINOR 0 -define VERSION_PATCH 46 +define VERSION_PATCH 49 // API limits define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256 @@ -320,7 +320,7 @@ define NULL_HANDLE 0 @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" -// 119 +// 120 @extension("VK_KHR_get_surface_capabilities2") define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 @extension("VK_KHR_get_surface_capabilities2") define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" @@ -409,7 +409,7 @@ enum VkImageLayout { //@extension("VK_KHR_swapchain") // 2 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, - //@extension("VK_KHR_shared_presentable_image") + //@extension("VK_KHR_shared_presentable_image") // 112 VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000, } @@ -1005,9 +1005,6 @@ enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHX = 1000071002, VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHX = 1000071003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHX = 1000071004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHX = 1000071005, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHX = 1000071006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHX = 1000071007, //@extension("VK_KHX_external_memory") // 73 VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHX = 1000072000, @@ -1086,10 +1083,10 @@ enum VkStructureType { //@extension("VK_EXT_hdr_metadata") // 106 VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, - //@extension("VK_KHR_shared_presentable_image") // 111 + //@extension("VK_KHR_shared_presentable_image") // 112 VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = 1000111000, - //@extension("VK_KHR_get_surface_capabilities2") // 119 + //@extension("VK_KHR_get_surface_capabilities2") // 120 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000, VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, @@ -1179,6 +1176,55 @@ enum VkDynamicState { VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, } +enum VkObjectType { + VK_OBJECT_TYPE_UNKNOWN = 0, + VK_OBJECT_TYPE_INSTANCE = 1, + VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2, + VK_OBJECT_TYPE_DEVICE = 3, + VK_OBJECT_TYPE_QUEUE = 4, + VK_OBJECT_TYPE_SEMAPHORE = 5, + VK_OBJECT_TYPE_COMMAND_BUFFER = 6, + VK_OBJECT_TYPE_FENCE = 7, + VK_OBJECT_TYPE_DEVICE_MEMORY = 8, + VK_OBJECT_TYPE_BUFFER = 9, + VK_OBJECT_TYPE_IMAGE = 10, + VK_OBJECT_TYPE_EVENT = 11, + VK_OBJECT_TYPE_QUERY_POOL = 12, + VK_OBJECT_TYPE_BUFFER_VIEW = 13, + VK_OBJECT_TYPE_IMAGE_VIEW = 14, + VK_OBJECT_TYPE_SHADER_MODULE = 15, + VK_OBJECT_TYPE_PIPELINE_CACHE = 16, + VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17, + VK_OBJECT_TYPE_RENDER_PASS = 18, + VK_OBJECT_TYPE_PIPELINE = 19, + VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20, + VK_OBJECT_TYPE_SAMPLER = 21, + VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22, + VK_OBJECT_TYPE_DESCRIPTOR_SET = 23, + VK_OBJECT_TYPE_FRAMEBUFFER = 24, + VK_OBJECT_TYPE_COMMAND_POOL = 25, + + //@extension("VK_KHR_surface") // 1 + VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, + + //@extension("VK_KHR_swapchain") // 2 + VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, + + //@extension("VK_KHR_display") // 3 + VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, + VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, + + //@extension("VK_KHR_debug_report") // 12 + VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, + + //@extension("VK_KHR_descriptor_update_template") // 86 + VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = 1000085000, + + //@extension("VK_NVX_device_generated_commands") // 87 + VK_OBJECT_TYPE_OBJECT_TABLE_NVX = 1000086000, + VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX = 1000086001, +} + @extension("VK_KHR_surface") // 1 enum VkPresentModeKHR { VK_PRESENT_MODE_IMMEDIATE_KHR = 0x00000000, @@ -1186,7 +1232,7 @@ enum VkPresentModeKHR { VK_PRESENT_MODE_FIFO_KHR = 0x00000002, VK_PRESENT_MODE_FIFO_RELAXED_KHR = 0x00000003, - //@extension("VK_KHR_shared_presentable_image") + //@extension("VK_KHR_shared_presentable_image") // 112 VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR = 1000111000, VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR = 1000111001, } @@ -4261,28 +4307,28 @@ class VkHdrMetadataEXT { f32 maxFrameAverageLightLevel } -@extension("VK_KHR_shared_presentable_image") // 111 +@extension("VK_KHR_shared_presentable_image") // 112 class VkSharedPresentSurfaceCapabilitiesKHR { VkStructureType sType const void* pNext VkImageUsageFlags sharedPresentSupportedUsageFlags } -@extension("VK_KHR_get_surface_capabilities2") // 119 +@extension("VK_KHR_get_surface_capabilities2") // 120 class VkPhysicalDeviceSurfaceInfo2KHR { VkStructureType sType const void* pNext VkSurfaceKHR surface } -@extension("VK_KHR_get_surface_capabilities2") // 119 +@extension("VK_KHR_get_surface_capabilities2") // 120 class VkSurfaceCapabilities2KHR { VkStructureType sType void* pNext VkSurfaceCapabilitiesKHR surfaceCapabilities } -@extension("VK_KHR_get_surface_capabilities2") // 119 +@extension("VK_KHR_get_surface_capabilities2") // 120 class VkSurfaceFormat2KHR { VkStructureType sType void* pNext @@ -7462,7 +7508,7 @@ cmd VkResult vkGetSwapchainStatusKHR( return ? } -@extension("VK_KHR_get_surface_capabilities2") // 119 +@extension("VK_KHR_get_surface_capabilities2") // 120 cmd VkResult vkGetPhysicalDeviceSurfaceCapabilities2KHR( VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, @@ -7470,7 +7516,7 @@ cmd VkResult vkGetPhysicalDeviceSurfaceCapabilities2KHR( return ? } -@extension("VK_KHR_get_surface_capabilities2") // 119 +@extension("VK_KHR_get_surface_capabilities2") // 120 cmd VkResult vkGetPhysicalDeviceSurfaceFormats2KHR( VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, diff --git a/vulkan/include/vulkan/vulkan.h b/vulkan/include/vulkan/vulkan.h index 67eba86646..ee3091348c 100644 --- a/vulkan/include/vulkan/vulkan.h +++ b/vulkan/include/vulkan/vulkan.h @@ -43,11 +43,11 @@ extern "C" { #define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) #define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) // Version of this file -#define VK_HEADER_VERSION 46 +#define VK_HEADER_VERSION 49 #define VK_NULL_HANDLE 0 - + #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; @@ -60,7 +60,7 @@ extern "C" { #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; #endif #endif - + typedef uint32_t VkFlags; @@ -261,9 +261,6 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHX = 1000071002, VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHX = 1000071003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHX = 1000071004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHX = 1000071005, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHX = 1000071006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHX = 1000071007, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHX = 1000072000, VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHX = 1000072001, VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHX = 1000072002, @@ -901,6 +898,47 @@ typedef enum VkSubpassContents { VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF } VkSubpassContents; +typedef enum VkObjectType { + VK_OBJECT_TYPE_UNKNOWN = 0, + VK_OBJECT_TYPE_INSTANCE = 1, + VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2, + VK_OBJECT_TYPE_DEVICE = 3, + VK_OBJECT_TYPE_QUEUE = 4, + VK_OBJECT_TYPE_SEMAPHORE = 5, + VK_OBJECT_TYPE_COMMAND_BUFFER = 6, + VK_OBJECT_TYPE_FENCE = 7, + VK_OBJECT_TYPE_DEVICE_MEMORY = 8, + VK_OBJECT_TYPE_BUFFER = 9, + VK_OBJECT_TYPE_IMAGE = 10, + VK_OBJECT_TYPE_EVENT = 11, + VK_OBJECT_TYPE_QUERY_POOL = 12, + VK_OBJECT_TYPE_BUFFER_VIEW = 13, + VK_OBJECT_TYPE_IMAGE_VIEW = 14, + VK_OBJECT_TYPE_SHADER_MODULE = 15, + VK_OBJECT_TYPE_PIPELINE_CACHE = 16, + VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17, + VK_OBJECT_TYPE_RENDER_PASS = 18, + VK_OBJECT_TYPE_PIPELINE = 19, + VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20, + VK_OBJECT_TYPE_SAMPLER = 21, + VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22, + VK_OBJECT_TYPE_DESCRIPTOR_SET = 23, + VK_OBJECT_TYPE_FRAMEBUFFER = 24, + VK_OBJECT_TYPE_COMMAND_POOL = 25, + VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, + VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, + VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, + VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, + VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, + VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = 1000085000, + VK_OBJECT_TYPE_OBJECT_TABLE_NVX = 1000086000, + VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX = 1000086001, + VK_OBJECT_TYPE_BEGIN_RANGE = VK_OBJECT_TYPE_UNKNOWN, + VK_OBJECT_TYPE_END_RANGE = VK_OBJECT_TYPE_COMMAND_POOL, + VK_OBJECT_TYPE_RANGE_SIZE = (VK_OBJECT_TYPE_COMMAND_POOL - VK_OBJECT_TYPE_UNKNOWN + 1), + VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkObjectType; + typedef VkFlags VkInstanceCreateFlags; typedef enum VkFormatFeatureFlagBits { @@ -4107,6 +4145,64 @@ VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR( const void* pData); #endif +#define VK_KHR_shared_presentable_image 1 +#define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1 +#define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image" + +typedef struct VkSharedPresentSurfaceCapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkImageUsageFlags sharedPresentSupportedUsageFlags; +} VkSharedPresentSurfaceCapabilitiesKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainStatusKHR)(VkDevice device, VkSwapchainKHR swapchain); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR( + VkDevice device, + VkSwapchainKHR swapchain); +#endif + +#define VK_KHR_get_surface_capabilities2 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" + +typedef struct VkPhysicalDeviceSurfaceInfo2KHR { + VkStructureType sType; + const void* pNext; + VkSurfaceKHR surface; +} VkPhysicalDeviceSurfaceInfo2KHR; + +typedef struct VkSurfaceCapabilities2KHR { + VkStructureType sType; + void* pNext; + VkSurfaceCapabilitiesKHR surfaceCapabilities; +} VkSurfaceCapabilities2KHR; + +typedef struct VkSurfaceFormat2KHR { + VkStructureType sType; + void* pNext; + VkSurfaceFormatKHR surfaceFormat; +} VkSurfaceFormat2KHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkSurfaceCapabilities2KHR* pSurfaceCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pSurfaceFormatCount, VkSurfaceFormat2KHR* pSurfaceFormats); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, + VkSurfaceCapabilities2KHR* pSurfaceCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, + uint32_t* pSurfaceFormatCount, + VkSurfaceFormat2KHR* pSurfaceFormats); +#endif + #define VK_EXT_debug_report 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) @@ -5770,66 +5866,6 @@ VKAPI_ATTR void VKAPI_CALL vkSetHdrMetadataEXT( const VkHdrMetadataEXT* pMetadata); #endif -#define VK_KHR_shared_presentable_image 1 -#define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1 -#define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image" - -typedef struct VkSharedPresentSurfaceCapabilitiesKHR { - VkStructureType sType; - void* pNext; - VkImageUsageFlags sharedPresentSupportedUsageFlags; -} VkSharedPresentSurfaceCapabilitiesKHR; - - -typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainStatusKHR)(VkDevice device, VkSwapchainKHR swapchain); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR( - VkDevice device, - VkSwapchainKHR swapchain); -#endif - -#define VK_KHR_get_surface_capabilities2 1 -#define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 -#define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" - -typedef struct VkPhysicalDeviceSurfaceInfo2KHR { - VkStructureType sType; - const void* pNext; - VkSurfaceKHR surface; -} VkPhysicalDeviceSurfaceInfo2KHR; - -typedef struct VkSurfaceCapabilities2KHR { - VkStructureType sType; - void* pNext; - VkSurfaceCapabilitiesKHR surfaceCapabilities; -} VkSurfaceCapabilities2KHR; - -typedef struct VkSurfaceFormat2KHR { - VkStructureType sType; - void* pNext; - VkSurfaceFormatKHR surfaceFormat; -} VkSurfaceFormat2KHR; - - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkSurfaceCapabilities2KHR* pSurfaceCapabilities); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pSurfaceFormatCount, VkSurfaceFormat2KHR* pSurfaceFormats); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, - VkSurfaceCapabilities2KHR* pSurfaceCapabilities); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, - uint32_t* pSurfaceFormatCount, - VkSurfaceFormat2KHR* pSurfaceFormats); -#endif - - - #ifdef VK_USE_PLATFORM_IOS_MVK #define VK_MVK_ios_surface 1 #define VK_MVK_IOS_SURFACE_SPEC_VERSION 2 |