Fix for an issue in the encoder when using m_state->usingDirectMapping();
This only shows up when we use MoltenVk with the emulator on Macos.
The encoder is not setting the packetlength properly.
Fixing this in the encoder would mean re-spinning all images
that enable Vulkan.
BUG: 297588622
Test: Running vulkan_test_applications/cube
Change-Id: Ifc8dc0c3ce2a21f57bc7acd69d9d0ff967138279
diff --git a/host/RenderThread.cpp b/host/RenderThread.cpp
index 195ec6a..ef0f1e0 100644
--- a/host/RenderThread.cpp
+++ b/host/RenderThread.cpp
@@ -349,7 +349,7 @@
auto& metricsLogger = FrameBuffer::getFB()->getMetricsLogger();
const ProcessResources* processResources = nullptr;
-
+ bool anyProgress = false;
while (true) {
// Let's make sure we read enough data for at least some processing.
uint32_t packetSize;
@@ -367,7 +367,11 @@
// time.
packetSize = 8;
}
-
+ if (!anyProgress) {
+ // If we didn't make any progress last time, then make sure we read at least one
+ // extra byte.
+ packetSize = std::max(packetSize, static_cast<uint32_t>(readBuf.validData() + 1));
+ }
int stat = 0;
if (packetSize > readBuf.validData()) {
stat = readBuf.getData(ioStream, packetSize);
@@ -418,9 +422,10 @@
fflush(dumpFP);
}
- bool progress;
-
+ bool progress = false;
+ anyProgress = false;
do {
+ anyProgress |= progress;
std::unique_ptr<EventHangMetadata::HangAnnotations> renderThreadData =
std::make_unique<EventHangMetadata::HangAnnotations>();