Merge "Adding basic test framework for BLASTBufferQueue"
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index e1181a6..657dfb6 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -1082,7 +1082,7 @@
std::string path(title);
path.append(" - ").append(String8(service).c_str());
size_t bytes_written = 0;
- status_t status = dumpsys.startDumpThread(service, args);
+ status_t status = dumpsys.startDumpThread(Dumpsys::Type::DUMP, service, args);
if (status == OK) {
dumpsys.writeDumpHeader(STDOUT_FILENO, service, priority);
std::chrono::duration<double> elapsed_seconds;
@@ -1154,7 +1154,7 @@
path.append("_HIGH");
}
path.append(kProtoExt);
- status_t status = dumpsys.startDumpThread(service, args);
+ status_t status = dumpsys.startDumpThread(Dumpsys::Type::DUMP, service, args);
if (status == OK) {
status = ds.AddZipEntryFromFd(path, dumpsys.getDumpFd(), service_timeout);
bool dumpTerminated = (status == OK);
diff --git a/cmds/dumpsys/dumpsys.cpp b/cmds/dumpsys/dumpsys.cpp
index 9f65425..abdf168 100644
--- a/cmds/dumpsys/dumpsys.cpp
+++ b/cmds/dumpsys/dumpsys.cpp
@@ -59,12 +59,13 @@
"usage: dumpsys\n"
" To dump all services.\n"
"or:\n"
- " dumpsys [-t TIMEOUT] [--priority LEVEL] [--help | -l | --skip SERVICES | "
- "SERVICE [ARGS]]\n"
+ " dumpsys [-t TIMEOUT] [--priority LEVEL] [--pid] [--help | -l | --skip SERVICES "
+ "| SERVICE [ARGS]]\n"
" --help: shows this help\n"
" -l: only list services, do not dump them\n"
" -t TIMEOUT_SEC: TIMEOUT to use in seconds instead of default 10 seconds\n"
" -T TIMEOUT_MS: TIMEOUT to use in milliseconds instead of default 10 seconds\n"
+ " --pid: dump PID instead of usual dump\n"
" --proto: filter services that support dumping data in proto format. Dumps\n"
" will be in proto format.\n"
" --priority LEVEL: filter services based on specified priority\n"
@@ -120,9 +121,11 @@
bool showListOnly = false;
bool skipServices = false;
bool asProto = false;
+ Type type = Type::DUMP;
int timeoutArgMs = 10000;
int priorityFlags = IServiceManager::DUMP_FLAG_PRIORITY_ALL;
- static struct option longOptions[] = {{"priority", required_argument, 0, 0},
+ static struct option longOptions[] = {{"pid", no_argument, 0, 0},
+ {"priority", required_argument, 0, 0},
{"proto", no_argument, 0, 0},
{"skip", no_argument, 0, 0},
{"help", no_argument, 0, 0},
@@ -157,6 +160,8 @@
usage();
return -1;
}
+ } else if (!strcmp(longOptions[optionIndex].name, "pid")) {
+ type = Type::PID;
}
break;
@@ -246,7 +251,7 @@
const String16& serviceName = services[i];
if (IsSkipped(skippedServices, serviceName)) continue;
- if (startDumpThread(serviceName, args) == OK) {
+ if (startDumpThread(type, serviceName, args) == OK) {
bool addSeparator = (N > 1);
if (addSeparator) {
writeDumpHeader(STDOUT_FILENO, serviceName, priorityFlags);
@@ -313,7 +318,18 @@
}
}
-status_t Dumpsys::startDumpThread(const String16& serviceName, const Vector<String16>& args) {
+static status_t dumpPidToFd(const sp<IBinder>& service, const unique_fd& fd) {
+ pid_t pid;
+ status_t status = service->getDebugPid(&pid);
+ if (status != OK) {
+ return status;
+ }
+ WriteStringToFd(std::to_string(pid) + "\n", fd.get());
+ return OK;
+}
+
+status_t Dumpsys::startDumpThread(Type type, const String16& serviceName,
+ const Vector<String16>& args) {
sp<IBinder> service = sm_->checkService(serviceName);
if (service == nullptr) {
aerr << "Can't find service: " << serviceName << endl;
@@ -333,16 +349,22 @@
// dump blocks until completion, so spawn a thread..
activeThread_ = std::thread([=, remote_end{std::move(remote_end)}]() mutable {
- int err = service->dump(remote_end.get(), args);
+ status_t err = 0;
- // It'd be nice to be able to close the remote end of the socketpair before the dump
- // call returns, to terminate our reads if the other end closes their copy of the
- // file descriptor, but then hangs for some reason. There doesn't seem to be a good
- // way to do this, though.
- remote_end.reset();
+ switch (type) {
+ case Type::DUMP:
+ err = service->dump(remote_end.get(), args);
+ break;
+ case Type::PID:
+ err = dumpPidToFd(service, remote_end);
+ break;
+ default:
+ aerr << "Unknown dump type" << static_cast<int>(type) << endl;
+ return;
+ }
- if (err != 0) {
- aerr << "Error dumping service info: (" << strerror(err) << ") "
+ if (err != OK) {
+ aerr << "Error dumping service info status_t: (" << err << ") "
<< serviceName << endl;
}
});
diff --git a/cmds/dumpsys/dumpsys.h b/cmds/dumpsys/dumpsys.h
index c48a1e9..929c55c 100644
--- a/cmds/dumpsys/dumpsys.h
+++ b/cmds/dumpsys/dumpsys.h
@@ -51,6 +51,11 @@
*/
static void setServiceArgs(Vector<String16>& args, bool asProto, int priorityFlags);
+ enum class Type {
+ DUMP, // dump using `dump` function
+ PID, // dump pid of server only
+ };
+
/**
* Starts a thread to connect to a service and get its dump output. The thread redirects
* the output to a pipe. Thread must be stopped by a subsequent callto {@code
@@ -61,7 +66,8 @@
* {@code NAME_NOT_FOUND} service could not be found.
* {@code != OK} error
*/
- status_t startDumpThread(const String16& serviceName, const Vector<String16>& args);
+ status_t startDumpThread(Type type, const String16& serviceName,
+ const Vector<String16>& args);
/**
* Writes a section header to a file descriptor.
diff --git a/cmds/dumpsys/tests/dumpsys_test.cpp b/cmds/dumpsys/tests/dumpsys_test.cpp
index cbac839..cf4e0b5 100644
--- a/cmds/dumpsys/tests/dumpsys_test.cpp
+++ b/cmds/dumpsys/tests/dumpsys_test.cpp
@@ -194,7 +194,7 @@
CaptureStdout();
CaptureStderr();
dump_.setServiceArgs(args, supportsProto, priorityFlags);
- status_t status = dump_.startDumpThread(serviceName, args);
+ status_t status = dump_.startDumpThread(Dumpsys::Type::DUMP, serviceName, args);
EXPECT_THAT(status, Eq(0));
status = dump_.writeDump(STDOUT_FILENO, serviceName, std::chrono::milliseconds(500), false,
elapsedDuration, bytesWritten);
@@ -539,6 +539,27 @@
AssertDumpedWithPriority("runninghigh2", "dump2", PriorityDumper::PRIORITY_ARG_HIGH);
}
+// Tests 'dumpsys --pid'
+TEST_F(DumpsysTest, ListAllServicesWithPid) {
+ ExpectListServices({"Locksmith", "Valet"});
+ ExpectCheckService("Locksmith");
+ ExpectCheckService("Valet");
+
+ CallMain({"--pid"});
+
+ AssertRunningServices({"Locksmith", "Valet"});
+ AssertOutputContains(std::to_string(getpid()));
+}
+
+// Tests 'dumpsys --pid service_name'
+TEST_F(DumpsysTest, ListServiceWithPid) {
+ ExpectCheckService("Locksmith");
+
+ CallMain({"--pid", "Locksmith"});
+
+ AssertOutput(std::to_string(getpid()) + "\n");
+}
+
TEST_F(DumpsysTest, GetBytesWritten) {
const char* serviceName = "service2";
const char* dumpContents = "dump1";
@@ -563,4 +584,4 @@
dump_.writeDump(STDOUT_FILENO, String16("service"), std::chrono::milliseconds(500),
/* as_proto = */ false, elapsedDuration, bytesWritten);
EXPECT_THAT(status, Eq(INVALID_OPERATION));
-}
\ No newline at end of file
+}
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 0336d3e..6971c72 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -373,7 +373,9 @@
}
}
+#ifdef __ANDROID__
LOG_ALWAYS_FATAL_IF(mDriverFD < 0, "Binder driver '%s' could not be opened. Terminating.", driver);
+#endif
}
ProcessState::~ProcessState()
diff --git a/libs/binder/fuzzer/Android.bp b/libs/binder/fuzzer/Android.bp
index d2f0d37..5a6955f 100644
--- a/libs/binder/fuzzer/Android.bp
+++ b/libs/binder/fuzzer/Android.bp
@@ -1,5 +1,5 @@
-cc_fuzz {
- name: "binder_parcel_fuzzer",
+cc_defaults {
+ name: "binder_parcel_fuzzer_defaults",
defaults: ["libbinder_ndk_host_user"],
host_supported: true,
srcs: [
@@ -36,4 +36,16 @@
],
},
},
+ defaults_visibility: [":__subpackages__"],
+}
+
+cc_fuzz {
+ name: "binder_parcel_fuzzer",
+ defaults: ["binder_parcel_fuzzer_defaults"],
+}
+
+cc_fuzz {
+ name: "binder_parcel_fuzzer_logs",
+ defaults: ["binder_parcel_fuzzer_defaults"],
+ cflags: ["-DENABLE_LOG_FUZZ"],
}
diff --git a/libs/binder/fuzzer/binder.cpp b/libs/binder/fuzzer/binder.cpp
index 86264db..04fe0e7 100644
--- a/libs/binder/fuzzer/binder.cpp
+++ b/libs/binder/fuzzer/binder.cpp
@@ -93,26 +93,16 @@
PARCEL_READ_NO_STATUS(size_t, allowFds),
PARCEL_READ_NO_STATUS(size_t, hasFileDescriptors),
[] (const ::android::Parcel& p, uint8_t len) {
-#ifdef __ANDROID__
std::string interface(len, 'a');
FUZZ_LOG() << "about to enforceInterface: " << interface;
bool b = p.enforceInterface(::android::String16(interface.c_str()));
FUZZ_LOG() << "enforced interface: " << b;
-#else
- FUZZ_LOG() << "skipping enforceInterface";
- (void)p;
- (void)len;
-#endif // __ANDROID__
},
[] (const ::android::Parcel& p, uint8_t /*len*/) {
-#ifdef __ANDROID__
FUZZ_LOG() << "about to checkInterface";
- bool b = p.checkInterface(new android::BBinder());
+ android::sp<android::IBinder> aBinder = new android::BBinder();
+ bool b = p.checkInterface(aBinder.get());
FUZZ_LOG() << "checked interface: " << b;
-#else
- FUZZ_LOG() << "skipping checkInterface";
- (void)p;
-#endif // __ANDROID__
},
PARCEL_READ_NO_STATUS(size_t, objectsCount),
PARCEL_READ_NO_STATUS(status_t, errorCheck),
diff --git a/libs/binder/fuzzer/main.cpp b/libs/binder/fuzzer/main.cpp
index 369aa34..929e2c3 100644
--- a/libs/binder/fuzzer/main.cpp
+++ b/libs/binder/fuzzer/main.cpp
@@ -36,22 +36,40 @@
for (size_t i = 0; i < instructions.size() - 1; i += 2) {
uint8_t a = instructions[i];
+ uint8_t readIdx = a % reads.size();
+
uint8_t b = instructions[i + 1];
- FUZZ_LOG() << "size: " << p.dataSize() << " avail: " << p.dataAvail()
- << " pos: " << p.dataPosition() << " cap: " << p.dataCapacity();
+ FUZZ_LOG() << "Instruction: " << (i / 2) + 1 << "/" << instructions.size() / 2
+ << " cmd: " << static_cast<size_t>(a) << " (" << static_cast<size_t>(readIdx)
+ << ") arg: " << static_cast<size_t>(b) << " size: " << p.dataSize()
+ << " avail: " << p.dataAvail() << " pos: " << p.dataPosition()
+ << " cap: " << p.dataCapacity();
- reads[a % reads.size()](p, b);
+ reads[readIdx](p, b);
}
}
void fuzz(uint8_t options, const std::vector<uint8_t>& input, const std::vector<uint8_t>& instructions) {
- (void) options;
+ uint8_t parcelType = options & 0x3;
- // although they will do completely different things, might as well fuzz both
- doFuzz<::android::hardware::Parcel>(HWBINDER_PARCEL_READ_FUNCTIONS, input, instructions);
- doFuzz<::android::Parcel>(BINDER_PARCEL_READ_FUNCTIONS, input, instructions);
- doFuzz<NdkParcelAdapter>(BINDER_NDK_PARCEL_READ_FUNCTIONS, input, instructions);
+ switch (parcelType) {
+ case 0x0:
+ doFuzz<::android::hardware::Parcel>(HWBINDER_PARCEL_READ_FUNCTIONS, input,
+ instructions);
+ break;
+ case 0x1:
+ doFuzz<::android::Parcel>(BINDER_PARCEL_READ_FUNCTIONS, input, instructions);
+ break;
+ case 0x2:
+ doFuzz<NdkParcelAdapter>(BINDER_NDK_PARCEL_READ_FUNCTIONS, input, instructions);
+ break;
+ case 0x3:
+ /*reserved for future use*/
+ break;
+ default:
+ LOG_ALWAYS_FATAL("unknown parcel type %d", static_cast<int>(parcelType));
+ }
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
diff --git a/libs/binder/fuzzer/util.cpp b/libs/binder/fuzzer/util.cpp
index b1213e9..479f406 100644
--- a/libs/binder/fuzzer/util.cpp
+++ b/libs/binder/fuzzer/util.cpp
@@ -24,13 +24,17 @@
std::string hexString(const void* bytes, size_t len) {
if (bytes == nullptr) return "<null>";
- std::ostringstream s;
- s << std::hex << std::setfill('0');
+ const uint8_t* bytes8 = static_cast<const uint8_t*>(bytes);
+ char chars[] = "0123456789abcdef";
+ std::string result;
+ result.resize(len * 2);
+
for (size_t i = 0; i < len; i++) {
- s << std::setw(2) << static_cast<int>(
- static_cast<const uint8_t*>(bytes)[i]);
+ result[2 * i] = chars[bytes8[i] >> 4];
+ result[2 * i + 1] = chars[bytes8[i] & 0xf];
}
- return s.str();
+
+ return result;
}
std::string hexString(const std::vector<uint8_t>& bytes) {
return hexString(bytes.data(), bytes.size());
diff --git a/libs/binder/fuzzer/util.h b/libs/binder/fuzzer/util.h
index 416c3a7..aa504d2 100644
--- a/libs/binder/fuzzer/util.h
+++ b/libs/binder/fuzzer/util.h
@@ -23,27 +23,31 @@
#error "Must define FUZZ_LOG_TAG"
#endif
-#define ENABLE_LOG_FUZZ 1
-#define FUZZ_LOG() FuzzLog(FUZZ_LOG_TAG, ENABLE_LOG_FUZZ).log()
+#define FUZZ_LOG() FuzzLog(FUZZ_LOG_TAG).log()
+#ifdef ENABLE_LOG_FUZZ
class FuzzLog {
public:
- FuzzLog(const std::string& tag, bool log) : mTag(tag), mLog(log) {}
- ~FuzzLog() {
- if (mLog) {
- std::cout << mTag << ": " << mOs.str() << std::endl;
- }
- }
+ FuzzLog(const char* tag) : mTag(tag) {}
+ ~FuzzLog() { std::cout << mTag << ": " << mOs.str() << std::endl; }
- std::stringstream& log() {
- return mOs;
- }
+ std::stringstream& log() { return mOs; }
private:
- std::string mTag;
- bool mLog;
+ const char* mTag = nullptr;
std::stringstream mOs;
};
+#else
+class FuzzLog {
+public:
+ FuzzLog(const char* /*tag*/) {}
+ template <typename T>
+ FuzzLog& operator<<(const T& /*t*/) {
+ return *this;
+ }
+ FuzzLog& log() { return *this; }
+};
+#endif
std::string hexString(const void* bytes, size_t len);
std::string hexString(const std::vector<uint8_t>& bytes);
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp
index 7d30672..e7640dd 100644
--- a/services/inputflinger/InputManager.cpp
+++ b/services/inputflinger/InputManager.cpp
@@ -128,7 +128,7 @@
"from non shell/root entity (PID: %d)", ipc->getCallingPid());
return;
}
- mDispatcher->registerInputChannel(channel, false);
+ mDispatcher->registerInputChannel(channel);
}
void InputManager::unregisterInputChannel(const sp<InputChannel>& channel) {
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 4db9ae2..ee8c344 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -3865,11 +3865,9 @@
}
}
-status_t InputDispatcher::registerInputChannel(const sp<InputChannel>& inputChannel,
- int32_t displayId) {
+status_t InputDispatcher::registerInputChannel(const sp<InputChannel>& inputChannel) {
#if DEBUG_REGISTRATION
- ALOGD("channel '%s' ~ registerInputChannel - displayId=%" PRId32,
- inputChannel->getName().c_str(), displayId);
+ ALOGD("channel '%s' ~ registerInputChannel", inputChannel->getName().c_str());
#endif
{ // acquire lock
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index 0d9d6b0..1f906e4 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -106,8 +106,7 @@
virtual bool transferTouchFocus(const sp<IBinder>& fromToken,
const sp<IBinder>& toToken) override;
- virtual status_t registerInputChannel(const sp<InputChannel>& inputChannel,
- int32_t displayId) override;
+ virtual status_t registerInputChannel(const sp<InputChannel>& inputChannel) override;
virtual status_t registerInputMonitor(const sp<InputChannel>& inputChannel, int32_t displayId,
bool isGestureMonitor) override;
virtual status_t unregisterInputChannel(const sp<InputChannel>& inputChannel) override;
diff --git a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
index 9329ca6..ce7366f 100644
--- a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
+++ b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
@@ -126,8 +126,7 @@
*
* This method may be called on any thread (usually by the input manager).
*/
- virtual status_t registerInputChannel(const sp<InputChannel>& inputChannel,
- int32_t displayId) = 0;
+ virtual status_t registerInputChannel(const sp<InputChannel>& inputChannel) = 0;
/* Registers input channels to be used to monitor input events.
*
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index aa98ef7..7d69854 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -471,7 +471,7 @@
FakeInputReceiver(dispatcher, name, displayId),
mFocused(false), mFrame(Rect(0, 0, WIDTH, HEIGHT)), mLayoutParamFlags(0) {
mServerChannel->setToken(new BBinder());
- mDispatcher->registerInputChannel(mServerChannel, displayId);
+ mDispatcher->registerInputChannel(mServerChannel);
inputApplicationHandle->updateInfo();
mInfo.applicationInfo = *inputApplicationHandle->getInfo();
diff --git a/vulkan/libvulkan/driver_gen.cpp b/vulkan/libvulkan/driver_gen.cpp
index d829e41..272f2d1 100644
--- a/vulkan/libvulkan/driver_gen.cpp
+++ b/vulkan/libvulkan/driver_gen.cpp
@@ -480,14 +480,14 @@
if (strcmp(name, "VK_EXT_swapchain_colorspace") == 0) return ProcHook::EXT_swapchain_colorspace;
if (strcmp(name, "VK_GOOGLE_display_timing") == 0) return ProcHook::GOOGLE_display_timing;
if (strcmp(name, "VK_KHR_android_surface") == 0) return ProcHook::KHR_android_surface;
+ if (strcmp(name, "VK_KHR_get_surface_capabilities2") == 0) return ProcHook::KHR_get_surface_capabilities2;
if (strcmp(name, "VK_KHR_incremental_present") == 0) return ProcHook::KHR_incremental_present;
if (strcmp(name, "VK_KHR_shared_presentable_image") == 0) return ProcHook::KHR_shared_presentable_image;
if (strcmp(name, "VK_KHR_surface") == 0) return ProcHook::KHR_surface;
if (strcmp(name, "VK_KHR_swapchain") == 0) return ProcHook::KHR_swapchain;
- if (strcmp(name, "VK_KHR_get_surface_capabilities2") == 0) return ProcHook::KHR_get_surface_capabilities2;
- if (strcmp(name, "VK_KHR_get_physical_device_properties2") == 0) return ProcHook::KHR_get_physical_device_properties2;
if (strcmp(name, "VK_ANDROID_external_memory_android_hardware_buffer") == 0) return ProcHook::ANDROID_external_memory_android_hardware_buffer;
if (strcmp(name, "VK_KHR_bind_memory2") == 0) return ProcHook::KHR_bind_memory2;
+ if (strcmp(name, "VK_KHR_get_physical_device_properties2") == 0) return ProcHook::KHR_get_physical_device_properties2;
// clang-format on
return ProcHook::EXTENSION_UNKNOWN;
}
diff --git a/vulkan/libvulkan/driver_gen.h b/vulkan/libvulkan/driver_gen.h
index fb2f257..cd7d8f8 100644
--- a/vulkan/libvulkan/driver_gen.h
+++ b/vulkan/libvulkan/driver_gen.h
@@ -40,14 +40,14 @@
EXT_swapchain_colorspace,
GOOGLE_display_timing,
KHR_android_surface,
+ KHR_get_surface_capabilities2,
KHR_incremental_present,
KHR_shared_presentable_image,
KHR_surface,
KHR_swapchain,
- KHR_get_surface_capabilities2,
- KHR_get_physical_device_properties2,
ANDROID_external_memory_android_hardware_buffer,
KHR_bind_memory2,
+ KHR_get_physical_device_properties2,
EXTENSION_CORE, // valid bit
EXTENSION_COUNT,
diff --git a/vulkan/nulldrv/null_driver_gen.h b/vulkan/nulldrv/null_driver_gen.h
index 668dc7d..0d3f688 100644
--- a/vulkan/nulldrv/null_driver_gen.h
+++ b/vulkan/nulldrv/null_driver_gen.h
@@ -207,9 +207,6 @@
VKAPI_ATTR VkResult GetSwapchainGrallocUsage2ANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, VkSwapchainImageUsageFlagsANDROID swapchainImageUsage, uint64_t* grallocConsumerUsage, uint64_t* grallocProducerUsage);
VKAPI_ATTR VkResult AcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);
-VKAPI_ATTR VkResult GetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
-VKAPI_ATTR VkResult AcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
-VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);
// clang-format on
} // namespace null_driver
diff --git a/vulkan/scripts/driver_generator.py b/vulkan/scripts/driver_generator.py
index ef36f8c..4868ac0 100644
--- a/vulkan/scripts/driver_generator.py
+++ b/vulkan/scripts/driver_generator.py
@@ -27,17 +27,17 @@
'VK_EXT_swapchain_colorspace',
'VK_GOOGLE_display_timing',
'VK_KHR_android_surface',
+ 'VK_KHR_get_surface_capabilities2',
'VK_KHR_incremental_present',
'VK_KHR_shared_presentable_image',
'VK_KHR_surface',
'VK_KHR_swapchain',
- 'VK_KHR_get_surface_capabilities2'
]
knownExtensions = interceptedExtensions + [
- 'VK_KHR_get_physical_device_properties2',
'VK_ANDROID_external_memory_android_hardware_buffer',
- 'VK_KHR_bind_memory2'
+ 'VK_KHR_bind_memory2',
+ 'VK_KHR_get_physical_device_properties2',
]
def defineProcHookType(f):
diff --git a/vulkan/scripts/generator_common.py b/vulkan/scripts/generator_common.py
index fe9dab4..f1f09d5 100644
--- a/vulkan/scripts/generator_common.py
+++ b/vulkan/scripts/generator_common.py
@@ -40,41 +40,46 @@
warning = '// WARNING: This file is generated. See ../README.md for instructions.\n\n'
blacklistedExtensions = [
- 'VK_KHR_display',
- 'VK_KHR_display_swapchain',
- 'VK_KHR_mir_surface',
- 'VK_KHR_xcb_surface',
- 'VK_KHR_xlib_surface',
- 'VK_KHR_wayland_surface',
- 'VK_KHR_win32_surface',
- 'VK_KHR_external_memory_win32',
- 'VK_KHR_win32_keyed_mutex',
- 'VK_KHR_external_semaphore_win32',
- 'VK_KHR_external_fence_win32',
'VK_EXT_acquire_xlib_display',
'VK_EXT_direct_mode_display',
- 'VK_EXT_display_surface_counter',
'VK_EXT_display_control',
+ 'VK_EXT_display_surface_counter',
+ 'VK_EXT_full_screen_exclusive',
+ 'VK_EXT_headless_surface',
+ 'VK_EXT_metal_surface',
'VK_FUCHSIA_imagepipe_surface',
+ 'VK_GGP_stream_descriptor_surface',
+ 'VK_KHR_display',
+ 'VK_KHR_display_swapchain',
+ 'VK_KHR_external_fence_win32',
+ 'VK_KHR_external_memory_win32',
+ 'VK_KHR_external_semaphore_win32',
+ 'VK_KHR_mir_surface',
+ 'VK_KHR_wayland_surface',
+ 'VK_KHR_win32_keyed_mutex',
+ 'VK_KHR_win32_surface',
+ 'VK_KHR_xcb_surface',
+ 'VK_KHR_xlib_surface',
'VK_MVK_ios_surface',
'VK_MVK_macos_surface',
'VK_NN_vi_surface',
+ 'VK_NV_cooperative_matrix',
+ 'VK_NV_coverage_reduction_mode',
'VK_NV_external_memory_win32',
'VK_NV_win32_keyed_mutex',
- 'VK_EXT_metal_surface', #not present in vulkan.api
- 'VK_NVX_image_view_handle', #not present in vulkan.api
- 'VK_NV_cooperative_matrix', #not present in vulkan.api
- 'VK_EXT_headless_surface', #not present in vulkan.api
- 'VK_GGP_stream_descriptor_surface', #not present in vulkan.api
- 'VK_NV_coverage_reduction_mode', #not present in vulkan.api
- 'VK_EXT_full_screen_exclusive' #not present in vulkan.api
+ 'VK_NVX_image_view_handle',
]
exportedExtensions = [
+ 'VK_ANDROID_external_memory_android_hardware_buffer',
+ 'VK_KHR_android_surface',
'VK_KHR_surface',
'VK_KHR_swapchain',
- 'VK_KHR_android_surface',
- 'VK_ANDROID_external_memory_android_hardware_buffer'
+]
+
+optionalCommands = [
+ 'vkGetSwapchainGrallocUsageANDROID',
+ 'vkGetSwapchainGrallocUsage2ANDROID',
]
def runClangFormat(args):
@@ -241,7 +246,7 @@
if name in versionDict and versionDict[name] == 'VK_VERSION_1_1':
f.write('false, ')
- elif name == 'vkGetSwapchainGrallocUsageANDROID' or name == 'vkGetSwapchainGrallocUsage2ANDROID': # optional in vulkan.api
+ elif name in optionalCommands:
f.write('false, ')
else:
f.write('true, ')
diff --git a/vulkan/scripts/null_generator.py b/vulkan/scripts/null_generator.py
index ee8762e..3a761ce 100644
--- a/vulkan/scripts/null_generator.py
+++ b/vulkan/scripts/null_generator.py
@@ -78,9 +78,6 @@
if isDriverFunction(cmds):
paramList = [''.join(i) for i in gencom.paramDict[cmds]]
f.write ('VKAPI_ATTR ' + gencom.returnTypeDict[cmds] + ' ' + cmds[2:] + '(' +', '.join(paramList) + ');\n')
- f.write ("""VKAPI_ATTR VkResult GetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage);
-VKAPI_ATTR VkResult AcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence);
-VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd);\n""")
gencom.clang_on(f,0)
f.write ('\n} // namespace null_driver\n')