gfxstream: guest: nuke Android HealthMonitor

The HealthMonitor is hang detection at the API Vulkan
encoder level.

It's actually not used in CF/AAOS/Emualtor.  The
plan for AOSP is actually to increase the amount
of Android CTS that are run against gfxstream to
increase health/stability, for example (b/347288539).

So if we consistently pass CTS on main with gfxstream
(as is the plan), HealthMonitoring would be somewhat
redundant.

Also, AndroidHealthMonitor is somewhat duplicated with
libaemu's HealthMonitor as well.

Also, nuke EncoderAutoLock while we're at it.  It also
is unused code.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:
Gurchetan Singh
2024-08-05 14:23:31 -07:00
committed by Marge Bot
parent f42b3be1b5
commit 2f161c31e3
10 changed files with 57 additions and 143 deletions
@@ -21,7 +21,7 @@ encoder_decl_preamble = """
class VkEncoder {
public:
VkEncoder(gfxstream::guest::IOStream* stream, gfxstream::guest::HealthMonitor<>* healthMonitor = nullptr);
VkEncoder(gfxstream::guest::IOStream* stream);
~VkEncoder();
#include "VkEncoder.h.inl"
@@ -31,7 +31,6 @@ encoder_decl_postamble = """
private:
class Impl;
std::unique_ptr<Impl> mImpl;
gfxstream::guest::HealthMonitor<>* mHealthMonitor;
};
"""
@@ -39,8 +38,6 @@ encoder_impl_preamble ="""
using namespace gfxstream::vk;
using gfxstream::guest::AutoLock;
using gfxstream::guest::Lock;
using gfxstream::guest::BumpPool;
#include "VkEncoder.cpp.inl"
@@ -363,7 +360,6 @@ def emit_parameter_encode_write_packet_info(typeInfo, api, cgen):
cgen.stmt("uint32_t packetSize_%s = 4 + 4 + (queueSubmitWithCommandsEnabled ? 4 : 0) + count" % (api.name))
else:
cgen.stmt("uint32_t packetSize_%s = 4 + 4 + count" % (api.name))
cgen.stmt("healthMonitorAnnotation_packetSize = std::make_optional(packetSize_%s)" % (api.name))
if not doDispatchSerialize:
cgen.stmt("if (queueSubmitWithCommandsEnabled) packetSize_%s -= 8" % api.name)
@@ -375,7 +371,6 @@ def emit_parameter_encode_write_packet_info(typeInfo, api, cgen):
if doSeqno:
cgen.stmt("uint32_t seqno; if (queueSubmitWithCommandsEnabled) seqno = ResourceTracker::nextSeqno()")
cgen.stmt("healthMonitorAnnotation_seqno = std::make_optional(seqno)")
cgen.stmt("memcpy(streamPtr, &opcode_%s, sizeof(uint32_t)); streamPtr += sizeof(uint32_t)" % api.name)
cgen.stmt("memcpy(streamPtr, &packetSize_%s, sizeof(uint32_t)); streamPtr += sizeof(uint32_t)" % api.name)
@@ -398,12 +393,6 @@ def emit_parameter_encode_do_parameter_write(typeInfo, api, cgen):
dispatchDone = True
cgen.beginIf("watchdog")
cgen.stmt("size_t watchdogBufSize = std::min<size_t>(static_cast<size_t>(packetSize_%s), kWatchdogBufferMax)" % (api.name))
cgen.stmt("healthMonitorAnnotation_packetContents.resize(watchdogBufSize)")
cgen.stmt("memcpy(&healthMonitorAnnotation_packetContents[0], packetBeginPtr, watchdogBufSize)")
cgen.endIf()
def emit_parameter_encode_read(typeInfo, api, cgen):
encodingParams = EncodingParameters(api)
@@ -495,31 +484,6 @@ def emit_debug_log(typeInfo, api, cgen):
cgen.stmt("ENCODER_DEBUG_LOG(\"%s(%s)\", %s)" % (api.name, logFormatStr, logVargsStr))
def emit_health_watchdog(api, cgen):
cgen.stmt("std::optional<uint32_t> healthMonitorAnnotation_seqno = std::nullopt")
cgen.stmt("std::optional<uint32_t> healthMonitorAnnotation_packetSize = std::nullopt")
cgen.stmt("std::vector<uint8_t> healthMonitorAnnotation_packetContents")
cgen.line("""
auto watchdog = WATCHDOG_BUILDER(mHealthMonitor, \"%s in VkEncoder\")
.setOnHangCallback([&]() {
auto annotations = std::make_unique<EventHangMetadata::HangAnnotations>();
if (healthMonitorAnnotation_seqno) {
annotations->insert({{"seqno", std::to_string(healthMonitorAnnotation_seqno.value())}});
}
if (healthMonitorAnnotation_packetSize) {
annotations->insert({{"packetSize", std::to_string(healthMonitorAnnotation_packetSize.value())}});
}
if (!healthMonitorAnnotation_packetContents.empty()) {
annotations->insert(
{{"packetContents", getPacketContents(
&healthMonitorAnnotation_packetContents[0], healthMonitorAnnotation_packetContents.size())}});
}
return std::move(annotations);
})
.build();
"""% (api.name)
)
def emit_default_encoding(typeInfo, api, cgen):
emit_debug_log(typeInfo, api, cgen)
emit_lock(cgen)
@@ -710,7 +674,6 @@ class VulkanEncoder(VulkanWrapperGenerator):
self.module.appendHeader(self.cgenHeader.swapCode())
def emit_function_impl(cgen):
emit_health_watchdog(api, cgen)
if api.name in custom_encodes.keys():
custom_encodes[api.name](self.typeInfo, api, cgen)
else:
@@ -310,7 +310,6 @@ class CerealGenerator(OutputGenerator):
self.hostCommonExtraVulkanHeaders = '#include "vk_android_native_buffer_gfxstream.h"'
encoderInclude = f"""
#include "{self.guestBaseLibDirPrefix}/AndroidHealthMonitor.h"
#include "goldfish_vk_private_defs.h"
#include <memory>
@@ -330,7 +329,6 @@ class IOStream;
#include "{self.guestBaseLibDirPrefix}/AlignedBuf.h"
#include "{self.guestBaseLibDirPrefix}/BumpPool.h"
#include "{self.guestBaseLibDirPrefix}/synchronization/AndroidLock.h"
#include <cutils/properties.h>