Merge "Allow access to tracing/per_cpu/cpu?/trace files."
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 80358d2..5d21f6a 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -58,6 +58,7 @@
#define MAX_SYS_FILES 10
const char* k_traceTagsProperty = "debug.atrace.tags.enableflags";
+const char* k_userInitiatedTraceProperty = "debug.atrace.user_initiated";
const char* k_traceAppsNumberProperty = "debug.atrace.app_number";
const char* k_traceAppsPropertyTemplate = "debug.atrace.app_%d";
@@ -444,6 +445,16 @@
return setKernelOptionEnable(k_tracingOverwriteEnablePath, enable);
}
+// Set the user initiated trace property
+static bool setUserInitiatedTraceProperty(bool enable)
+{
+ if (!android::base::SetProperty(k_userInitiatedTraceProperty, enable ? "1" : "")) {
+ fprintf(stderr, "error setting user initiated strace system property\n");
+ return false;
+ }
+ return true;
+}
+
// Enable or disable kernel tracing.
static bool setTracingEnabled(bool enable)
{
@@ -837,6 +848,8 @@
{
bool ok = true;
+ ok &= setUserInitiatedTraceProperty(true);
+
// Set up the tracing options.
ok &= setCategoriesEnableFromFile(g_categoriesFile);
ok &= setTraceOverwriteEnable(g_traceOverwrite);
@@ -884,6 +897,7 @@
setTraceBufferSizeKB(1);
setPrintTgidEnableIfPresent(false);
setKernelTraceFuncs(NULL);
+ setUserInitiatedTraceProperty(false);
}
// Enable tracing in the kernel.
diff --git a/cmds/installd/otapreopt_chroot.cpp b/cmds/installd/otapreopt_chroot.cpp
index 3ae56db..e90cf3b 100644
--- a/cmds/installd/otapreopt_chroot.cpp
+++ b/cmds/installd/otapreopt_chroot.cpp
@@ -115,7 +115,7 @@
exit(207);
}
{
- std::string vendor_partition = StringPrintf("/dev/block/bootdevice/by-name/vendor%s",
+ std::string vendor_partition = StringPrintf("/dev/block/by-name/vendor%s",
arg[2]);
int vendor_result = mount(vendor_partition.c_str(),
"/postinstall/vendor",
@@ -128,7 +128,7 @@
// Try to mount the product partition. update_engine doesn't do this for us, but we
// want it for product APKs. Same notes as vendor above.
{
- std::string product_partition = StringPrintf("/dev/block/bootdevice/by-name/product%s",
+ std::string product_partition = StringPrintf("/dev/block/by-name/product%s",
arg[2]);
int product_result = mount(product_partition.c_str(),
"/postinstall/product",
diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp
index c99b863..c0e1a35 100644
--- a/cmds/lshal/ListCommand.cpp
+++ b/cmds/lshal/ListCommand.cpp
@@ -126,6 +126,67 @@
return process;
}
+bool match(const vintf::ManifestInstance& instance, const FqInstance& fqInstance,
+ vintf::TransportArch ta) {
+ // For hwbinder libs, allow missing arch in manifest.
+ // For passthrough libs, allow missing interface/instance in table.
+ return (ta.transport == instance.transport()) &&
+ (ta.transport == vintf::Transport::HWBINDER ||
+ vintf::contains(instance.arch(), ta.arch)) &&
+ (!fqInstance.hasInterface() || fqInstance.getInterface() == instance.interface()) &&
+ (!fqInstance.hasInstance() || fqInstance.getInstance() == instance.instance());
+}
+
+bool match(const vintf::MatrixInstance& instance, const FqInstance& fqInstance,
+ vintf::TransportArch /* ta */) {
+ return (!fqInstance.hasInterface() || fqInstance.getInterface() == instance.interface()) &&
+ (!fqInstance.hasInstance() || instance.matchInstance(fqInstance.getInstance()));
+}
+
+template <typename ObjectType>
+VintfInfo getVintfInfo(const std::shared_ptr<const ObjectType>& object,
+ const FqInstance& fqInstance, vintf::TransportArch ta, VintfInfo value) {
+ bool found = false;
+ (void)object->forEachInstanceOfVersion(fqInstance.getPackage(), fqInstance.getVersion(),
+ [&](const auto& instance) {
+ found = match(instance, fqInstance, ta);
+ return !found; // continue if not found
+ });
+ return found ? value : VINTF_INFO_EMPTY;
+}
+
+std::shared_ptr<const vintf::HalManifest> ListCommand::getDeviceManifest() const {
+ return vintf::VintfObject::GetDeviceHalManifest();
+}
+
+std::shared_ptr<const vintf::CompatibilityMatrix> ListCommand::getDeviceMatrix() const {
+ return vintf::VintfObject::GetDeviceCompatibilityMatrix();
+}
+
+std::shared_ptr<const vintf::HalManifest> ListCommand::getFrameworkManifest() const {
+ return vintf::VintfObject::GetFrameworkHalManifest();
+}
+
+std::shared_ptr<const vintf::CompatibilityMatrix> ListCommand::getFrameworkMatrix() const {
+ return vintf::VintfObject::GetFrameworkCompatibilityMatrix();
+}
+
+VintfInfo ListCommand::getVintfInfo(const std::string& fqInstanceName,
+ vintf::TransportArch ta) const {
+ FqInstance fqInstance;
+ if (!fqInstance.setTo(fqInstanceName) &&
+ // Ignore interface / instance for passthrough libs
+ !fqInstance.setTo(splitFirst(fqInstanceName, ':').first)) {
+ err() << "Warning: Cannot parse '" << fqInstanceName << "'; no VINTF info." << std::endl;
+ return VINTF_INFO_EMPTY;
+ }
+
+ return lshal::getVintfInfo(getDeviceManifest(), fqInstance, ta, DEVICE_MANIFEST) |
+ lshal::getVintfInfo(getFrameworkManifest(), fqInstance, ta, FRAMEWORK_MANIFEST) |
+ lshal::getVintfInfo(getDeviceMatrix(), fqInstance, ta, DEVICE_MATRIX) |
+ lshal::getVintfInfo(getFrameworkMatrix(), fqInstance, ta, FRAMEWORK_MATRIX);
+}
+
static bool scanBinderContext(pid_t pid,
const std::string &contextName,
std::function<void(const std::string&)> eachLine) {
@@ -269,6 +330,7 @@
}
for (TableEntry& entry : table) {
entry.partition = getPartition(entry.serverPid);
+ entry.vintfInfo = getVintfInfo(entry.interfaceName, {entry.transport, entry.arch});
}
});
// use a double for loop here because lshal doesn't care about efficiency.
@@ -279,7 +341,7 @@
continue;
}
for (TableEntry &interfaceEntry : mPassthroughRefTable) {
- if (interfaceEntry.arch != ARCH_UNKNOWN) {
+ if (interfaceEntry.arch != vintf::Arch::ARCH_EMPTY) {
continue;
}
FQName interfaceName;
@@ -330,35 +392,22 @@
return true; // strip out instances that is in a different partition.
}
- vintf::Transport transport;
vintf::Arch arch;
- if (entry.transport == "hwbinder") {
- transport = vintf::Transport::HWBINDER;
- arch = vintf::Arch::ARCH_EMPTY;
- } else if (entry.transport == "passthrough") {
- transport = vintf::Transport::PASSTHROUGH;
- switch (entry.arch) {
- case lshal::ARCH32:
- arch = vintf::Arch::ARCH_32;
- break;
- case lshal::ARCH64:
- arch = vintf::Arch::ARCH_64;
- break;
- case lshal::ARCH_BOTH:
- arch = vintf::Arch::ARCH_32_64;
- break;
- case lshal::ARCH_UNKNOWN: // fallthrough
- default:
- err() << "Warning: '" << entry.interfaceName << "' doesn't have bitness info.";
- return false;
+ if (entry.transport == vintf::Transport::HWBINDER) {
+ arch = vintf::Arch::ARCH_EMPTY; // no need to specify arch in manifest
+ } else if (entry.transport == vintf::Transport::PASSTHROUGH) {
+ if (entry.arch == vintf::Arch::ARCH_EMPTY) {
+ err() << "Warning: '" << entry.interfaceName << "' doesn't have bitness info.";
+ return false;
}
+ arch = entry.arch;
} else {
err() << "Warning: '" << entry.transport << "' is not a valid transport." << std::endl;
return false;
}
std::string e;
- if (!manifest->insertInstance(fqInstance, transport, arch, vintf::HalFormat::HIDL, &e)) {
+ if (!manifest->insertInstance(fqInstance, entry.transport, arch, vintf::HalFormat::HIDL, &e)) {
err() << "Warning: Cannot insert '" << fqInstance.string() << ": " << e << std::endl;
return false;
}
@@ -440,15 +489,15 @@
" until they are updated.\n"
};
-static Architecture fromBaseArchitecture(::android::hidl::base::V1_0::DebugInfo::Architecture a) {
+static vintf::Arch fromBaseArchitecture(::android::hidl::base::V1_0::DebugInfo::Architecture a) {
switch (a) {
case ::android::hidl::base::V1_0::DebugInfo::Architecture::IS_64BIT:
- return ARCH64;
+ return vintf::Arch::ARCH_64;
case ::android::hidl::base::V1_0::DebugInfo::Architecture::IS_32BIT:
- return ARCH32;
+ return vintf::Arch::ARCH_32;
case ::android::hidl::base::V1_0::DebugInfo::Architecture::UNKNOWN: // fallthrough
default:
- return ARCH_UNKNOWN;
+ return vintf::Arch::ARCH_EMPTY;
}
}
@@ -534,7 +583,7 @@
std::string{info.instanceName.c_str()};
entries.emplace(interfaceName, TableEntry{
.interfaceName = interfaceName,
- .transport = "passthrough",
+ .transport = vintf::Transport::PASSTHROUGH,
.clientPids = info.clientPids,
}).first->second.arch |= fromBaseArchitecture(info.arch);
}
@@ -566,7 +615,7 @@
.interfaceName =
std::string{info.interfaceName.c_str()} + "/" +
std::string{info.instanceName.c_str()},
- .transport = "passthrough",
+ .transport = vintf::Transport::PASSTHROUGH,
.serverPid = info.clientPids.size() == 1 ? info.clientPids[0] : NO_PID,
.clientPids = info.clientPids,
.arch = fromBaseArchitecture(info.arch)
@@ -582,9 +631,11 @@
}
Status ListCommand::fetchBinderized(const sp<IServiceManager> &manager) {
+ using vintf::operator<<;
+
if (!shouldReportHalType(HalType::BINDERIZED_SERVICES)) { return OK; }
- const std::string mode = "hwbinder";
+ const vintf::Transport mode = vintf::Transport::HWBINDER;
hidl_vec<hidl_string> fqInstanceNames;
// copying out for timeoutIPC
auto listRet = timeoutIPC(manager, &IServiceManager::list, [&] (const auto &names) {
@@ -748,7 +799,7 @@
mOptions.push_back({'l', "released", no_argument, v++, [](ListCommand* thiz, const char*) {
thiz->mSelectedColumns.push_back(TableColumnType::RELEASED);
return OK;
- }, "print the 'is released?' column\n(Y=released, empty=unreleased or unknown)"});
+ }, "print the 'is released?' column\n(Y=released, N=unreleased, ?=unknown)"});
mOptions.push_back({'t', "transport", no_argument, v++, [](ListCommand* thiz, const char*) {
thiz->mSelectedColumns.push_back(TableColumnType::TRANSPORT);
return OK;
@@ -788,6 +839,15 @@
}, "Emit debug info from\nIBase::debug with empty options. Cannot be used with --neat.\n"
"Writes to specified file if 'arg' is provided, otherwise stdout."});
+ mOptions.push_back({'V', "vintf", no_argument, v++, [](ListCommand* thiz, const char*) {
+ thiz->mSelectedColumns.push_back(TableColumnType::VINTF);
+ return OK;
+ }, "print VINTF info. This column contains a comma-separated list of:\n"
+ " - DM: device manifest\n"
+ " - DC: device compatibility matrix\n"
+ " - FM: framework manifest\n"
+ " - FC: framework compatibility matrix"});
+
// long options without short alternatives
mOptions.push_back({'\0', "init-vintf", no_argument, v++, [](ListCommand* thiz, const char* arg) {
thiz->mVintf = true;
diff --git a/cmds/lshal/ListCommand.h b/cmds/lshal/ListCommand.h
index c35561d..87d93b5 100644
--- a/cmds/lshal/ListCommand.h
+++ b/cmds/lshal/ListCommand.h
@@ -28,6 +28,7 @@
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <hidl-util/FqInstance.h>
#include <vintf/HalManifest.h>
+#include <vintf/VintfObject.h>
#include "Command.h"
#include "NullableOStream.h"
@@ -87,7 +88,9 @@
protected:
Status parseArgs(const Arg &arg);
+ // Retrieve first-hand information
Status fetch();
+ // Retrieve derived information base on existing table
virtual void postprocess();
Status dump();
void putEntry(TableEntrySource source, TableEntry &&entry);
@@ -122,6 +125,13 @@
virtual Partition getPartition(pid_t pid);
Partition resolvePartition(Partition processPartition, const FqInstance &fqInstance) const;
+ VintfInfo getVintfInfo(const std::string &fqInstanceName, vintf::TransportArch ta) const;
+ // Allow to mock these functions for testing.
+ virtual std::shared_ptr<const vintf::HalManifest> getDeviceManifest() const;
+ virtual std::shared_ptr<const vintf::CompatibilityMatrix> getDeviceMatrix() const;
+ virtual std::shared_ptr<const vintf::HalManifest> getFrameworkManifest() const;
+ virtual std::shared_ptr<const vintf::CompatibilityMatrix> getFrameworkMatrix() const;
+
void forEachTable(const std::function<void(Table &)> &f);
void forEachTable(const std::function<void(const Table &)> &f) const;
diff --git a/cmds/lshal/PipeRelay.cpp b/cmds/lshal/PipeRelay.cpp
index fc40749..3828bbf 100644
--- a/cmds/lshal/PipeRelay.cpp
+++ b/cmds/lshal/PipeRelay.cpp
@@ -16,7 +16,6 @@
#include "PipeRelay.h"
-#include <sys/socket.h>
#include <utils/Thread.h>
namespace android {
@@ -58,7 +57,7 @@
PipeRelay::PipeRelay(std::ostream &os)
: mInitCheck(NO_INIT) {
- int res = socketpair(AF_UNIX, SOCK_STREAM, 0 /* protocol */, mFds);
+ int res = pipe(mFds);
if (res < 0) {
mInitCheck = -errno;
@@ -77,20 +76,13 @@
}
PipeRelay::~PipeRelay() {
- if (mFds[1] >= 0) {
- shutdown(mFds[1], SHUT_WR);
- }
-
- if (mFds[0] >= 0) {
- shutdown(mFds[0], SHUT_RD);
- }
+ CloseFd(&mFds[1]);
if (mThread != NULL) {
mThread->join();
mThread.clear();
}
- CloseFd(&mFds[1]);
CloseFd(&mFds[0]);
}
diff --git a/cmds/lshal/TableEntry.cpp b/cmds/lshal/TableEntry.cpp
index e8792a4..4ad3e92 100644
--- a/cmds/lshal/TableEntry.cpp
+++ b/cmds/lshal/TableEntry.cpp
@@ -16,7 +16,11 @@
#define LOG_TAG "lshal"
#include <android-base/logging.h>
+#include <map>
+
+#include <android-base/strings.h>
#include <hidl-hash/Hash.h>
+#include <vintf/parse_string.h>
#include "TableEntry.h"
@@ -26,19 +30,19 @@
namespace android {
namespace lshal {
-static const std::string &getArchString(Architecture arch) {
+static const std::string &getArchString(vintf::Arch 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 = "";
+ static const std::string sStrUnknown = "?";
switch (arch) {
- case ARCH64:
+ case vintf::Arch::ARCH_64:
return sStr64;
- case ARCH32:
+ case vintf::Arch::ARCH_32:
return sStr32;
- case ARCH_BOTH:
+ case vintf::Arch::ARCH_32_64:
return sStrBoth;
- case ARCH_UNKNOWN: // fall through
+ case vintf::Arch::ARCH_EMPTY: // fall through
default:
return sStrUnknown;
}
@@ -57,6 +61,7 @@
case TableColumnType::THREADS: return "Thread Use";
case TableColumnType::RELEASED: return "R";
case TableColumnType::HASH: return "Hash";
+ case TableColumnType::VINTF: return "VINTF";
default:
LOG(FATAL) << __func__ << "Should not reach here. " << static_cast<int>(type);
return "";
@@ -68,7 +73,7 @@
case TableColumnType::INTERFACE_NAME:
return interfaceName;
case TableColumnType::TRANSPORT:
- return transport;
+ return vintf::to_string(transport);
case TableColumnType::SERVER_PID:
return serverPid == NO_PID ? "N/A" : std::to_string(serverPid);
case TableColumnType::SERVER_CMD:
@@ -87,6 +92,8 @@
return isReleased();
case TableColumnType::HASH:
return hash;
+ case TableColumnType::VINTF:
+ return getVintfInfo();
default:
LOG(FATAL) << __func__ << "Should not reach here. " << static_cast<int>(type);
return "";
@@ -96,12 +103,32 @@
std::string TableEntry::isReleased() const {
static const std::string unreleased = Hash::hexString(Hash::kEmptyHash);
- if (hash.empty() || hash == unreleased) {
- return " "; // unknown or unreleased
+ if (hash.empty()) {
+ return "?";
+ }
+ if (hash == unreleased) {
+ return "N"; // unknown or unreleased
}
return "Y"; // released
}
+std::string TableEntry::getVintfInfo() const {
+ static const std::map<VintfInfo, std::string> values{
+ {DEVICE_MANIFEST, "DM"},
+ {DEVICE_MATRIX, "DC"},
+ {FRAMEWORK_MANIFEST, "FM"},
+ {FRAMEWORK_MATRIX, "FC"},
+ };
+ std::vector<std::string> ret;
+ for (const auto& pair : values) {
+ if (vintfInfo & pair.first) {
+ ret.push_back(pair.second);
+ }
+ }
+ auto joined = base::Join(ret, ',');
+ return joined.empty() ? "X" : joined;
+}
+
TextTable Table::createTextTable(bool neat,
const std::function<std::string(const std::string&)>& emitDebugInfo) const {
@@ -152,6 +179,7 @@
}
std::string TableEntry::to_string() const {
+ using vintf::operator<<;
std::stringstream ss;
ss << "name=" << interfaceName << ";transport=" << transport << ";thread=" << getThreadUsage()
<< ";server=" << serverPid
diff --git a/cmds/lshal/TableEntry.h b/cmds/lshal/TableEntry.h
index 24ea438..c9a6a23 100644
--- a/cmds/lshal/TableEntry.h
+++ b/cmds/lshal/TableEntry.h
@@ -24,6 +24,8 @@
#include <iostream>
#include <procpartition/procpartition.h>
+#include <vintf/Arch.h>
+#include <vintf/Transport.h>
#include "TextTable.h"
@@ -40,14 +42,6 @@
};
using TableEntrySource = unsigned int;
-enum : unsigned int {
- ARCH_UNKNOWN = 0,
- ARCH32 = 1 << 0,
- ARCH64 = 1 << 1,
- ARCH_BOTH = ARCH32 | ARCH64
-};
-using Architecture = unsigned int;
-
enum class TableColumnType : unsigned int {
INTERFACE_NAME,
TRANSPORT,
@@ -60,8 +54,18 @@
THREADS,
RELEASED,
HASH,
+ VINTF,
};
+enum : unsigned int {
+ VINTF_INFO_EMPTY = 0,
+ DEVICE_MANIFEST = 1 << 0,
+ DEVICE_MATRIX = 1 << 1,
+ FRAMEWORK_MANIFEST = 1 << 2,
+ FRAMEWORK_MATRIX = 1 << 3,
+};
+using VintfInfo = unsigned int;
+
enum {
NO_PID = -1,
NO_PTR = 0
@@ -69,7 +73,7 @@
struct TableEntry {
std::string interfaceName{};
- std::string transport{};
+ vintf::Transport transport{vintf::Transport::EMPTY};
int32_t serverPid{NO_PID};
uint32_t threadUsage{0};
uint32_t threadCount{0};
@@ -77,10 +81,11 @@
uint64_t serverObjectAddress{NO_PTR};
Pids clientPids{};
std::vector<std::string> clientCmdlines{};
- Architecture arch{ARCH_UNKNOWN};
+ vintf::Arch arch{vintf::Arch::ARCH_EMPTY};
// empty: unknown, all zeros: unreleased, otherwise: released
std::string hash{};
Partition partition{Partition::UNKNOWN};
+ VintfInfo vintfInfo{VINTF_INFO_EMPTY};
static bool sortByInterfaceName(const TableEntry &a, const TableEntry &b) {
return a.interfaceName < b.interfaceName;
@@ -99,6 +104,8 @@
std::string isReleased() const;
+ std::string getVintfInfo() const;
+
std::string getField(TableColumnType type) const;
bool operator==(const TableEntry& other) const;
diff --git a/cmds/lshal/test.cpp b/cmds/lshal/test.cpp
index 3fc957b..501c04d 100644
--- a/cmds/lshal/test.cpp
+++ b/cmds/lshal/test.cpp
@@ -44,6 +44,13 @@
using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
+using android::vintf::Arch;
+using android::vintf::CompatibilityMatrix;
+using android::vintf::gCompatibilityMatrixConverter;
+using android::vintf::gHalManifestConverter;
+using android::vintf::HalManifest;
+using android::vintf::Transport;
+using android::vintf::VintfObject;
using InstanceDebugInfo = IServiceManager::InstanceDebugInfo;
@@ -207,6 +214,11 @@
MOCK_CONST_METHOD2(getPidInfo, bool(pid_t, PidInfo*));
MOCK_CONST_METHOD1(parseCmdline, std::string(pid_t));
MOCK_METHOD1(getPartition, Partition(pid_t));
+
+ MOCK_CONST_METHOD0(getDeviceManifest, std::shared_ptr<const vintf::HalManifest>());
+ MOCK_CONST_METHOD0(getDeviceMatrix, std::shared_ptr<const vintf::CompatibilityMatrix>());
+ MOCK_CONST_METHOD0(getFrameworkManifest, std::shared_ptr<const vintf::HalManifest>());
+ MOCK_CONST_METHOD0(getFrameworkMatrix, std::shared_ptr<const vintf::CompatibilityMatrix>());
};
class ListParseArgsTest : public ::testing::Test {
@@ -335,6 +347,15 @@
});
}));
ON_CALL(*mockList, getPartition(_)).WillByDefault(Return(Partition::VENDOR));
+
+ ON_CALL(*mockList, getDeviceManifest())
+ .WillByDefault(Return(VintfObject::GetDeviceHalManifest()));
+ ON_CALL(*mockList, getDeviceMatrix())
+ .WillByDefault(Return(VintfObject::GetDeviceCompatibilityMatrix()));
+ ON_CALL(*mockList, getFrameworkManifest())
+ .WillByDefault(Return(VintfObject::GetFrameworkHalManifest()));
+ ON_CALL(*mockList, getFrameworkMatrix())
+ .WillByDefault(Return(VintfObject::GetFrameworkCompatibilityMatrix()));
}
void initMockServiceManager() {
@@ -389,25 +410,28 @@
TEST_F(ListTest, Fetch) {
EXPECT_EQ(0u, mockList->fetch());
- std::array<std::string, 6> transports{{"hwbinder", "hwbinder", "passthrough",
- "passthrough", "passthrough", "passthrough"}};
- std::array<Architecture, 6> archs{{ARCH64, ARCH64, ARCH32, ARCH32, ARCH32, ARCH32}};
+ vintf::TransportArch hwbinder{Transport::HWBINDER, Arch::ARCH_64};
+ vintf::TransportArch passthrough{Transport::PASSTHROUGH, Arch::ARCH_32};
+ std::array<vintf::TransportArch, 6> transportArchs{{hwbinder, hwbinder, passthrough,
+ passthrough, passthrough, passthrough}};
int id = 1;
mockList->forEachTable([&](const Table& table) {
ASSERT_EQ(2u, table.size());
for (const auto& entry : table) {
- const auto& transport = transports[id - 1];
+ auto transport = transportArchs.at(id - 1).transport;
TableEntry expected{
.interfaceName = getFqInstanceName(id),
.transport = transport,
- .serverPid = transport == "hwbinder" ? id : NO_PID,
- .threadUsage = transport == "hwbinder" ? getPidInfoFromId(id).threadUsage : 0,
- .threadCount = transport == "hwbinder" ? getPidInfoFromId(id).threadCount : 0,
+ .serverPid = transport == Transport::HWBINDER ? id : NO_PID,
+ .threadUsage =
+ transport == Transport::HWBINDER ? getPidInfoFromId(id).threadUsage : 0,
+ .threadCount =
+ transport == Transport::HWBINDER ? getPidInfoFromId(id).threadCount : 0,
.serverCmdline = {},
- .serverObjectAddress = transport == "hwbinder" ? getPtr(id) : NO_PTR,
+ .serverObjectAddress = transport == Transport::HWBINDER ? getPtr(id) : NO_PTR,
.clientPids = getClients(id),
.clientCmdlines = {},
- .arch = archs[id - 1],
+ .arch = transportArchs.at(id - 1).arch,
};
EXPECT_EQ(expected, entry) << expected.to_string() << " vs. " << entry.to_string();
@@ -460,18 +484,18 @@
const std::string expected =
"[fake description 0]\n"
"R Interface Thread Use Server Clients\n"
- " a.h.foo1@1.0::IFoo/1 11/21 1 2 4\n"
+ "N a.h.foo1@1.0::IFoo/1 11/21 1 2 4\n"
"Y a.h.foo2@2.0::IFoo/2 12/22 2 3 5\n"
"\n"
"[fake description 1]\n"
"R Interface Thread Use Server Clients\n"
- " a.h.foo3@3.0::IFoo/3 N/A N/A 4 6\n"
- " a.h.foo4@4.0::IFoo/4 N/A N/A 5 7\n"
+ "? a.h.foo3@3.0::IFoo/3 N/A N/A 4 6\n"
+ "? a.h.foo4@4.0::IFoo/4 N/A N/A 5 7\n"
"\n"
"[fake description 2]\n"
"R Interface Thread Use Server Clients\n"
- " a.h.foo5@5.0::IFoo/5 N/A N/A 6 8\n"
- " a.h.foo6@6.0::IFoo/6 N/A N/A 7 9\n"
+ "? a.h.foo5@5.0::IFoo/5 N/A N/A 6 8\n"
+ "? a.h.foo6@6.0::IFoo/6 N/A N/A 7 9\n"
"\n";
optind = 1; // mimic Lshal::parseArg()
@@ -484,18 +508,18 @@
const std::string expected =
"[fake description 0]\n"
"Interface R Hash\n"
- "a.h.foo1@1.0::IFoo/1 0000000000000000000000000000000000000000000000000000000000000000\n"
+ "a.h.foo1@1.0::IFoo/1 N 0000000000000000000000000000000000000000000000000000000000000000\n"
"a.h.foo2@2.0::IFoo/2 Y 0202020202020202020202020202020202020202020202020202020202020202\n"
"\n"
"[fake description 1]\n"
"Interface R Hash\n"
- "a.h.foo3@3.0::IFoo/3 \n"
- "a.h.foo4@4.0::IFoo/4 \n"
+ "a.h.foo3@3.0::IFoo/3 ? \n"
+ "a.h.foo4@4.0::IFoo/4 ? \n"
"\n"
"[fake description 2]\n"
"Interface R Hash\n"
- "a.h.foo5@5.0::IFoo/5 \n"
- "a.h.foo6@6.0::IFoo/6 \n"
+ "a.h.foo5@5.0::IFoo/5 ? \n"
+ "a.h.foo6@6.0::IFoo/6 ? \n"
"\n";
optind = 1; // mimic Lshal::parseArg()
@@ -651,6 +675,87 @@
EXPECT_THAT(err.str(), HasSubstr("Unrecognized HAL type: a"));
}
+TEST_F(ListTest, Vintf) {
+ std::string deviceManifestXml =
+ "<manifest version=\"1.0\" type=\"device\">\n"
+ " <hal>\n"
+ " <name>a.h.foo1</name>\n"
+ " <transport>hwbinder</transport>\n"
+ " <fqname>@1.0::IFoo/1</fqname>\n"
+ " </hal>\n"
+ " <hal>\n"
+ " <name>a.h.foo3</name>\n"
+ " <transport arch=\"32+64\">passthrough</transport>\n"
+ " <fqname>@3.0::IFoo/3</fqname>\n"
+ " </hal>\n"
+ "</manifest>\n";
+ std::string frameworkManifestXml =
+ "<manifest version=\"1.0\" type=\"framework\">\n"
+ " <hal>\n"
+ " <name>a.h.foo5</name>\n"
+ " <transport arch=\"32\">passthrough</transport>\n"
+ " <fqname>@5.0::IFoo/5</fqname>\n"
+ " </hal>\n"
+ "</manifest>\n";
+ std::string deviceMatrixXml =
+ "<compatibility-matrix version=\"1.0\" type=\"device\">\n"
+ " <hal>\n"
+ " <name>a.h.foo5</name>\n"
+ " <version>5.0</version>\n"
+ " <interface>\n"
+ " <name>IFoo</name>\n"
+ " <instance>5</instance>\n"
+ " </interface>\n"
+ " </hal>\n"
+ "</compatibility-matrix>\n";
+ std::string frameworkMatrixXml =
+ "<compatibility-matrix version=\"1.0\" type=\"framework\">\n"
+ " <hal>\n"
+ " <name>a.h.foo1</name>\n"
+ " <version>1.0</version>\n"
+ " <interface>\n"
+ " <name>IFoo</name>\n"
+ " <instance>1</instance>\n"
+ " </interface>\n"
+ " </hal>\n"
+ " <hal>\n"
+ " <name>a.h.foo3</name>\n"
+ " <version>3.0</version>\n"
+ " <interface>\n"
+ " <name>IFoo</name>\n"
+ " <instance>3</instance>\n"
+ " </interface>\n"
+ " </hal>\n"
+ "</compatibility-matrix>\n";
+
+ std::string expected = "DM,FC a.h.foo1@1.0::IFoo/1\n"
+ "X a.h.foo2@2.0::IFoo/2\n"
+ "DM,FC a.h.foo3@3.0::IFoo/3\n"
+ "X a.h.foo4@4.0::IFoo/4\n"
+ "DC,FM a.h.foo5@5.0::IFoo/5\n"
+ "X a.h.foo6@6.0::IFoo/6\n";
+
+ auto deviceManifest = std::make_shared<HalManifest>();
+ auto frameworkManifest = std::make_shared<HalManifest>();
+ auto deviceMatrix = std::make_shared<CompatibilityMatrix>();
+ auto frameworkMatrix = std::make_shared<CompatibilityMatrix>();
+
+ ASSERT_TRUE(gHalManifestConverter(deviceManifest.get(), deviceManifestXml));
+ ASSERT_TRUE(gHalManifestConverter(frameworkManifest.get(), frameworkManifestXml));
+ ASSERT_TRUE(gCompatibilityMatrixConverter(deviceMatrix.get(), deviceMatrixXml));
+ ASSERT_TRUE(gCompatibilityMatrixConverter(frameworkMatrix.get(), frameworkMatrixXml));
+
+ ON_CALL(*mockList, getDeviceManifest()).WillByDefault(Return(deviceManifest));
+ ON_CALL(*mockList, getDeviceMatrix()).WillByDefault(Return(deviceMatrix));
+ ON_CALL(*mockList, getFrameworkManifest()).WillByDefault(Return(frameworkManifest));
+ ON_CALL(*mockList, getFrameworkMatrix()).WillByDefault(Return(frameworkMatrix));
+
+ optind = 1; // mimic Lshal::parseArg()
+ EXPECT_EQ(0u, mockList->main(createArg({"lshal", "-Vi", "--neat"})));
+ EXPECT_THAT(out.str(), HasSubstr(expected));
+ EXPECT_EQ("", err.str());
+}
+
class HelpTest : public ::testing::Test {
public:
void SetUp() override {
diff --git a/libs/binder/include/binder/IInterface.h b/libs/binder/include/binder/IInterface.h
index 0f1fe5b..227d0ae 100644
--- a/libs/binder/include/binder/IInterface.h
+++ b/libs/binder/include/binder/IInterface.h
@@ -142,7 +142,7 @@
{
return remote();
}
-
+
// ----------------------------------------------------------------------
}; // namespace android
diff --git a/libs/ui/Fence.cpp b/libs/ui/Fence.cpp
index b67f4d9..eb88be1 100644
--- a/libs/ui/Fence.cpp
+++ b/libs/ui/Fence.cpp
@@ -115,25 +115,25 @@
return SIGNAL_TIME_INVALID;
}
- struct sync_fence_info_data* finfo = sync_fence_info(mFenceFd);
+ struct sync_file_info* finfo = sync_file_info(mFenceFd);
if (finfo == NULL) {
- ALOGE("sync_fence_info returned NULL for fd %d", mFenceFd);
+ ALOGE("sync_file_info returned NULL for fd %d", mFenceFd);
return SIGNAL_TIME_INVALID;
}
if (finfo->status != 1) {
- sync_fence_info_free(finfo);
+ sync_file_info_free(finfo);
return SIGNAL_TIME_PENDING;
}
- struct sync_pt_info* pinfo = NULL;
uint64_t timestamp = 0;
- while ((pinfo = sync_pt_info(finfo, pinfo)) != NULL) {
- if (pinfo->timestamp_ns > timestamp) {
- timestamp = pinfo->timestamp_ns;
+ struct sync_fence_info* pinfo = sync_get_fence_info(finfo);
+ for (size_t i = 0; i < finfo->num_fences; i++) {
+ if (pinfo[i].timestamp_ns > timestamp) {
+ timestamp = pinfo[i].timestamp_ns;
}
}
- sync_fence_info_free(finfo);
+ sync_file_info_free(finfo);
return nsecs_t(timestamp);
}
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 95802bd..b8a0a5a 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -169,20 +169,6 @@
mPowerMode = (mType >= DisplayDevice::DISPLAY_VIRTUAL) ?
HWC_POWER_MODE_NORMAL : HWC_POWER_MODE_OFF;
- // Name the display. The name will be replaced shortly if the display
- // was created with createDisplay().
- switch (mType) {
- case DISPLAY_PRIMARY:
- mDisplayName = "Built-in Screen";
- break;
- case DISPLAY_EXTERNAL:
- mDisplayName = "HDMI Screen";
- break;
- default:
- mDisplayName = "Virtual Screen"; // e.g. Overlay #n
- break;
- }
-
// initialize the display orientation transform.
setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 624fda2..ffc61be 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -369,17 +369,6 @@
setTransactionFlags(eDisplayTransactionNeeded);
}
-void SurfaceFlinger::createBuiltinDisplayLocked(DisplayDevice::DisplayType type) {
- ALOGV("createBuiltinDisplayLocked(%d)", type);
- ALOGW_IF(mBuiltinDisplays[type],
- "Overwriting display token for display type %d", type);
- mBuiltinDisplays[type] = new BBinder();
- // All non-virtual displays are currently considered secure.
- DisplayDeviceState info(type, true);
- mCurrentState.displays.add(mBuiltinDisplays[type], info);
- mInterceptor.saveDisplayCreation(info);
-}
-
sp<IBinder> SurfaceFlinger::getBuiltInDisplay(int32_t id) {
if (uint32_t(id) >= DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) {
ALOGE("getDefaultDisplay: id=%d is not a valid default display id", id);
@@ -627,6 +616,15 @@
"Starting with vr flinger active is not currently supported.");
mHwc.reset(new HWComposer(mHwcServiceName));
mHwc->registerCallback(this, mComposerSequenceId);
+ // Process any initial hotplug and resulting display changes.
+ processDisplayHotplugEventsLocked();
+ LOG_ALWAYS_FATAL_IF(!mHwc->isConnected(HWC_DISPLAY_PRIMARY),
+ "Registered composer callback but didn't create the default primary "
+ "display");
+
+ // make the default display GLContext current so that we can create textures
+ // when creating Layers (which may happens before we render something)
+ getDefaultDisplayDeviceLocked()->makeCurrent(mEGLDisplay, mEGLContext);
if (useVrFlinger) {
auto vrFlingerRequestDisplayCallback = [this] (bool requestDisplay) {
@@ -1262,52 +1260,6 @@
*compositorTiming = mCompositorTiming;
}
-void SurfaceFlinger::createDefaultDisplayDevice() {
- const DisplayDevice::DisplayType type = DisplayDevice::DISPLAY_PRIMARY;
- wp<IBinder> token = mBuiltinDisplays[type];
-
- // All non-virtual displays are currently considered secure.
- const bool isSecure = true;
-
- sp<IGraphicBufferProducer> producer;
- sp<IGraphicBufferConsumer> consumer;
- BufferQueue::createBufferQueue(&producer, &consumer);
-
- sp<FramebufferSurface> fbs = new FramebufferSurface(*mHwc, type, consumer);
-
- bool hasWideColorModes = false;
- std::vector<android_color_mode_t> modes = getHwComposer().getColorModes(type);
- for (android_color_mode_t colorMode : modes) {
- switch (colorMode) {
- case HAL_COLOR_MODE_DISPLAY_P3:
- case HAL_COLOR_MODE_ADOBE_RGB:
- case HAL_COLOR_MODE_DCI_P3:
- hasWideColorModes = true;
- break;
- default:
- break;
- }
- }
- sp<DisplayDevice> hw = new DisplayDevice(this, DisplayDevice::DISPLAY_PRIMARY, type, isSecure,
- token, fbs, producer, mRenderEngine->getEGLConfig(),
- hasWideColorModes && hasWideColorDisplay);
- mDisplays.add(token, hw);
- android_color_mode defaultColorMode = HAL_COLOR_MODE_NATIVE;
- if (hasWideColorModes && hasWideColorDisplay) {
- defaultColorMode = HAL_COLOR_MODE_SRGB;
- }
- setActiveColorModeInternal(hw, defaultColorMode);
- hw->setCompositionDataSpace(HAL_DATASPACE_UNKNOWN);
-
- // Add the primary display token to mDrawingState so we don't try to
- // recreate the DisplayDevice for the primary display.
- mDrawingState.displays.add(token, DisplayDeviceState(type, true));
-
- // make the GLContext current so that we can create textures when creating
- // Layers (which may happens before we render something)
- hw->makeCurrent(mEGLDisplay, mEGLContext);
-}
-
void SurfaceFlinger::onHotplugReceived(int32_t sequenceId,
hwc2_display_t display, HWC2::Connection connection,
bool primaryDisplay) {
@@ -1317,39 +1269,25 @@
"connected" : "disconnected",
primaryDisplay ? "primary" : "external");
+ // Ignore events that do not have the right sequenceId.
+ if (sequenceId != mComposerSequenceId) {
+ return;
+ }
+
// Only lock if we're not on the main thread. This function is normally
// called on a hwbinder thread, but for the primary display it's called on
// the main thread with the state lock already held, so don't attempt to
// acquire it here.
- ConditionalLock lock(mStateLock,
- std::this_thread::get_id() != mMainThreadId);
+ ConditionalLock lock(mStateLock, std::this_thread::get_id() != mMainThreadId);
- if (primaryDisplay) {
- mHwc->onHotplug(display, connection);
- if (!mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY].get()) {
- createBuiltinDisplayLocked(DisplayDevice::DISPLAY_PRIMARY);
- }
- createDefaultDisplayDevice();
- } else {
- if (sequenceId != mComposerSequenceId) {
- return;
- }
- if (mHwc->isUsingVrComposer()) {
- ALOGE("External displays are not supported by the vr hardware composer.");
- return;
- }
- mHwc->onHotplug(display, connection);
- auto type = DisplayDevice::DISPLAY_EXTERNAL;
- if (connection == HWC2::Connection::Connected) {
- createBuiltinDisplayLocked(type);
- } else {
- mCurrentState.displays.removeItem(mBuiltinDisplays[type]);
- mBuiltinDisplays[type].clear();
- }
- setTransactionFlags(eDisplayTransactionNeeded);
+ mPendingHotplugEvents.emplace_back(HotplugEvent{display, connection, primaryDisplay});
- // Defer EventThread notification until SF has updated mDisplays.
+ if (std::this_thread::get_id() == mMainThreadId) {
+ // Process all pending hot plug events immediately if we are on the main thread.
+ processDisplayHotplugEventsLocked();
}
+
+ setTransactionFlags(eDisplayTransactionNeeded);
}
void SurfaceFlinger::onRefreshReceived(int sequenceId,
@@ -2089,6 +2027,223 @@
// here the transaction has been committed
}
+void SurfaceFlinger::processDisplayHotplugEventsLocked() {
+ for (const auto& event : mPendingHotplugEvents) {
+ DisplayDevice::DisplayType displayType = event.isPrimaryDisplay
+ ? DisplayDevice::DISPLAY_PRIMARY
+ : DisplayDevice::DISPLAY_EXTERNAL;
+
+ if (mHwc->isUsingVrComposer() && displayType == DisplayDevice::DISPLAY_EXTERNAL) {
+ ALOGE("External displays are not supported by the vr hardware composer.");
+ continue;
+ }
+
+ mHwc->onHotplug(event.display, event.connection);
+
+ if (event.connection == HWC2::Connection::Connected) {
+ ALOGV("Creating built in display %d", displayType);
+ ALOGW_IF(mBuiltinDisplays[displayType], "Overwriting display token for display type %d",
+ displayType);
+ mBuiltinDisplays[displayType] = new BBinder();
+ // All non-virtual displays are currently considered secure.
+ DisplayDeviceState info(displayType, true);
+ info.displayName = displayType == DisplayDevice::DISPLAY_PRIMARY ? "Built-in Screen"
+ : "External Screen";
+ mCurrentState.displays.add(mBuiltinDisplays[displayType], info);
+ mInterceptor.saveDisplayCreation(info);
+ } else {
+ ALOGV("Removing built in display %d", displayType);
+
+ ssize_t idx = mCurrentState.displays.indexOfKey(mBuiltinDisplays[displayType]);
+ if (idx >= 0) {
+ const DisplayDeviceState& info(mCurrentState.displays.valueAt(idx));
+ mInterceptor.saveDisplayDeletion(info.displayId);
+ mCurrentState.displays.removeItemsAt(idx);
+ }
+ mBuiltinDisplays[displayType].clear();
+ }
+
+ processDisplayChangesLocked();
+ }
+
+ mPendingHotplugEvents.clear();
+}
+
+void SurfaceFlinger::processDisplayChangesLocked() {
+ // here we take advantage of Vector's copy-on-write semantics to
+ // improve performance by skipping the transaction entirely when
+ // know that the lists are identical
+ const KeyedVector<wp<IBinder>, DisplayDeviceState>& curr(mCurrentState.displays);
+ const KeyedVector<wp<IBinder>, DisplayDeviceState>& draw(mDrawingState.displays);
+ if (!curr.isIdenticalTo(draw)) {
+ mVisibleRegionsDirty = true;
+ const size_t cc = curr.size();
+ size_t dc = draw.size();
+
+ // find the displays that were removed
+ // (ie: in drawing state but not in current state)
+ // also handle displays that changed
+ // (ie: displays that are in both lists)
+ for (size_t i = 0; i < dc;) {
+ const ssize_t j = curr.indexOfKey(draw.keyAt(i));
+ if (j < 0) {
+ // in drawing state but not in current state
+ if (!draw[i].isMainDisplay()) {
+ // Call makeCurrent() on the primary display so we can
+ // be sure that nothing associated with this display
+ // is current.
+ const sp<const DisplayDevice> defaultDisplay(getDefaultDisplayDeviceLocked());
+ defaultDisplay->makeCurrent(mEGLDisplay, mEGLContext);
+ sp<DisplayDevice> hw(getDisplayDeviceLocked(draw.keyAt(i)));
+ if (hw != NULL) hw->disconnect(getHwComposer());
+ if (draw[i].type < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES)
+ mEventThread->onHotplugReceived(draw[i].type, false);
+ mDisplays.removeItem(draw.keyAt(i));
+ } else {
+ ALOGW("trying to remove the main display");
+ }
+ } else {
+ // this display is in both lists. see if something changed.
+ const DisplayDeviceState& state(curr[j]);
+ const wp<IBinder>& display(curr.keyAt(j));
+ const sp<IBinder> state_binder = IInterface::asBinder(state.surface);
+ const sp<IBinder> draw_binder = IInterface::asBinder(draw[i].surface);
+ if (state_binder != draw_binder) {
+ // changing the surface is like destroying and
+ // recreating the DisplayDevice, so we just remove it
+ // from the drawing state, so that it get re-added
+ // below.
+ sp<DisplayDevice> hw(getDisplayDeviceLocked(display));
+ if (hw != NULL) hw->disconnect(getHwComposer());
+ mDisplays.removeItem(display);
+ mDrawingState.displays.removeItemsAt(i);
+ dc--;
+ // at this point we must loop to the next item
+ continue;
+ }
+
+ const sp<DisplayDevice> disp(getDisplayDeviceLocked(display));
+ if (disp != NULL) {
+ if (state.layerStack != draw[i].layerStack) {
+ disp->setLayerStack(state.layerStack);
+ }
+ if ((state.orientation != draw[i].orientation) ||
+ (state.viewport != draw[i].viewport) || (state.frame != draw[i].frame)) {
+ disp->setProjection(state.orientation, state.viewport, state.frame);
+ }
+ if (state.width != draw[i].width || state.height != draw[i].height) {
+ disp->setDisplaySize(state.width, state.height);
+ }
+ }
+ }
+ ++i;
+ }
+
+ // find displays that were added
+ // (ie: in current state but not in drawing state)
+ for (size_t i = 0; i < cc; i++) {
+ if (draw.indexOfKey(curr.keyAt(i)) < 0) {
+ const DisplayDeviceState& state(curr[i]);
+
+ sp<DisplaySurface> dispSurface;
+ sp<IGraphicBufferProducer> producer;
+ sp<IGraphicBufferProducer> bqProducer;
+ sp<IGraphicBufferConsumer> bqConsumer;
+ BufferQueue::createBufferQueue(&bqProducer, &bqConsumer);
+
+ int32_t hwcId = -1;
+ if (state.isVirtualDisplay()) {
+ // Virtual displays without a surface are dormant:
+ // they have external state (layer stack, projection,
+ // etc.) but no internal state (i.e. a DisplayDevice).
+ if (state.surface != NULL) {
+ // Allow VR composer to use virtual displays.
+ if (mUseHwcVirtualDisplays || mHwc->isUsingVrComposer()) {
+ int width = 0;
+ int status = state.surface->query(NATIVE_WINDOW_WIDTH, &width);
+ ALOGE_IF(status != NO_ERROR, "Unable to query width (%d)", status);
+ int height = 0;
+ status = state.surface->query(NATIVE_WINDOW_HEIGHT, &height);
+ ALOGE_IF(status != NO_ERROR, "Unable to query height (%d)", status);
+ int intFormat = 0;
+ status = state.surface->query(NATIVE_WINDOW_FORMAT, &intFormat);
+ ALOGE_IF(status != NO_ERROR, "Unable to query format (%d)", status);
+ auto format = static_cast<android_pixel_format_t>(intFormat);
+
+ mHwc->allocateVirtualDisplay(width, height, &format, &hwcId);
+ }
+
+ // TODO: Plumb requested format back up to consumer
+
+ sp<VirtualDisplaySurface> vds =
+ new VirtualDisplaySurface(*mHwc, hwcId, state.surface, bqProducer,
+ bqConsumer, state.displayName);
+
+ dispSurface = vds;
+ producer = vds;
+ }
+ } else {
+ ALOGE_IF(state.surface != NULL,
+ "adding a supported display, but rendering "
+ "surface is provided (%p), ignoring it",
+ state.surface.get());
+
+ hwcId = state.type;
+ dispSurface = new FramebufferSurface(*mHwc, hwcId, bqConsumer);
+ producer = bqProducer;
+ }
+
+ const wp<IBinder>& display(curr.keyAt(i));
+
+ if (dispSurface != NULL) {
+ bool useWideColorMode = hasWideColorDisplay;
+ if (state.isMainDisplay()) {
+ bool hasWideColorModes = false;
+ std::vector<android_color_mode_t> modes =
+ getHwComposer().getColorModes(state.type);
+ for (android_color_mode_t colorMode : modes) {
+ switch (colorMode) {
+ case HAL_COLOR_MODE_DISPLAY_P3:
+ case HAL_COLOR_MODE_ADOBE_RGB:
+ case HAL_COLOR_MODE_DCI_P3:
+ hasWideColorModes = true;
+ break;
+ default:
+ break;
+ }
+ }
+ useWideColorMode = hasWideColorModes && hasWideColorDisplay;
+ }
+
+ sp<DisplayDevice> hw =
+ new DisplayDevice(this, state.type, hwcId, state.isSecure, display,
+ dispSurface, producer, mRenderEngine->getEGLConfig(),
+ useWideColorMode);
+
+ if (state.isMainDisplay()) {
+ android_color_mode defaultColorMode = HAL_COLOR_MODE_NATIVE;
+ if (useWideColorMode) {
+ defaultColorMode = HAL_COLOR_MODE_SRGB;
+ }
+ setActiveColorModeInternal(hw, defaultColorMode);
+ hw->setCompositionDataSpace(HAL_DATASPACE_UNKNOWN);
+ }
+
+ hw->setLayerStack(state.layerStack);
+ hw->setProjection(state.orientation, state.viewport, state.frame);
+ hw->setDisplayName(state.displayName);
+ mDisplays.add(display, hw);
+ if (!state.isVirtualDisplay()) {
+ mEventThread->onHotplugReceived(state.type, true);
+ }
+ }
+ }
+ }
+ }
+
+ mDrawingState.displays = mCurrentState.displays;
+}
+
void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
{
// Notify all layers of available frames
@@ -2117,163 +2272,8 @@
*/
if (transactionFlags & eDisplayTransactionNeeded) {
- // here we take advantage of Vector's copy-on-write semantics to
- // improve performance by skipping the transaction entirely when
- // know that the lists are identical
- const KeyedVector< wp<IBinder>, DisplayDeviceState>& curr(mCurrentState.displays);
- const KeyedVector< wp<IBinder>, DisplayDeviceState>& draw(mDrawingState.displays);
- if (!curr.isIdenticalTo(draw)) {
- mVisibleRegionsDirty = true;
- const size_t cc = curr.size();
- size_t dc = draw.size();
-
- // find the displays that were removed
- // (ie: in drawing state but not in current state)
- // also handle displays that changed
- // (ie: displays that are in both lists)
- for (size_t i=0 ; i<dc ;) {
- const ssize_t j = curr.indexOfKey(draw.keyAt(i));
- if (j < 0) {
- // in drawing state but not in current state
- if (!draw[i].isMainDisplay()) {
- // Call makeCurrent() on the primary display so we can
- // be sure that nothing associated with this display
- // is current.
- const sp<const DisplayDevice> defaultDisplay(getDefaultDisplayDeviceLocked());
- defaultDisplay->makeCurrent(mEGLDisplay, mEGLContext);
- sp<DisplayDevice> hw(getDisplayDeviceLocked(draw.keyAt(i)));
- if (hw != NULL)
- hw->disconnect(getHwComposer());
- if (draw[i].type < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES)
- mEventThread->onHotplugReceived(draw[i].type, false);
- mDisplays.removeItem(draw.keyAt(i));
- } else {
- ALOGW("trying to remove the main display");
- }
- } else {
- // this display is in both lists. see if something changed.
- const DisplayDeviceState& state(curr[j]);
- const wp<IBinder>& display(curr.keyAt(j));
- const sp<IBinder> state_binder = IInterface::asBinder(state.surface);
- const sp<IBinder> draw_binder = IInterface::asBinder(draw[i].surface);
- if (state_binder != draw_binder) {
- // changing the surface is like destroying and
- // recreating the DisplayDevice, so we just remove it
- // from the drawing state, so that it get re-added
- // below.
- sp<DisplayDevice> hw(getDisplayDeviceLocked(display));
- if (hw != NULL)
- hw->disconnect(getHwComposer());
- mDisplays.removeItem(display);
- mDrawingState.displays.removeItemsAt(i);
- dc--;
- // at this point we must loop to the next item
- continue;
- }
-
- const sp<DisplayDevice> disp(getDisplayDeviceLocked(display));
- if (disp != NULL) {
- if (state.layerStack != draw[i].layerStack) {
- disp->setLayerStack(state.layerStack);
- }
- if ((state.orientation != draw[i].orientation)
- || (state.viewport != draw[i].viewport)
- || (state.frame != draw[i].frame))
- {
- disp->setProjection(state.orientation,
- state.viewport, state.frame);
- }
- if (state.width != draw[i].width || state.height != draw[i].height) {
- disp->setDisplaySize(state.width, state.height);
- }
- }
- }
- ++i;
- }
-
- // find displays that were added
- // (ie: in current state but not in drawing state)
- for (size_t i=0 ; i<cc ; i++) {
- if (draw.indexOfKey(curr.keyAt(i)) < 0) {
- const DisplayDeviceState& state(curr[i]);
-
- sp<DisplaySurface> dispSurface;
- sp<IGraphicBufferProducer> producer;
- sp<IGraphicBufferProducer> bqProducer;
- sp<IGraphicBufferConsumer> bqConsumer;
- BufferQueue::createBufferQueue(&bqProducer, &bqConsumer);
-
- int32_t hwcId = -1;
- if (state.isVirtualDisplay()) {
- // Virtual displays without a surface are dormant:
- // they have external state (layer stack, projection,
- // etc.) but no internal state (i.e. a DisplayDevice).
- if (state.surface != NULL) {
-
- // Allow VR composer to use virtual displays.
- if (mUseHwcVirtualDisplays || mHwc->isUsingVrComposer()) {
- int width = 0;
- int status = state.surface->query(
- NATIVE_WINDOW_WIDTH, &width);
- ALOGE_IF(status != NO_ERROR,
- "Unable to query width (%d)", status);
- int height = 0;
- status = state.surface->query(
- NATIVE_WINDOW_HEIGHT, &height);
- ALOGE_IF(status != NO_ERROR,
- "Unable to query height (%d)", status);
- int intFormat = 0;
- status = state.surface->query(
- NATIVE_WINDOW_FORMAT, &intFormat);
- ALOGE_IF(status != NO_ERROR,
- "Unable to query format (%d)", status);
- auto format = static_cast<android_pixel_format_t>(
- intFormat);
-
- mHwc->allocateVirtualDisplay(width, height, &format,
- &hwcId);
- }
-
- // TODO: Plumb requested format back up to consumer
-
- sp<VirtualDisplaySurface> vds =
- new VirtualDisplaySurface(*mHwc,
- hwcId, state.surface, bqProducer,
- bqConsumer, state.displayName);
-
- dispSurface = vds;
- producer = vds;
- }
- } else {
- ALOGE_IF(state.surface!=NULL,
- "adding a supported display, but rendering "
- "surface is provided (%p), ignoring it",
- state.surface.get());
-
- hwcId = state.type;
- dispSurface = new FramebufferSurface(*mHwc, hwcId, bqConsumer);
- producer = bqProducer;
- }
-
- const wp<IBinder>& display(curr.keyAt(i));
- if (dispSurface != NULL) {
- sp<DisplayDevice> hw =
- new DisplayDevice(this, state.type, hwcId, state.isSecure, display,
- dispSurface, producer,
- mRenderEngine->getEGLConfig(),
- hasWideColorDisplay);
- hw->setLayerStack(state.layerStack);
- hw->setProjection(state.orientation,
- state.viewport, state.frame);
- hw->setDisplayName(state.displayName);
- mDisplays.add(display, hw);
- if (!state.isVirtualDisplay()) {
- mEventThread->onHotplugReceived(state.type, true);
- }
- }
- }
- }
- }
+ processDisplayChangesLocked();
+ processDisplayHotplugEventsLocked();
}
if (transactionFlags & (eTraversalNeeded|eDisplayTransactionNeeded)) {
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 821e15c8..e32fa58 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -483,9 +483,9 @@
// called when starting, or restarting after system_server death
void initializeDisplays();
- // Create an IBinder for a builtin display and add it to current state
+#ifndef USE_HWC2
void createBuiltinDisplayLocked(DisplayDevice::DisplayType type);
-
+#endif
sp<const DisplayDevice> getDisplayDevice(const wp<IBinder>& dpy) const {
Mutex::Autolock _l(mStateLock);
@@ -511,8 +511,6 @@
return getDisplayDeviceLocked(mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]);
}
- void createDefaultDisplayDevice();
-
int32_t getDisplayType(const sp<IBinder>& display) {
if (!display.get()) return NAME_NOT_FOUND;
for (int i = 0; i < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES; ++i) {
@@ -576,6 +574,8 @@
/* ------------------------------------------------------------------------
* Display management
*/
+ void processDisplayChangesLocked();
+ void processDisplayHotplugEventsLocked();
/* ------------------------------------------------------------------------
* VSync
@@ -705,6 +705,17 @@
FenceTimeline mGlCompositionDoneTimeline;
FenceTimeline mDisplayTimeline;
+#ifdef USE_HWC2
+ struct HotplugEvent {
+ hwc2_display_t display;
+ HWC2::Connection connection = HWC2::Connection::Invalid;
+ bool isPrimaryDisplay;
+ };
+ // protected by mStateLock
+ std::vector<HotplugEvent> mPendingHotplugEvents;
+#endif
+
+
// this may only be written from the main thread with mStateLock held
// it may be read from other threads with mStateLock held
DefaultKeyedVector< wp<IBinder>, sp<DisplayDevice> > mDisplays;
diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
index 1d6fbaf..ee938ef 100644
--- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
+++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
@@ -309,6 +309,9 @@
mBuiltinDisplays[type] = new BBinder();
// All non-virtual displays are currently considered secure.
DisplayDeviceState info(type, true);
+ info.displayName =
+ type== DisplayDevice::DISPLAY_PRIMARY ? "Built-in Screen" : "External Screen";
+
mCurrentState.displays.add(mBuiltinDisplays[type], info);
mInterceptor.saveDisplayCreation(info);
}
diff --git a/vulkan/api/vulkan.api b/vulkan/api/vulkan.api
index 568c4ad..832a8e9 100644
--- a/vulkan/api/vulkan.api
+++ b/vulkan/api/vulkan.api
@@ -28,7 +28,7 @@
// API version (major.minor.patch)
define VERSION_MAJOR 1
define VERSION_MINOR 1
-define VERSION_PATCH 72
+define VERSION_PATCH 76
// API limits
define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256
@@ -377,6 +377,10 @@
@extension("VK_KHR_variable_pointers") define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1
@extension("VK_KHR_variable_pointers") define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers"
+// 122
+@extension("VK_KHR_get_display_properties2") define VK_KHR_GET_DISPLAY_PROPERTIES_2_SPEC_VERSION 1
+@extension("VK_KHR_get_display_properties2") define VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_display_properties2"
+
// 123
@extension("VK_MVK_ios_surface") define VK_MVK_IOS_SURFACE_SPEC_VERSION 1
@extension("VK_MVK_ios_surface") define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface"
@@ -489,6 +493,10 @@
@extension("VK_KHR_maintenance3") define VK_KHR_MAINTENANCE3_SPEC_VERSION 1
@extension("VK_KHR_maintenance3") define VK_KHR_MAINTENANCE3_EXTENSION_NAME "VK_KHR_maintenance3"
+// 170
+@extension("VK_KHR_draw_indirect_count") define VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION 1
+@extension("VK_KHR_draw_indirect_count") define VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_KHR_draw_indirect_count"
+
// 175
@extension("VK_EXT_global_priority") define VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION 1
@extension("VK_EXT_global_priority") define VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME "VK_EXT_global_priority"
@@ -1521,6 +1529,13 @@
//@extension("VK_KHR_variable_pointers") // 121
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = 1000120000,
+ //@extension("VK_KHR_display_properties2") // 122
+ VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR = 1000121000,
+ VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR = 1000121001,
+ VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR = 1000121002,
+ VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR = 1000121003,
+ VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR = 1000121004,
+
//@extension("VK_MVK_ios_surface") // 123
VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000,
@@ -4194,6 +4209,16 @@
u32 z
}
+class VkBaseOutStructure {
+ VkStructureType sType
+ void* pNext
+}
+
+class VkBaseInStructure {
+ VkStructureType sType
+ const void* pNext
+}
+
//@vulkan1_1 structures
class VkPhysicalDeviceSubgroupProperties {
@@ -6007,6 +6032,42 @@
VkBool32 variablePointers
}
+@extension("VK_KHR_display_properties2") // 122
+class VkDisplayProperties2KHR {
+ VkStructureType sType
+ void* pNext
+ VkDisplayPropertiesKHR displayProperties
+}
+
+@extension("VK_KHR_display_properties2") // 122
+class VkDisplayPlaneProperties2KHR {
+ VkStructureType sType
+ void* pNext
+ VkDisplayPlanePropertiesKHR displayPlaneProperties
+}
+
+@extension("VK_KHR_display_properties2") // 122
+class VkDisplayModeProperties2KHR {
+ VkStructureType sType
+ void* pNext
+ VkDisplayModePropertiesKHR displayModeProperties
+}
+
+@extension("VK_KHR_display_properties2") // 122
+class VkDisplayPlaneInfo2KHR {
+ VkStructureType sType
+ const void* pNext
+ VkDisplayModeKHR mode
+ u32 planeIndex
+}
+
+@extension("VK_KHR_display_properties2") // 122
+class VkDisplayPlaneCapabilities2KHR {
+ VkStructureType sType
+ void* pNext
+ VkDisplayPlaneCapabilitiesKHR capabilities
+}
+
@extension("VK_MVK_ios_surface") // 123
class VkIOSSurfaceCreateInfoMVK {
VkStructureType sType
@@ -10018,6 +10079,39 @@
return ?
}
+@extension("VK_KHR_display_properties2") // 122
+cmd VkResult vkGetPhysicalDeviceDisplayProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ u32* pPropertyCount,
+ VkDisplayProperties2KHR* pProperties) {
+ return ?
+}
+
+@extension("VK_KHR_display_properties2") // 122
+cmd VkResult vkGetPhysicalDeviceDisplayPlaneProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ u32* pPropertyCount,
+ VkDisplayPlaneProperties2KHR* pProperties) {
+ return ?
+}
+
+@extension("VK_KHR_display_properties2") // 122
+cmd VkResult vkGetDisplayModeProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ VkDisplayKHR display,
+ u32* pPropertyCount,
+ VkDisplayModeProperties2KHR* pProperties) {
+ return ?
+}
+
+@extension("VK_KHR_display_properties2") // 122
+cmd VkResult vkGetDisplayPlaneCapabilities2KHR(
+ VkPhysicalDevice physicalDevice,
+ const VkDisplayPlaneInfo2KHR* pDisplayPlaneInfo,
+ VkDisplayPlaneCapabilities2KHR* pCapabilities) {
+ return ?
+}
+
@extension("VK_MVK_ios_surface") // 123
cmd VkResult vkCreateIOSSurfaceMVK(
VkInstance instance,
@@ -10243,6 +10337,28 @@
VkDescriptorSetLayoutSupportKHR* pSupport) {
}
+@extension("VK_KHR_draw_indirect_count") // 170
+cmd void vkCmdDrawIndirectCountKHR(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkBuffer countBuffer,
+ VkDeviceSize countBufferOffset,
+ u32 maxDrawCount,
+ u32 stride) {
+}
+
+@extension("VK_KHR_draw_indirect_count") // 170
+cmd void vkCmdDrawIndexedIndirectCountKHR(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkBuffer countBuffer,
+ VkDeviceSize countBufferOffset,
+ u32 maxDrawCount,
+ u32 stride) {
+}
+
@extension("VK_EXT_external_memory_host") // 179
cmd VkResult vkGetMemoryHostPointerPropertiesEXT(
VkDevice device,
diff --git a/vulkan/include/vulkan/vulkan_core.h b/vulkan/include/vulkan/vulkan_core.h
index ed0d596..a28661f 100644
--- a/vulkan/include/vulkan/vulkan_core.h
+++ b/vulkan/include/vulkan/vulkan_core.h
@@ -43,7 +43,7 @@
#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 72
+#define VK_HEADER_VERSION 76
#define VK_NULL_HANDLE 0
@@ -350,6 +350,11 @@
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,
+ VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR = 1000121000,
+ VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR = 1000121001,
+ VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR = 1000121002,
+ VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR = 1000121003,
+ VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR = 1000121004,
VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000,
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT = 1000128000,
@@ -2715,6 +2720,16 @@
uint32_t firstInstance;
} VkDrawIndirectCommand;
+typedef struct VkBaseOutStructure {
+ VkStructureType sType;
+ struct VkBaseOutStructure* pNext;
+} VkBaseOutStructure;
+
+typedef struct VkBaseInStructure {
+ VkStructureType sType;
+ const struct VkBaseInStructure* pNext;
+} VkBaseInStructure;
+
typedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);
typedef void (VKAPI_PTR *PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks* pAllocator);
@@ -5572,6 +5587,70 @@
+#define VK_KHR_get_display_properties2 1
+#define VK_KHR_GET_DISPLAY_PROPERTIES_2_SPEC_VERSION 1
+#define VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_display_properties2"
+
+typedef struct VkDisplayProperties2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkDisplayPropertiesKHR displayProperties;
+} VkDisplayProperties2KHR;
+
+typedef struct VkDisplayPlaneProperties2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkDisplayPlanePropertiesKHR displayPlaneProperties;
+} VkDisplayPlaneProperties2KHR;
+
+typedef struct VkDisplayModeProperties2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkDisplayModePropertiesKHR displayModeProperties;
+} VkDisplayModeProperties2KHR;
+
+typedef struct VkDisplayPlaneInfo2KHR {
+ VkStructureType sType;
+ const void* pNext;
+ VkDisplayModeKHR mode;
+ uint32_t planeIndex;
+} VkDisplayPlaneInfo2KHR;
+
+typedef struct VkDisplayPlaneCapabilities2KHR {
+ VkStructureType sType;
+ void* pNext;
+ VkDisplayPlaneCapabilitiesKHR capabilities;
+} VkDisplayPlaneCapabilities2KHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayProperties2KHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayProperties2KHR* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlaneProperties2KHR* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModeProperties2KHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModeProperties2KHR* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilities2KHR)(VkPhysicalDevice physicalDevice, const VkDisplayPlaneInfo2KHR* pDisplayPlaneInfo, VkDisplayPlaneCapabilities2KHR* pCapabilities);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t* pPropertyCount,
+ VkDisplayProperties2KHR* pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlaneProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t* pPropertyCount,
+ VkDisplayPlaneProperties2KHR* pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModeProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ VkDisplayKHR display,
+ uint32_t* pPropertyCount,
+ VkDisplayModeProperties2KHR* pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilities2KHR(
+ VkPhysicalDevice physicalDevice,
+ const VkDisplayPlaneInfo2KHR* pDisplayPlaneInfo,
+ VkDisplayPlaneCapabilities2KHR* pCapabilities);
+#endif
+
#define VK_KHR_dedicated_allocation 1
#define VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION 3
#define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_KHR_dedicated_allocation"
@@ -5727,6 +5806,33 @@
VkDescriptorSetLayoutSupport* pSupport);
#endif
+#define VK_KHR_draw_indirect_count 1
+#define VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION 1
+#define VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_KHR_draw_indirect_count"
+
+typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountKHR)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);
+typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountKHR)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountKHR(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkBuffer countBuffer,
+ VkDeviceSize countBufferOffset,
+ uint32_t maxDrawCount,
+ uint32_t stride);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountKHR(
+ VkCommandBuffer commandBuffer,
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkBuffer countBuffer,
+ VkDeviceSize countBufferOffset,
+ uint32_t maxDrawCount,
+ uint32_t stride);
+#endif
+
#define VK_EXT_debug_report 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
diff --git a/vulkan/libvulkan/api_gen.cpp b/vulkan/libvulkan/api_gen.cpp
index 7650e0c..629ebb1 100644
--- a/vulkan/libvulkan/api_gen.cpp
+++ b/vulkan/libvulkan/api_gen.cpp
@@ -553,7 +553,11 @@
"vkEnumeratePhysicalDeviceGroups",
"vkEnumeratePhysicalDeviceGroupsKHR",
"vkEnumeratePhysicalDevices",
+ "vkGetDisplayModeProperties2KHR",
+ "vkGetDisplayPlaneCapabilities2KHR",
"vkGetInstanceProcAddr",
+ "vkGetPhysicalDeviceDisplayPlaneProperties2KHR",
+ "vkGetPhysicalDeviceDisplayProperties2KHR",
"vkGetPhysicalDeviceExternalBufferProperties",
"vkGetPhysicalDeviceExternalBufferPropertiesKHR",
"vkGetPhysicalDeviceExternalFenceProperties",