Simplify ApiInfo
Removes the additional saving of opcode and packet len as this is all available from within the packet itself. Removes the "trace" position from `VulkanMemReadingStream` as these seemed to only be used for getting the packet start and packet size but these are already available. Reviewed-by: Marcin Radomski <dextero@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33018>
This commit is contained in:
@@ -460,13 +460,9 @@ def emit_seqno_incr(api, cgen):
|
||||
cgen.stmt("if (m_queueSubmitWithCommandsEnabled) seqnoPtr->fetch_add(1, std::memory_order_seq_cst)")
|
||||
|
||||
def emit_snapshot(typeInfo, api, cgen):
|
||||
|
||||
cgen.stmt("%s->setReadPos((uintptr_t)(*readStreamPtrPtr) - (uintptr_t)snapshotTraceBegin)" % READ_STREAM)
|
||||
cgen.stmt("size_t snapshotTraceBytes = %s->endTrace()" % READ_STREAM)
|
||||
|
||||
additionalParams = [ \
|
||||
makeVulkanTypeSimple(True, "uint8_t", 1, "snapshotTraceBegin"),
|
||||
makeVulkanTypeSimple(False, "size_t", 0, "snapshotTraceBytes"),
|
||||
makeVulkanTypeSimple(True, "uint8_t", 1, "packet"),
|
||||
makeVulkanTypeSimple(False, "size_t", 0, "packetLen"),
|
||||
makeVulkanTypeSimple(False, "android::base::BumpPool", 1, "&m_pool"),
|
||||
]
|
||||
|
||||
@@ -840,6 +836,7 @@ size_t VkDecoder::Impl::decode(void* buf, size_t len, IOStream* ioStream,
|
||||
self.cgen.line("while (end - ptr >= 8)")
|
||||
self.cgen.beginBlock() # while loop
|
||||
|
||||
self.cgen.stmt("const uint8_t* packet = (const uint8_t *)ptr")
|
||||
self.cgen.stmt("uint32_t opcode = *(uint32_t *)ptr")
|
||||
self.cgen.stmt("uint32_t packetLen = *(uint32_t *)(ptr + 4)")
|
||||
self.cgen.line("""
|
||||
@@ -857,7 +854,6 @@ size_t VkDecoder::Impl::decode(void* buf, size_t len, IOStream* ioStream,
|
||||
self.cgen.stmt("VulkanMemReadingStream* %s = readStream()" % READ_STREAM)
|
||||
self.cgen.stmt("%s->setBuf((uint8_t*)(ptr + 8))" % READ_STREAM)
|
||||
self.cgen.stmt("uint8_t* readStreamPtr = %s->getBuf(); uint8_t** readStreamPtrPtr = &readStreamPtr" % READ_STREAM)
|
||||
self.cgen.stmt("uint8_t* snapshotTraceBegin = %s->beginTrace()" % READ_STREAM)
|
||||
self.cgen.stmt("%s->setHandleMapping(&m_boxedHandleUnwrapMapping)" % READ_STREAM)
|
||||
self.cgen.line("""
|
||||
std::unique_ptr<EventHangMetadata::HangAnnotations> executionData =
|
||||
|
@@ -238,7 +238,7 @@ def api_special_implementation_vkBindImageMemory2(api, cgen):
|
||||
|
||||
cgen.stmt("auto apiHandle = mReconstruction.createApiInfo()")
|
||||
cgen.stmt("auto apiInfo = mReconstruction.getApiInfo(apiHandle)")
|
||||
cgen.stmt("mReconstruction.setApiTrace(apiInfo, OP_%s, snapshotTraceBegin, snapshotTraceBytes)" % api.name)
|
||||
cgen.stmt("mReconstruction.setApiTrace(apiInfo, snapshotTraceBegin, snapshotTraceBytes)")
|
||||
cgen.line("// Note: the implementation does not work with bindInfoCount > 1");
|
||||
cgen.beginFor("uint32_t i = 0", "i < bindInfoCount", "++i")
|
||||
cgen.stmt("%s boxed_%s = unboxed_to_boxed_non_dispatchable_%s(pBindInfos[i].image)"
|
||||
@@ -361,7 +361,7 @@ def emit_impl(typeInfo, api, cgen):
|
||||
|
||||
cgen.stmt("auto apiHandle = mReconstruction.createApiInfo()")
|
||||
cgen.stmt("auto apiInfo = mReconstruction.getApiInfo(apiHandle)")
|
||||
cgen.stmt("mReconstruction.setApiTrace(apiInfo, OP_%s, snapshotTraceBegin, snapshotTraceBytes)" % api.name)
|
||||
cgen.stmt("mReconstruction.setApiTrace(apiInfo, snapshotTraceBegin, snapshotTraceBytes)")
|
||||
if lenAccessGuard is not None:
|
||||
cgen.beginIf(lenAccessGuard)
|
||||
cgen.stmt(f"mReconstruction.forEachHandleAddApi((const uint64_t*){boxed_access}, {lenExpr}, apiHandle, {get_target_state(api, p)})")
|
||||
@@ -393,7 +393,7 @@ def emit_impl(typeInfo, api, cgen):
|
||||
cgen.stmt("mReconstruction.addHandles((const uint64_t*)(&handle), 1)");
|
||||
cgen.stmt("auto apiHandle = mReconstruction.createApiInfo()")
|
||||
cgen.stmt("auto apiInfo = mReconstruction.getApiInfo(apiHandle)")
|
||||
cgen.stmt("mReconstruction.setApiTrace(apiInfo, OP_%s, snapshotTraceBegin, snapshotTraceBytes)" % api.name)
|
||||
cgen.stmt("mReconstruction.setApiTrace(apiInfo, snapshotTraceBegin, snapshotTraceBytes)")
|
||||
if api.name in specialCaseDependencyExtractors:
|
||||
specialCaseDependencyExtractors[api.name](p, None, None, api, cgen)
|
||||
cgen.stmt(f"mReconstruction.forEachHandleAddApi((const uint64_t*)(&handle), 1, apiHandle, {get_target_state(api, p)})")
|
||||
@@ -404,7 +404,7 @@ def emit_impl(typeInfo, api, cgen):
|
||||
cgen.line("// %s modify" % p.paramName)
|
||||
cgen.stmt("auto apiHandle = mReconstruction.createApiInfo()")
|
||||
cgen.stmt("auto apiInfo = mReconstruction.getApiInfo(apiHandle)")
|
||||
cgen.stmt("mReconstruction.setApiTrace(apiInfo, OP_%s, snapshotTraceBegin, snapshotTraceBytes)" % api.name)
|
||||
cgen.stmt("mReconstruction.setApiTrace(apiInfo, snapshotTraceBegin, snapshotTraceBytes)")
|
||||
if lenAccessGuard is not None:
|
||||
cgen.beginIf(lenAccessGuard)
|
||||
cgen.beginFor("uint32_t i = 0", "i < %s" % lenExpr, "++i")
|
||||
|
Reference in New Issue
Block a user