gfxstream: Update to new logging

Reviewed-by: Marcin Radomski <dextero@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35323>
This commit is contained in:
Jason Macnak
2025-04-10 12:25:49 -07:00
committed by Marge Bot
parent f1f684ffa7
commit 1d4b4fe8b7
4 changed files with 9 additions and 11 deletions
@@ -575,7 +575,7 @@ def decode_vkFlushMappedMemoryRanges(typeInfo: VulkanTypeInfo, api, cgen):
cgen.stmt("memcpy(&readStream, *readStreamPtrPtr, sizeof(uint64_t)); *readStreamPtrPtr += sizeof(uint64_t)")
cgen.stmt("sizeLeft -= sizeof(uint64_t)")
cgen.stmt("auto hostPtr = m_state->getMappedHostPointer(memory)")
cgen.stmt("if (!hostPtr && readStream > 0) GFXSTREAM_ABORT(::emugl::FatalError(::emugl::ABORT_REASON_OTHER))")
cgen.stmt("if (!hostPtr && readStream > 0) GFXSTREAM_FATAL(\"Unexpected\")")
cgen.stmt("if (!hostPtr) continue")
cgen.beginIf("sizeLeft < readStream")
cgen.beginIf("m_prevSeqno")
@@ -882,7 +882,7 @@ size_t VkDecoder::Impl::decode(void* buf, size_t len, IOStream* ioStream,
self.cgen.line("""
// packetLen should be at least 8 (op code and packet length) and should not be excessively large
if (packetLen < 8 || packetLen > MAX_PACKET_LENGTH) {
WARN("Bad packet length %d detected, decode may fail", packetLen);
GFXSTREAM_WARNING("Bad packet length %d detected, decode may fail", packetLen);
metricsLogger.logMetricEvent(MetricEventBadPacketLength{ .len = packetLen });
}
""")
@@ -919,7 +919,7 @@ size_t VkDecoder::Impl::decode(void* buf, size_t len, IOStream* ioStream,
memcpy(&seqno, *readStreamPtrPtr, sizeof(uint32_t)); *readStreamPtrPtr += sizeof(uint32_t);
if (healthMonitor) executionData->insert({{"seqno", std::to_string(seqno)}});
if (m_prevSeqno && seqno == m_prevSeqno.value()) {
WARN(
GFXSTREAM_WARNING(
"Seqno %d is the same as previously processed on thread %d. It might be a "
"duplicate command.",
seqno, getCurrentThreadId());
@@ -98,8 +98,8 @@ class VulkanExtensionStructs(VulkanWrapperGenerator):
# emitForEachStructExtension and not accessible here. Consequently,
# this is a copy-paste from there and must be updated accordingly.
# NOTE: No need for %% if no substitution is made.
cgen.stmt("fprintf(stderr, \"Unhandled Vulkan structure type %s [%d], aborting.\\n\", string_VkStructureType(VkStructureType(structType)), structType)")
cgen.stmt("GFXSTREAM_ABORT(::emugl::FatalError(::emugl::ABORT_REASON_OTHER))")
cgen.stmt("const std::string structTypeString = string_VkStructureType(VkStructureType(structType))")
cgen.stmt("GFXSTREAM_FATAL(\"Unhandled Vulkan structure type %s [%d], aborting.\", structTypeString.c_str(), structType)")
cgen.stmt("return static_cast<%s>(0)" % self.extensionStructSizeRetType.typeName)
self.module.appendImpl(
@@ -359,7 +359,7 @@ class VulkanSubDecoder(VulkanWrapperGenerator):
self.cgen.line("""
// packetLen should be at least 8 (op code and packet length) and should not be excessively large
if (packetLen < 8 || packetLen > MAX_PACKET_LENGTH) {
WARN("Bad packet length %d detected, subdecode may fail", packetLen);
GFXSTREAM_WARNING("Bad packet length %d detected, subdecode may fail", packetLen);
metricsLogger.logMetricEvent(MetricEventBadPacketLength{ .len = packetLen });
}
""")
@@ -399,7 +399,7 @@ class VulkanSubDecoder(VulkanWrapperGenerator):
self.cgen.line("default:")
self.cgen.beginBlock()
self.cgen.stmt(
"GFXSTREAM_ABORT(::emugl::FatalError(::emugl::ABORT_REASON_OTHER)) << \"Unrecognized opcode \" << opcode")
"GFXSTREAM_FATAL(\"Unrecognized opcode %\" PRIu32, opcode)")
self.cgen.endBlock()
self.cgen.endBlock() # switch stmt
@@ -450,8 +450,8 @@ using DlSymFunc = void* (void*, const char*);
extensionStructsInclude = f"""
{self.hostCommonExtraVulkanHeaders}
#include "gfxstream/host/logging.h"
#include "goldfish_vk_private_defs.h"
#include "host-common/GfxstreamFatalError.h"
#include "vulkan/vk_enum_string_helper.h"
"""
@@ -534,9 +534,7 @@ class BumpPool;
#include "render-utils/IOStream.h"
#include "FrameBuffer.h"
#include "gfxstream/host/Tracing.h"
#include "host-common/feature_control.h"
#include "host-common/GfxstreamFatalError.h"
#include "host-common/logging.h"
#include "gfxstream/host/logging.h"
#include "VkDecoderGlobalState.h"
#include "VkDecoderSnapshot.h"